switch root namespace name to NITLOAD
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="IImageProvider"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Nitload.Graphics
|
||||
{
|
||||
public interface IImageProvider
|
||||
{
|
||||
|
||||
Image ProvideImage();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="ImageHelper"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace Nitload.Graphics
|
||||
{
|
||||
public static class ImageHelper
|
||||
{
|
||||
|
||||
public static void Resize(
|
||||
Image i,
|
||||
int width,
|
||||
int height,
|
||||
ImageMovement move
|
||||
)
|
||||
{
|
||||
if (i == null) {
|
||||
throw new ArgumentNullException(nameof(i));
|
||||
}
|
||||
if (i.Size == (width, height)) {
|
||||
return;
|
||||
}
|
||||
if (!Enum.IsDefined(typeof(ImageMovement), move)) {
|
||||
throw new InvalidEnumArgumentException(nameof(move));
|
||||
}
|
||||
byte[] oldData = i.Data;
|
||||
i.Data = new byte[width * height * i.PixelSize];
|
||||
i.Height = height;
|
||||
i.Width = width;
|
||||
i.PixelUpdateCount++;
|
||||
switch (move)
|
||||
{
|
||||
case ImageMovement.Discard:
|
||||
break;
|
||||
case ImageMovement.Top:
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum ImageMovement
|
||||
{
|
||||
#pragma warning disable CA1008
|
||||
Discard = 0,
|
||||
#pragma warning restore CA1008
|
||||
Top = 1,
|
||||
Bottom = 2,
|
||||
Left = 4,
|
||||
Right = 8,
|
||||
TopLeft = Top | Left,
|
||||
BottomLeft = Bottom | Left,
|
||||
TopRight = Top | Right,
|
||||
BottomRight = Bottom | Right,
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="BufferObjectBase"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Nitload.Graphics;
|
||||
using Nitload.Graphics.OpenGL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nitload.Graphics
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface of all kinds OpenGL BufferHandle objects
|
||||
/// </summary>
|
||||
public abstract class BufferObjectBase : IDisposable
|
||||
{
|
||||
|
||||
protected GlHandle[] _bufferHandle;
|
||||
protected RenderStream binding;
|
||||
|
||||
/// <summary>
|
||||
/// Get the only handle to one of the Object instance
|
||||
/// </summary>
|
||||
/// <param _label="index">
|
||||
///
|
||||
/// </param>
|
||||
/// <returns>
|
||||
///
|
||||
/// </returns>
|
||||
public GlHandle this[
|
||||
int index
|
||||
] => _bufferHandle[index];
|
||||
|
||||
/// <summary>
|
||||
/// Bind a BufferHandle instance to OpenGL
|
||||
/// </summary>
|
||||
/// <param _label="index">
|
||||
/// Index of handle of the object in this instance to be bind
|
||||
/// </param>
|
||||
public abstract void Bind(
|
||||
int index
|
||||
);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing:true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return $"This is a {GetType().FullName}, containing {_bufferHandle.Length} buffer handles: {_bufferHandle.ToString()}.";
|
||||
}
|
||||
|
||||
protected abstract void Dispose(
|
||||
bool disposing
|
||||
);
|
||||
|
||||
~BufferObjectBase()
|
||||
{
|
||||
Dispose(disposing:false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="GraphicInitializer"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Nitload;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nitload.Graphics
|
||||
{
|
||||
public class GraphicModuel : IStaticModule
|
||||
{
|
||||
|
||||
public string ModuleName => "Graphics";
|
||||
|
||||
public void InitializeModule(
|
||||
IModuleInitializeConfiguration profile
|
||||
)
|
||||
{
|
||||
GraphicFramework.LoadGlfw();
|
||||
if (GraphicFramework.glfwInit() == 0) {
|
||||
throw new Exception("Failed to init system graphic environment.");
|
||||
}
|
||||
}
|
||||
|
||||
public void UninitializeModule()
|
||||
{
|
||||
GraphicFramework.glfwTerminate();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="Image.Native"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Nitload.Common.Internal;
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Nitload.Graphics
|
||||
{
|
||||
internal static unsafe partial class GraphicFramework
|
||||
{
|
||||
|
||||
[LibraryImport(
|
||||
Native.LibName,
|
||||
EntryPoint = "loadImageData",
|
||||
StringMarshalling = StringMarshalling.Utf8)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
internal static partial void InternalLoadImage(
|
||||
string fileName,
|
||||
ImageInfo* output,
|
||||
ImageLoader loader
|
||||
);
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "unloadImageData")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
internal static partial void InternalUnloadImage(
|
||||
ImageInfo* output
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="Image"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Nitload.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Nitload.Graphics
|
||||
{
|
||||
public class Image : IImageProvider
|
||||
{
|
||||
|
||||
private byte[] _data;
|
||||
private ImageInfo _rawInfo;
|
||||
private int _pixelUpdateCount = 0;
|
||||
|
||||
internal unsafe Image()
|
||||
{
|
||||
_rawInfo = new ImageInfo();
|
||||
}
|
||||
|
||||
internal Image(
|
||||
ImageInfo information
|
||||
)
|
||||
{
|
||||
_rawInfo = information;
|
||||
_data = [];
|
||||
|
||||
// int length = _rawInfo.width * _rawInfo.height * _rawInfo.channel;
|
||||
}
|
||||
|
||||
public (int width, int height) Size => (_rawInfo.Width, _rawInfo.Height);
|
||||
|
||||
public byte[] PixelBuffer
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((_data.Length == 0) || (_data == null))
|
||||
{
|
||||
GetBytes();
|
||||
return _data!;
|
||||
}
|
||||
return _data;
|
||||
}
|
||||
}
|
||||
|
||||
public ImageChannel Channel => _rawInfo.Channel;
|
||||
|
||||
/// <summary>
|
||||
/// Hash code of time pixels updated last time.
|
||||
/// </summary>
|
||||
public int PixelUpdateCount
|
||||
{
|
||||
get => _pixelUpdateCount;
|
||||
internal set => _pixelUpdateCount = value;
|
||||
}
|
||||
|
||||
public int ChannelCount => _rawInfo.ChannelCount;
|
||||
|
||||
public int Height
|
||||
{
|
||||
get => _rawInfo.Height;
|
||||
internal set => _rawInfo.Height = value;
|
||||
}
|
||||
|
||||
public int Width
|
||||
{
|
||||
get => _rawInfo.Width;
|
||||
internal set => _rawInfo.Width = value;
|
||||
}
|
||||
|
||||
public int PixelSize => ImageInfo.GetPixelSize(_rawInfo.pixelLayout, _rawInfo.Channel);
|
||||
|
||||
public PixelChannelLayout PixelLayout
|
||||
{
|
||||
get => _rawInfo.pixelLayout;
|
||||
private set => _rawInfo.pixelLayout = value;
|
||||
}
|
||||
|
||||
internal ref byte[] Data => ref _data;
|
||||
|
||||
public void FromBytes(
|
||||
byte[] stream
|
||||
) { }
|
||||
|
||||
public static unsafe Image FromFile(
|
||||
string route,
|
||||
ImageLoader loader
|
||||
)
|
||||
{
|
||||
Image ret = new Image();
|
||||
fixed (ImageInfo* iptr = &ret._rawInfo) {
|
||||
GraphicFramework.InternalLoadImage(route, iptr, loader);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Image FromMemory(
|
||||
(int width, int height) size,
|
||||
ImageChannel channel,
|
||||
byte[] stream
|
||||
)
|
||||
{
|
||||
ImageInfo _info = new ImageInfo
|
||||
{
|
||||
Height = size.height,
|
||||
Width = size.width,
|
||||
Channel = channel,
|
||||
StreamPtr = IntPtr.Zero
|
||||
};
|
||||
Image ret = new Image(_info);
|
||||
ret.PixelLayout = PixelChannelLayout.Byte;
|
||||
ret._data = stream;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Image FromMemory(
|
||||
(int width, int height) size,
|
||||
ImageChannel channel,
|
||||
PixelChannelLayout layout,
|
||||
byte[] stream
|
||||
)
|
||||
{
|
||||
ImageInfo _info = new ImageInfo
|
||||
{
|
||||
Height = size.height,
|
||||
Width = size.width,
|
||||
Channel = channel,
|
||||
StreamPtr = IntPtr.Zero
|
||||
};
|
||||
Image ret = new Image(_info);
|
||||
ret.PixelLayout = layout;
|
||||
ret._data = stream;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public unsafe byte[] GetBytes()
|
||||
{
|
||||
if (_data.Length == 0)
|
||||
{
|
||||
int size = Width * Height * ImageInfo.GetPixelSize(PixelLayout, Channel);
|
||||
_data = new Span<byte>((byte*)_rawInfo.StreamPtr, size).ToArray();
|
||||
fixed (ImageInfo* pptr = &_rawInfo) {
|
||||
GraphicFramework.InternalUnloadImage(pptr);
|
||||
}
|
||||
_rawInfo.StreamPtr = IntPtr.Zero;
|
||||
}
|
||||
return _data;
|
||||
}
|
||||
|
||||
public Image ProvideImage()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
internal static Image FromMemory(
|
||||
ImageInfo info,
|
||||
byte[] data,
|
||||
int operationCount
|
||||
)
|
||||
{
|
||||
return new Image
|
||||
{
|
||||
_rawInfo = info,
|
||||
_data = data,
|
||||
_pixelUpdateCount = operationCount
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="ImageInfo"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Nitload.Graphics.OpenGL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Nitload.Graphics
|
||||
{
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
public delegate IntPtr ImageLoader(
|
||||
string name,
|
||||
ref int width,
|
||||
ref int height,
|
||||
ref int definedChannel,
|
||||
int desiredChannel
|
||||
);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ImageInfo
|
||||
{
|
||||
|
||||
private ImageChannel channel;
|
||||
private int height;
|
||||
private int width;
|
||||
private IntPtr pixelPtr;
|
||||
internal PixelChannelLayout pixelLayout;
|
||||
|
||||
public ImageChannel Channel
|
||||
{
|
||||
get => channel;
|
||||
set => channel = value;
|
||||
}
|
||||
|
||||
public int ChannelCount => GetChannelCount(channel);
|
||||
|
||||
public int Height
|
||||
{
|
||||
get => height;
|
||||
set => height = value;
|
||||
}
|
||||
|
||||
public int StreamSize => width * height * GetPixelSize(
|
||||
pixelLayout, channel);
|
||||
|
||||
public int Width
|
||||
{
|
||||
get => width;
|
||||
set => width = value;
|
||||
}
|
||||
|
||||
public IntPtr StreamPtr
|
||||
{
|
||||
get => pixelPtr;
|
||||
internal set => pixelPtr = value;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = 17;
|
||||
hash = (hash * 17) + width;
|
||||
hash = (hash * 17) + height;
|
||||
hash = (hash * 17) + (int)channel;
|
||||
return hash;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{channel}\t{width}\t{height}\t{(ulong)StreamPtr}";
|
||||
}
|
||||
|
||||
internal static int GetChannelCount(
|
||||
ImageChannel channel
|
||||
)
|
||||
{
|
||||
return channel switch
|
||||
{
|
||||
ImageChannel.SingleColor => 1,
|
||||
ImageChannel.DoubleColor => 2,
|
||||
ImageChannel.TripleColor => 3,
|
||||
ImageChannel.WithAlphaChannel => 4,
|
||||
_ => throw new InvalidCastException(
|
||||
"Unknown color channel decoding setting.")
|
||||
};
|
||||
}
|
||||
|
||||
internal static int GetPixelSize(
|
||||
PixelChannelLayout layout,
|
||||
ImageChannel channel
|
||||
)
|
||||
{
|
||||
return layout switch
|
||||
{
|
||||
PixelChannelLayout.UByte => sizeof(byte) * GetChannelCount(
|
||||
channel),
|
||||
PixelChannelLayout.Byte => sizeof(byte) * GetChannelCount(
|
||||
channel),
|
||||
PixelChannelLayout.UShort => sizeof(short) * GetChannelCount(
|
||||
channel),
|
||||
PixelChannelLayout.Short => sizeof(short) * GetChannelCount(
|
||||
channel),
|
||||
PixelChannelLayout.UInt => sizeof(int) * GetChannelCount(
|
||||
channel),
|
||||
PixelChannelLayout.Int => sizeof(int) * GetChannelCount(
|
||||
channel),
|
||||
PixelChannelLayout.Float => sizeof(float) * GetChannelCount(
|
||||
channel),
|
||||
PixelChannelLayout.UByte332 => sizeof(byte),
|
||||
PixelChannelLayout.UByte233Rev => sizeof(byte),
|
||||
PixelChannelLayout.UShort565 => sizeof(short),
|
||||
PixelChannelLayout.UShort565Rev => sizeof(short),
|
||||
PixelChannelLayout.UShort4444 => sizeof(short),
|
||||
PixelChannelLayout.UShort4444Rev => sizeof(short),
|
||||
PixelChannelLayout.UShort5551 => sizeof(short),
|
||||
PixelChannelLayout.UShort1555Rev => sizeof(short),
|
||||
PixelChannelLayout.UInt8888 => sizeof(int),
|
||||
PixelChannelLayout.UInt8888Rev => sizeof(int),
|
||||
PixelChannelLayout.UInt1010102 => sizeof(int),
|
||||
PixelChannelLayout.UInt2101010Rev => sizeof(int),
|
||||
_ => throw new ArgumentException("Unknown layout type"),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum ImageChannel : uint
|
||||
{
|
||||
|
||||
SingleColor = glConst.RED,
|
||||
DoubleColor = glConst.RG,
|
||||
TripleColor = glConst.RGB,
|
||||
WithAlphaChannel = glConst.RGBA,
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="AutoTexture"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Nitload.Common.Collections;
|
||||
using Nitload.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nitload.Graphics.OpenGL
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of a sets of OpenGL textures. The collection can automatically select one of
|
||||
/// the texture with minimum costs to upgrade pixels to BufferHandle. Usually <see ///
|
||||
/// cref="AutoTextureGL" /> is used for <see cref="IImageProvider" /> loading, but not for
|
||||
/// target of <see cref="OpenGLFunction.FrameBufferTexture2d(FrameBufferTarget, uint, ///
|
||||
/// Texture2DTarget, GlHandle, int)" />.
|
||||
/// </summary>
|
||||
public sealed class AutoTextureGL
|
||||
{
|
||||
|
||||
private TextureProperty[] propertyCache;
|
||||
private BidirectionalDictionary<Image, int> imageIndexMap = new BidirectionalDictionary<Image, int>(
|
||||
);
|
||||
private Dictionary<Image, int> imageUpdateIndex = new Dictionary<Image, int>();
|
||||
|
||||
private int _size, _currentIndex;
|
||||
private LinkedList<int> usedTextureIndex;
|
||||
private Queue<int> unusedTextureUnitIndex;
|
||||
private TextureGL texturePackage;
|
||||
|
||||
private TextureProperty _textureProperty;
|
||||
|
||||
private AutoTextureGL(
|
||||
TextureGL texture
|
||||
)
|
||||
{
|
||||
texturePackage = texture;
|
||||
_size = texture.Count;
|
||||
imageIndexMap = new BidirectionalDictionary<Image, int>();
|
||||
unusedTextureUnitIndex = new Queue<int>(Enumerable.Range(0, _size));
|
||||
usedTextureIndex = new LinkedList<int>();
|
||||
propertyCache = new TextureProperty[_size];
|
||||
}
|
||||
|
||||
public AutoTextureGL(
|
||||
int textureObjectSize,
|
||||
[NotNull]glRender binding
|
||||
)
|
||||
{
|
||||
this._size = textureObjectSize;
|
||||
imageIndexMap = new BidirectionalDictionary<Image, int>();
|
||||
texturePackage = new TextureGL(textureObjectSize, binding);
|
||||
unusedTextureUnitIndex = new Queue<int>(Enumerable.Range(0, _size));
|
||||
usedTextureIndex = new LinkedList<int>();
|
||||
propertyCache = new TextureProperty[_size];
|
||||
}
|
||||
|
||||
public TextureProperty DefaultTextureProperty
|
||||
{
|
||||
get => _textureProperty;
|
||||
set => _textureProperty = value;
|
||||
}
|
||||
|
||||
private OpenGLFunction GL => texturePackage.GL;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SelectTextureAndBind(
|
||||
Image i
|
||||
)
|
||||
{
|
||||
TextureProperty property = _textureProperty;
|
||||
|
||||
SelectTextureAndBind(i, property);
|
||||
}
|
||||
|
||||
public void SelectTextureAndBind(
|
||||
[NotNull]Image i,
|
||||
TextureProperty property
|
||||
)
|
||||
{
|
||||
// usable texture with image match
|
||||
if (imageIndexMap.TryGetValue(i, out int index))
|
||||
{
|
||||
// prop setting match
|
||||
if (propertyCache[index] == property)
|
||||
{
|
||||
_currentIndex = index; //GL.Assert(true);
|
||||
texturePackage.Bind2D(index); //GL.Assert(true);
|
||||
if (i.PixelUpdateCount != imageUpdateIndex[i])
|
||||
{
|
||||
texturePackage.LoadTexture(index, i); //GL.Assert(true);
|
||||
}
|
||||
} else
|
||||
{
|
||||
_currentIndex = index; //GL.Assert(true);
|
||||
texturePackage.Bind2D(index); //GL.Assert(true);
|
||||
texturePackage.Set2dProperty(index, property); //GL.Assert(true);
|
||||
if (i.PixelUpdateCount != imageUpdateIndex[i])
|
||||
{
|
||||
texturePackage.LoadTexture(index, i); //GL.Assert(true);
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (unusedTextureUnitIndex.TryDequeue(out int newIndex))
|
||||
{
|
||||
// has extra unused texture object
|
||||
imageIndexMap.Add(i, index);
|
||||
texturePackage.Bind2D(index);
|
||||
texturePackage.Set2dProperty(index, property);
|
||||
texturePackage.LoadTexture(index, i);
|
||||
usedTextureIndex.AddLast(newIndex);
|
||||
propertyCache[newIndex] = property;
|
||||
imageUpdateIndex[i] = i.PixelUpdateCount;
|
||||
} else
|
||||
{
|
||||
// recycle from current
|
||||
int reusedIndex = usedTextureIndex.First!.Value;
|
||||
usedTextureIndex.RemoveFirst();
|
||||
usedTextureIndex.AddLast(reusedIndex);
|
||||
imageIndexMap[i] = reusedIndex;
|
||||
propertyCache[newIndex] = property;
|
||||
imageUpdateIndex[i] = i.PixelUpdateCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static AutoTextureGL ToAuto(
|
||||
[NotNull]TextureGL texture
|
||||
)
|
||||
{
|
||||
if (texture.IndexOfCurrentTexture != -1) {
|
||||
throw new InvalidOperationException("Texture to be converted has been editted.");
|
||||
}
|
||||
return new AutoTextureGL(texture);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="GLBufferObjectBase"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Nitload.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Nitload.Graphics.OpenGL
|
||||
{
|
||||
public abstract class GlBufferObjectBase : BufferObjectBase
|
||||
{
|
||||
|
||||
private readonly glRender _contextBinding;
|
||||
|
||||
protected GlBufferObjectBase(
|
||||
glRender contextBinding
|
||||
)
|
||||
{
|
||||
binding = contextBinding;
|
||||
_contextBinding = contextBinding;
|
||||
}
|
||||
|
||||
protected OpenGLFunction GL => _contextBinding.GL;
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="IglConvertable"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Nitload.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nitload.Graphics.ShaderEdit
|
||||
{
|
||||
public interface IglConvertable
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void DisplayGLtypeDefinition();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void GainAllUniforms(
|
||||
ShaderProgram source,
|
||||
params string[] uniformName
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
///
|
||||
/// </returns>
|
||||
public ShaderStruct GetConvertedGLtype();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void SetAllUniforms();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,665 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="glApiManager.Const"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Nitload.Graphics.OpenGL
|
||||
{
|
||||
public static partial class glManager
|
||||
{
|
||||
|
||||
#region coreVersion
|
||||
|
||||
private static bool core10 = false;
|
||||
private static bool core11 = false;
|
||||
private static bool core12 = false;
|
||||
private static bool core13 = false;
|
||||
private static bool core14 = false;
|
||||
private static bool core15 = false;
|
||||
private static bool core20 = false;
|
||||
private static bool core21 = false;
|
||||
private static bool core30 = false;
|
||||
private static bool core31 = false;
|
||||
private static bool core32 = false;
|
||||
private static bool core33 = false;
|
||||
private static bool core40 = false;
|
||||
private static bool core41 = false;
|
||||
private static bool core42 = false;
|
||||
private static bool core43 = false;
|
||||
private static bool core44 = false;
|
||||
private static bool core45 = false;
|
||||
private static bool core46 = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region extension
|
||||
|
||||
private static bool _3DFX_tbuffer;
|
||||
private static bool _3DFX_texture_compression_FXT1;
|
||||
private static bool _4DFX_multisample;
|
||||
private static bool AMD_blend_minmax_factor;
|
||||
private static bool AMD_conservative_depth;
|
||||
private static bool AMD_debug_output;
|
||||
private static bool AMD_depth_clamp_separate;
|
||||
private static bool AMD_draw_buffers_blend;
|
||||
private static bool AMD_framebuffer_multisample_advanced;
|
||||
private static bool AMD_framebuffer_sample_positions;
|
||||
private static bool AMD_gcn_shader;
|
||||
private static bool AMD_gpu_shader_half_float;
|
||||
private static bool AMD_gpu_shader_int16;
|
||||
private static bool AMD_gpu_shader_int64;
|
||||
private static bool AMD_interleaved_elements;
|
||||
private static bool AMD_multi_draw_indirect;
|
||||
private static bool AMD_name_gen_delete;
|
||||
private static bool AMD_occlusion_query_event;
|
||||
private static bool AMD_performance_monitor;
|
||||
private static bool AMD_pinned_memory;
|
||||
private static bool AMD_query_buffer_object;
|
||||
private static bool AMD_sample_positions;
|
||||
private static bool AMD_seamless_cubemap_per_texture;
|
||||
private static bool AMD_shader_atomic_counter_ops;
|
||||
private static bool AMD_shader_ballot;
|
||||
private static bool AMD_shader_explicit_vertex_parameter;
|
||||
private static bool AMD_shader_gpu_shader_half_float_fetch;
|
||||
private static bool AMD_shader_image_load_store_lod;
|
||||
private static bool AMD_shader_stencil_export;
|
||||
private static bool AMD_shader_trinary_minmax;
|
||||
private static bool AMD_sparse_texture;
|
||||
private static bool AMD_stencil_operation_extended;
|
||||
private static bool AMD_texture_gather_bias_lod;
|
||||
private static bool AMD_texture_texture4;
|
||||
private static bool AMD_transform_feedback3_lines_triangles;
|
||||
private static bool AMD_transform_feedback4;
|
||||
private static bool AMD_vertex_shader_layer;
|
||||
private static bool AMD_vertex_shader_tessellator;
|
||||
private static bool AMD_vertex_shader_viewport_index;
|
||||
private static bool APPLE_aux_depth_stencil;
|
||||
private static bool APPLE_client_storage;
|
||||
private static bool APPLE_element_array;
|
||||
private static bool APPLE_fence;
|
||||
private static bool APPLE_float_pixels;
|
||||
private static bool APPLE_flush_buffer_range;
|
||||
private static bool APPLE_object_purgeable;
|
||||
private static bool APPLE_rgb_422;
|
||||
private static bool APPLE_row_bytes;
|
||||
private static bool APPLE_specular_vector;
|
||||
private static bool APPLE_texture_range;
|
||||
private static bool APPLE_transform_hint;
|
||||
private static bool APPLE_vertex_array_object;
|
||||
private static bool APPLE_vertex_array_range;
|
||||
private static bool APPLE_vertex_program_evaluators;
|
||||
private static bool APPLE_ycbcr_422;
|
||||
private static bool ARB_arrays_of_arrays;
|
||||
private static bool ARB_base_instance;
|
||||
private static bool ARB_bindless_texture;
|
||||
private static bool ARB_blend_func_extended;
|
||||
private static bool ARB_buffer_storage;
|
||||
private static bool ARB_cl_event;
|
||||
private static bool ARB_clear_buffer_object;
|
||||
private static bool ARB_clear_texture;
|
||||
private static bool ARB_clip_control;
|
||||
private static bool ARB_color_buffer_float;
|
||||
private static bool ARB_compatibility;
|
||||
private static bool ARB_compressed_texture_pixel_storage;
|
||||
private static bool ARB_compute_shader;
|
||||
private static bool ARB_compute_variable_group_size;
|
||||
private static bool ARB_conditional_render_inverted;
|
||||
private static bool ARB_conservative_depth;
|
||||
private static bool ARB_copy_buffer;
|
||||
private static bool ARB_copy_image;
|
||||
private static bool ARB_cull_distance;
|
||||
private static bool ARB_debug_output;
|
||||
private static bool ARB_depth_buffer_float;
|
||||
private static bool ARB_depth_clamp;
|
||||
private static bool ARB_depth_texture;
|
||||
private static bool ARB_derivative_control;
|
||||
private static bool ARB_direct_state_access;
|
||||
private static bool ARB_draw_buffers;
|
||||
private static bool ARB_draw_buffers_blend;
|
||||
private static bool ARB_draw_elements_base_vertex;
|
||||
private static bool ARB_draw_indirect;
|
||||
private static bool ARB_draw_instanced;
|
||||
private static bool ARB_enhanced_layouts;
|
||||
private static bool ARB_ES2_compatibility;
|
||||
private static bool ARB_ES3_1_compatibility;
|
||||
private static bool ARB_ES3_2_compatibility;
|
||||
private static bool ARB_ES3_compatibility;
|
||||
private static bool ARB_explicit_attrib_location;
|
||||
private static bool ARB_explicit_uniform_location;
|
||||
private static bool ARB_fragment_coord_conventions;
|
||||
private static bool ARB_fragment_layer_viewport;
|
||||
private static bool ARB_fragment_program;
|
||||
private static bool ARB_fragment_program_shadow;
|
||||
private static bool ARB_fragment_shader;
|
||||
private static bool ARB_fragment_shader_interlock;
|
||||
private static bool ARB_framebuffer_no_attachments;
|
||||
private static bool ARB_framebuffer_object;
|
||||
private static bool ARB_framebuffer_sRGB;
|
||||
private static bool ARB_geometry_shader4;
|
||||
private static bool ARB_get_program_binary;
|
||||
private static bool ARB_get_texture_sub_image;
|
||||
private static bool ARB_gl_spirv;
|
||||
private static bool ARB_gpu_shader_fp64;
|
||||
private static bool ARB_gpu_shader_int64;
|
||||
private static bool ARB_gpu_shader5;
|
||||
private static bool ARB_half_float_pixel;
|
||||
private static bool ARB_half_float_vertex;
|
||||
private static bool ARB_imaging;
|
||||
private static bool ARB_indirect_parameters;
|
||||
private static bool ARB_instanced_arrays;
|
||||
private static bool ARB_internalformat_query;
|
||||
private static bool ARB_internalformat_query2;
|
||||
private static bool ARB_invalidate_subdata;
|
||||
private static bool ARB_map_buffer_alignment;
|
||||
private static bool ARB_map_buffer_range;
|
||||
private static bool ARB_matrix_palette;
|
||||
private static bool ARB_multi_bind;
|
||||
private static bool ARB_multi_draw_indirect;
|
||||
private static bool ARB_multisample;
|
||||
private static bool ARB_multitexture;
|
||||
private static bool ARB_occlusion_query;
|
||||
private static bool ARB_occlusion_query2;
|
||||
private static bool ARB_parallel_shader_compile;
|
||||
private static bool ARB_pipeline_statistics_query;
|
||||
private static bool ARB_pixel_buffer_object;
|
||||
private static bool ARB_point_parameters;
|
||||
private static bool ARB_point_sprite;
|
||||
private static bool ARB_polygon_offset_clamp;
|
||||
private static bool ARB_post_depth_coverage;
|
||||
private static bool ARB_program_interface_query;
|
||||
private static bool ARB_provoking_vertex;
|
||||
private static bool ARB_query_buffer_object;
|
||||
private static bool ARB_robust_buffer_access_behavior;
|
||||
private static bool ARB_robustness;
|
||||
private static bool ARB_robustness_isolation;
|
||||
private static bool ARB_sample_locations;
|
||||
private static bool ARB_sample_shading;
|
||||
private static bool ARB_sampler_objects;
|
||||
private static bool ARB_seamless_cube_map;
|
||||
private static bool ARB_seamless_cubemap_per_texture;
|
||||
private static bool ARB_separate_shader_objects;
|
||||
private static bool ARB_shader_atomic_counter_ops;
|
||||
private static bool ARB_shader_atomic_counters;
|
||||
private static bool ARB_shader_ballot;
|
||||
private static bool ARB_shader_bit_encoding;
|
||||
private static bool ARB_shader_clock;
|
||||
private static bool ARB_shader_draw_parameters;
|
||||
private static bool ARB_shader_group_vote;
|
||||
private static bool ARB_shader_image_load_store;
|
||||
private static bool ARB_shader_image_size;
|
||||
private static bool ARB_shader_objects;
|
||||
private static bool ARB_shader_precision;
|
||||
private static bool ARB_shader_stencil_export;
|
||||
private static bool ARB_shader_storage_buffer_object;
|
||||
private static bool ARB_shader_subroutine;
|
||||
private static bool ARB_shader_texture_image_samples;
|
||||
private static bool ARB_shader_texture_lod;
|
||||
private static bool ARB_shader_viewport_layer_array;
|
||||
private static bool ARB_shading_language_100;
|
||||
private static bool ARB_shading_language_420pack;
|
||||
private static bool ARB_shading_language_include;
|
||||
private static bool ARB_shading_language_packing;
|
||||
private static bool ARB_shadow;
|
||||
private static bool ARB_shadow_ambient;
|
||||
private static bool ARB_sparse_buffer;
|
||||
private static bool ARB_sparse_texture;
|
||||
private static bool ARB_sparse_texture_clamp;
|
||||
private static bool ARB_sparse_texture2;
|
||||
private static bool ARB_spirv_extensions;
|
||||
private static bool ARB_stencil_texturing;
|
||||
private static bool ARB_sync;
|
||||
private static bool ARB_tessellation_shader;
|
||||
private static bool ARB_texture_barrier;
|
||||
private static bool ARB_texture_border_clamp;
|
||||
private static bool ARB_texture_buffer_object;
|
||||
private static bool ARB_texture_buffer_object_rgb32;
|
||||
private static bool ARB_texture_buffer_range;
|
||||
private static bool ARB_texture_compression;
|
||||
private static bool ARB_texture_compression_bptc;
|
||||
private static bool ARB_texture_compression_rgtc;
|
||||
private static bool ARB_texture_cube_map;
|
||||
private static bool ARB_texture_cube_map_array;
|
||||
private static bool ARB_texture_env_add;
|
||||
private static bool ARB_texture_env_combine;
|
||||
private static bool ARB_texture_env_crossbar;
|
||||
private static bool ARB_texture_env_dot3;
|
||||
private static bool ARB_texture_filter_anisotropic;
|
||||
private static bool ARB_texture_filter_minmax;
|
||||
private static bool ARB_texture_float;
|
||||
private static bool ARB_texture_gather;
|
||||
private static bool ARB_texture_mirror_clamp_to_edge;
|
||||
private static bool ARB_texture_mirrored_repeat;
|
||||
private static bool ARB_texture_multisample;
|
||||
private static bool ARB_texture_non_power_of_two;
|
||||
private static bool ARB_texture_query_levels;
|
||||
private static bool ARB_texture_query_lod;
|
||||
private static bool ARB_texture_rectangle;
|
||||
private static bool ARB_texture_rg;
|
||||
private static bool ARB_texture_rgb10_a2ui;
|
||||
private static bool ARB_texture_stencil8;
|
||||
private static bool ARB_texture_storage;
|
||||
private static bool ARB_texture_storage_multisample;
|
||||
private static bool ARB_texture_swizzle;
|
||||
private static bool ARB_texture_view;
|
||||
private static bool ARB_timer_query;
|
||||
private static bool ARB_transform_feedback_instanced;
|
||||
private static bool ARB_transform_feedback_overflow_query;
|
||||
private static bool ARB_transform_feedback2;
|
||||
private static bool ARB_transform_feedback3;
|
||||
private static bool ARB_transpose_matrix;
|
||||
private static bool ARB_uniform_buffer_object;
|
||||
private static bool ARB_vertex_array_bgra;
|
||||
private static bool ARB_vertex_array_object;
|
||||
private static bool ARB_vertex_attrib_64bit;
|
||||
private static bool ARB_vertex_attrib_binding;
|
||||
private static bool ARB_vertex_blend;
|
||||
private static bool ARB_vertex_buffer_object;
|
||||
private static bool ARB_vertex_program;
|
||||
private static bool ARB_vertex_shader;
|
||||
private static bool ARB_vertex_type_10f_11f_11f_rev;
|
||||
private static bool ARB_vertex_type_2_10_10_10_rev;
|
||||
private static bool ARB_viewport_array;
|
||||
private static bool ARB_window_pos;
|
||||
private static bool ATI_draw_buffers;
|
||||
private static bool ATI_element_array;
|
||||
private static bool ATI_envmap_bumpmap;
|
||||
private static bool ATI_fragment_shader;
|
||||
private static bool ATI_map_object_buffer;
|
||||
private static bool ATI_meminfo;
|
||||
private static bool ATI_pixel_format_float;
|
||||
private static bool ATI_pn_triangles;
|
||||
private static bool ATI_separate_stencil;
|
||||
private static bool ATI_text_fragment_shader;
|
||||
private static bool ATI_texture_env_combine3;
|
||||
private static bool ATI_texture_float;
|
||||
private static bool ATI_texture_mirror_once;
|
||||
private static bool ATI_vertex_array_object;
|
||||
private static bool ATI_vertex_attrib_array_object;
|
||||
private static bool ATI_vertex_streams;
|
||||
private static bool EXT_422_pixels;
|
||||
private static bool EXT_abgr;
|
||||
private static bool EXT_bgra;
|
||||
private static bool EXT_bindable_uniform;
|
||||
private static bool EXT_blend_color;
|
||||
private static bool EXT_blend_equation_separate;
|
||||
private static bool EXT_blend_func_separate;
|
||||
private static bool EXT_blend_logic_op;
|
||||
private static bool EXT_blend_minmax;
|
||||
private static bool EXT_blend_subtract;
|
||||
private static bool EXT_clip_volume_hint;
|
||||
private static bool EXT_cmyka;
|
||||
private static bool EXT_color_subtable;
|
||||
private static bool EXT_compiled_vertex_array;
|
||||
private static bool EXT_convolution;
|
||||
private static bool EXT_coordinate_frame;
|
||||
private static bool EXT_copy_texture;
|
||||
private static bool EXT_cull_vertex;
|
||||
private static bool EXT_debug_label;
|
||||
private static bool EXT_debug_marker;
|
||||
private static bool EXT_depth_bounds_test;
|
||||
private static bool EXT_direct_state_access;
|
||||
private static bool EXT_draw_buffers2;
|
||||
private static bool EXT_draw_instanced;
|
||||
private static bool EXT_draw_range_elements;
|
||||
private static bool EXT_EGL_image_storage;
|
||||
private static bool EXT_EGL_sync;
|
||||
private static bool EXT_external_buffer;
|
||||
private static bool EXT_fog_coord;
|
||||
private static bool EXT_framebuffer_blit;
|
||||
private static bool EXT_framebuffer_blit_layers;
|
||||
private static bool EXT_framebuffer_multisample;
|
||||
private static bool EXT_framebuffer_multisample_blit_scaled;
|
||||
private static bool EXT_framebuffer_object;
|
||||
private static bool EXT_framebuffer_sRGB;
|
||||
private static bool EXT_geometry_shader4;
|
||||
private static bool EXT_gpu_program_parameters;
|
||||
private static bool EXT_gpu_shader4;
|
||||
private static bool EXT_histogram;
|
||||
private static bool EXT_index_array_formats;
|
||||
private static bool EXT_index_func;
|
||||
private static bool EXT_index_material;
|
||||
private static bool EXT_index_texture;
|
||||
private static bool EXT_light_texture;
|
||||
private static bool EXT_memory_object;
|
||||
private static bool EXT_memory_object_fd;
|
||||
private static bool EXT_memory_object_win32;
|
||||
private static bool EXT_misc_attribute;
|
||||
private static bool EXT_multi_draw_arrays;
|
||||
private static bool EXT_multisample;
|
||||
private static bool EXT_multiview_tessellation_geometry_shader;
|
||||
private static bool EXT_multiview_texture_multisample;
|
||||
private static bool EXT_multiview_timer_query;
|
||||
private static bool EXT_packed_depth_stencil;
|
||||
private static bool EXT_packed_float;
|
||||
private static bool EXT_packed_pixels;
|
||||
private static bool EXT_paletted_texture;
|
||||
private static bool EXT_pixel_buffer_object;
|
||||
private static bool EXT_pixel_transform;
|
||||
private static bool EXT_pixel_transform_color_table;
|
||||
private static bool EXT_point_parameters;
|
||||
private static bool EXT_polygon_offset;
|
||||
private static bool EXT_polygon_offset_clamp;
|
||||
private static bool EXT_post_depth_coverage;
|
||||
private static bool EXT_provoking_vertex;
|
||||
private static bool EXT_raster_multisample;
|
||||
private static bool EXT_rescale_normal;
|
||||
private static bool EXT_secondary_color;
|
||||
private static bool EXT_semaphore;
|
||||
private static bool EXT_semaphore_fd;
|
||||
private static bool EXT_semaphore_win32;
|
||||
private static bool EXT_separate_shader_objects;
|
||||
private static bool EXT_separate_specular_color;
|
||||
private static bool EXT_shader_framebuffer_fetch;
|
||||
private static bool EXT_shader_framebuffer_fetch_non_coherent;
|
||||
private static bool EXT_shader_image_load_formatted;
|
||||
private static bool EXT_shader_image_load_store;
|
||||
private static bool EXT_shader_integer_mix;
|
||||
private static bool EXT_shader_samples_identical;
|
||||
private static bool EXT_shadow_funcs;
|
||||
private static bool EXT_shared_texture_palette;
|
||||
private static bool EXT_sparse_texture2;
|
||||
private static bool EXT_stencil_clear_tag;
|
||||
private static bool EXT_stencil_two_side;
|
||||
private static bool EXT_stencil_wrap;
|
||||
private static bool EXT_subtexture;
|
||||
private static bool EXT_texture;
|
||||
private static bool EXT_texture_array;
|
||||
private static bool EXT_texture_buffer_object;
|
||||
private static bool EXT_texture_compression_latc;
|
||||
private static bool EXT_texture_compression_rgtc;
|
||||
private static bool EXT_texture_compression_s3tc;
|
||||
private static bool EXT_texture_cube_map;
|
||||
private static bool EXT_texture_env_add;
|
||||
private static bool EXT_texture_env_combine;
|
||||
private static bool EXT_texture_env_dot3;
|
||||
private static bool EXT_texture_filter_anisotropic;
|
||||
private static bool EXT_texture_filter_minmax;
|
||||
private static bool EXT_texture_integer;
|
||||
private static bool EXT_texture_lod_bias;
|
||||
private static bool EXT_texture_mirror_clamp;
|
||||
private static bool EXT_texture_object;
|
||||
private static bool EXT_texture_perturb_normal;
|
||||
private static bool EXT_texture_shadow_lod;
|
||||
private static bool EXT_texture_shared_exponent;
|
||||
private static bool EXT_texture_snorm;
|
||||
private static bool EXT_texture_sRGB;
|
||||
private static bool EXT_texture_sRGB_decode;
|
||||
private static bool EXT_texture_sRGB_R8;
|
||||
private static bool EXT_texture_sRGB_RG8;
|
||||
private static bool EXT_texture_storage;
|
||||
private static bool EXT_texture_swizzle;
|
||||
private static bool EXT_texture3D;
|
||||
private static bool EXT_timer_query;
|
||||
private static bool EXT_transform_feedback;
|
||||
private static bool EXT_vertex_array;
|
||||
private static bool EXT_vertex_array_bgra;
|
||||
private static bool EXT_vertex_attrib_64bit;
|
||||
private static bool EXT_vertex_shader;
|
||||
private static bool EXT_vertex_weighting;
|
||||
private static bool EXT_win32_keyed_mutex;
|
||||
private static bool EXT_window_rectangles;
|
||||
private static bool EXT_x11_sync_object;
|
||||
private static bool GREMEDY_frame_terminator;
|
||||
private static bool GREMEDY_string_marker;
|
||||
private static bool HP_convolution_border_modes;
|
||||
private static bool HP_image_transform;
|
||||
private static bool HP_occlusion_test;
|
||||
private static bool HP_texture_lighting;
|
||||
private static bool IBM_cull_vertex;
|
||||
private static bool IBM_multimode_draw_arrays;
|
||||
private static bool IBM_rasterpos_clip;
|
||||
private static bool IBM_static_data;
|
||||
private static bool IBM_texture_mirrored_repeat;
|
||||
private static bool IBM_vertex_array_lists;
|
||||
private static bool INGR_blend_func_separate;
|
||||
private static bool INGR_color_clamp;
|
||||
private static bool INGR_interlace_read;
|
||||
private static bool INTEL_blackhole_render;
|
||||
private static bool INTEL_conservative_rasterization;
|
||||
private static bool INTEL_fragment_shader_ordering;
|
||||
private static bool INTEL_framebuffer_CMAA;
|
||||
private static bool INTEL_map_texture;
|
||||
private static bool INTEL_parallel_arrays;
|
||||
private static bool INTEL_performance_query;
|
||||
private static bool KHR_blend_equation_advanced;
|
||||
private static bool KHR_blend_equation_advanced_coherent;
|
||||
private static bool KHR_context_flush_control;
|
||||
private static bool KHR_debug;
|
||||
private static bool KHR_no_error;
|
||||
private static bool KHR_parallel_shader_compile;
|
||||
private static bool KHR_robust_buffer_access_behavior;
|
||||
private static bool KHR_robustness;
|
||||
private static bool KHR_shader_subgroup;
|
||||
private static bool KHR_texture_compression_astc_hdr;
|
||||
private static bool KHR_texture_compression_astc_ldr;
|
||||
private static bool KHR_texture_compression_astc_sliced_3d;
|
||||
private static bool MESA_framebuffer_flip_x;
|
||||
private static bool MESA_framebuffer_flip_y;
|
||||
private static bool MESA_framebuffer_swap_xy;
|
||||
private static bool MESA_pack_invert;
|
||||
private static bool MESA_program_binary_formats;
|
||||
private static bool MESA_resize_buffers;
|
||||
private static bool MESA_shader_integer_functions;
|
||||
private static bool MESA_tile_raster_order;
|
||||
private static bool MESA_window_pos;
|
||||
private static bool MESA_ycbcr_texture;
|
||||
private static bool MESAX_texture_stack;
|
||||
private static bool NV_alpha_to_coverage_dither_control;
|
||||
private static bool NV_bindless_multi_draw_indirect;
|
||||
private static bool NV_bindless_multi_draw_indirect_count;
|
||||
private static bool NV_bindless_texture;
|
||||
private static bool NV_blend_equation_advanced;
|
||||
private static bool NV_blend_equation_advanced_coherent;
|
||||
private static bool NV_blend_minmax_factor;
|
||||
private static bool NV_blend_square;
|
||||
private static bool NV_clip_space_w_scaling;
|
||||
private static bool NV_command_list;
|
||||
private static bool NV_compute_program5;
|
||||
private static bool NV_compute_shader_derivatives;
|
||||
private static bool NV_conditional_render;
|
||||
private static bool NV_conservative_raster;
|
||||
private static bool NV_conservative_raster_dilate;
|
||||
private static bool NV_conservative_raster_pre_snap;
|
||||
private static bool NV_conservative_raster_pre_snap_triangles;
|
||||
private static bool NV_conservative_raster_underestimation;
|
||||
private static bool NV_copy_depth_to_color;
|
||||
private static bool NV_copy_image;
|
||||
private static bool NV_deep_texture3D;
|
||||
private static bool NV_depth_buffer_float;
|
||||
private static bool NV_depth_clamp;
|
||||
private static bool NV_draw_texture;
|
||||
private static bool NV_draw_vulkan_image;
|
||||
private static bool NV_evaluators;
|
||||
private static bool NV_explicit_multisample;
|
||||
private static bool NV_fence;
|
||||
private static bool NV_fill_rectangle;
|
||||
private static bool NV_float_buffer;
|
||||
private static bool NV_fog_distance;
|
||||
private static bool NV_fragment_coverage_to_color;
|
||||
private static bool NV_fragment_program;
|
||||
private static bool NV_fragment_program_option;
|
||||
private static bool NV_fragment_program2;
|
||||
private static bool NV_fragment_program4;
|
||||
private static bool NV_fragment_shader_barycentric;
|
||||
private static bool NV_fragment_shader_interlock;
|
||||
private static bool NV_framebuffer_mixed_samples;
|
||||
private static bool NV_framebuffer_multisample_coverage;
|
||||
private static bool NV_geometry_program4;
|
||||
private static bool NV_geometry_shader_passthrough;
|
||||
private static bool NV_geometry_shader4;
|
||||
private static bool NV_gpu_multicast;
|
||||
private static bool NV_gpu_program4;
|
||||
private static bool NV_gpu_program5;
|
||||
private static bool NV_gpu_program5_mem_extended;
|
||||
private static bool NV_gpu_shader5;
|
||||
private static bool NV_half_float;
|
||||
private static bool NV_internalformat_sample_query;
|
||||
private static bool NV_light_max_exponent;
|
||||
private static bool NV_memory_attachment;
|
||||
private static bool NV_memory_object_sparse;
|
||||
private static bool NV_mesh_shader;
|
||||
private static bool NV_multisample_coverage;
|
||||
private static bool NV_multisample_filter_hint;
|
||||
private static bool NV_occlusion_query;
|
||||
private static bool NV_packed_depth_stencil;
|
||||
private static bool NV_parameter_buffer_object;
|
||||
private static bool NV_parameter_buffer_object2;
|
||||
private static bool NV_path_rendering;
|
||||
private static bool NV_path_rendering_shared_edge;
|
||||
private static bool NV_pixel_data_range;
|
||||
private static bool NV_point_sprite;
|
||||
private static bool NV_present_video;
|
||||
private static bool NV_primitive_restart;
|
||||
private static bool NV_primitive_shading_rate;
|
||||
private static bool NV_query_resource;
|
||||
private static bool NV_query_resource_tag;
|
||||
private static bool NV_register_combiners;
|
||||
private static bool NV_register_combiners2;
|
||||
private static bool NV_representative_fragment_test;
|
||||
private static bool NV_robustness_video_memory_purge;
|
||||
private static bool NV_sample_locations;
|
||||
private static bool NV_sample_mask_override_coverage;
|
||||
private static bool NV_scissor_exclusive;
|
||||
private static bool NV_shader_atomic_counters;
|
||||
private static bool NV_shader_atomic_float;
|
||||
private static bool NV_shader_atomic_float64;
|
||||
private static bool NV_shader_atomic_fp16_vector;
|
||||
private static bool NV_shader_atomic_int64;
|
||||
private static bool NV_shader_buffer_load;
|
||||
private static bool NV_shader_buffer_store;
|
||||
private static bool NV_shader_storage_buffer_object;
|
||||
private static bool NV_shader_subgroup_partitioned;
|
||||
private static bool NV_shader_texture_footprint;
|
||||
private static bool NV_shader_thread_group;
|
||||
private static bool NV_shader_thread_shuffle;
|
||||
private static bool NV_shading_rate_image;
|
||||
private static bool NV_stereo_view_rendering;
|
||||
private static bool NV_tessellation_program5;
|
||||
private static bool NV_texgen_emboss;
|
||||
private static bool NV_texgen_reflection;
|
||||
private static bool NV_texture_barrier;
|
||||
private static bool NV_texture_compression_vtc;
|
||||
private static bool NV_texture_env_combine4;
|
||||
private static bool NV_texture_expand_normal;
|
||||
private static bool NV_texture_multisample;
|
||||
private static bool NV_texture_rectangle;
|
||||
private static bool NV_texture_rectangle_compressed;
|
||||
private static bool NV_texture_shader;
|
||||
private static bool NV_texture_shader2;
|
||||
private static bool NV_texture_shader3;
|
||||
private static bool NV_timeline_semaphore;
|
||||
private static bool NV_transform_feedback;
|
||||
private static bool NV_transform_feedback2;
|
||||
private static bool NV_uniform_buffer_std430_layout;
|
||||
private static bool NV_uniform_buffer_unified_memory;
|
||||
private static bool NV_vdpau_interop;
|
||||
private static bool NV_vdpau_interop2;
|
||||
private static bool NV_vertex_array_range;
|
||||
private static bool NV_vertex_array_range2;
|
||||
private static bool NV_vertex_attrib_integer_64bit;
|
||||
private static bool NV_vertex_buffer_unified_memory;
|
||||
private static bool NV_vertex_program;
|
||||
private static bool NV_vertex_program1_1;
|
||||
private static bool NV_vertex_program2;
|
||||
private static bool NV_vertex_program2_option;
|
||||
private static bool NV_vertex_program3;
|
||||
private static bool NV_vertex_program4;
|
||||
private static bool NV_video_capture;
|
||||
private static bool NV_viewport_array2;
|
||||
private static bool NV_viewport_swizzle;
|
||||
private static bool NVX_blend_equation_advanced_multi_draw_buffers;
|
||||
private static bool NVX_conditional_render;
|
||||
private static bool NVX_gpu_memory_info;
|
||||
private static bool NVX_gpu_multicast2;
|
||||
private static bool NVX_linked_gpu_multicast;
|
||||
private static bool NVX_progress_fence;
|
||||
private static bool OES_byte_coordinates;
|
||||
private static bool OES_compressed_paletted_texture;
|
||||
private static bool OES_fixed_point;
|
||||
private static bool OES_query_matrix;
|
||||
private static bool OES_read_format;
|
||||
private static bool OES_single_precision;
|
||||
private static bool OML_interlace;
|
||||
private static bool OML_resample;
|
||||
private static bool OML_subsample;
|
||||
private static bool OVR_multiview;
|
||||
private static bool OVR_multiview2;
|
||||
private static bool PGI_misc_hints;
|
||||
private static bool PGI_vertex_hints;
|
||||
private static bool REND_screen_coordinates;
|
||||
private static bool S3_s3tc;
|
||||
private static bool SGI_color_matrix;
|
||||
private static bool SGI_color_table;
|
||||
private static bool SGI_texture_color_table;
|
||||
private static bool SGIS_detail_texture;
|
||||
private static bool SGIS_fog_function;
|
||||
private static bool SGIS_generate_mipmap;
|
||||
private static bool SGIS_multisample;
|
||||
private static bool SGIS_pixel_texture;
|
||||
private static bool SGIS_point_line_texgen;
|
||||
private static bool SGIS_point_parameters;
|
||||
private static bool SGIS_sharpen_texture;
|
||||
private static bool SGIS_texture_border_clamp;
|
||||
private static bool SGIS_texture_color_mask;
|
||||
private static bool SGIS_texture_edge_clamp;
|
||||
private static bool SGIS_texture_filter4;
|
||||
private static bool SGIS_texture_lod;
|
||||
private static bool SGIS_texture_select;
|
||||
private static bool SGIS_texture4D;
|
||||
private static bool SGIX_async;
|
||||
private static bool SGIX_async_histogram;
|
||||
private static bool SGIX_async_pixel;
|
||||
private static bool SGIX_blend_alpha_minmax;
|
||||
private static bool SGIX_calligraphic_fragment;
|
||||
private static bool SGIX_clipmap;
|
||||
private static bool SGIX_convolution_accuracy;
|
||||
private static bool SGIX_depth_pass_instrument;
|
||||
private static bool SGIX_depth_texture;
|
||||
private static bool SGIX_flush_raster;
|
||||
private static bool SGIX_fog_offset;
|
||||
private static bool SGIX_fragment_lighting;
|
||||
private static bool SGIX_framezoom;
|
||||
private static bool SGIX_igloo_interface;
|
||||
private static bool SGIX_instruments;
|
||||
private static bool SGIX_interlace;
|
||||
private static bool SGIX_ir_instrument1;
|
||||
private static bool SGIX_list_priority;
|
||||
private static bool SGIX_pixel_texture;
|
||||
private static bool SGIX_pixel_tiles;
|
||||
private static bool SGIX_polynomial_ffd;
|
||||
private static bool SGIX_reference_plane;
|
||||
private static bool SGIX_resample;
|
||||
private static bool SGIX_scalebias_hint;
|
||||
private static bool SGIX_shadow;
|
||||
private static bool SGIX_shadow_ambient;
|
||||
private static bool SGIX_sprite;
|
||||
private static bool SGIX_subsample;
|
||||
private static bool SGIX_tag_sample_buffer;
|
||||
private static bool SGIX_texture_add_env;
|
||||
private static bool SGIX_texture_coordinate_clamp;
|
||||
private static bool SGIX_texture_lod_bias;
|
||||
private static bool SGIX_texture_multi_buffer;
|
||||
private static bool SGIX_texture_scale_bias;
|
||||
private static bool SGIX_vertex_preclip;
|
||||
private static bool SGIX_ycrcb;
|
||||
private static bool SGIX_ycrcb_subsample;
|
||||
private static bool SGIX_ycrcba;
|
||||
private static bool SUN_convolution_border_modes;
|
||||
private static bool SUN_global_alpha;
|
||||
private static bool SUN_mesh_array;
|
||||
private static bool SUN_slice_accum;
|
||||
private static bool SUN_triangle_list;
|
||||
private static bool SUN_vertex;
|
||||
private static bool SUNX_constant_data;
|
||||
private static bool WIN_phong_shading;
|
||||
private static bool WIN_specular_fog;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,114 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="glRenderObjectGenrator"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nitload.Graphics.OpenGL
|
||||
{
|
||||
public partial class glRender
|
||||
{
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected AutoTextureGL CreateAutoTexture(
|
||||
int count
|
||||
)
|
||||
{
|
||||
return new AutoTextureGL(count, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a set of <see cref="ElementBuffer" />.
|
||||
/// </summary>
|
||||
/// <param _label="count">
|
||||
/// Amount of EBO to be created.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
///
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected ElementBuffer CreateElementBuffer(
|
||||
int count
|
||||
)
|
||||
{
|
||||
return new ElementBuffer(count, this);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected FrameBuffer CreateFrameBuffer(
|
||||
int count
|
||||
)
|
||||
{
|
||||
return new FrameBuffer(count, this);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected RenderBuffer CreateRenderBuffer(
|
||||
int count
|
||||
)
|
||||
{
|
||||
return new RenderBuffer(count, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a sets of <see cref="TextureGL" />
|
||||
/// </summary>
|
||||
/// <param _label="count">
|
||||
/// Amount of textures to be created.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
///
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected TextureGL CreateTexture(
|
||||
int count
|
||||
)
|
||||
{
|
||||
return new TextureGL(count, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a set of <see cref="VertexArray" />.
|
||||
/// </summary>
|
||||
/// <param _label="count">
|
||||
/// Amount of VAO to be created.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
///
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected VertexArray CreateVertexArray(
|
||||
int count
|
||||
)
|
||||
{
|
||||
return new VertexArray(count, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a set of <see cref="VertexBuffer" />.
|
||||
/// </summary>
|
||||
/// <param _label="count">
|
||||
/// Amount of Object to be created.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
///
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected VertexBuffer CreateVertexBuffer(
|
||||
int count
|
||||
)
|
||||
{
|
||||
return new VertexBuffer(count, this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="glRenderStream.ThreadSecurity"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nitload.Graphics.OpenGL
|
||||
{
|
||||
public partial class glRender
|
||||
{
|
||||
|
||||
private static ConcurrentDictionary<Thread, glRender> threadLocalIndex
|
||||
= new();
|
||||
private readonly SynchronizationContext mainThreadContext = SynchronizationContext.Current;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="glType"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Nitload.Graphics.OpenGL
|
||||
{
|
||||
internal delegate void GLVULKANPROCNV();
|
||||
|
||||
public unsafe struct glHandleARB(
|
||||
IntPtr value
|
||||
) { }
|
||||
|
||||
/// <summary>
|
||||
/// OpenGL numeric type. An IEEE-754 floating-point value, clamped to the range [0,1].
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct GlClampF
|
||||
{
|
||||
|
||||
public float value;
|
||||
|
||||
public GlClampF(
|
||||
float a
|
||||
)
|
||||
{
|
||||
value = a;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
||||
public struct glHalfNv(
|
||||
Half bin
|
||||
)
|
||||
{
|
||||
|
||||
[FieldOffset(0)] public Half binary = bin;
|
||||
|
||||
public float ToSingle()
|
||||
{
|
||||
return (float)binary;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct glSync
|
||||
{
|
||||
|
||||
public IntPtr Handle;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 8)]
|
||||
public struct GlFixed
|
||||
{
|
||||
|
||||
[FieldOffset(0)] public int All;
|
||||
[FieldOffset(0)] public short Decimals;
|
||||
[FieldOffset(4)] public short Integer;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OpenGL numeric type. An IEEE-754 double precision floating-point value, clamped to the
|
||||
/// range [0,1].
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct GlClampD
|
||||
{
|
||||
|
||||
public double value;
|
||||
|
||||
public GlClampD(
|
||||
double a
|
||||
)
|
||||
{
|
||||
value = a;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="Pixels"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Nitload.Graphics
|
||||
{
|
||||
public interface IPixel
|
||||
{
|
||||
|
||||
public float Red { get; set; }
|
||||
|
||||
public float Green { get; set; }
|
||||
|
||||
public float Blue { get; set; }
|
||||
|
||||
public float Alpha { get; set; }
|
||||
|
||||
internal int Size { get; }
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 32)]
|
||||
public unsafe struct Pixel32RGBA : IPixel
|
||||
{
|
||||
|
||||
[FieldOffset(0)] private unsafe fixed byte data[4];
|
||||
[FieldOffset(0)] private readonly int mask;
|
||||
|
||||
public readonly int Size => 4;
|
||||
|
||||
public override bool Equals(
|
||||
object obj
|
||||
)
|
||||
{
|
||||
return obj is not null && obj is Pixel32RGBA pixel && this == pixel;
|
||||
}
|
||||
|
||||
public override readonly int GetHashCode()
|
||||
{
|
||||
return mask.GetHashCode();
|
||||
}
|
||||
|
||||
public static bool operator !=(
|
||||
Pixel32RGBA left,
|
||||
Pixel32RGBA right
|
||||
)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public static bool operator ==(
|
||||
Pixel32RGBA left,
|
||||
Pixel32RGBA right
|
||||
)
|
||||
{
|
||||
return left.mask == right.mask;
|
||||
}
|
||||
|
||||
float IPixel.Alpha
|
||||
{
|
||||
get => data[3] / 256;
|
||||
set => data[3] = (byte)(value * 256);
|
||||
}
|
||||
|
||||
float IPixel.Blue
|
||||
{
|
||||
get => data[2] / 256;
|
||||
set => data[2] = (byte)(value * 256);
|
||||
}
|
||||
|
||||
float IPixel.Green
|
||||
{
|
||||
get => data[1] / 256;
|
||||
set => data[1] = (byte)(value * 256);
|
||||
}
|
||||
|
||||
float IPixel.Red
|
||||
{
|
||||
get => data[0] / 256;
|
||||
set => data[0] = (byte)(value * 256);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
# StgSharp.Graphics retired sources
|
||||
|
||||
This directory contains source snapshots retired during the Graphics/OpenGL
|
||||
reorganization on 2026-08-26. Files use the `.cs.old` suffix so that SDK-style
|
||||
project globbing does not compile them.
|
||||
|
||||
## Retired without an active replacement
|
||||
|
||||
- `framework.cs.old`: unused GL/debug delegate declarations.
|
||||
- `Vulkan.*.cs.old`: unreferenced Vulkan placeholders.
|
||||
- `OpenGL.glRenderStream.ThreadSecurity.cs.old`: unused thread/context fields.
|
||||
- `OpenGL.Generated.GlCommandHistory.g.cs.old`: generator report data that does
|
||||
not belong in the runtime assembly.
|
||||
|
||||
## Split before retirement
|
||||
|
||||
- `gl.cs.old`: image P/Invokes were temporarily split out and later retired;
|
||||
legacy OpenGL native helpers were replaced with direct calls through the
|
||||
OpenGL function table.
|
||||
- `glfw.dtruct.cs.old`: reduced to the four opaque GLFW types currently used by
|
||||
the wrapper in `glfw.struct.cs`.
|
||||
- `OpenGL.glType.cs.old`: only `glSync` remains active in `OpenGL/glSync.cs`.
|
||||
- `ShaderEdit.ShaderGenerator.cs.old`: only the temporary
|
||||
`InternalShaderType` compatibility enum remains active.
|
||||
- `GraphicInitializer.cs.old`: merged into the correctly named `GraphicModule`
|
||||
in `glfw.cs`.
|
||||
- `OpenGL.glApiManager.cs.old` and `OpenGL.glApiManager.Const.cs.old`: the active
|
||||
compatibility loader retains only core-version loading; the unused extension
|
||||
classification table and 619 write-only flags were retired.
|
||||
|
||||
## Retired during the image simplification
|
||||
|
||||
- `Image.cs.old`: the former image/decoder/OpenGL-format aggregate.
|
||||
- `ImageInfo.cs.old` and `Image.Native.cs.old`: the mismatched native decoder
|
||||
state and its P/Invoke bridge.
|
||||
- `Pixels.cs.old`: the unused and incorrectly sized legacy pixel abstraction.
|
||||
- `CPUanimation.ImageHelper.cs.old`: incomplete resizing and movement logic;
|
||||
image transformations now belong to a caller-selected codec or image library.
|
||||
- `CPUanimation.IImageProvider.cs.old`: the redundant image-returns-itself
|
||||
provider contract.
|
||||
- `TexturePipeline.cs.old`: an unused pipeline payload tied to the retired
|
||||
non-generic image type.
|
||||
- `OpenGL.Buffer.AutoTexture.cs.old`: the unused texture cache depended on image
|
||||
mutation counters and also contained incorrect slot/recycling bookkeeping.
|
||||
|
||||
## Retired during the data-only OpenGL resource migration
|
||||
|
||||
- `Define.BufferObjectBase.cs.old` and
|
||||
`OpenGL.Buffer.GLBufferObjectBase.cs.old`: the former resource base classes
|
||||
injected `glRender`/`OpenGLFunction` and attempted context-bound disposal from
|
||||
resource objects and finalizers.
|
||||
- `OpenGL.glRenderObjectGenrator.cs.old`: the former factories implicitly
|
||||
created resources through a render-stream instance.
|
||||
- `OpenGL.ShaderEdit.IglConvertable.cs.old`, `ShaderEdit.ShaderStruct.cs.old`,
|
||||
and `ShaderEdit.InternalShaderType.cs.old`: the obsolete shader conversion
|
||||
layer submitted uniforms through the global `CurrentGL` context.
|
||||
|
||||
Active OpenGL resource and shader types are passive handle records. Creation,
|
||||
binding, upload, compilation, use, and deletion are explicitly submitted to an
|
||||
`OpenGLFunction` instance.
|
||||
|
||||
The active `Image<TPixel>` is only a tightly packed managed bitmap buffer. It
|
||||
does not load files, convert formats, resize pixels, or retain native memory.
|
||||
|
||||
These files are historical references, not candidates for restoration as a
|
||||
group. Restore individual behavior only after checking it against the new
|
||||
Graphics and OpenGL architecture.
|
||||
@@ -0,0 +1,37 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="InternalShaderType"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
namespace Nitload.Graphics.ShaderEdit
|
||||
{
|
||||
// Temporary compatibility type for ShaderStruct. The new shader model will replace it.
|
||||
public enum InternalShaderType
|
||||
{
|
||||
#pragma warning disable CS1591
|
||||
Struct,
|
||||
Void,
|
||||
Int,
|
||||
UInt,
|
||||
Float,
|
||||
Double,
|
||||
Vector2,
|
||||
Vector3,
|
||||
Vector4,
|
||||
VectorD2,
|
||||
VectorD3,
|
||||
VectorD4,
|
||||
Matrix2x2,
|
||||
Matrix2x3,
|
||||
Matrix2x4,
|
||||
Matrix3x2,
|
||||
Matrix3x3,
|
||||
Matrix3x4,
|
||||
Matrix4x2,
|
||||
Matrix4x3,
|
||||
Matrix4x4,
|
||||
#pragma warning restore CS1591
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="ShaderGenerator"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Nitload.Graphics;
|
||||
using Nitload.Graphics.OpenGL;
|
||||
using Nitload.Mathematics;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nitload.Graphics.ShaderEdit
|
||||
{
|
||||
public class ShaderGenerator
|
||||
{
|
||||
|
||||
private Dictionary<int, ShaderParameter> uniformDefine;
|
||||
private List<string> codeList;
|
||||
private List<ShaderFunction> usedShaderFunctions;
|
||||
|
||||
public Uniform<T> DefineUniform<T>(
|
||||
string name,
|
||||
int index
|
||||
) where T : unmanaged
|
||||
{
|
||||
ShaderParameter p = new ShaderParameter(name, ShaderParameter.TypeMarshal<T>());
|
||||
uniformDefine.Add(index, p);
|
||||
|
||||
// return new Uniform<TView>();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ShaderFunction
|
||||
{
|
||||
|
||||
private List<string> codeList;
|
||||
private List<ShaderParameter> inputList;
|
||||
private ShaderParameter outPut;
|
||||
private string name;
|
||||
|
||||
public int ParameterCount => inputList.Count;
|
||||
|
||||
public void EmitCall(
|
||||
ShaderFunction function,
|
||||
ShaderParameter outPut,
|
||||
params ShaderParameter[] inputParams
|
||||
)
|
||||
{
|
||||
if (inputParams.Length != function.ParameterCount)
|
||||
{
|
||||
// Param list length not equal
|
||||
throw new ArgumentException(
|
||||
"Provided parameters does not match function's parameter list.");
|
||||
}
|
||||
if (!ShaderParameter.IsSameType(outPut, function.outPut))
|
||||
{
|
||||
// Type of returning value not equal
|
||||
throw new ArgumentException(
|
||||
"Provided parameters does not match function's parameter list.");
|
||||
}
|
||||
for (int i = 0; i < inputParams.Length; i++)
|
||||
{
|
||||
if (!ShaderParameter.IsSameType(function.inputList[i], inputParams[i]))
|
||||
{
|
||||
// Input type not match
|
||||
throw new InvalidCastException(
|
||||
"Provided parameters does not match function's parameter list.");
|
||||
}
|
||||
}
|
||||
string codeLine = string.Empty; // adding a line like " outvalue = Func(input1, input2,...); "
|
||||
if (outPut != ShaderParameter.Void) {
|
||||
codeLine += $"{outPut.name} = ";
|
||||
}
|
||||
codeLine += $"{function.name}(";
|
||||
foreach (ShaderParameter inputParam in inputParams) {
|
||||
codeLine += inputParam.name;
|
||||
}
|
||||
codeLine += ");\n";
|
||||
codeList.Add(codeLine);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ShaderParameter
|
||||
{
|
||||
|
||||
public static readonly ShaderParameter Void = new ShaderParameter(
|
||||
string.Empty, InternalShaderType.Void);
|
||||
internal readonly bool isReadOnly;
|
||||
internal readonly InternalShaderType type;
|
||||
internal readonly string name;
|
||||
|
||||
public ShaderParameter(
|
||||
string name,
|
||||
InternalShaderType type
|
||||
)
|
||||
{
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
isReadOnly = false;
|
||||
}
|
||||
|
||||
public static bool IsSameType(
|
||||
ShaderParameter param1,
|
||||
ShaderParameter param2
|
||||
)
|
||||
{
|
||||
if (param1.type != InternalShaderType.Struct)
|
||||
{
|
||||
return param1.type == param2.type;
|
||||
} else
|
||||
{
|
||||
throw new Exception("Struct is currently not supported.");
|
||||
}
|
||||
}
|
||||
|
||||
public static InternalShaderType TypeMarshal<T>() where T : unmanaged
|
||||
{
|
||||
switch (Type.GetTypeCode(typeof(T)))
|
||||
{
|
||||
case TypeCode.Single:
|
||||
return InternalShaderType.Float;
|
||||
case TypeCode.Double:
|
||||
return InternalShaderType.Double;
|
||||
case TypeCode.Int32:
|
||||
return InternalShaderType.Int;
|
||||
case TypeCode.UInt32:
|
||||
return InternalShaderType.UInt;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (typeof(T).Name)
|
||||
{
|
||||
case "vec4d":
|
||||
return InternalShaderType.Vector4;
|
||||
case "Matrix2x2":
|
||||
return InternalShaderType.Matrix2x2;
|
||||
case "Matrix2x3":
|
||||
return InternalShaderType.Matrix2x3;
|
||||
case "Matrix2x4":
|
||||
return InternalShaderType.Matrix2x4;
|
||||
case "Matrix3x2":
|
||||
return InternalShaderType.Matrix3x2;
|
||||
case "Matrix3x3":
|
||||
return InternalShaderType.Matrix3x3;
|
||||
case "Matrix3x4":
|
||||
return InternalShaderType.Matrix3x4;
|
||||
case "Matrix4x2":
|
||||
return InternalShaderType.Matrix4x2;
|
||||
case "Matrix4x3":
|
||||
return InternalShaderType.Matrix4x3;
|
||||
case "Matrix4x4":
|
||||
return InternalShaderType.Matrix4x4;
|
||||
default:
|
||||
throw new ArgumentException("Not supported shader data type.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum InternalShaderType
|
||||
{
|
||||
#pragma warning disable CS1591
|
||||
Struct,
|
||||
Void,
|
||||
Int,
|
||||
UInt,
|
||||
Float,
|
||||
Double,
|
||||
Vector2,
|
||||
Vector3,
|
||||
Vector4,
|
||||
VectorD2,
|
||||
VectorD3,
|
||||
VectorD4,
|
||||
Matrix2x2,
|
||||
Matrix2x3,
|
||||
Matrix2x4,
|
||||
Matrix3x2,
|
||||
Matrix3x3,
|
||||
Matrix3x4,
|
||||
Matrix4x2,
|
||||
Matrix4x3,
|
||||
Matrix4x4,
|
||||
#pragma warning restore CS1591
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="ShaderStruct"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Nitload.Graphics;
|
||||
using Nitload.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nitload.Graphics.ShaderEdit
|
||||
{
|
||||
public class ShaderStructMember
|
||||
{
|
||||
|
||||
internal InternalShaderType type;
|
||||
internal object value;
|
||||
|
||||
}
|
||||
|
||||
public class ShaderStruct
|
||||
{
|
||||
|
||||
internal Dictionary<GlHandle, ShaderStructMember> uniformPair;
|
||||
|
||||
internal ShaderStruct() { }
|
||||
|
||||
public ShaderStruct(
|
||||
params (GlHandle, ShaderStructMember)[] uniformPairs
|
||||
)
|
||||
{
|
||||
uniformPair = new Dictionary<GlHandle, ShaderStructMember>();
|
||||
if (uniformPairs.Length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ((GlHandle, ShaderStructMember) item in uniformPairs) {
|
||||
uniformPair.Add(item.Item1, item.Item2);
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void SetAllUniforms()
|
||||
{
|
||||
OpenglContext* gl = (OpenglContext*)OpenGL.OpenGLFunction.CurrentGL.ContextHandle;
|
||||
foreach (KeyValuePair<GlHandle, ShaderStructMember> uniform in uniformPair)
|
||||
{
|
||||
int id = uniform.Key.SignedValue;
|
||||
ShaderStructMember s = uniform.Value;
|
||||
switch (s.type)
|
||||
{
|
||||
case InternalShaderType.Struct:
|
||||
throw new ArgumentException(
|
||||
"Incorrect type \"Struct\" defined in this self define type");
|
||||
case InternalShaderType.Void:
|
||||
throw new ArgumentException(
|
||||
"Incorrect type \"Void\" defined in this self define type");
|
||||
case InternalShaderType.Float:
|
||||
gl->glUniform1f(id, (float)s.value);
|
||||
break;
|
||||
case InternalShaderType.Int:
|
||||
gl->glUniform1f(id, (int)s.value);
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
throw new ArgumentException(
|
||||
"Incorrect type \"Unknown\" defined in this self define type");
|
||||
}
|
||||
}
|
||||
}//------------------------------------ End of Class ---------------------------------------
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="TexturePipeline"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Nitload.Common.PipeLine;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nitload.Graphics
|
||||
{
|
||||
public class TexturePipeline : IPipeLineConnectionPayload
|
||||
{
|
||||
|
||||
private Image _value;
|
||||
|
||||
public TexturePipeline(
|
||||
Image i
|
||||
)
|
||||
{
|
||||
_value = i;
|
||||
}
|
||||
|
||||
public object? ValueDefault => null;
|
||||
|
||||
public object Value
|
||||
{
|
||||
get => _value;
|
||||
set
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(value);
|
||||
if (value is not Image image) {
|
||||
throw new ArgumentException("Value must be of type Image");
|
||||
}
|
||||
_value = image;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="vkEnum"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Nitload.Graphics.Vulkan
|
||||
{
|
||||
internal enum VkStructureType : uint
|
||||
{
|
||||
|
||||
VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000,
|
||||
VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000,
|
||||
VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000,
|
||||
VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
|
||||
VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
|
||||
VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000,
|
||||
VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
|
||||
}
|
||||
|
||||
internal enum VkResult
|
||||
{
|
||||
|
||||
VK_SUCCESS = 0,
|
||||
VK_NOT_READY = 1,
|
||||
VK_TIMEOUT = 2,
|
||||
VK_EVENT_SET = 3,
|
||||
VK_EVENT_RESET = 4,
|
||||
VK_INCOMPLETE = 5,
|
||||
VK_ERROR_OUT_OF_HOST_MEMORY = -1,
|
||||
VK_ERROR_OUT_OF_DEVICE_MEMORY = -2,
|
||||
VK_ERROR_INITIALIZATION_FAILED = -3,
|
||||
VK_ERROR_DEVICE_LOST = -4,
|
||||
VK_ERROR_MEMORY_MAP_FAILED = -5,
|
||||
VK_ERROR_LAYER_NOT_PRESENT = -6,
|
||||
VK_ERROR_EXTENSION_NOT_PRESENT = -7,
|
||||
VK_ERROR_FEATURE_NOT_PRESENT = -8,
|
||||
VK_ERROR_INCOMPATIBLE_DRIVER = -9,
|
||||
VK_ERROR_TOO_MANY_OBJECTS = -10,
|
||||
VK_ERROR_FORMAT_NOT_SUPPORTED = -11,
|
||||
VK_ERROR_SURFACE_LOST_KHR = -1000000000,
|
||||
VK_SUBOPTIMAL_KHR = 1000001003,
|
||||
VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
|
||||
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
|
||||
VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001,
|
||||
VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
|
||||
VK_RESULT_MAX_ENUM = 0x7FFFFFFF
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="vkHandle"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nitload.Graphics.Vulkan
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Size = 8)]
|
||||
public struct vkHandle
|
||||
{
|
||||
|
||||
[FieldOffset(0)] public int SignedHalfValue;
|
||||
[FieldOffset(0)] public IntPtr Handle;
|
||||
[FieldOffset(0)] public IntPtr UnsignedHandle;
|
||||
[FieldOffset(0)] public uint HalfValue;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="framework"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if Windows
|
||||
// using Windows.Win32;
|
||||
#endif
|
||||
|
||||
namespace Nitload.Graphics
|
||||
{
|
||||
/// <summary>
|
||||
/// Function handler to load an opengl function by searching its _label.
|
||||
/// </summary>
|
||||
/// <param _label="name">
|
||||
/// the _label of the Opengl function
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// An Intptr value representing the pointer to the function
|
||||
/// </returns>
|
||||
public delegate IntPtr glLoader(
|
||||
string name
|
||||
);
|
||||
|
||||
#region StgSharpDele
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public unsafe delegate void FrameBufferSizeHandler(
|
||||
IntPtr window,
|
||||
int width,
|
||||
int height
|
||||
);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public unsafe delegate void FramePositionHandler(
|
||||
IntPtr window,
|
||||
float width,
|
||||
float height
|
||||
);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region glDEBUG
|
||||
|
||||
internal unsafe delegate void GLDEBUGPROC(
|
||||
int source,
|
||||
int type,
|
||||
uint id,
|
||||
int severity,
|
||||
int length,
|
||||
sbyte* message,
|
||||
void* userParam
|
||||
);
|
||||
internal unsafe delegate void GLDEBUGPROCARB(
|
||||
int source,
|
||||
int type,
|
||||
uint id,
|
||||
int severity,
|
||||
int length,
|
||||
sbyte* message,
|
||||
void* userParam
|
||||
);
|
||||
internal unsafe delegate void GLDEBUGPROCKHR(
|
||||
int source,
|
||||
int type,
|
||||
uint id,
|
||||
int severity,
|
||||
int length,
|
||||
sbyte* message,
|
||||
void* userParam
|
||||
);
|
||||
internal unsafe delegate void GLDEBUGPROCAMD(
|
||||
uint id,
|
||||
int category,
|
||||
int severity,
|
||||
int length,
|
||||
sbyte* message,
|
||||
void* userParam
|
||||
);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="gl"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Nitload.Graphics;
|
||||
using Nitload.Graphics.OpenGL;
|
||||
using Nitload.Common.Internal;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Nitload.Graphics
|
||||
{
|
||||
internal static partial class GraphicFramework
|
||||
{
|
||||
|
||||
internal static uint[] GLtype = new uint[16];
|
||||
|
||||
static GraphicFramework()
|
||||
{
|
||||
GLtype[(int)TypeCode.Single] = glConst.FLOAT;
|
||||
GLtype[(int)TypeCode.Int32] = glConst.INT;
|
||||
GLtype[(int)TypeCode.UInt32] = glConst.UNSIGNED_INT;
|
||||
GLtype[(int)TypeCode.Int16] = glConst.SHORT;
|
||||
GLtype[(int)TypeCode.UInt16] = glConst.UNSIGNED_SHORT;
|
||||
GLtype[(int)TypeCode.SByte] = glConst.BYTE;
|
||||
GLtype[(int)TypeCode.Byte] = glConst.UNSIGNED_BYTE;
|
||||
}
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "glCheckShaderStat")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
#pragma warning disable CA5392
|
||||
internal static partial int glCheckShaderStatus(
|
||||
ref OpenglContext context,
|
||||
uint shaderHandle,
|
||||
int key,
|
||||
ref IntPtr logPtr
|
||||
);
|
||||
#pragma warning restore CA5392
|
||||
|
||||
|
||||
#region ssgc api define
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "initGL")]
|
||||
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
|
||||
internal static partial void InternalInitGL(
|
||||
int majorVersion,
|
||||
int minorVersion
|
||||
);
|
||||
|
||||
[LibraryImport(
|
||||
Native.LibName,
|
||||
EntryPoint = "loadGlfuncDefault",
|
||||
StringMarshalling = StringMarshalling.Utf8)]
|
||||
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
|
||||
internal static partial IntPtr InternalLoadGlFuncDefault(
|
||||
string name
|
||||
);
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "linkShaderProgram")]
|
||||
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
|
||||
internal static unsafe partial uint InternalLinkShaderProgram(
|
||||
OpenglContext* context,
|
||||
uint shaderProgram
|
||||
);
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "readLog")]
|
||||
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
|
||||
internal static unsafe partial IntPtr InternalReadSSCLog();
|
||||
|
||||
[LibraryImport(
|
||||
Native.LibName,
|
||||
EntryPoint = "loadImageData",
|
||||
StringMarshalling = StringMarshalling.Utf8)]
|
||||
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
|
||||
internal static unsafe partial void InternalLoadImage(
|
||||
string fileName,
|
||||
ImageInfo* output,
|
||||
ImageLoader loader
|
||||
);
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "unloadImageData")]
|
||||
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
|
||||
internal static unsafe partial void InternalUnloadImage(
|
||||
ImageInfo* output
|
||||
);
|
||||
|
||||
#endregion ssgc api define
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="glfw.dtruct"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Nitload.Graphics;
|
||||
using Nitload.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/**/
|
||||
|
||||
namespace Nitload.Common.Internal
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct glfwContext { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct glfwVideomode { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct glfwGammaramp { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWimage { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWgamepadstate { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWallocator { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct glfwMonitor { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal unsafe struct glfwWindow { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct GLFWwindowCallback { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct GLFWcursor { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWinitconfig { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWwndconfig { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWctxconfig { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWfbconfig { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal unsafe struct GLFWlibrary { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWmapelement { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWmapping { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWjoystick { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWls { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWplatform { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWmutex { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal unsafe struct VkExtensionProperties { }
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
||||
public struct uintptr_t { }
|
||||
}
|
||||
|
||||
/**/
|
||||
Reference in New Issue
Block a user