daily update on 20240305 by nitload youmu

This commit is contained in:
YoumuLiu
2024-03-05 10:17:02 +08:00
parent 1f2fca4c8f
commit 6a0cccae79
156 changed files with 23040 additions and 1385 deletions
@@ -1,36 +1,37 @@
using System;
using System.Runtime.InteropServices;
/**/
namespace StgSharp.Graphics
{
//rename types in style of GLFW
using GLFWbool = Boolean;
//strucs defined in GLFW3.h
#region GLFW3 struct
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWcontext
{
int client;
int source;
int major, minor, revision;
GLFWbool forward, debug, noerror;
int profile;
int robustness;
int release;
private int client;
private int source;
private int major, minor, revision;
private GLFWbool forward, debug, noerror;
private int profile;
private int robustness;
private int release;
//PFNGLGETSTRINGIPROC GetStringi;
IntPtr GetStringi;
private IntPtr GetStringi;
//PFNGLGETINTEGERVPROC GetIntegerv;
IntPtr GetIntegerv;
private IntPtr GetIntegerv;
//PFNGLGETSTRINGPROC GetString;
IntPtr GetString;
private IntPtr GetString;
/*
void (* makeCurrent) (GLFWwindow*);
@@ -41,12 +42,12 @@ namespace StgSharp.Graphics
void (* destroy) (GLFWwindow*);
*/
delegate*<GLFWwindow*> makeCurrent;
delegate*<GLFWwindow*> swapBuffer;
delegate*<int> swapInterval;
delegate*<byte*> extensionSupported;
delegate*<delegate*<void>, void> getProcAddress;
IntPtr destroy;
private delegate*<GLFWwindow*> makeCurrent;
private delegate*<GLFWwindow*> swapBuffer;
private delegate*<int> swapInterval;
private delegate*<byte*> extensionSupported;
private delegate*<delegate*<void>, void> getProcAddress;
private IntPtr destroy;
internal struct egl
{
@@ -55,24 +56,24 @@ namespace StgSharp.Graphics
EGLContext handle;
EGLSurface surface;
*/
void* config;
void* handle;
void* surface;
void* client;
private void* config;
private void* handle;
private void* surface;
private void* client;
}
internal struct osmesa
{
//OSMesaContext handle;
void* handle;
int width;
int height;
void* buffer;
private void* handle;
private int width;
private int height;
private void* buffer;
}
// This is defined in platform.h
//GLFW_PLATFORM_CONTEXT_STATE
}
[StructLayout(LayoutKind.Sequential)]
@@ -95,46 +96,43 @@ namespace StgSharp.Graphics
public int blueBits;
/*! The refresh rate, in Hz, of the video mode.
*/
int refreshRate;
private int refreshRate;
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWgammaramp
{
/*! An array of value describing the response of the red channel.
*/
ushort* red;
private ushort* red;
/*! An array of value describing the response of the green channel.
*/
ushort* green;
private ushort* green;
/*! An array of value describing the response of the blue channel.
*/
ushort* blue;
private ushort* blue;
/*! The number of elements in each array.
*/
uint size;
private uint size;
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWimage
{
/*! The width, in pixels, of this image.
*/
int width;
private int width;
/*! The height, in pixels, of this image.
*/
int height;
private int height;
/*! The pixel data of this image, arranged left-to-right, top-to-bottom.
*/
byte* pixels;
private byte* pixels;
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWgamepadstate
{
/*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
* or `GLFW_RELEASE`.
*/
@@ -149,40 +147,44 @@ namespace StgSharp.Graphics
public unsafe struct GLFWallocator
{
//GLFWallocatefun allocate;
IntPtr allocate;
private IntPtr allocate;
//GLFWreallocatefun reallocate;
IntPtr reallocate;
private IntPtr reallocate;
//GLFWdeallocatefun deallocate;
IntPtr deallocate;
void* user;
private IntPtr deallocate;
private void* user;
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWmonitor
{
byte[] name = new byte[128];
void* userPointer;
private byte[] name = new byte[128];
private void* userPointer;
// Physical dimensions in millimeters.
int widthMM, heightMM;
private int widthMM, heightMM;
// The window whose video mode is current on this monitor
//GLFWwindow* window;
IntPtr window;
private IntPtr window;
//GLFWvidmode* modes;
IntPtr modes;
int modeCount;
GLFWvidmode currentMode;
private IntPtr modes;
GLFWgammaramp originalRamp;
GLFWgammaramp currentRamp;
private int modeCount;
private GLFWvidmode currentMode;
private GLFWgammaramp originalRamp;
private GLFWgammaramp currentRamp;
// not transformed
//GLFW_PLATFORM_MONITOR_STATE;
public GLFWmonitor() { }
public GLFWmonitor()
{ }
}
[StructLayout(LayoutKind.Sequential)]
@@ -214,15 +216,16 @@ namespace StgSharp.Graphics
public int cursorMode = 0;
public fixed byte mouseButtons[8];
public fixed byte keys[349];
// Virtual cursor position when cursor is disabled
public double virtualCursorPosX = 0, virtualCursorPosY = 0;
public bool rawMouseMotion = false;
public GLFWcontext context = default;
public GLFWwindow()
{
}
}
@@ -230,7 +233,7 @@ namespace StgSharp.Graphics
public struct GLFWcursor
{
//GLFWcursor* next;
IntPtr next;
private IntPtr next;
// This is defined in platform.h
// not completed in tranformation
@@ -241,7 +244,6 @@ namespace StgSharp.Graphics
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWerror
{
//GLFWerror* next;
IntPtr next;
int code;
@@ -257,61 +259,64 @@ namespace StgSharp.Graphics
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWinitconfig
{
private GLFWbool hatButtons;
private int angleType;
private int platformID;
GLFWbool hatButtons;
int angleType;
int platformID;
//PFN_vkGetInstanceProcAddr vulkanLoader;
IntPtr vulkanLoader;
struct ns
private IntPtr vulkanLoader;
private struct ns
{
GLFWbool menubar;
GLFWbool chdir;
private GLFWbool menubar;
private GLFWbool chdir;
}
struct x11
private struct x11
{
GLFWbool xcbVulkanSurface;
private GLFWbool xcbVulkanSurface;
}
struct wl
private struct wl
{
int libdecorMode;
private int libdecorMode;
}
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWwndconfig
{
private int xpos;
private int ypos;
private int width;
private int height;
private byte* title;
private GLFWbool resizable;
private GLFWbool visible;
private GLFWbool decorated;
private GLFWbool focused;
private GLFWbool autoIconify;
private GLFWbool floating;
private GLFWbool maximized;
private GLFWbool centerCursor;
private GLFWbool focusOnShow;
private GLFWbool mousePassthrough;
private GLFWbool scaleToMonitor;
int xpos;
int ypos;
int width;
int height;
byte* title;
GLFWbool resizable;
GLFWbool visible;
GLFWbool decorated;
GLFWbool focused;
GLFWbool autoIconify;
GLFWbool floating;
GLFWbool maximized;
GLFWbool centerCursor;
GLFWbool focusOnShow;
GLFWbool mousePassthrough;
GLFWbool scaleToMonitor;
internal struct Ns
{
GLFWbool retina = false;
private GLFWbool retina = false;
public fixed byte frameName[256];
public Ns()
{
}
}
internal Ns ns = new Ns();
internal struct X11
{
public fixed byte className[256];
public fixed byte instanceName[256];
@@ -319,12 +324,14 @@ namespace StgSharp.Graphics
{
}
}
internal X11 x11 = new X11();
internal struct Win32
{
GLFWbool keymenu;
private GLFWbool keymenu;
}
internal Win32 win32 = new Win32();
internal struct Wl
@@ -335,6 +342,7 @@ namespace StgSharp.Graphics
{
}
}
internal Wl wl = new Wl();
public GLFWwndconfig()
@@ -345,22 +353,25 @@ namespace StgSharp.Graphics
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWctxconfig
{
int client;
int source;
int major;
int minor;
GLFWbool forward;
GLFWbool debug;
GLFWbool noerror;
int profile;
int robustness;
int release;
private int client;
private int source;
private int major;
private int minor;
private GLFWbool forward;
private GLFWbool debug;
private GLFWbool noerror;
private int profile;
private int robustness;
private int release;
//GLFWwindow* share;
IntPtr share;
private IntPtr share;
internal struct Nsgl
{
GLFWbool offline;
private GLFWbool offline;
}
internal Nsgl nsgl = new Nsgl();
public GLFWctxconfig()
@@ -371,78 +382,81 @@ namespace StgSharp.Graphics
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWfbconfig
{
int redBits;
int greenBits;
int blueBits;
int alphaBits;
int depthBits;
int stencilBits;
int accumRedBits;
int accumGreenBits;
int accumBlueBits;
int accumAlphaBits;
int auxBuffers;
GLFWbool stereo;
int samples;
GLFWbool sRGB;
GLFWbool doublebuffer;
GLFWbool transparent;
uintptr_t handle;
private int redBits;
private int greenBits;
private int blueBits;
private int alphaBits;
private int depthBits;
private int stencilBits;
private int accumRedBits;
private int accumGreenBits;
private int accumBlueBits;
private int accumAlphaBits;
private int auxBuffers;
private GLFWbool stereo;
private int samples;
private GLFWbool sRGB;
private GLFWbool doublebuffer;
private GLFWbool transparent;
private uintptr_t handle;
}
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWlibrary
{
GLFWbool initialized;
GLFWallocator allocator;
private GLFWbool initialized;
private GLFWallocator allocator;
GLFWplatform platform;
private GLFWplatform platform;
internal unsafe struct Hints
{
GLFWinitconfig init;
GLFWfbconfig framebuffer;
GLFWwndconfig window;
GLFWctxconfig context;
int refreshRate;
private GLFWinitconfig init;
private GLFWfbconfig framebuffer;
private GLFWwndconfig window;
private GLFWctxconfig context;
private int refreshRate;
}
internal Hints hints = new Hints();
//GLFWerror* errorListHead;
IntPtr errorListHead;
private IntPtr errorListHead;
//GLFWcursor* cursorListHead;
IntPtr cursorListHead;
private IntPtr cursorListHead;
//GLFWwindow* windowListHead;
IntPtr windowListHead;
private IntPtr windowListHead;
//GLFWmonitor** monitors;
IntPtr monitors;
int monitorCount;
private IntPtr monitors;
private int monitorCount;
private GLFWbool joysticksInitialized;
GLFWbool joysticksInitialized;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = GLconst.GLFW_JOYSTICK_LAST + 1)]
GLFWjoystick[] joysticks = new GLFWjoystick[GLconst.GLFW_JOYSTICK_LAST + 1];
//GLFWmapping* mappings;
IntPtr mappings;
int mappingCount;
private GLFWjoystick[] joysticks = new GLFWjoystick[GLconst.GLFW_JOYSTICK_LAST + 1];
GLFWls errorSlot;
GLFWls contextSlot;
GLFWmutex errorLock;
//GLFWmapping* mappings;
private IntPtr mappings;
private int mappingCount;
private GLFWls errorSlot;
private GLFWls contextSlot;
private GLFWmutex errorLock;
internal unsafe struct timer
{
ulong offset;
private ulong offset;
// This is defined in platform.h
//not transformed function defination
//GLFW_PLATFORM_LIBRARY_TIMER_STATE
}
internal unsafe struct Egl
{
internal int platform;
@@ -488,101 +502,105 @@ namespace StgSharp.Graphics
internal IntPtr GetPlatformDisplayEXT;
internal IntPtr CreatePlatformWindowSurfaceEXT;
}
internal Egl egl = new Egl();
internal unsafe struct Osmesa
{
void* handle;
private void* handle;
IntPtr CreateContextExt;
IntPtr CreateContextAttribs;
IntPtr DestroyContext;
IntPtr MakeCurrent;
IntPtr GetColorBuffer;
IntPtr GetDepthBuffer;
IntPtr GetProcAddress;
private IntPtr CreateContextExt;
private IntPtr CreateContextAttribs;
private IntPtr DestroyContext;
private IntPtr MakeCurrent;
private IntPtr GetColorBuffer;
private IntPtr GetDepthBuffer;
private IntPtr GetProcAddress;
}
internal Osmesa osmesa = new Osmesa();
internal unsafe struct vk
{
GLFWbool available;
void* handle;
fixed ulong extensions[2];
IntPtr GetInstanceProcAddr;
GLFWbool KHR_surface;
GLFWbool KHR_win32_surface;
GLFWbool MVK_macos_surface;
GLFWbool EXT_metal_surface;
GLFWbool KHR_xlib_surface;
GLFWbool KHR_xcb_surface;
GLFWbool KHR_wayland_surface;
private GLFWbool available;
private void* handle;
private fixed ulong extensions[2];
private IntPtr GetInstanceProcAddr;
private GLFWbool KHR_surface;
private GLFWbool KHR_win32_surface;
private GLFWbool MVK_macos_surface;
private GLFWbool EXT_metal_surface;
private GLFWbool KHR_xlib_surface;
private GLFWbool KHR_xcb_surface;
private GLFWbool KHR_wayland_surface;
public vk()
{
}
}
internal unsafe struct Callbacks
{
IntPtr monitor;
IntPtr joystick;
private IntPtr monitor;
private IntPtr joystick;
}
internal Callbacks callbacks = new Callbacks();
public GLFWlibrary()
{
}
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWmapelement
{
byte type;
byte index;
sbyte axisScale;
sbyte axisOffset;
private byte type;
private byte index;
private sbyte axisScale;
private sbyte axisOffset;
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWmapping
{
private fixed byte name[128];
private fixed byte guid[33];
fixed byte name[128];
fixed byte guid[33];
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)]
GLFWmapelement[] buttons = new GLFWmapelement[15];
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
GLFWmapelement[] axes = new GLFWmapelement[6];
private GLFWmapelement[] buttons = new GLFWmapelement[15];
public GLFWmapping() { }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
private GLFWmapelement[] axes = new GLFWmapelement[6];
public GLFWmapping()
{ }
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWjoystick
{
private GLFWbool allocated;
private GLFWbool connected;
private float* axes;
private int axisCount;
private byte* buttons;
private int buttonCount;
private byte* hats;
private int hatCount;
private fixed byte name[128];
private void* userPointer;
private fixed byte guid[33];
GLFWbool allocated;
GLFWbool connected;
float* axes;
int axisCount;
byte* buttons;
int buttonCount;
byte* hats;
int hatCount;
fixed byte name[128];
void* userPointer;
fixed byte guid[33];
//GLFWmapping* mapping;
IntPtr mapping;
private IntPtr mapping;
// This is defined in platform.h
// not completed in transforming
// GLFW_PLATFORM_JOYSTICK_STATE;
public GLFWjoystick() { }
public GLFWjoystick()
{ }
}
[StructLayout(LayoutKind.Sequential)]
@@ -596,13 +614,14 @@ namespace StgSharp.Graphics
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWplatform
{
private int platformID;
int platformID;
// init
//GLFWbool(*init)(void);
IntPtr init;
private IntPtr init;
//void (* terminate) (void);
IntPtr terminate;
private IntPtr terminate;
// input
/* void (* getCursorPos) (GLFWwindow*, double*, double*);
@@ -688,8 +707,10 @@ namespace StgSharp.Graphics
internal IntPtr pollJoystick;
internal IntPtr getMappingName;
internal IntPtr updateGamepadGUID;
// monitor
internal IntPtr freeMonitor;
internal IntPtr getMonitorPos;
internal IntPtr getMonitorContentScale;
internal IntPtr getMonitorWorkarea;
@@ -697,8 +718,10 @@ namespace StgSharp.Graphics
internal IntPtr getVideoMode;
internal IntPtr getGammaRamp;
internal IntPtr setGammaRamp;
// window
internal IntPtr createWindow;
internal IntPtr destroyWindow;
internal IntPtr setWindowTitle;
internal IntPtr setWindowIcon;
@@ -736,25 +759,23 @@ namespace StgSharp.Graphics
internal IntPtr waitEventsTimeout;
internal IntPtr postEmptyEvent;
// EGL
//EGLenum(*getEGLPlatform)(EGLint**);
//EGLNativeDisplayType(*getEGLNativeDisplay)(void);
//EGLNativeWindowType(*getEGLNativeWindow)(GLFWwindow*);
internal IntPtr getEGLPlatform;
internal IntPtr getEGLNativeDisplay;
internal IntPtr getEGLNativeWindow;
// vulkan
//void (* getRequiredInstanceExtensions) (byte**);
//GLFWbool(*getPhysicalDevicePresentationSupport)(VkInstance, VkPhysicalDevice, uint32_t);
//VkResult(*createWindowSurface)(VkInstance, GLFWwindow*,const VkAllocationCallbacks*, VkSurfaceKHR*);
internal IntPtr getRequiredInstanceExtensions;
internal IntPtr VkPhysicalDevice;
internal IntPtr GLFWwindow;
}
[StructLayout(LayoutKind.Sequential)]
@@ -769,8 +790,8 @@ namespace StgSharp.Graphics
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct VkExtensionProperties
{
fixed byte extensionName[256];
uint specVersion;
private fixed byte extensionName[256];
private uint specVersion;
public VkExtensionProperties()
{
@@ -792,27 +813,26 @@ namespace StgSharp.Graphics
}
*/
[StructLayout(LayoutKind.Explicit, Size = 16)]
public struct uintptr_t
{
[FieldOffset(0)]
long part1;
private long part1;
[FieldOffset(8)]
long part2;
private long part2;
}
#endregion
#endregion GLFW3 struct
#region glad struct
[StructLayout(LayoutKind.Sequential)]
internal struct GLsync
{
}
#endregion
#endregion glad struct
}
/**/