daily update on 20241002 by nitload youmu, intrinsic function rebuild, syntax style arrange
This commit is contained in:
@@ -52,31 +52,31 @@ namespace StgSharp.Graphics
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public GlHandle this[int index] => _bufferHandle[index];
|
||||
public GlHandle this[ int index ] => _bufferHandle[ index ];
|
||||
|
||||
/// <summary>
|
||||
/// Bind a buffer instance to OpenGL
|
||||
/// </summary>
|
||||
/// <param name="index">Index of handle of the object in this instance to be bind</param>
|
||||
public abstract void Bind(int index);
|
||||
/// <param name="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);
|
||||
Dispose( disposing: true );
|
||||
GC.SuppressFinalize( this );
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return $"This is a {GetType().FullName}, containing {_bufferHandle.Length} buffer handles: {_bufferHandle.ToString()}.";
|
||||
}
|
||||
|
||||
protected abstract void Dispose(bool disposing);
|
||||
protected abstract void Dispose( bool disposing );
|
||||
|
||||
~BufferObjectBase()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
Dispose( disposing: false );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
#region GLFW3 struct
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWcontext
|
||||
{
|
||||
|
||||
@@ -116,12 +116,12 @@ namespace StgSharp.Graphics
|
||||
//GLFW_PLATFORM_CONTEXT_STATE
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct glfwVideomode
|
||||
{
|
||||
|
||||
/*! The refresh rate, in Hz, of the video mode.
|
||||
*/
|
||||
|
||||
private int refreshRate;
|
||||
/*! The bit depth of the blue channel of the video mode.
|
||||
*/
|
||||
@@ -142,12 +142,12 @@ namespace StgSharp.Graphics
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct glfwGammaramp
|
||||
{
|
||||
|
||||
/*! An array of value describing the response of the blue channel.
|
||||
*/
|
||||
|
||||
private ushort* blue;
|
||||
/*! An array of value describing the response of the green channel.
|
||||
*/
|
||||
@@ -162,12 +162,12 @@ namespace StgSharp.Graphics
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWimage
|
||||
{
|
||||
|
||||
/*! The pixel _data of this image, arranged left-to-right, top-to-bottom.
|
||||
*/
|
||||
|
||||
private byte* pixels;
|
||||
|
||||
/*! The height, in pixels, of this image.
|
||||
@@ -177,26 +177,25 @@ namespace StgSharp.Graphics
|
||||
*/
|
||||
private int width;
|
||||
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWgamepadstate
|
||||
{
|
||||
|
||||
/*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
|
||||
* or `GLFW_RELEASE`.
|
||||
*/
|
||||
public fixed byte buttons[15];
|
||||
|
||||
public fixed byte buttons[ 15 ];
|
||||
|
||||
/*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0
|
||||
* to 1.0 inclusive.
|
||||
*/
|
||||
public fixed float axes[6];
|
||||
public fixed float axes[ 6 ];
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWallocator
|
||||
{
|
||||
|
||||
@@ -213,7 +212,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct glfwMonitor
|
||||
{
|
||||
|
||||
@@ -221,7 +220,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
private glfwWindow* window;
|
||||
|
||||
private fixed byte name[128];
|
||||
private fixed byte name[ 128 ];
|
||||
private glfwGammaramp currentRamp;
|
||||
|
||||
private glfwGammaramp originalRamp;
|
||||
@@ -231,57 +230,55 @@ namespace StgSharp.Graphics
|
||||
private int width, height;
|
||||
private IntPtr userPointer;
|
||||
|
||||
public glfwMonitor()
|
||||
{ }
|
||||
public glfwMonitor() { }
|
||||
|
||||
public unsafe string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
fixed (byte* cptr = name)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi((IntPtr)cptr);
|
||||
fixed( byte* cptr = name ) {
|
||||
return Marshal.PtrToStringAnsi( ( IntPtr )cptr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
unsafe struct glfwWindow
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
internal unsafe struct glfwWindow
|
||||
{
|
||||
|
||||
glfwWindow* next;
|
||||
void* userPointer;
|
||||
bool rawMouseMotion;
|
||||
Callbacks callbacks;
|
||||
private glfwWindow* next;
|
||||
private void* userPointer;
|
||||
private bool rawMouseMotion;
|
||||
private Callbacks callbacks;
|
||||
|
||||
// Virtual cursor position when cursor is disabled
|
||||
double virtualCursorPosX, virtualCursorPosY;
|
||||
int autoIconify;
|
||||
int cursorMode;
|
||||
int decorated;
|
||||
int doublebuffer;
|
||||
int floating;
|
||||
int focusOnShow;
|
||||
int lockKeyMods;
|
||||
int maxwidth, maxheight;
|
||||
private double virtualCursorPosX, virtualCursorPosY;
|
||||
private int autoIconify;
|
||||
private int cursorMode;
|
||||
private int decorated;
|
||||
private int doublebuffer;
|
||||
private int floating;
|
||||
private int focusOnShow;
|
||||
private int lockKeyMods;
|
||||
private int maxwidth, maxheight;
|
||||
|
||||
int minwidth, minheight;
|
||||
int mousePassthrough;
|
||||
int numer, denom;
|
||||
private int minwidth, minheight;
|
||||
private int mousePassthrough;
|
||||
private int numer, denom;
|
||||
|
||||
// Window settings and state
|
||||
int resizable;
|
||||
int shouldClose;
|
||||
private int resizable;
|
||||
private int shouldClose;
|
||||
|
||||
int stickyKeys;
|
||||
int stickyMouseButtons;
|
||||
IntPtr cursor; // _GLFWcursor* cursor;
|
||||
private int stickyKeys;
|
||||
private int stickyMouseButtons;
|
||||
private IntPtr cursor; // _GLFWcursor* cursor;
|
||||
// glfwVideomode videoMode; // 根据GLFWvidmode的定义转换
|
||||
IntPtr monitor; // _GLFWmonitor* monitor;
|
||||
public fixed byte keys[GLconst.GLFW_KEY_LAST + 1];
|
||||
public fixed byte mouseButtons[GLconst.GLFW_MOUSE_BUTTON_LAST + 1];
|
||||
private IntPtr monitor; // _GLFWmonitor* monitor;
|
||||
public fixed byte keys[ GLconst.GLFW_KEY_LAST + 1 ];
|
||||
public fixed byte mouseButtons[ GLconst.GLFW_MOUSE_BUTTON_LAST + 1 ];
|
||||
|
||||
// _GLFWcontext viewPortDisplay; // 根据_GLFWcontext的定义转换
|
||||
|
||||
@@ -312,14 +309,10 @@ namespace StgSharp.Graphics
|
||||
// GLFW_PLATFORM_WINDOW_STATE platformWindowState;
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public struct GLFWwindowCallback { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct GLFWwindowCallback
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public struct GLFWcursor
|
||||
{
|
||||
|
||||
@@ -347,7 +340,7 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
*/
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWinitconfig
|
||||
{
|
||||
|
||||
@@ -361,7 +354,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWwndconfig
|
||||
{
|
||||
|
||||
@@ -392,31 +385,25 @@ namespace StgSharp.Graphics
|
||||
|
||||
internal X11 x11 = new X11();
|
||||
|
||||
public GLFWwndconfig()
|
||||
{
|
||||
}
|
||||
public GLFWwndconfig() { }
|
||||
|
||||
internal struct Ns
|
||||
{
|
||||
|
||||
private GLFWbool retina = false;
|
||||
public fixed byte frameName[256];
|
||||
public fixed byte frameName[ 256 ];
|
||||
|
||||
public Ns()
|
||||
{
|
||||
}
|
||||
public Ns() { }
|
||||
|
||||
}
|
||||
|
||||
internal struct X11
|
||||
{
|
||||
|
||||
public fixed byte className[256];
|
||||
public fixed byte instanceName[256];
|
||||
public fixed byte className[ 256 ];
|
||||
public fixed byte instanceName[ 256 ];
|
||||
|
||||
public X11()
|
||||
{
|
||||
}
|
||||
public X11() { }
|
||||
|
||||
}
|
||||
|
||||
@@ -430,17 +417,15 @@ namespace StgSharp.Graphics
|
||||
internal struct Wl
|
||||
{
|
||||
|
||||
public fixed byte appId[256];
|
||||
public fixed byte appId[ 256 ];
|
||||
|
||||
public Wl()
|
||||
{
|
||||
}
|
||||
public Wl() { }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWctxconfig
|
||||
{
|
||||
|
||||
@@ -461,9 +446,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
internal Nsgl nsgl = new Nsgl();
|
||||
|
||||
public GLFWctxconfig()
|
||||
{
|
||||
}
|
||||
public GLFWctxconfig() { }
|
||||
|
||||
internal struct Nsgl
|
||||
{
|
||||
@@ -474,7 +457,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWfbconfig
|
||||
{
|
||||
|
||||
@@ -500,11 +483,13 @@ namespace StgSharp.Graphics
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
internal unsafe struct GLFWlibrary
|
||||
{
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = GLconst.GLFW_JOYSTICK_LAST + 1)]
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = GLconst.GLFW_JOYSTICK_LAST + 1 )]
|
||||
private GLFWjoystick[] joysticks = new GLFWjoystick[GLconst.GLFW_JOYSTICK_LAST + 1];
|
||||
|
||||
private GLFWallocator allocator;
|
||||
@@ -546,9 +531,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
internal Osmesa osmesa = new Osmesa();
|
||||
|
||||
public GLFWlibrary()
|
||||
{
|
||||
}
|
||||
public GLFWlibrary() { }
|
||||
|
||||
internal unsafe struct Hints
|
||||
{
|
||||
@@ -566,6 +549,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
private ulong offset;
|
||||
|
||||
// This is defined in platform.h
|
||||
|
||||
//not transformed function defination
|
||||
@@ -652,11 +636,9 @@ namespace StgSharp.Graphics
|
||||
private GLFWbool KHR_xlib_surface;
|
||||
private GLFWbool MVK_macos_surface;
|
||||
private IntPtr GetInstanceProcAddr;
|
||||
private fixed ulong extensions[2];
|
||||
private fixed ulong extensions[ 2 ];
|
||||
|
||||
public vk()
|
||||
{
|
||||
}
|
||||
public vk() { }
|
||||
|
||||
}
|
||||
|
||||
@@ -671,7 +653,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWmapelement
|
||||
{
|
||||
|
||||
@@ -684,25 +666,24 @@ namespace StgSharp.Graphics
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWmapping
|
||||
{
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 6 )]
|
||||
private GLFWmapelement[] axes = new GLFWmapelement[6];
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)]
|
||||
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 15 )]
|
||||
private GLFWmapelement[] buttons = new GLFWmapelement[15];
|
||||
private fixed byte guid[33];
|
||||
private fixed byte guid[ 33 ];
|
||||
|
||||
private fixed byte name[128];
|
||||
private fixed byte name[ 128 ];
|
||||
|
||||
public GLFWmapping()
|
||||
{ }
|
||||
public GLFWmapping() { }
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWjoystick
|
||||
{
|
||||
|
||||
@@ -710,8 +691,8 @@ namespace StgSharp.Graphics
|
||||
private byte* buttons;
|
||||
private byte* hats;
|
||||
private void* userPointer;
|
||||
private fixed byte guid[33];
|
||||
private fixed byte name[128];
|
||||
private fixed byte guid[ 33 ];
|
||||
private fixed byte name[ 128 ];
|
||||
|
||||
private GLFWbool allocated;
|
||||
private GLFWbool connected;
|
||||
@@ -726,20 +707,20 @@ namespace StgSharp.Graphics
|
||||
// not completed in transforming
|
||||
// GLFW_PLATFORM_JOYSTICK_STATE;
|
||||
|
||||
public GLFWjoystick()
|
||||
{ }
|
||||
public GLFWjoystick() { }
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWls
|
||||
{
|
||||
|
||||
// This is defined in platform.h
|
||||
|
||||
//GLFW_PLATFORM_TLS_STATE
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWplatform
|
||||
{
|
||||
|
||||
@@ -812,6 +793,7 @@ namespace StgSharp.Graphics
|
||||
internal IntPtr setCursorMode;
|
||||
|
||||
#region input
|
||||
|
||||
/* void (* getCursorPos) (glfwWindow*, double*, double*);
|
||||
void (* setCursorPos) (glfwWindow*, double, double);
|
||||
void (* setCursorMode) (glfwWindow*, int);
|
||||
@@ -878,6 +860,7 @@ namespace StgSharp.Graphics
|
||||
void (* waitEventsTimeout) (double);
|
||||
void (* postEmptyEvent) (void);
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
internal IntPtr setCursorPos;
|
||||
@@ -910,25 +893,24 @@ namespace StgSharp.Graphics
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWmutex
|
||||
{
|
||||
|
||||
// This is defined in platform.h
|
||||
//GLFW_PLATFORM_MUTEX_STATE
|
||||
}
|
||||
|
||||
//public unsafe struct VkAllocationCallbacks { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
internal unsafe struct VkExtensionProperties
|
||||
{
|
||||
|
||||
private fixed byte extensionName[256];
|
||||
private fixed byte extensionName[ 256 ];
|
||||
private uint specVersion;
|
||||
|
||||
public VkExtensionProperties()
|
||||
{
|
||||
}
|
||||
public VkExtensionProperties() { }
|
||||
|
||||
}
|
||||
|
||||
@@ -947,14 +929,14 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
*/
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
||||
[StructLayout( LayoutKind.Explicit, Size = 16 )]
|
||||
public struct uintptr_t
|
||||
{
|
||||
|
||||
[FieldOffset(0)]
|
||||
[FieldOffset( 0 )]
|
||||
private long part1;
|
||||
|
||||
[FieldOffset(8)]
|
||||
[FieldOffset( 8 )]
|
||||
private long part2;
|
||||
|
||||
}
|
||||
@@ -963,7 +945,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
#region glad struct
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
internal struct GLsync
|
||||
{
|
||||
|
||||
|
||||
@@ -39,27 +39,59 @@ namespace StgSharp.Graphics
|
||||
/// <summary>
|
||||
/// Function handler to load an opengl function by searching its name.
|
||||
/// </summary>
|
||||
/// <param name="name">the name of the Opengl function</param>
|
||||
/// <returns>An Intptr value representing the pointer to the function</returns>
|
||||
public delegate IntPtr glLoader(string name);
|
||||
/// <param name="name"> the name of the Opengl function </param>
|
||||
/// <returns> An Intptr value representing the pointer to the function </returns>
|
||||
public delegate IntPtr glLoader( string name );
|
||||
|
||||
#region StgSharpDele
|
||||
|
||||
public unsafe delegate void FrameBufferSizeHandler(IntPtr window, uint width, uint height);
|
||||
public unsafe delegate void FrameBufferSizeHandler(
|
||||
IntPtr window,
|
||||
int width,
|
||||
int height );
|
||||
|
||||
public unsafe delegate void FramePositionHandler(IntPtr window, float width, float height);
|
||||
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
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
@@ -337,7 +337,6 @@ namespace StgSharp.Graphics.OpenGL
|
||||
|
||||
#region glad
|
||||
|
||||
|
||||
public const int _1PASS_EXT = 0x80A1;
|
||||
public const int _1PASS_SGIS = 0x80A1;
|
||||
public const int _2PASS_0_EXT = 0x80A2;
|
||||
@@ -4839,12 +4838,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
public const int ZERO_TO_ONE = 0x935F;
|
||||
public const int Z_EXT = 0x87D7;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public static class glAttachment
|
||||
@@ -4854,18 +4848,14 @@ namespace StgSharp.Graphics.OpenGL
|
||||
public const uint DepthAndStencil = GLconst.DEPTH_STENCIL_ATTACHMENT;
|
||||
public const uint Stencil = GLconst.STENCIL_ATTACHMENT;
|
||||
|
||||
private static int colorRange =
|
||||
OpenGLFunction.CurrentGL.GetMaskInteger((uint)GLconst.MAX_COLOR_ATTACHMENTS);
|
||||
|
||||
public static uint Color(int i)
|
||||
public static uint Color( int i )
|
||||
{
|
||||
#if DEBUG
|
||||
if ((i > colorRange) || (i < 0))
|
||||
{
|
||||
#if DEBUG
|
||||
if( ( i > OpenGLFunction.CurrentGL.AttachmentColorRange ) || ( i < 0 ) ) {
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
#endif
|
||||
return (uint)(GLconst.COLOR_ATTACHMENT0 + i);
|
||||
#endif
|
||||
return ( uint )( GLconst.COLOR_ATTACHMENT0 + i );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace StgSharp.Graphics.OpenGL
|
||||
{
|
||||
public enum PixelChannelLayout
|
||||
{
|
||||
|
||||
UByte = GLconst.UNSIGNED_BYTE,
|
||||
Byte = GLconst.BYTE,
|
||||
UShort = GLconst.UNSIGNED_SHORT,
|
||||
@@ -55,10 +55,12 @@ namespace StgSharp.Graphics.OpenGL
|
||||
UInt8888Rev = GLconst.UNSIGNED_INT_8_8_8_8_REV,
|
||||
UInt1010102 = GLconst.UNSIGNED_INT_10_10_10_2,
|
||||
UInt2101010Rev = GLconst.UNSIGNED_INT_2_10_10_10_REV
|
||||
|
||||
}
|
||||
|
||||
public enum FrameBufferStatus
|
||||
{
|
||||
|
||||
Complete = GLconst.FRAMEBUFFER_COMPLETE, // GL_FRAMEBUFFER_COMPLETE
|
||||
IncompleteAttachment = GLconst.FRAMEBUFFER_INCOMPLETE_ATTACHMENT, // GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
|
||||
IncompleteMissingAttachment = GLconst.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, // GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
|
||||
@@ -67,10 +69,12 @@ namespace StgSharp.Graphics.OpenGL
|
||||
Unsupported = GLconst.FRAMEBUFFER_UNSUPPORTED, // GL_FRAMEBUFFER_UNSUPPORTED
|
||||
IncompleteMultisample = GLconst.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, // GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
|
||||
IncompleteLayerTargets = GLconst.FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS // GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS
|
||||
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -78,10 +82,12 @@ namespace StgSharp.Graphics.OpenGL
|
||||
VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
|
||||
VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000,
|
||||
VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
|
||||
}
|
||||
|
||||
public enum FrameBufferChannel
|
||||
{
|
||||
|
||||
STENCIL_INDEX = GLconst.STENCIL_INDEX,
|
||||
DEPTH_COMPONENT = GLconst.DEPTH_COMPONENT,
|
||||
DEPTH_STENCIL = GLconst.DEPTH_STENCIL,
|
||||
@@ -92,17 +98,22 @@ namespace StgSharp.Graphics.OpenGL
|
||||
BGR = GLconst.BGR,
|
||||
RGBA = GLconst.RGBA,
|
||||
BGRA = GLconst.BGRA
|
||||
|
||||
}
|
||||
|
||||
public enum FrameBufferAttachment
|
||||
{
|
||||
|
||||
Color = GLconst.COLOR_ATTACHMENT0,
|
||||
Depth = GLconst.DEPTH_ATTACHMENT,
|
||||
Stencil = GLconst.STENCIL_ATTACHMENT,
|
||||
DepthAndStencil = GLconst.DEPTH_STENCIL_ATTACHMENT,
|
||||
|
||||
}
|
||||
|
||||
public enum Texture2DTarget
|
||||
{
|
||||
|
||||
Texture2D = GLconst.TEXTURE_2D,
|
||||
ProxyTexture2D = GLconst.PROXY_TEXTURE_2D,
|
||||
Texture1DArray = GLconst.TEXTURE_1D_ARRAY,
|
||||
@@ -116,21 +127,27 @@ namespace StgSharp.Graphics.OpenGL
|
||||
TextureCubeMapPositiveZ = GLconst.TEXTURE_CUBE_MAP_POSITIVE_Z,
|
||||
TextureCubeMapNegativeZ = GLconst.TEXTURE_CUBE_MAP_NEGATIVE_Z,
|
||||
ProxyTextureCubeMap = GLconst.PROXY_TEXTURE_CUBE_MAP
|
||||
|
||||
}
|
||||
|
||||
public enum RenderBufferInternalFormat : uint
|
||||
{
|
||||
|
||||
RGBA8 = GLconst.RGBA8,
|
||||
Depth24_Stencil8 = GLconst.DEPTH24_STENCIL8,
|
||||
|
||||
}
|
||||
|
||||
public enum GLOperation : uint
|
||||
{
|
||||
|
||||
StencilTest = GLconst.STENCIL_TEST,
|
||||
|
||||
}
|
||||
|
||||
internal enum VkResult
|
||||
{
|
||||
|
||||
VK_SUCCESS = 0,
|
||||
VK_NOT_READY = 1,
|
||||
VK_TIMEOUT = 2,
|
||||
@@ -155,22 +172,26 @@ namespace StgSharp.Graphics.OpenGL
|
||||
VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001,
|
||||
VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
|
||||
VK_RESULT_MAX_ENUM = 0x7FFFFFFF
|
||||
|
||||
}
|
||||
|
||||
#pragma warning disable CA1008
|
||||
#pragma warning disable CA1008
|
||||
public enum ShaderType : int
|
||||
#pragma warning restore CA1008
|
||||
#pragma warning restore CA1008
|
||||
{
|
||||
|
||||
Fragment = GLconst.FRAGMENT_SHADER,
|
||||
Vertex = GLconst.VERTEX_SHADER,
|
||||
Compute = GLconst.COMPUTE_SHADER,
|
||||
Geometry = GLconst.GEOMETRY_SHADER,
|
||||
|
||||
}
|
||||
|
||||
#pragma warning disable CA1008 // 枚举应具有零值
|
||||
#pragma warning disable CA1008 // 枚举应具有零值
|
||||
public enum BufferType : int
|
||||
#pragma warning restore CA1008 // 枚举应具有零值
|
||||
#pragma warning restore CA1008 // 枚举应具有零值
|
||||
{
|
||||
|
||||
ArrayBuffer = GLconst.ARRAY_BUFFER,
|
||||
ElementArrayBuffer = GLconst.ELEMENT_ARRAY_BUFFER,
|
||||
AtomicCounterBuffer = GLconst.ATOMIC_COUNTER_BUFFER,
|
||||
@@ -185,12 +206,14 @@ namespace StgSharp.Graphics.OpenGL
|
||||
TEXTURE_BUFFER = GLconst.TEXTURE_BUFFER,
|
||||
TRANSFORM_FEEDBACK_BUFFER = GLconst.TRANSFORM_FEEDBACK_BUFFER,
|
||||
UNIFORM_BUFFER = GLconst.UNIFORM_BUFFER,
|
||||
|
||||
}
|
||||
|
||||
#pragma warning disable CA1008 // 枚举应具有零值
|
||||
#pragma warning disable CA1008 // 枚举应具有零值
|
||||
public enum BufferUsage : int
|
||||
#pragma warning restore CA1008 // 枚举应具有零值
|
||||
#pragma warning restore CA1008 // 枚举应具有零值
|
||||
{
|
||||
|
||||
StreamDraw = 0x88E0,
|
||||
StreamRead = 0x88E1,
|
||||
StreamCopy = 0x88E2,
|
||||
@@ -200,18 +223,21 @@ namespace StgSharp.Graphics.OpenGL
|
||||
DynamicDraw = 0x88E8,
|
||||
DynamicRead = 0x88E9,
|
||||
DynamicCopy = 0x88EA
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum MaskBufferBit
|
||||
{
|
||||
|
||||
COLOR = GLconst.COLOR_BUFFER_BIT,
|
||||
DEPTH = GLconst.DEPTH_BUFFER_BIT,
|
||||
STENCIL = GLconst.STENCIL_BUFFER_BIT,
|
||||
|
||||
}
|
||||
|
||||
public enum GeometryType : uint
|
||||
{
|
||||
|
||||
POINTS = 0x0000,
|
||||
LINES = 0x0001,
|
||||
LINE_LOOP = 0x0002,
|
||||
@@ -219,11 +245,14 @@ namespace StgSharp.Graphics.OpenGL
|
||||
TRIANGLES = 0x0004,
|
||||
TRIANGLE_STRIP = 0x0005,
|
||||
TRIANGLE_FAN = 0x0006
|
||||
|
||||
}
|
||||
|
||||
public enum TextureFiltering
|
||||
{
|
||||
|
||||
Nearest = 0x2600,
|
||||
Linear = 0x2601
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,81 +36,114 @@ using System.Collections.ObjectModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
public delegate IntPtr GLfuncLoader(string name);
|
||||
public delegate IntPtr GLfuncLoader( string name );
|
||||
|
||||
internal delegate void GLVULKANPROCNV();
|
||||
|
||||
public unsafe struct GLhandleARB
|
||||
{
|
||||
|
||||
dynamic value;
|
||||
private dynamic value;
|
||||
|
||||
public unsafe GLhandleARB(dynamic value)
|
||||
public unsafe GLhandleARB( dynamic value )
|
||||
{
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
if (value.GetType().Name != "Uint32")
|
||||
{
|
||||
if( !RuntimeInformation.IsOSPlatform( OSPlatform.OSX ) ) {
|
||||
if( value.GetType().Name != "Uint32" ) {
|
||||
goto errorlog;
|
||||
}
|
||||
this.value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value.GetType().Name != "IntPtr")
|
||||
{
|
||||
} else {
|
||||
if( value.GetType().Name != "IntPtr" ) {
|
||||
goto errorlog;
|
||||
}
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
errorlog:
|
||||
errorlog:
|
||||
{
|
||||
InternalIO.InternalWriteLog(
|
||||
$"{value.GetType().Name} does not match definination of GLhandlARB on OS {Environment.OSVersion.Platform} ",
|
||||
LogType.Error);
|
||||
LogType.Error );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static implicit operator uint(GLhandleARB value)
|
||||
public static implicit operator uint( GLhandleARB value )
|
||||
{
|
||||
return (uint)value;
|
||||
return ( uint )value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#region GLFW_dele
|
||||
|
||||
internal unsafe delegate void GLFWwindowsizefun(glfwWindow* window, int width, int height);
|
||||
internal unsafe delegate void GLFWwindowrefreshfun(glfwWindow* window);
|
||||
internal unsafe delegate void GLFWwindowposfun(glfwWindow* window, int xpos, int ypos);
|
||||
internal unsafe delegate void GLFWwindowmaximizefun(glfwWindow* window, int maximized);
|
||||
internal unsafe delegate void GLFWwindowiconifyfun(glfwWindow* window, int iconified);
|
||||
internal unsafe delegate void GLFWwindowfocusfun(glfwWindow* window, int focused);
|
||||
internal unsafe delegate void GLFWwindowcontentscalefun(glfwWindow* window, float xscale, float yscale);
|
||||
internal unsafe delegate void GLFWwindowclosefun(glfwWindow* window);
|
||||
internal unsafe delegate void GLFWwindowsizefun(
|
||||
glfwWindow* window,
|
||||
int width,
|
||||
int height );
|
||||
internal unsafe delegate void GLFWwindowrefreshfun( glfwWindow* window );
|
||||
internal unsafe delegate void GLFWwindowposfun(
|
||||
glfwWindow* window,
|
||||
int xpos,
|
||||
int ypos );
|
||||
internal unsafe delegate void GLFWwindowmaximizefun(
|
||||
glfwWindow* window,
|
||||
int maximized );
|
||||
internal unsafe delegate void GLFWwindowiconifyfun(
|
||||
glfwWindow* window,
|
||||
int iconified );
|
||||
internal unsafe delegate void GLFWwindowfocusfun(
|
||||
glfwWindow* window,
|
||||
int focused );
|
||||
internal unsafe delegate void GLFWwindowcontentscalefun(
|
||||
glfwWindow* window,
|
||||
float xscale,
|
||||
float yscale );
|
||||
internal unsafe delegate void GLFWwindowclosefun( glfwWindow* window );
|
||||
internal unsafe delegate void GLFWvkproc();
|
||||
internal unsafe delegate void GLFWscrollfun(glfwWindow* window, double xoffset, double yoffset);
|
||||
internal unsafe delegate void GLFWmousebuttonfun(glfwWindow* window, int button, int action, int mods);
|
||||
internal unsafe delegate void GLFWmonitorfun(glfwMonitor* monitor, int monitorevent);
|
||||
internal unsafe delegate void GLFWkeyfun(glfwWindow* window, int key, int scancode, int action, int mods);
|
||||
internal unsafe delegate void GLFWjoystickfun(int jid, int keyevent);
|
||||
internal unsafe delegate void GLFWscrollfun(
|
||||
glfwWindow* window,
|
||||
double xoffset,
|
||||
double yoffset );
|
||||
internal unsafe delegate void GLFWmousebuttonfun(
|
||||
glfwWindow* window,
|
||||
int button,
|
||||
int action,
|
||||
int mods );
|
||||
internal unsafe delegate void GLFWmonitorfun(
|
||||
glfwMonitor* monitor,
|
||||
int monitorevent );
|
||||
internal unsafe delegate void GLFWkeyfun(
|
||||
glfwWindow* window,
|
||||
int key,
|
||||
int scancode,
|
||||
int action,
|
||||
int mods );
|
||||
internal unsafe delegate void GLFWjoystickfun( int jid, int keyevent );
|
||||
public unsafe delegate void GLFWglproc();
|
||||
internal unsafe delegate void GLFWerrorfun(int error_code, sbyte* description);
|
||||
internal unsafe delegate void GLFWdropfun(glfwWindow* window, int path_count, sbyte*[] paths);
|
||||
internal unsafe delegate void GLFWcursorposfun(glfwWindow* window, double xpos, double ypos);
|
||||
internal unsafe delegate void GLFWcursorenterfun(glfwWindow* window, int entered);
|
||||
internal unsafe delegate void GLFWcharmodsfun(glfwWindow* window, uint codepoint, int mods);
|
||||
internal unsafe delegate void GLFWcharfun(glfwWindow* window, uint codepoint);
|
||||
|
||||
#endregion
|
||||
internal unsafe delegate void GLFWerrorfun(
|
||||
int error_code,
|
||||
sbyte* description );
|
||||
internal unsafe delegate void GLFWdropfun(
|
||||
glfwWindow* window,
|
||||
int path_count,
|
||||
sbyte*[] paths );
|
||||
internal unsafe delegate void GLFWcursorposfun(
|
||||
glfwWindow* window,
|
||||
double xpos,
|
||||
double ypos );
|
||||
internal unsafe delegate void GLFWcursorenterfun(
|
||||
glfwWindow* window,
|
||||
int entered );
|
||||
internal unsafe delegate void GLFWcharmodsfun(
|
||||
glfwWindow* window,
|
||||
uint codepoint,
|
||||
int mods );
|
||||
internal unsafe delegate void GLFWcharfun(
|
||||
glfwWindow* window,
|
||||
uint codepoint );
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user