daily update on 20240305 by nitload youmu
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using StgSharp.Controlling;
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -187,7 +188,7 @@ namespace StgSharp.Graphics
|
||||
internal unsafe delegate*<uint, uint, int, int, int, int, int, int, int, int, uint, uint, void> glBlitNamedFramebuffer;
|
||||
internal unsafe delegate*<uint, uint, ulong, UIntPtr, void> glBufferAddressRangeNV;
|
||||
internal unsafe delegate*<uint, uint, ulong, void> glBufferAttachMemoryNV;
|
||||
internal unsafe delegate*<uint, IntPtr, void*, uint, void> glBufferData;
|
||||
internal unsafe delegate*<uint, IntPtr, IntPtr, uint, void> glBufferData;
|
||||
internal unsafe delegate*<uint, IntPtr, void*, uint, void> glBufferDataARB;
|
||||
internal unsafe delegate*<uint, IntPtr, UIntPtr, bool, void> glBufferPageCommitmentARB;
|
||||
internal unsafe delegate*<uint, IntPtr, UIntPtr, uint, ulong, bool, void> glBufferPageCommitmentMemNV;
|
||||
@@ -1823,7 +1824,7 @@ namespace StgSharp.Graphics
|
||||
internal unsafe delegate*<uint, uint, uint, void> glShaderOp1EXT;
|
||||
internal unsafe delegate*<uint, uint, uint, uint, void> glShaderOp2EXT;
|
||||
internal unsafe delegate*<uint, uint, uint, uint, uint, void> glShaderOp3EXT;
|
||||
internal unsafe delegate*<uint, uint, byte*, string, byte*, void> glShaderSource;
|
||||
internal unsafe delegate* unmanaged[Stdcall]<uint, uint, byte**, void*, void> glShaderSource;
|
||||
internal unsafe delegate*<GLhandleARB, uint, byte**, int*, void> glShaderSourceARB;
|
||||
internal unsafe delegate*<uint, uint, uint, void> glShaderStorageBlockBinding;
|
||||
internal unsafe delegate*<bool, void> glShadingRateImageBarrierNV;
|
||||
|
||||
@@ -104,6 +104,7 @@ namespace StgSharp
|
||||
|
||||
internal static void InternalWriteLog(string logLine, LogType logType)
|
||||
{
|
||||
logSyncSemaphore.Wait();
|
||||
if (!File.Exists(SS_errorlog))
|
||||
{
|
||||
FileStream stream = File.Create(SS_errorlog);
|
||||
@@ -115,6 +116,7 @@ namespace StgSharp
|
||||
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
||||
logStream.WriteLine(logLine);
|
||||
}
|
||||
logSyncSemaphore.Release(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
+224
-204
@@ -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
|
||||
}
|
||||
|
||||
/**/
|
||||
@@ -2,6 +2,7 @@
|
||||
using StgSharp.Controlling;
|
||||
using StgSharp.Logic;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@@ -272,7 +273,7 @@ namespace StgSharp.Graphics
|
||||
else
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt64[0] = (ulong)windowID;
|
||||
m.Write<ulong>(0, (ulong)windowID);
|
||||
GLonUpdate glu = gl as GLonUpdate;
|
||||
glu.frameworkHandleEnqueue(
|
||||
(IntPtr)(delegate*<void>)&InternalSwapBuffer, m);
|
||||
@@ -405,13 +406,27 @@ namespace StgSharp.Graphics
|
||||
ConcurrentQueue<IntPtr> glActions = (gl as GLonUpdate).GLactionQueue;
|
||||
#pragma warning restore CS8602
|
||||
IntPtr currentOperation;
|
||||
while (gl.GetWindowShouldClose(this))
|
||||
TimeSpan span = new TimeSpan(100L);
|
||||
try
|
||||
{
|
||||
if (glActions.TryDequeue(out currentOperation))
|
||||
while (gl.GetWindowShouldClose(this))
|
||||
{
|
||||
((delegate*<void>)currentOperation)();
|
||||
if (glActions.TryDequeue(out currentOperation))
|
||||
{
|
||||
((delegate*<void>)currentOperation)();
|
||||
}
|
||||
else
|
||||
{
|
||||
Thread.Sleep(span);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
this.ShouldClose = true;
|
||||
(gl as GLonUpdate).ShowDequeueStream();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion form main
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using StgSharp;
|
||||
using StgSharp.Logic;
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
@@ -9,7 +10,6 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
public partial class Form
|
||||
{
|
||||
|
||||
private bool isFullyRendered = false;
|
||||
|
||||
internal class FrameUpdateTimer
|
||||
@@ -29,6 +29,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
get { return tickCounter; }
|
||||
}
|
||||
|
||||
internal void Refresh()
|
||||
{
|
||||
refreshed = false;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -7,11 +8,9 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A collecion of handle to Element Buffer Object in OpenGL.
|
||||
/// Each <see langword="int"/> value indexed from instance of this class this
|
||||
/// Each <see langword="uint"/> value indexed from instance of this class this
|
||||
/// is the only handle to one Element Buffer Object.
|
||||
/// </summary>
|
||||
public unsafe class ElementBuffer : BufferObjectBase
|
||||
@@ -22,8 +21,7 @@ namespace StgSharp.Graphics
|
||||
_bufferHandle = GL.GenBuffers(n);
|
||||
}
|
||||
|
||||
|
||||
public override void Bind(int index)
|
||||
public override sealed void Bind(int index)
|
||||
{
|
||||
GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
}
|
||||
@@ -31,16 +29,18 @@ namespace StgSharp.Graphics
|
||||
public void SetValue<T>(int index, T[] bufferArray, BufferUsage usage)
|
||||
where T : struct, IConvertible
|
||||
{
|
||||
Console.WriteLine("Setting ebo data.");
|
||||
GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
GL.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
|
||||
}
|
||||
|
||||
protected sealed override void Dispose(bool disposing)
|
||||
protected override sealed void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
GL.DeleteBuffers(_bufferHandle);
|
||||
_bufferHandle.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
public unsafe class VertexArray : BufferObjectBase
|
||||
{
|
||||
internal VertexArray(int n, IglFunc gl)
|
||||
@@ -15,7 +14,7 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public sealed override void Bind(int index)
|
||||
public override sealed void Bind(int index)
|
||||
{
|
||||
GL.BindVertexArray(_bufferHandle[index]);
|
||||
}
|
||||
@@ -23,7 +22,7 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void BindNull()
|
||||
{
|
||||
GL.BindVertexArray(glHandle.Alloc(0));
|
||||
GL.BindVertexArray(glHandle.Zero);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -35,12 +34,13 @@ namespace StgSharp.Graphics
|
||||
stride, pointer);
|
||||
}
|
||||
|
||||
protected sealed override void Dispose(bool disposing)
|
||||
protected override sealed void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
GL.DeleteVertexArrays(_bufferHandle);
|
||||
_bufferHandle.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Security;
|
||||
@@ -9,7 +10,6 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
public unsafe class VertexBuffer : BufferObjectBase
|
||||
{
|
||||
internal VertexBuffer(int n, IglFunc glFunc)
|
||||
@@ -18,7 +18,7 @@ namespace StgSharp.Graphics
|
||||
_bufferHandle = GL.GenBuffers(n);
|
||||
}
|
||||
|
||||
public sealed override void Bind(int index)
|
||||
public override sealed void Bind(int index)
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
}
|
||||
@@ -32,9 +32,9 @@ namespace StgSharp.Graphics
|
||||
/// <param name="usage">How OpenGL use these data, defined by <see cref="BufferUsage"/></param>
|
||||
public void SetValue<T>(int index, T bufferData, BufferUsage usage) where T : IMat
|
||||
{
|
||||
Console.WriteLine("Setting vbo data.");
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferData, usage);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -51,7 +51,7 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Unbind()
|
||||
@@ -65,13 +65,13 @@ namespace StgSharp.Graphics
|
||||
GL = gl;
|
||||
}
|
||||
|
||||
protected sealed override void Dispose(bool disposing)
|
||||
protected override sealed void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
GL.DeleteBuffers(_bufferHandle);
|
||||
_bufferHandle.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,8 +9,35 @@ using System.Security.AccessControl;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
//TODO 发现一个大问题,paramQueue大多数时候取出的是数组,不是数组句柄,也就是说其内存将被长期固定且不能回收,这是内存泄漏
|
||||
public unsafe class glArrayHandle
|
||||
{
|
||||
internal readonly Array copy;
|
||||
internal GCHandle handle;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public IntPtr AddressOfArray()
|
||||
{
|
||||
return handle.AddrOfPinnedObject();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static glArrayHandle Alloc<T>(T[] array) where T : struct
|
||||
{
|
||||
Array copy = new T[array.Length];
|
||||
array.CopyTo(copy, 0);
|
||||
return new glArrayHandle(copy);
|
||||
}
|
||||
|
||||
internal glArrayHandle(Array array)
|
||||
{
|
||||
copy = array;
|
||||
handle = GCHandle.Alloc(array, GCHandleType.Pinned);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A handle to an OpenGL object,
|
||||
/// must be indexed from a <see cref="glHandleSet"/>.
|
||||
|
||||
@@ -9,7 +9,5 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
public unsafe partial class Form
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,13 +54,13 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void IglFunc.AttachShader(glHandle program, glHandle shader)
|
||||
{
|
||||
api->glAttachShader(*program.valuePtr, *shader.valuePtr);
|
||||
api->glAttachShader(*program.valuePtr, shader.DirectValue);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void IglFunc.BindBuffer(BufferType bufferType, glHandle handle)
|
||||
{
|
||||
api->glBindBuffer((uint)bufferType, *handle.valuePtr);
|
||||
api->glBindBuffer((uint)bufferType, handle.DirectValue);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -93,57 +93,39 @@ namespace StgSharp.Graphics
|
||||
while (api->glGetError() != 0) { }
|
||||
}
|
||||
|
||||
glHandleSet IglFunc.CompileShader(ShaderType shaderType, params string[] shaderCodeArray)
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.LoadShaderSource(glHandle shaderHandle, string codeStream)
|
||||
{
|
||||
int l = shaderCodeArray.Length;
|
||||
if (l == 0)
|
||||
byte[] stream = Encoding.UTF8.GetBytes(codeStream);
|
||||
fixed (byte* streamPtr = stream)
|
||||
{
|
||||
throw new ArgumentException("At least one pice of code is required.");
|
||||
api->glShaderSource(shaderHandle.DirectValue, 1, &streamPtr, (void*)0);
|
||||
}
|
||||
glHandleSet handleSet = new glHandleSet(l);
|
||||
for (int i = 0; i < l; i++)
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
glHandleSet IglFunc.CreateShaderSet(int count, ShaderType type)
|
||||
{
|
||||
glHandleSet ret = new glHandleSet(count);
|
||||
uint t = (uint)type;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
uint shaderID;
|
||||
byte[] data = Encoding.UTF8.GetBytes(shaderCodeArray[i] + '\0');
|
||||
fixed (byte* codePtr = data)
|
||||
uint id = api->glCreateShader(t);
|
||||
if (id == 0)
|
||||
{
|
||||
shaderID = InternalIO.InternalLoadShaderCode(api, codePtr, (int)shaderType);
|
||||
uint error = api->glGetError();
|
||||
InternalIO.InternalWriteLog($"Failed in creating shader: {error}", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
if (shaderID == 0) //compile error handler
|
||||
{
|
||||
IntPtr logPtr = InternalIO.InternalReadSSCLog();
|
||||
string log;
|
||||
try
|
||||
{
|
||||
byte[] logByte = new byte[512];
|
||||
Marshal.Copy(logPtr, logByte, 0, 512);
|
||||
log = Encoding.UTF8.GetString(logByte);
|
||||
log = log.Replace("\0", "");
|
||||
|
||||
bool isUseful = false;
|
||||
foreach (char item in log)
|
||||
{
|
||||
if (!char.IsControl(item))
|
||||
{
|
||||
isUseful = true; break;
|
||||
}
|
||||
}
|
||||
if (!isUseful)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
log = "Failed to compile shader.\n" +
|
||||
"Failed to get GLSL compiler log";
|
||||
}
|
||||
|
||||
InternalIO.InternalWriteLog(log, LogType.Error);
|
||||
}
|
||||
handleSet.SetValue(i, shaderID);
|
||||
ret.SetValue(i, id);
|
||||
}
|
||||
return handleSet;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void IglFunc.CompileShader(glHandle shaderhandle)
|
||||
{
|
||||
api->glCompileShader(shaderhandle.DirectValue);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -301,7 +283,7 @@ namespace StgSharp.Graphics
|
||||
api->glBufferData(
|
||||
(uint)bufferType,
|
||||
(IntPtr)size,
|
||||
&bufferData,
|
||||
(IntPtr)(&bufferData),
|
||||
(uint)usage);
|
||||
}
|
||||
|
||||
@@ -317,7 +299,7 @@ namespace StgSharp.Graphics
|
||||
api->glBufferData(
|
||||
(uint)bufferType,
|
||||
(IntPtr)size,
|
||||
bufferPtr,
|
||||
(IntPtr)bufferPtr,
|
||||
(uint)usage);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@ namespace StgSharp.Graphics
|
||||
private FrameTimeoutException refreshSIgnal = new FrameTimeoutException();
|
||||
private FrameTimeoutException signal = new FrameTimeoutException("This frame is timeout");
|
||||
|
||||
unsafe GLcontext* IglFunc.Context => throw signal;
|
||||
|
||||
private GLonTimeout()
|
||||
{ }
|
||||
|
||||
unsafe GLcontext* IglFunc.Context => throw signal;
|
||||
|
||||
void IglFunc.ActiveTexture(uint type) => throw signal;
|
||||
|
||||
void IglFunc.AfterAlign(Form form, Action action) => throw signal;
|
||||
@@ -43,12 +43,17 @@ namespace StgSharp.Graphics
|
||||
|
||||
void IglFunc.ClearGraphicError() => throw signal;
|
||||
|
||||
glHandleSet IglFunc.CompileShader(ShaderType shaderType, params string[] shaderCode) => throw signal;
|
||||
public void CompileShader(glHandle shaderhandle)
|
||||
{
|
||||
throw signal;
|
||||
}
|
||||
|
||||
glHandle IglFunc.CreateProgram() => throw signal;
|
||||
|
||||
glHandleSet IglFunc.CreateProgram(int count) => throw signal;
|
||||
|
||||
glHandleSet IglFunc.CreateShaderSet(int count, StgSharp.Graphics.ShaderType type) => throw signal;
|
||||
|
||||
IntPtr IglFunc.CreateWindowHandle(int width, int height, string tittle, IntPtr monitor, Form share) => throw signal;
|
||||
|
||||
glHandle IglFunc.CreatGraphicProgram() => throw signal;
|
||||
@@ -71,6 +76,11 @@ namespace StgSharp.Graphics
|
||||
|
||||
bool IglFunc.GetWindowShouldClose(Form form) => throw signal;
|
||||
|
||||
void IglFunc.LoadShaderSource(glHandle shaderHandle, string codeStream)
|
||||
{
|
||||
throw signal;
|
||||
}
|
||||
|
||||
void IglFunc.MakeContexCurrent(Form form) => throw signal;
|
||||
|
||||
void IglFunc.SetBufferData<T>(BufferType bufferType, T bufferData, BufferUsage usage) => throw signal;
|
||||
@@ -93,6 +103,11 @@ namespace StgSharp.Graphics
|
||||
|
||||
void IglFunc.SetVertexAttribute(uint index, int size, TypeCode t, bool normalized, uint stride, int pointer) => throw signal;
|
||||
|
||||
void IglFunc.SwitchContext()
|
||||
{
|
||||
throw signal;
|
||||
}
|
||||
|
||||
unsafe void IglFunc.TextureImage2d<T>(int target, int level, uint internalformat, uint width, uint height, uint format, uint type, glHandle pixels) => throw signal;
|
||||
|
||||
void IglFunc.TextureParameter(int target, uint pname, int param) => throw signal;
|
||||
@@ -102,10 +117,5 @@ namespace StgSharp.Graphics
|
||||
void IglFunc.Viewport(int x, int y, uint width, uint height) => throw signal;
|
||||
|
||||
internal static GLonTimeout Set() => singleInstance;
|
||||
|
||||
void IglFunc.SwitchContext()
|
||||
{
|
||||
throw signal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,15 +17,13 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
private static ConcurrentQueue<IntPtr> glActionQueue;
|
||||
private static GLparamQueue paramQueue;
|
||||
private FrameTimeoutException refreshSignal = new();
|
||||
|
||||
private GLcontext* api;
|
||||
|
||||
private FrameTimeoutException refreshSignal = new();
|
||||
private IntPtr SwapBufferPtr = (IntPtr)(delegate*<IntPtr, void>)&InternalIO.glfwSwapBuffers;
|
||||
|
||||
GLcontext* IglFunc.Context
|
||||
internal void ShowDequeueStream()
|
||||
{
|
||||
get => api;
|
||||
paramQueue.ShowDequeueLog();
|
||||
}
|
||||
|
||||
internal GLonUpdate(GLcontext* context)
|
||||
@@ -38,6 +36,11 @@ namespace StgSharp.Graphics
|
||||
api = context;
|
||||
}
|
||||
|
||||
GLcontext* IglFunc.Context
|
||||
{
|
||||
get => api;
|
||||
}
|
||||
|
||||
internal static GLparamQueue ParamQueue
|
||||
{
|
||||
get { return paramQueue; }
|
||||
@@ -84,8 +87,8 @@ namespace StgSharp.Graphics
|
||||
void IglFunc.BindBuffer(BufferType bufferType, glHandle handle)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt32[0] = (uint)bufferType;
|
||||
m.UInt64[1] = (ulong)handle.Handle;
|
||||
m.Write<uint>(0, (uint)bufferType);
|
||||
m.Write<ulong>(1, (ulong)handle.valuePtr);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(BindBufferPtr);
|
||||
}
|
||||
@@ -94,8 +97,8 @@ namespace StgSharp.Graphics
|
||||
void IglFunc.BindTexture(uint type, glHandle texture)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt64[1] = (ulong)texture.valuePtr;
|
||||
m.UInt32[0] = (uint)type;
|
||||
m.Write<uint>(0, (uint)type);
|
||||
m.Write<ulong>(1, (ulong)texture.valuePtr);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(BindTexturePtr);
|
||||
}
|
||||
@@ -110,6 +113,7 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void IglFunc.Clear(MaskBufferBit mask)
|
||||
{
|
||||
paramQueue.Enqueue((int)mask);
|
||||
glActionQueue.Enqueue(ClearPtr);
|
||||
}
|
||||
|
||||
@@ -126,22 +130,10 @@ namespace StgSharp.Graphics
|
||||
glActionQueue.Enqueue(ClearGraphicErrorPtr);
|
||||
}
|
||||
|
||||
glHandleSet IglFunc.CompileShader(ShaderType shaderType, params string[] shaderCode)
|
||||
unsafe void IglFunc.CompileShader(glHandle shaderhandle)
|
||||
{
|
||||
int l = shaderCode.Length;
|
||||
if (l == 0)
|
||||
{
|
||||
throw new ArgumentException("Should input at least one piece of shader code");
|
||||
}
|
||||
glHandleSet shaderHandle = new glHandleSet(shaderCode.Length);
|
||||
paramQueue.Enqueue((int)shaderType, l);
|
||||
for (int i = 0; i < l; i++)
|
||||
{
|
||||
GCHandle codePtr = GCHandle.Alloc(Encoding.UTF8.GetBytes(shaderCode[i] + '\0'), GCHandleType.Pinned);
|
||||
paramQueue.Enqueue((IntPtr)(shaderHandle.handle + i), codePtr.AddrOfPinnedObject());
|
||||
}
|
||||
paramQueue.Enqueue((IntPtr)shaderhandle.valuePtr);
|
||||
glActionQueue.Enqueue(CompileShaderPtr);
|
||||
return shaderHandle;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -153,18 +145,31 @@ namespace StgSharp.Graphics
|
||||
return h;
|
||||
}
|
||||
|
||||
//TODO
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
glHandleSet IglFunc.CreateProgram(int count)
|
||||
{
|
||||
M128 m = default;
|
||||
glHandleSet h = new glHandleSet(count);
|
||||
m.UInt64[0] = (ulong)h.handle;
|
||||
m.Int32[2] = count;
|
||||
m.Write<ulong>(0, (ulong)h.handle);
|
||||
m.Write<int>(2, count);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(CreateProgramSetPtr);
|
||||
return h;
|
||||
}
|
||||
|
||||
glHandleSet IglFunc.CreateShaderSet(int count, ShaderType type)
|
||||
{
|
||||
glHandleSet ret = new glHandleSet(count);
|
||||
M128 m = new M128();
|
||||
m.Write<int>(0, count);
|
||||
m.Write<uint>(1, (uint)type);
|
||||
m.Write<ulong>(1, (ulong)ret.handle);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(CreateShaderPtr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
IntPtr IglFunc.CreateWindowHandle(int width, int height, string tittle, IntPtr monitor, Form share)
|
||||
{
|
||||
byte[] tittleBytes = Encoding.UTF8.GetBytes(tittle);
|
||||
@@ -203,8 +208,8 @@ namespace StgSharp.Graphics
|
||||
unsafe void IglFunc.DeleteBuffer(glHandle handle)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt64[0] = (ulong)handle.Handle;
|
||||
m.UInt32[2] = 1;
|
||||
m.Write<ulong>(0, (ulong)handle.valuePtr);
|
||||
m.Write(2, 1);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(DeleBufferPtr);
|
||||
}
|
||||
@@ -212,16 +217,16 @@ namespace StgSharp.Graphics
|
||||
unsafe void IglFunc.DeleteBuffers(glHandleSet handle)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt32[2] = (uint)handle.length;
|
||||
m.UInt64[0] = (ulong)handle.handle;
|
||||
m.Write<uint>(2, (uint)handle.length);
|
||||
m.Write<ulong>(0, (ulong)handle.handle);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(DeleBufferPtr);
|
||||
}
|
||||
|
||||
unsafe void IglFunc.DeleteVertexArrays(glHandleSet arrays)
|
||||
{
|
||||
M128 m = default; m.UInt64[1] = (ulong)arrays.handle;
|
||||
m.Int32[0] = arrays.length;
|
||||
M128 m = default; m.Write<ulong>(1, (ulong)arrays.handle);
|
||||
m.Write<int>(0, arrays.length);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(DeleteVertexArrayPtr);
|
||||
}
|
||||
@@ -258,7 +263,7 @@ namespace StgSharp.Graphics
|
||||
unsafe glHandleSet IglFunc.GenBuffers(int count)
|
||||
{
|
||||
glHandleSet h = new glHandleSet(count);
|
||||
M128 m = default; m.UInt32[2] = (uint)count; m.UInt64[0] = (ulong)h.handle;
|
||||
M128 m = default; m.Write<uint>(2, (uint)count); m.Write<ulong>(0, (ulong)h.handle);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(GenBufferPtr);
|
||||
return h;
|
||||
@@ -267,7 +272,7 @@ namespace StgSharp.Graphics
|
||||
unsafe glHandleSet IglFunc.GenTextures(int count)
|
||||
{
|
||||
glHandleSet h = new glHandleSet(count);
|
||||
M128 m = default; m.UInt32[2] = (uint)count; m.UInt64[0] = (ulong)h.handle;
|
||||
M128 m = default; m.Write<uint>(2, (uint)count); m.Write<ulong>(0, (ulong)h.handle);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(GenTexturesPtr);
|
||||
return h;
|
||||
@@ -276,7 +281,7 @@ namespace StgSharp.Graphics
|
||||
unsafe glHandleSet IglFunc.GenVertexArrays(int count)
|
||||
{
|
||||
glHandleSet h = new glHandleSet(count);
|
||||
M128 m = default; m.UInt32[2] = (uint)count; m.UInt64[0] = (ulong)h.handle;
|
||||
M128 m = default; m.Write<uint>(2, (uint)count); m.Write<ulong>(0, (ulong)h.handle);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(GenTexturesPtr);
|
||||
return h;
|
||||
@@ -286,9 +291,9 @@ namespace StgSharp.Graphics
|
||||
unsafe glSHandle IglFunc.GetUniformLocation(glHandle program, string ptr)
|
||||
{
|
||||
glSHandle h = glSHandle.Alloc(0);
|
||||
M128 m;
|
||||
m.UInt64[0] = (ulong)program.Handle;
|
||||
m.UInt64[1] = (ulong)GCHandle.Alloc(Encoding.UTF8.GetBytes(ptr)).AddrOfPinnedObject();
|
||||
M128 m = default;
|
||||
m.Write<ulong>(0, (ulong)program.Handle);
|
||||
m.Write<ulong>(1, (ulong)GCHandle.Alloc(Encoding.UTF8.GetBytes(ptr)).AddrOfPinnedObject());
|
||||
paramQueue.Enqueue(m);
|
||||
paramQueue.Enqueue((IntPtr)h.valuePtr);
|
||||
glActionQueue.Enqueue(GetUniformLocationPtr);
|
||||
@@ -310,6 +315,12 @@ namespace StgSharp.Graphics
|
||||
InternalIO.glfwSwapBuffers(form.windowID);
|
||||
}
|
||||
|
||||
void IglFunc.LoadShaderSource(glHandle shaderHandle, string codeStream)
|
||||
{
|
||||
paramQueue.Enqueue(shaderHandle);
|
||||
paramQueue.Enqueue(codeStream);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void IglFunc.MakeContexCurrent(Form form)
|
||||
{
|
||||
@@ -330,7 +341,8 @@ namespace StgSharp.Graphics
|
||||
void IglFunc.SetBufferData<T>(BufferType bufferType, T[] bufferArray, BufferUsage usage)
|
||||
{
|
||||
paramQueue.Enqueue((uint)bufferType, (uint)usage);
|
||||
paramQueue.Enqueue((IntPtr)(Marshal.SizeOf<T>() * bufferArray.Length), GCHandle.Alloc(bufferArray).AddrOfPinnedObject());
|
||||
paramQueue.Enqueue((IntPtr)(Marshal.SizeOf<T>() * bufferArray.Length));
|
||||
paramQueue.Enqueue<T>(bufferArray);
|
||||
glActionQueue.Enqueue(BufferDataPtr);
|
||||
}
|
||||
|
||||
@@ -359,9 +371,9 @@ namespace StgSharp.Graphics
|
||||
void IglFunc.TextureParameter(int target, uint pname, int param)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Int32[0] = target;
|
||||
m.UInt32[2] = pname;
|
||||
m.Int32[3] = param;
|
||||
m.Write<int>(0, target);
|
||||
m.Write<uint>(2, pname);
|
||||
m.Write<int>(3, param);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(TextureParameterPtr);
|
||||
}
|
||||
@@ -382,11 +394,11 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal void frameworkHandleEnqueue(IntPtr methodHandle, params M128[] param)
|
||||
{
|
||||
glActionQueue.Enqueue(methodHandle);
|
||||
foreach (M128 item in param)
|
||||
{
|
||||
paramQueue.Enqueue(item);
|
||||
}
|
||||
glActionQueue.Enqueue(methodHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,16 +18,17 @@ namespace StgSharp.Graphics
|
||||
private IntPtr ActiveTexturePtr = (IntPtr)(delegate*<void>)&InternalActiveTexture;
|
||||
private IntPtr AttachShaderPtr = (IntPtr)(delegate*<void>)&InternalAttachShader;
|
||||
private IntPtr BindBufferPtr = (IntPtr)(delegate*<void>)&InternalBindBuffer;
|
||||
private IntPtr ClearColorPtr = (IntPtr)(delegate*<void>)&InternalClearColor;
|
||||
private IntPtr ClearGraphicErrorPtr = (IntPtr)(delegate*<void>)&InternalClearGraphicError;
|
||||
private IntPtr CompileShaderPtr = (IntPtr)(delegate*<void>)&InternalCompileShader;
|
||||
private IntPtr DeleBufferPtr = (IntPtr)(delegate*<void>)&InternalDeleteBuffer;
|
||||
private IntPtr BindTexturePtr = (IntPtr)(delegate*<void>)&InternalBindTexture;
|
||||
private IntPtr BindVertexArrayPtr = (IntPtr)(delegate*<void>)&InternalBindVertexArray;
|
||||
private IntPtr BufferDataPtr = (IntPtr)(delegate*<void>)&InternalSetBufferData;
|
||||
private IntPtr ClearColorPtr = (IntPtr)(delegate*<void>)&InternalClearColor;
|
||||
private IntPtr ClearGraphicErrorPtr = (IntPtr)(delegate*<void>)&InternalClearGraphicError;
|
||||
private IntPtr ClearPtr = (IntPtr)(delegate*<void>)&InternalClear;
|
||||
private IntPtr CompileShaderPtr = (IntPtr)(delegate*<void>)&InternalCompileShader;
|
||||
private IntPtr CreateProgramPtr = (IntPtr)(delegate*<void>)&InternalCreateProgram;
|
||||
private IntPtr CreateProgramSetPtr = (IntPtr)(delegate*<void>)&InternalCreateProgramSet;
|
||||
private IntPtr CreateShaderPtr = (IntPtr)(delegate*<void>)&InternalCreateShader;
|
||||
private IntPtr DeleBufferPtr = (IntPtr)(delegate*<void>)&InternalDeleteBuffer;
|
||||
private IntPtr DeleteVertexArrayPtr = (IntPtr)(delegate*<void>)&InternalDeleteVertexArrays;
|
||||
private IntPtr DrawElementsPtr = (IntPtr)(delegate*<void>)&InternalDrawElements;
|
||||
private IntPtr GenBufferPtr = (IntPtr)(delegate*<void>)&InternalGenBuffers;
|
||||
@@ -35,6 +36,7 @@ namespace StgSharp.Graphics
|
||||
private IntPtr GenVertexArraysPtr = (IntPtr)(delegate*<void>)&InternalGenVertexArrays;
|
||||
private IntPtr GetUniformLocationPtr = (IntPtr)(delegate*<void>)&InternalGetUniformLocation;
|
||||
private IntPtr SetVertexArrayPtr = (IntPtr)(delegate*<void>)&InternalSetVertexAttribute;
|
||||
private IntPtr ShaderSourcePtr = (IntPtr)(delegate*<void>)&InternalShaderSource;
|
||||
private IntPtr textureImage2dPtr = (IntPtr)(delegate*<void>)&InternalTextureImage2d;
|
||||
private IntPtr TextureParameterPtr = (IntPtr)(delegate*<void>)&InternalTextureParameter;
|
||||
private IntPtr UseProgramPtr = (IntPtr)(delegate*<void>)&InternalUseProgram;
|
||||
@@ -56,16 +58,21 @@ namespace StgSharp.Graphics
|
||||
|
||||
private static void InternalBindBuffer()
|
||||
{
|
||||
M128 m = default;
|
||||
M128 m = new M128();
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glBindBuffer(m.UInt32[0], *(uint*)m.UInt64[1]);
|
||||
uint usage = m.Read<uint>(0);
|
||||
uint handle = *(uint*)m.Read<ulong>(1);
|
||||
paramQueue.context->glBindBuffer(usage, handle);
|
||||
}
|
||||
|
||||
private static void InternalBindTexture()
|
||||
{
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glBindTexture(m.UInt32[0], *(uint*)m.UInt64[1]);
|
||||
paramQueue.context->glBindTexture(
|
||||
m.Read<uint>(0),
|
||||
*(uint*)m.Read<ulong>(1)
|
||||
);
|
||||
}
|
||||
|
||||
private static void InternalBindVertexArray()
|
||||
@@ -94,53 +101,14 @@ namespace StgSharp.Graphics
|
||||
while (paramQueue.context->glGetError() != 0) { }
|
||||
}
|
||||
|
||||
private static void InternalCompileShader()
|
||||
private static unsafe void InternalCompileShader()
|
||||
{
|
||||
IntPtr shaderHandle, codeHandle;
|
||||
int count, type;
|
||||
paramQueue.TryDequeue(out type, out count);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
paramQueue.TryDequeue(out shaderHandle, out codeHandle);
|
||||
GCHandle code = GCHandle.FromIntPtr(codeHandle);
|
||||
byte[] c = (byte[])code.Target;
|
||||
Console.WriteLine(Encoding.UTF8.GetString(c));
|
||||
*(uint*)shaderHandle = InternalIO.InternalLoadShaderCode(paramQueue.context, (byte*)codeHandle, type);
|
||||
if (*(uint*)shaderHandle == 0)
|
||||
{
|
||||
IntPtr logPtr = InternalIO.InternalReadSSCLog();
|
||||
string log;
|
||||
try
|
||||
{
|
||||
byte[] logByte = new byte[512];
|
||||
Marshal.Copy(logPtr, logByte, 0, 512);
|
||||
log = Encoding.UTF8.GetString(logByte);
|
||||
log = log.Replace("\0", "");
|
||||
|
||||
bool isUseful = false;
|
||||
foreach (char item in log)
|
||||
{
|
||||
if (!char.IsControl(item))
|
||||
{
|
||||
isUseful = true; break;
|
||||
}
|
||||
}
|
||||
if (!isUseful)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
log = "Failed to compile shader.\nFailed to get GLSL compiler log";
|
||||
}
|
||||
|
||||
InternalIO.InternalWriteLog(log, LogType.Error);
|
||||
}
|
||||
GCHandle.FromIntPtr(codeHandle).Free();
|
||||
}
|
||||
IntPtr handle = default;
|
||||
paramQueue.TryDequeue(out handle);
|
||||
paramQueue.context->glCompileShader(*(uint*)handle);
|
||||
}
|
||||
|
||||
//TODO
|
||||
private static void InternalCreateProgram()
|
||||
{
|
||||
IntPtr programHandle = default;
|
||||
@@ -153,25 +121,36 @@ namespace StgSharp.Graphics
|
||||
uint* programHandle;
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
programHandle = (uint*)m.UInt64[0];
|
||||
for (int i = 0; i < m.Int32[2]; i++)
|
||||
programHandle = (uint*)m.Read<ulong>(0);
|
||||
for (int i = 0; i < m.Read<int>(2); i++)
|
||||
{
|
||||
*(programHandle + i) = paramQueue.context->glCreateProgram();
|
||||
}
|
||||
}
|
||||
|
||||
private static unsafe void InternalCreateShader()
|
||||
{
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
int count = m.Read<int>(0); uint type = m.Read<uint>(1); uint* handle = (uint*)m.Read<ulong>(1);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
*(handle + i) = paramQueue.context->glCreateShader(type);
|
||||
}
|
||||
}
|
||||
|
||||
private static void InternalDeleteBuffer()
|
||||
{
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glDeleteBuffers(m.UInt32[2], (uint*)m.UInt64[0]);
|
||||
paramQueue.context->glDeleteBuffers(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
|
||||
}
|
||||
|
||||
private static void InternalDeleteVertexArrays()
|
||||
{
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glDeleteVertexArrays((uint)m.Int32[0], (uint*)m.UInt64[0]);
|
||||
paramQueue.context->glDeleteVertexArrays((uint)m.Read<int>(0), (uint*)m.Read<ulong>(0));
|
||||
}
|
||||
|
||||
private static void InternalDrawElements()
|
||||
@@ -187,21 +166,21 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glGenBuffers(m.UInt32[2], (uint*)m.UInt64[0]);
|
||||
paramQueue.context->glGenBuffers(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
|
||||
}
|
||||
|
||||
private static void InternalGenTextures()
|
||||
{
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glGenTextures(m.UInt32[2], (uint*)m.UInt64[0]);
|
||||
paramQueue.context->glGenTextures(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
|
||||
}
|
||||
|
||||
private static void InternalGenVertexArrays()
|
||||
{
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glGenVertexArrays(m.UInt32[2], (uint*)m.UInt64[0]);
|
||||
paramQueue.context->glGenVertexArrays(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
|
||||
}
|
||||
|
||||
private static void InternalGetUniformLocation()
|
||||
@@ -215,11 +194,12 @@ namespace StgSharp.Graphics
|
||||
private static void InternalSetBufferData()
|
||||
{
|
||||
uint type = 0, use = 0;
|
||||
IntPtr size = default, handle = default;
|
||||
IntPtr size = default;
|
||||
glArrayHandle array = default;
|
||||
paramQueue.TryDequeue(out type, out use);
|
||||
paramQueue.TryDequeue(out size, out handle);
|
||||
paramQueue.context->glBufferData(type, size, (void*)handle, use);
|
||||
GCHandle.FromIntPtr(handle).Free();
|
||||
paramQueue.TryDequeue(out size);
|
||||
paramQueue.TryDequeue(out array);
|
||||
paramQueue.context->glBufferData(type, size, array.AddressOfArray(), use);
|
||||
}
|
||||
|
||||
private static void InternalSetVertexAttribute()
|
||||
@@ -232,6 +212,18 @@ namespace StgSharp.Graphics
|
||||
paramQueue.context->glEnableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
private static unsafe void InternalShaderSource()
|
||||
{
|
||||
IntPtr handle = default;
|
||||
byte[] stream = Array.Empty<byte>();
|
||||
paramQueue.TryDequeue(out handle);
|
||||
paramQueue.TryDequeue(out stream);
|
||||
fixed (byte* sPtr = stream)
|
||||
{
|
||||
paramQueue.context->glShaderSource(*(uint*)handle, 1, &sPtr, (void*)0);
|
||||
}
|
||||
}
|
||||
|
||||
private static void InternalTextureImage2d()
|
||||
{
|
||||
IntPtr pix = IntPtr.Zero;
|
||||
@@ -240,14 +232,13 @@ namespace StgSharp.Graphics
|
||||
paramQueue.TryDequeue(out level, out internalFormat, out width, out height);
|
||||
paramQueue.TryDequeue(out target, out format, out type);
|
||||
paramQueue.context->glTexImage2D(target, (int)level, internalFormat, width, height, 0, format, type, (void*)pix);
|
||||
GCHandle.FromIntPtr(pix).Free();
|
||||
}
|
||||
|
||||
private static void InternalTextureParameter()
|
||||
{
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glTextureParameteri(m.UInt32[0], m.UInt32[2], m.Int32[3]);
|
||||
paramQueue.context->glTextureParameteri(m.Read<uint>(0), m.Read<uint>(2), m.Read<int>(3));
|
||||
}
|
||||
|
||||
private static void InternalUseProgram()
|
||||
@@ -261,7 +252,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glViewport(m.Int32[0], m.Int32[1], m.UInt32[2], m.UInt32[3]);
|
||||
paramQueue.context->glViewport(m.Read<int>(0), m.Read<int>(1), m.Read<uint>(2), m.Read<uint>(3));
|
||||
}
|
||||
|
||||
private void InternalMakeContexCurrent(Form form)
|
||||
@@ -269,11 +260,6 @@ namespace StgSharp.Graphics
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void InternalSetValue(Uniform<float, float, float, float> uniform, float v0, float v1, float v2, float v3)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void InternalSwitchContext()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StgSharp;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -19,9 +20,10 @@ namespace StgSharp.Graphics
|
||||
return new ShaderProgram(GL);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected Shader CreateShader(ShaderType type, int count)
|
||||
{
|
||||
return new Shader(this.gl, new glHandleSet(count), type);
|
||||
return new Shader(this.gl, gl.CreateShaderSet(count, type), type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,18 +40,20 @@ namespace StgSharp.Graphics
|
||||
type = usage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compile the vertex shader to be attached to this shader.
|
||||
/// </summary>
|
||||
/// <param name="code">GLSL code of vertex shader.</param>
|
||||
public unsafe void Compile(params string[] code)
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void Compile(int index, string code)
|
||||
{
|
||||
glHandleSet.Copy(GL.CompileShader(type, code), handle);
|
||||
if (code == null)
|
||||
{
|
||||
throw new ArgumentNullException("Must provide enough code");
|
||||
}
|
||||
GL.LoadShaderSource(handle[index], code + '\0');
|
||||
GL.CompileShader(handle[index]);
|
||||
}
|
||||
|
||||
//TODO:写链接着色器的文档注释
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="index"></param>
|
||||
@@ -103,8 +107,8 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a uniform form current shader,
|
||||
/// the value type of the uniform should be provided.
|
||||
/// Get a uniform form current shader,
|
||||
/// the value type of the uniform should be provided.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the Uniform in shader code</param>
|
||||
/// <returns></returns>
|
||||
@@ -113,9 +117,10 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
return new Uniform<T>(this, name, GL);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a uniform form current shader,
|
||||
/// the value type of the uniform should be provided.
|
||||
/// Get a uniform form current shader,
|
||||
/// the value type of the uniform should be provided.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the Uniform in shader code</param>
|
||||
/// <returns></returns>
|
||||
@@ -125,9 +130,10 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
return new Uniform<T, U>(this, name, GL);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a uniform form current shader,
|
||||
/// the value type of the uniform should be provided.
|
||||
/// Get a uniform form current shader,
|
||||
/// the value type of the uniform should be provided.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the Uniform in shader code</param>
|
||||
/// <returns></returns>
|
||||
@@ -148,4 +154,4 @@ namespace StgSharp.Graphics
|
||||
GL.UseProgram(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
using StgSharp.Graphics;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharpDebug.Graphics.GL.ShaderEdit
|
||||
{
|
||||
public class ShaderGenerator
|
||||
{
|
||||
private List<string> codeList;
|
||||
private List<ShaderFunction> usedShaderFunctions;
|
||||
|
||||
public Uniform<T> DefineUniform<T>() where T : struct
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class ShaderFunction
|
||||
{
|
||||
private string name;
|
||||
private List<string> codeList;
|
||||
private List<ShaderParameter> inputList;
|
||||
private ShaderParameter outPut;
|
||||
|
||||
public int ParameterCount
|
||||
{
|
||||
get { return inputList.Count; }
|
||||
}
|
||||
|
||||
public void EmitCall(ShaderFunction function, ShaderParameter outPut, params ShaderParameter[] inputParams)
|
||||
{
|
||||
if (inputParams.Length != function.ParameterCount)
|
||||
{
|
||||
throw new ArgumentException("Provided parameters does not match function's parameter list.");
|
||||
}
|
||||
if (!ShaderParameter.IsSameType(outPut, function.outPut))
|
||||
{
|
||||
throw new Exception("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]))
|
||||
{
|
||||
throw new Exception("Provided parameters does not match function's parameter list.");
|
||||
}
|
||||
}
|
||||
string codeLine = "";
|
||||
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
|
||||
{
|
||||
internal readonly InternalShaderType type;
|
||||
internal readonly string name;
|
||||
internal readonly bool isReadOnly;
|
||||
|
||||
public ShaderParameter(string name, InternalShaderType type)
|
||||
{
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
isReadOnly = false;
|
||||
}
|
||||
|
||||
public static readonly ShaderParameter Void = new ShaderParameter("", InternalShaderType.Void);
|
||||
|
||||
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 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
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -8,7 +9,6 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
public class Uniform<T> where T : struct
|
||||
{
|
||||
internal glSHandle id;
|
||||
@@ -25,10 +25,8 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class Uniform<T, U>
|
||||
where T : struct
|
||||
where U : struct
|
||||
@@ -88,12 +86,10 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal partial class GLonRender : IglFunc
|
||||
{
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.SetValue(Uniform<float> uniform, float v0)
|
||||
{
|
||||
@@ -156,8 +152,9 @@ namespace StgSharp.Graphics
|
||||
unsafe void IglFunc.SetValue(Uniform<float, float> uniform, float f0, float f1)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt64[0] = (ulong)uniform.id.valuePtr;
|
||||
m.Single[2] = f0; m.Single[3] = f1;
|
||||
m.Write<ulong>(0, (ulong)uniform.id.valuePtr);
|
||||
m.Write<float>(2, f0);
|
||||
m.Write<float>(3, f1);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(UniformVal2fPtr);
|
||||
}
|
||||
@@ -179,8 +176,8 @@ namespace StgSharp.Graphics
|
||||
unsafe void IglFunc.SetValue(Uniform<float> uniform, float f0)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt64[0] = (ulong)uniform.id.valuePtr;
|
||||
m.Single[2] = f0;
|
||||
m.Write<ulong>(0, (ulong)uniform.id.valuePtr);
|
||||
m.Write<float>(2, f0);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(UniformVal1fPtr);
|
||||
}
|
||||
@@ -188,8 +185,8 @@ namespace StgSharp.Graphics
|
||||
unsafe void IglFunc.SetValue(Uniform<int> uniform, int i0)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt64[0] = (ulong)uniform.id.valuePtr;
|
||||
m.Int32[2] = i0;
|
||||
m.Write<ulong>(0, (ulong)uniform.id.valuePtr);
|
||||
m.Write<int>(2, i0);
|
||||
paramQueue.Enqueue(m);
|
||||
glActionQueue.Enqueue(UniformVal1fPtr);
|
||||
}
|
||||
@@ -205,28 +202,28 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glUniform1f(*(int*)m.UInt64[0], m.Single[2]);
|
||||
paramQueue.context->glUniform1f(*(int*)m.Read<uint>(0), m.Read<uint>(2));
|
||||
}
|
||||
|
||||
private static unsafe void UniformVal1fv()
|
||||
{
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glUniform1fv(*(int*)m.UInt64[0], 4, (Vec4d*)m.UInt64[0]);
|
||||
paramQueue.context->glUniform1fv(*(int*)m.Read<ulong>(0), 4, (Vec4d*)&m.vec);
|
||||
}
|
||||
|
||||
private static void UniformVal1i()
|
||||
{
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glUniform1i(*(int*)m.UInt64[0], m.Int32[2]);
|
||||
paramQueue.context->glUniform1i(*(int*)m.Read<uint>(0), m.Read<int>(2));
|
||||
}
|
||||
|
||||
private static void UniformVal2f()
|
||||
{
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glUniform2f(*(int*)m.UInt64[0], m.Single[2], m.Single[3]);
|
||||
paramQueue.context->glUniform2f(*(int*)m.Read<uint>(0), m.Read<float>(2), m.Read<float>(3));
|
||||
}
|
||||
|
||||
private static void UniformVal3f()
|
||||
@@ -235,16 +232,16 @@ namespace StgSharp.Graphics
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out handle);
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glUniform3f(*(int*)handle, m.Single[0], m.Single[1], m.Single[2]);
|
||||
paramQueue.context->glUniform3f(*(int*)handle, m.Read<float>(0), m.Read<float>(1), m.Read<float>(2));
|
||||
}
|
||||
|
||||
private static void UniformVal4f()
|
||||
{
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
M128 m = default;
|
||||
paramQueue.TryDequeue(out handle);
|
||||
paramQueue.TryDequeue(out m);
|
||||
paramQueue.context->glUniform4f(*(int*)handle, m.Single[0], m.Single[1], m.Single[2], m.Single[2]);
|
||||
paramQueue.context->glUniform4f(*(int*)handle, m.Read<float>(0), m.Read<float>(1), m.Read<float>(2), m.Read<float>(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -746,7 +747,6 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
if (!form.IsSingleThread)
|
||||
{
|
||||
Console.WriteLine("This context runs on two threads");
|
||||
form.RenderThread.Start();
|
||||
}
|
||||
}
|
||||
@@ -1001,7 +1001,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
contextPtr->glBeginQuery = (delegate*<uint, uint, void>)load("glBeginQuery");
|
||||
contextPtr->glBindBuffer = (delegate*<uint, uint, void>)load("glBindBuffer");
|
||||
contextPtr->glBufferData = (delegate*<uint, IntPtr, void*, uint, void>)load("glBufferData");
|
||||
contextPtr->glBufferData = (delegate*<uint, IntPtr, IntPtr, uint, void>)load("glBufferData");
|
||||
contextPtr->glBufferSubData = (delegate*<uint, IntPtr, UIntPtr, void*, void>)load("glBufferSubData");
|
||||
contextPtr->glDeleteBuffers = (delegate*<uint, uint*, void>)load("glDeleteBuffers");
|
||||
contextPtr->glDeleteQueries = (delegate*<uint, uint*, void>)load("glDeleteQueries");
|
||||
@@ -1065,7 +1065,7 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glIsProgram = (delegate*<uint, bool>)load("glIsProgram");
|
||||
contextPtr->glIsShader = (delegate*<uint, bool>)load("glIsShader");
|
||||
contextPtr->glLinkProgram = (delegate*<uint, void>)load("glLinkProgram");
|
||||
contextPtr->glShaderSource = (delegate*<uint, uint, byte*, string, byte*, void>)load("glShaderSource");
|
||||
contextPtr->glShaderSource = (delegate* unmanaged[Stdcall]<uint, uint, byte**, void*, void>)load("glShaderSource");
|
||||
contextPtr->glStencilFuncSeparate = (delegate*<uint, uint, int, uint, void>)load("glStencilFuncSeparate");
|
||||
contextPtr->glStencilMaskSeparate = (delegate*<uint, uint, void>)load("glStencilMaskSeparate");
|
||||
contextPtr->glStencilOpSeparate = (delegate*<uint, uint, uint, uint, void>)load("glStencilOpSeparate");
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.ComponentModel.Design;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
@@ -84,21 +86,18 @@ namespace StgSharp.Graphics
|
||||
|
||||
void ClearGraphicError();
|
||||
|
||||
/// <summary>
|
||||
/// Conpile the provided shader code in string form.
|
||||
/// </summary>
|
||||
/// <param name="shaderCodeArray">A string array contains all shaders' code</param>
|
||||
/// <param name="shaderType">An <see cref="ShaderType"/> enum represent the type of the shader to
|
||||
/// conpile, including vertex shader and fragment shader.</param>
|
||||
/// <returns>An handle of conpiled shader</returns>
|
||||
glHandleSet CompileShader(ShaderType shaderType, params string[] shaderCodeArray);
|
||||
|
||||
/// <summary>
|
||||
/// Same function as OpenGL api, glCreateProgram
|
||||
/// </summary>
|
||||
/// <returns>A handle representing a single shader program</returns>
|
||||
glHandle CreateProgram();
|
||||
|
||||
glHandleSet CreateShaderSet(int count, ShaderType type);
|
||||
|
||||
void LoadShaderSource(glHandle shaderHandle, string codeStream);
|
||||
|
||||
void CompileShader(glHandle shaderhandle);
|
||||
|
||||
/// <summary>
|
||||
/// Same function as OpenGL api, glCreateProgram.
|
||||
/// Used for creating multiple shader program.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StgSharp.Graphics;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,8 +11,6 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Logic
|
||||
{
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 8)]
|
||||
internal struct LogSeperator
|
||||
{
|
||||
@@ -31,8 +30,6 @@ namespace StgSharp.Logic
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A linear data structure with dynamic length.
|
||||
/// It contains a <see cref="List{T}"/> of <see cref="Array"/>,
|
||||
@@ -44,13 +41,16 @@ namespace StgSharp.Logic
|
||||
private List<T[]> arrayIndexList;
|
||||
private LogSeperator indexpair;
|
||||
private int lastMain = 0;
|
||||
|
||||
// main index to the last used element
|
||||
private int lastSub = 0;
|
||||
|
||||
private int length;
|
||||
private int subLength = 1;
|
||||
|
||||
// sub index to the last used element
|
||||
private Queue<int> unusedMainIndex;
|
||||
|
||||
private Queue<int> unusedSubIndex;
|
||||
|
||||
public DynamicArrayList()
|
||||
@@ -105,7 +105,6 @@ namespace StgSharp.Logic
|
||||
/// <param name="instace"></param>
|
||||
public DynamicArrayList(int count, T instace)
|
||||
{
|
||||
|
||||
arrayIndexList = new List<T[]>();
|
||||
length = count;
|
||||
unusedMainIndex = new();
|
||||
@@ -162,7 +161,6 @@ namespace StgSharp.Logic
|
||||
}
|
||||
arrayIndexList[indexpair.high_s][indexpair.low_s] = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void CopyTo(DynamicArrayList<T> target)
|
||||
@@ -230,7 +228,6 @@ namespace StgSharp.Logic
|
||||
|
||||
public int Count => length;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Length of this <see cref="DynamicArrayList{T}"/>
|
||||
/// </summary>
|
||||
@@ -256,7 +253,6 @@ namespace StgSharp.Logic
|
||||
length++;
|
||||
subLength = 1;
|
||||
return length - 1;
|
||||
|
||||
}
|
||||
|
||||
length++;
|
||||
@@ -357,8 +353,6 @@ namespace StgSharp.Logic
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Obsolete("This method is not same, you may read data form an empty index.", false)]
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
@@ -424,4 +418,4 @@ namespace StgSharp.Logic
|
||||
indexpair.low >>= (int)(32 - mainindex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
@@ -11,14 +13,23 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Logic
|
||||
{
|
||||
|
||||
internal unsafe class GLparamQueue
|
||||
{
|
||||
private string _dequeueLog = "\n";
|
||||
|
||||
internal GLcontext* context;
|
||||
private ConcurrentQueue<M128> paramQueue;
|
||||
private ConcurrentQueue<glArrayHandle> streamQueue;
|
||||
|
||||
public GLparamQueue()
|
||||
{
|
||||
paramQueue = new ConcurrentQueue<M128>();
|
||||
streamQueue = new ConcurrentQueue<glArrayHandle>();
|
||||
}
|
||||
|
||||
internal void ShowDequeueLog()
|
||||
{
|
||||
Console.WriteLine(_dequeueLog);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -30,6 +41,7 @@ namespace StgSharp.Logic
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(M128 m)
|
||||
{
|
||||
Console.WriteLine(m.ToString(10));
|
||||
paramQueue.Enqueue(m);
|
||||
}
|
||||
|
||||
@@ -37,134 +49,172 @@ namespace StgSharp.Logic
|
||||
public void Enqueue(uint u0)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt32[0] = u0;
|
||||
paramQueue.Enqueue(m);
|
||||
m.Write<uint>(0, u0);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(uint u0, uint u1)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt32[0] = u0;
|
||||
m.UInt32[1] = u1;
|
||||
paramQueue.Enqueue(m);
|
||||
m.Write<uint>(0, u0);
|
||||
m.Write<uint>(1, u1);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(ulong u0, ulong u1)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<ulong>(0, u0);
|
||||
m.Write<ulong>(1, u1);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(uint u0, uint u1, uint u2)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt32[0] = u0;
|
||||
m.UInt32[1] = u1;
|
||||
m.UInt32[2] = u2;
|
||||
paramQueue.Enqueue(m);
|
||||
m.Write<uint>(0, u0);
|
||||
m.Write<uint>(1, u1);
|
||||
m.Write<uint>(2, u2);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(float f0, float f1, float f2)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Single[0] = f0;
|
||||
m.Single[1] = f1;
|
||||
m.Single[2] = f2;
|
||||
paramQueue.Enqueue(m);
|
||||
m.Write<float>(0, f0);
|
||||
m.Write<float>(1, f1);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(float f0, float f1, float f2, float f3)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Single[0] = f0;
|
||||
m.Single[1] = f1;
|
||||
m.Single[2] = f2;
|
||||
m.Single[3] = f3;
|
||||
paramQueue.Enqueue(m);
|
||||
m.Write<float>(0, f0);
|
||||
m.Write<float>(1, f1);
|
||||
m.Write<float>(2, f2);
|
||||
m.Write<float>(3, f3);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(IntPtr p0, IntPtr p1)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt64[0] = (ulong)p0;
|
||||
m.UInt64[1] = (ulong)p1;
|
||||
paramQueue.Enqueue(m);
|
||||
m.Write<ulong>(0, (ulong)p0);
|
||||
m.Write<ulong>(1, (ulong)p1);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(IntPtr p)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt64[0] = (ulong)p;
|
||||
paramQueue.Enqueue(m);
|
||||
m.Write<ulong>(0, (ulong)p);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(glHandle handle)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt64[0] = (ulong)handle.valuePtr;
|
||||
paramQueue.Enqueue(m);
|
||||
m.Write<ulong>(0, (ulong)handle.valuePtr);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(glHandle handle, glHandle handle1)
|
||||
{
|
||||
M128 m = default;
|
||||
m.UInt64[0] = (ulong)handle.valuePtr;
|
||||
m.UInt64[1] = (ulong)handle1.valuePtr;
|
||||
paramQueue.Enqueue(m);
|
||||
m.Write<ulong>(0, (ulong)handle.valuePtr);
|
||||
m.Write<ulong>(1, (ulong)handle1.valuePtr);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(int i0)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Int32[0] = i0;
|
||||
paramQueue.Enqueue(m);
|
||||
m.Write<int>(0, i0);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(int i0, int i1)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Int32[0] = i0;
|
||||
m.Int32[1] = i1;
|
||||
paramQueue.Enqueue(m);
|
||||
m.Write<int>(0, i0);
|
||||
m.Write<int>(1, i1);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(int i0, int i1, int i2)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Int32[0] = i0;
|
||||
m.Int32[1] = i1;
|
||||
m.Int32[2] = i2;
|
||||
paramQueue.Enqueue(m);
|
||||
m.Write<int>(0, i0);
|
||||
m.Write<int>(1, i1);
|
||||
m.Write<int>(2, i2);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(int i0, int i1, int i2, int i3)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Int32[0] = i0;
|
||||
m.Int32[1] = i1;
|
||||
m.Int32[2] = i2;
|
||||
m.Int32[3] = i3;
|
||||
paramQueue.Enqueue(m);
|
||||
m.Write<int>(0, i0);
|
||||
m.Write<int>(1, i1);
|
||||
m.Write<int>(2, i2);
|
||||
m.Write<int>(3, i3);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out M128 m)
|
||||
public void Enqueue(string str)
|
||||
{
|
||||
paramQueue.TryDequeue(out m);
|
||||
byte[] code = Encoding.UTF8.GetBytes(str);
|
||||
streamQueue.Enqueue(glArrayHandle.Alloc<byte>(code));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue<T>(T[] array) where T : struct
|
||||
|
||||
{
|
||||
streamQueue.Enqueue(glArrayHandle.Alloc<T>(array));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out glArrayHandle arrayHandle)
|
||||
{
|
||||
glArrayHandle handle = default;
|
||||
if (streamQueue.TryDequeue(out handle))
|
||||
{
|
||||
arrayHandle = handle;
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool TryDequeue(out M128 m)
|
||||
{
|
||||
bool ret = paramQueue.TryDequeue(out m);
|
||||
_dequeueLog += $"{m.ToString(10)}\n";
|
||||
return ret;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out Vec4d v)
|
||||
{
|
||||
M128 m;
|
||||
if (paramQueue.TryDequeue(out m))
|
||||
if (this.TryDequeue(out m))
|
||||
{
|
||||
v = *(Vec4d*)&m;
|
||||
}
|
||||
@@ -175,13 +225,28 @@ namespace StgSharp.Logic
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue<T>(out T[] array)
|
||||
{
|
||||
glArrayHandle output = default;
|
||||
if (streamQueue.TryDequeue(out output))
|
||||
{
|
||||
array = output.copy as T[];
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out int i0)
|
||||
{
|
||||
M128 ret;
|
||||
if (paramQueue.TryDequeue(out ret))
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
i0 = ret.Int32[0];
|
||||
i0 = ret.Read<int>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -194,10 +259,10 @@ namespace StgSharp.Logic
|
||||
public void TryDequeue(out int i0, out int i1)
|
||||
{
|
||||
M128 ret;
|
||||
if (paramQueue.TryDequeue(out ret))
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
i0 = ret.Int32[0];
|
||||
i1 = ret.Int32[1];
|
||||
i0 = ret.Read<int>(0);
|
||||
i1 = ret.Read<int>(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -205,15 +270,16 @@ namespace StgSharp.Logic
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out int i0, out int i1, out int i2)
|
||||
{
|
||||
M128 ret;
|
||||
if (paramQueue.TryDequeue(out ret))
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
i0 = ret.Int32[0];
|
||||
i1 = ret.Int32[1];
|
||||
i2 = ret.Int32[2];
|
||||
i0 = ret.Read<int>(0);
|
||||
i1 = ret.Read<int>(1);
|
||||
i2 = ret.Read<int>(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -221,16 +287,17 @@ namespace StgSharp.Logic
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out int i0, out int i1, out int i2, out int i3)
|
||||
{
|
||||
M128 ret;
|
||||
if (paramQueue.TryDequeue(out ret))
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
i0 = ret.Int32[0];
|
||||
i1 = ret.Int32[1];
|
||||
i2 = ret.Int32[2];
|
||||
i3 = ret.Int32[3];
|
||||
i0 = ret.Read<int>(0);
|
||||
i1 = ret.Read<int>(1);
|
||||
i2 = ret.Read<int>(2);
|
||||
i3 = ret.Read<int>(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -243,9 +310,9 @@ namespace StgSharp.Logic
|
||||
public void TryDequeue(out IntPtr p)
|
||||
{
|
||||
M128 ret;
|
||||
if (paramQueue.TryDequeue(out ret))
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
p = (IntPtr)ret.UInt64[0];
|
||||
p = (IntPtr)ret.Read<ulong>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -257,12 +324,11 @@ namespace StgSharp.Logic
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out IntPtr p0, out IntPtr p1)
|
||||
{
|
||||
|
||||
M128 ret;
|
||||
if (paramQueue.TryDequeue(out ret))
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
p0 = (IntPtr)ret.UInt64[0];
|
||||
p1 = (IntPtr)ret.UInt64[1];
|
||||
p0 = (IntPtr)ret.Read<ulong>(0);
|
||||
p1 = (IntPtr)ret.Read<ulong>(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -275,12 +341,12 @@ namespace StgSharp.Logic
|
||||
public void TryDequeue(out float f0, out float f1, out float f2, out float f3)
|
||||
{
|
||||
M128 ret;
|
||||
if (paramQueue.TryDequeue(out ret))
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
f0 = ret.UInt32[0];
|
||||
f1 = ret.UInt32[1];
|
||||
f2 = ret.UInt32[2];
|
||||
f3 = ret.UInt32[3];
|
||||
f0 = ret.Read<uint>(0);
|
||||
f1 = ret.Read<uint>(1);
|
||||
f2 = ret.Read<uint>(2);
|
||||
f3 = ret.Read<uint>(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -293,11 +359,11 @@ namespace StgSharp.Logic
|
||||
public void TryDequeue(out float f0, out float f1, out float f2)
|
||||
{
|
||||
M128 ret;
|
||||
if (paramQueue.TryDequeue(out ret))
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
f0 = ret.UInt32[0];
|
||||
f1 = ret.UInt32[1];
|
||||
f2 = ret.UInt32[2];
|
||||
f0 = ret.Read<uint>(0);
|
||||
f1 = ret.Read<uint>(1);
|
||||
f2 = ret.Read<uint>(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -310,9 +376,9 @@ namespace StgSharp.Logic
|
||||
public void TryDequeue(out uint u0)
|
||||
{
|
||||
M128 ret;
|
||||
if (paramQueue.TryDequeue(out ret))
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
u0 = ret.UInt32[0];
|
||||
u0 = ret.Read<uint>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -325,10 +391,10 @@ namespace StgSharp.Logic
|
||||
public void TryDequeue(out uint u0, out uint u1)
|
||||
{
|
||||
M128 ret;
|
||||
if (paramQueue.TryDequeue(out ret))
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
u0 = ret.UInt32[0];
|
||||
u1 = ret.UInt32[1];
|
||||
u0 = ret.Read<uint>(0);
|
||||
u1 = ret.Read<uint>(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -341,11 +407,11 @@ namespace StgSharp.Logic
|
||||
public void TryDequeue(out uint u0, out uint u1, out uint u2)
|
||||
{
|
||||
M128 ret;
|
||||
if (paramQueue.TryDequeue(out ret))
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
u0 = ret.UInt32[0];
|
||||
u1 = ret.UInt32[1];
|
||||
u2 = ret.UInt32[2];
|
||||
u0 = ret.Read<uint>(0);
|
||||
u1 = ret.Read<uint>(1);
|
||||
u2 = ret.Read<uint>(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -358,12 +424,12 @@ namespace StgSharp.Logic
|
||||
public void TryDequeue(out uint u0, out uint u1, out uint u2, out uint u3)
|
||||
{
|
||||
M128 ret;
|
||||
if (paramQueue.TryDequeue(out ret))
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
u0 = ret.UInt32[0];
|
||||
u1 = ret.UInt32[1];
|
||||
u2 = ret.UInt32[2];
|
||||
u3 = ret.UInt32[3];
|
||||
u0 = ret.Read<uint>(0);
|
||||
u1 = ret.Read<uint>(1);
|
||||
u2 = ret.Read<uint>(2);
|
||||
u3 = ret.Read<uint>(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -376,6 +442,19 @@ namespace StgSharp.Logic
|
||||
{
|
||||
context = p;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
internal void TryDequeue(out Array array)
|
||||
{
|
||||
glArrayHandle output = default;
|
||||
if (streamQueue.TryDequeue(out output))
|
||||
{
|
||||
array = output.copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if NET5_0_OR_GREATER
|
||||
|
||||
using System.Runtime.Intrinsics;
|
||||
|
||||
#endif
|
||||
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 16)]
|
||||
public unsafe struct M128
|
||||
{
|
||||
[FieldOffset(0)] internal Vector4 vec;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public T Read<T>(int index) where T : struct
|
||||
{
|
||||
fixed (Vector4* p = &vec)
|
||||
return *((T*)(p) + index);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Write<T>(int index, T value) where T : struct
|
||||
{
|
||||
fixed (Vector4* p = &vec)
|
||||
*((T*)(p) + index) = value;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public string ToString(int sample)
|
||||
{
|
||||
string str = "";
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
str += $"{Convert.ToString(this.Read<byte>(i), sample)} ";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
#if NET5_0_OR_GREATER
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator Vector128<byte>(M128 m)
|
||||
{
|
||||
return Vector128.As<float, byte>(m.vec.AsVector128());
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator Vector128<sbyte>(M128 m)
|
||||
{
|
||||
return Vector128.As<float, sbyte>(m.vec.AsVector128());
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator Vector128<short>(M128 m)
|
||||
{
|
||||
return Vector128.As<float, short>(m.vec.AsVector128());
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator Vector128<ushort>(M128 m)
|
||||
{
|
||||
return Vector128.As<float, ushort>(m.vec.AsVector128());
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator Vector128<int>(M128 m)
|
||||
{
|
||||
return Vector128.As<float, int>(m.vec.AsVector128());
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator Vector128<uint>(M128 m)
|
||||
{
|
||||
return Vector128.As<float, uint>(m.vec.AsVector128());
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator Vector128<long>(M128 m)
|
||||
{
|
||||
return Vector128.As<float, long>(m.vec.AsVector128());
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator Vector128<ulong>(M128 m)
|
||||
{
|
||||
return Vector128.As<float, ulong>(m.vec.AsVector128());
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator Vector128<float>(M128 m)
|
||||
{
|
||||
return Vector128.As<float, float>(m.vec.AsVector128());
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator Vector128<double>(M128 m)
|
||||
{
|
||||
return Vector128.As<float, double>(m.vec.AsVector128());
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,15 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Size = 7*4*sizeof(float)+ sizeof(bool),Pack =16 )]
|
||||
[StructLayout(LayoutKind.Explicit, Size = 7 * 4 * sizeof(float) + sizeof(bool), Pack = 16)]
|
||||
public struct Matrix4x3 : IEquatable<Matrix4x3>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
internal Mat3 mat;
|
||||
|
||||
[FieldOffset(3 * 4 * sizeof(float))]
|
||||
internal Mat4 transpose;
|
||||
|
||||
[FieldOffset(7 * 4 * sizeof(float))]
|
||||
internal bool isTransposed;
|
||||
|
||||
@@ -62,7 +64,6 @@ namespace StgSharp.Math
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
if (rowNum > 3 || rowNum < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(columNum));
|
||||
@@ -92,7 +93,6 @@ namespace StgSharp.Math
|
||||
fixed (Mat4* target = &this.transpose)
|
||||
{
|
||||
InternalIO.Transpose3to4_internal(source, target);
|
||||
|
||||
}
|
||||
isTransposed = true;
|
||||
}
|
||||
@@ -108,7 +108,6 @@ namespace StgSharp.Math
|
||||
return EqualityComparer<Mat3>.Default.Equals(mat, other.mat);
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Matrix4x3 operator +(Matrix4x3 left, Matrix4x3 right)
|
||||
{
|
||||
@@ -127,7 +126,6 @@ namespace StgSharp.Math
|
||||
left.mat.colum1 - right.mat.colum1,
|
||||
left.mat.colum2 - right.mat.colum2
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public static bool operator ==(Matrix4x3 left, Matrix4x3 right)
|
||||
@@ -159,7 +157,7 @@ namespace StgSharp.Math
|
||||
mat.mat.colum2 / value
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Matrix4x2 operator *(Matrix4x3 left, Matrix3x2 right)
|
||||
{
|
||||
@@ -167,19 +165,19 @@ namespace StgSharp.Math
|
||||
return new Matrix4x2(
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum1),
|
||||
|
||||
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum1),
|
||||
|
||||
|
||||
Vector4.Dot(left.transpose.colum2, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum2, right.mat.colum1),
|
||||
|
||||
|
||||
Vector4.Dot(left.transpose.colum3, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum3, right.mat.colum1)
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Matrix4x3 operator *(Matrix4x3 left, Matrix3x3 right)
|
||||
{
|
||||
@@ -223,7 +221,7 @@ namespace StgSharp.Math
|
||||
Vector4.Dot(left.transpose.colum2, right.mat.colum1),
|
||||
Vector4.Dot(left.transpose.colum2, right.mat.colum2),
|
||||
Vector4.Dot(left.transpose.colum2, right.mat.colum3),
|
||||
|
||||
|
||||
Vector4.Dot(left.transpose.colum3, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum3, right.mat.colum1),
|
||||
Vector4.Dot(left.transpose.colum3, right.mat.colum2),
|
||||
@@ -240,8 +238,5 @@ namespace StgSharp.Math
|
||||
mat.colum2.GetHashCode()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using StgSharp.Controlling;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Data.Common;
|
||||
using System.Numerics;
|
||||
@@ -7,23 +8,6 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public unsafe struct M128
|
||||
{
|
||||
[FieldOffset(0)] internal fixed float Single[4];
|
||||
[FieldOffset(0)] internal fixed double Double[2];
|
||||
|
||||
[FieldOffset(0)] internal fixed sbyte Int8[16];
|
||||
[FieldOffset(0)] internal fixed short Int16[8];
|
||||
[FieldOffset(0)] internal fixed int Int32[4];
|
||||
[FieldOffset(0)] internal fixed long Int64[2];
|
||||
|
||||
[FieldOffset(0)] internal fixed byte UInt8[16];
|
||||
[FieldOffset(0)] internal fixed ushort UInt16[8];
|
||||
[FieldOffset(0)] internal fixed uint UInt32[4];
|
||||
[FieldOffset(0)] internal fixed ulong UInt64[2];
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
|
||||
public struct Vec4d
|
||||
{
|
||||
@@ -35,7 +19,6 @@ namespace StgSharp.Math
|
||||
[FieldOffset(8)] public float Z;
|
||||
[FieldOffset(12)] public float W;
|
||||
|
||||
|
||||
public Vec4d(float x, float y, float z, float w)
|
||||
{
|
||||
vec = new Vector4(x, y, z, w);
|
||||
@@ -46,4 +29,4 @@ namespace StgSharp.Math
|
||||
return vec.reg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -204,7 +204,7 @@
|
||||
<member name="T:StgSharp.Graphics.ElementBuffer">
|
||||
<summary>
|
||||
A collecion of handle to Element Buffer Object in OpenGL.
|
||||
Each <see langword="int"/> value indexed from instance of this class this
|
||||
Each <see langword="uint"/> value indexed from instance of this class this
|
||||
is the only handle to one Element Buffer Object.
|
||||
</summary>
|
||||
</member>
|
||||
@@ -234,9 +234,9 @@
|
||||
<param name="usage">How OpenGL use these data, defined by <see cref="T:StgSharp.Graphics.BufferUsage"/></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.VertexBuffer.Unbind">
|
||||
<summary>
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glManager.LoadGLapi(StgSharp.Graphics.Form,StgSharp.Graphics.GLfuncLoader)">
|
||||
<summary>
|
||||
@@ -252,18 +252,37 @@
|
||||
<param name="name">Name of the OpenGL api</param>
|
||||
<returns>The funtion pointer of the api in form of <see cref="T:System.IntPtr"/></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Shader.Compile(System.String[])">
|
||||
<member name="T:StgSharp.Graphics.glHandle">
|
||||
<summary>
|
||||
Compile the vertex shader to be attached to this shader.
|
||||
A handle to an OpenGL object,
|
||||
must be indexed from a <see cref="T:StgSharp.Graphics.glHandleSet"/>.
|
||||
Direct call will cause <see langword="InvalidOperationException"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.glHandleSet">
|
||||
<summary>
|
||||
A handle to an OpenGL object.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glHandleSet.Free">
|
||||
<summary>
|
||||
temporarily release the handle of GLhandle sets.
|
||||
Please call <see cref="M:StgSharp.Graphics.glHandleSet.Pin"/> method before indexing.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glHandleSet.Release">
|
||||
<summary>
|
||||
Realse all resource in this handle.
|
||||
This will release all resource in this <see cref="T:StgSharp.Graphics.glHandle"/>.
|
||||
This <see langword="glHandle"/> will be not usable.
|
||||
</summary>
|
||||
<param name="code">GLSL code of vertex shader.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Shader.AttachTo(System.Int32,StgSharp.Graphics.ShaderProgram)">
|
||||
<summary>
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<param name="target"></param>
|
||||
<param name="index"></param>
|
||||
</summary>
|
||||
<param name="target"></param>
|
||||
<param name="index"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.ShaderProgram.#ctor(StgSharp.Graphics.IglFunc)">
|
||||
<summary>
|
||||
@@ -277,24 +296,24 @@
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.ShaderProgram.GetUniform``1(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param name="name">Name of the Uniform in shader code</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.ShaderProgram.GetUniform``2(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param name="name">Name of the Uniform in shader code</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.ShaderProgram.GetUniform``3(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param name="name">Name of the Uniform in shader code</param>
|
||||
<returns></returns>
|
||||
@@ -332,7 +351,7 @@
|
||||
<param name="form">The form used as frame update benchmark.</param>
|
||||
<exception cref="T:System.InvalidOperationException">More than one alingment attached to one form timer</exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.AttachShader(System.glHandle,System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.AttachShader(StgSharp.Graphics.glHandle,StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Same fucntion as OpenGL api glAttachShader.
|
||||
Only the first <see href="shader"/> in handle
|
||||
@@ -342,21 +361,21 @@
|
||||
<param name="program">Shader program to be attachec</param>
|
||||
<param name="shader">A shader part to attach</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.BindBuffer(StgSharp.Graphics.BufferType,System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.BindBuffer(StgSharp.Graphics.BufferType,StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Bind the indexed buffer object to certain type of buffer
|
||||
</summary>
|
||||
<param name="bufferType"></param>
|
||||
<param name="handle"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.BindTexture(System.UInt32,System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.BindTexture(System.UInt32,StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Same function as OpenGL api, glBindTexture.
|
||||
</summary>
|
||||
<param name="type">Type of texture to bind</param>
|
||||
<param name="texture">Sign of texture</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.BindVertexArray(System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.BindVertexArray(StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Same function as OpenGL api, glBindVertexArray
|
||||
</summary>
|
||||
@@ -379,15 +398,6 @@
|
||||
<param name="B">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="A">Specify the red values used when the color buffers are cleared.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.CompileShader(StgSharp.Graphics.ShaderType,System.String[])">
|
||||
<summary>
|
||||
Conpile the provided shader code in string form.
|
||||
</summary>
|
||||
<param name="shaderCodeArray">A string array contains all shaders' code</param>
|
||||
<param name="shaderType">An <see cref="T:StgSharp.Graphics.ShaderType"/> enum represent the type of the shader to
|
||||
conpile, including vertex shader and fragment shader.</param>
|
||||
<returns>An handle of conpiled shader</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.CreateProgram">
|
||||
<summary>
|
||||
Same function as OpenGL api, glCreateProgram
|
||||
@@ -412,19 +422,19 @@
|
||||
<param name="share"></param>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.DeleteBuffer(System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.DeleteBuffer(StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Same function as OpenGL api, glDeleteBuffer. This method can delete one buffer in one call
|
||||
</summary>
|
||||
<param name="handle">a handle representing the buffer to be deleted</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.DeleteBuffers(System.glHandleSet)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.DeleteBuffers(StgSharp.Graphics.glHandleSet)">
|
||||
<summary>
|
||||
Same function as OpenGL api, glDeleteBuffer. This method can delete a sets of buffers in one call.
|
||||
</summary>
|
||||
<param name="handleSet">Array of buffers to be deleted</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.DeleteVertexArrays(System.glHandleSet)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.DeleteVertexArrays(StgSharp.Graphics.glHandleSet)">
|
||||
<summary>
|
||||
Same function as OpenGL api, glDeleteVertexArrays
|
||||
</summary>
|
||||
@@ -458,7 +468,7 @@
|
||||
</summary>
|
||||
<param name="count">Amount of vao to be generated</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.GetUniformLocation(System.glHandle,System.String)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.GetUniformLocation(StgSharp.Graphics.glHandle,System.String)">
|
||||
<summary>
|
||||
Same fucntion as OpenGL api, glGetUniformLocation
|
||||
</summary>
|
||||
@@ -545,7 +555,7 @@
|
||||
<param name="stride">Pixels stride of each sets of data</param>
|
||||
<param name="pointer"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.TextureImage2d``1(System.Int32,System.Int32,System.UInt32,System.UInt32,System.UInt32,System.UInt32,System.UInt32,System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.TextureImage2d``1(System.Int32,System.Int32,System.UInt32,System.UInt32,System.UInt32,System.UInt32,System.UInt32,StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Same function as OpenGL api glTexImage2d
|
||||
</summary>
|
||||
@@ -566,7 +576,7 @@
|
||||
<param name="pname">name of parameter</param>
|
||||
<param name="param">value of parameter</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.UseProgram(System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.UseProgram(StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Same fucntion as OpenGL api glUseShader.
|
||||
</summary>
|
||||
@@ -905,31 +915,6 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:System.glHandle">
|
||||
<summary>
|
||||
A handle to an OpenGL object,
|
||||
must be indexed from a <see cref="T:System.glHandleSet"/>.
|
||||
Direct call will cause <see langword="InvalidOperationException"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:System.glHandleSet">
|
||||
<summary>
|
||||
A handle to an OpenGL object.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:System.glHandleSet.Free">
|
||||
<summary>
|
||||
temporarily release the handle of GLhandle sets.
|
||||
Please call <see cref="M:System.glHandleSet.Pin"/> method before indexing.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:System.glHandleSet.Release">
|
||||
<summary>
|
||||
Realse all resource in this handle.
|
||||
This will release all resource in this <see cref="T:System.glHandle"/>.
|
||||
This <see langword="glHandle"/> will be not usable.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Windows.Win32.Foundation.COLORREF">
|
||||
<summary>The COLORREF value is used to specify an RGB color.</summary>
|
||||
<remarks>
|
||||
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a2241a5a5816a9438c63e3ca3c69313e6f2e8f56")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1f2fca4c8fe323daf9751677ccfdf0f7b04a9be8")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
457b2788dd58b1c0006f9a671fa39abf8ac3de9589c64a4bb867c6c39b05c04c
|
||||
acdc10c0e1b1a3f1b82b38920dec1e26dd82a6bdfd91a17620bc677a983bc21d
|
||||
|
||||
@@ -1 +1 @@
|
||||
0437f6196a65a1b8aa683720932b3cb8cb17e7d708c883c23def372b98154e31
|
||||
1a8e1802d5a508dcd983ae4f5d79408adb0743ed41648884055a8a411bac563f
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\Debug\netstandard2.1\StgSharp.deps.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\Debug\netstandard2.1\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\Debug\netstandard2.1\StgSharp.xml
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.csproj.AssemblyReference.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.GeneratedMSBuildEditorConfig.editorconfig
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.AssemblyInfoInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.AssemblyInfo.cs
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.csproj.CoreCompileInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.sourcelink.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\Debug\netstandard2.1\StgSharp.deps.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\Debug\netstandard2.1\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\Debug\netstandard2.1\StgSharp.xml
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\refint\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.xml
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/a2241a5a5816a9438c63e3ca3c69313e6f2e8f56/*"}}
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/1f2fca4c8fe323daf9751677ccfdf0f7b04a9be8/*"}}
|
||||
@@ -204,7 +204,7 @@
|
||||
<member name="T:StgSharp.Graphics.ElementBuffer">
|
||||
<summary>
|
||||
A collecion of handle to Element Buffer Object in OpenGL.
|
||||
Each <see langword="int"/> value indexed from instance of this class this
|
||||
Each <see langword="uint"/> value indexed from instance of this class this
|
||||
is the only handle to one Element Buffer Object.
|
||||
</summary>
|
||||
</member>
|
||||
@@ -234,9 +234,9 @@
|
||||
<param name="usage">How OpenGL use these data, defined by <see cref="T:StgSharp.Graphics.BufferUsage"/></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.VertexBuffer.Unbind">
|
||||
<summary>
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glManager.LoadGLapi(StgSharp.Graphics.Form,StgSharp.Graphics.GLfuncLoader)">
|
||||
<summary>
|
||||
@@ -252,18 +252,37 @@
|
||||
<param name="name">Name of the OpenGL api</param>
|
||||
<returns>The funtion pointer of the api in form of <see cref="T:System.IntPtr"/></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Shader.Compile(System.String[])">
|
||||
<member name="T:StgSharp.Graphics.glHandle">
|
||||
<summary>
|
||||
Compile the vertex shader to be attached to this shader.
|
||||
A handle to an OpenGL object,
|
||||
must be indexed from a <see cref="T:StgSharp.Graphics.glHandleSet"/>.
|
||||
Direct call will cause <see langword="InvalidOperationException"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.glHandleSet">
|
||||
<summary>
|
||||
A handle to an OpenGL object.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glHandleSet.Free">
|
||||
<summary>
|
||||
temporarily release the handle of GLhandle sets.
|
||||
Please call <see cref="M:StgSharp.Graphics.glHandleSet.Pin"/> method before indexing.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glHandleSet.Release">
|
||||
<summary>
|
||||
Realse all resource in this handle.
|
||||
This will release all resource in this <see cref="T:StgSharp.Graphics.glHandle"/>.
|
||||
This <see langword="glHandle"/> will be not usable.
|
||||
</summary>
|
||||
<param name="code">GLSL code of vertex shader.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Shader.AttachTo(System.Int32,StgSharp.Graphics.ShaderProgram)">
|
||||
<summary>
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<param name="target"></param>
|
||||
<param name="index"></param>
|
||||
</summary>
|
||||
<param name="target"></param>
|
||||
<param name="index"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.ShaderProgram.#ctor(StgSharp.Graphics.IglFunc)">
|
||||
<summary>
|
||||
@@ -277,24 +296,24 @@
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.ShaderProgram.GetUniform``1(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param name="name">Name of the Uniform in shader code</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.ShaderProgram.GetUniform``2(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param name="name">Name of the Uniform in shader code</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.ShaderProgram.GetUniform``3(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param name="name">Name of the Uniform in shader code</param>
|
||||
<returns></returns>
|
||||
@@ -332,7 +351,7 @@
|
||||
<param name="form">The form used as frame update benchmark.</param>
|
||||
<exception cref="T:System.InvalidOperationException">More than one alingment attached to one form timer</exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.AttachShader(System.glHandle,System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.AttachShader(StgSharp.Graphics.glHandle,StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Same fucntion as OpenGL api glAttachShader.
|
||||
Only the first <see href="shader"/> in handle
|
||||
@@ -342,21 +361,21 @@
|
||||
<param name="program">Shader program to be attachec</param>
|
||||
<param name="shader">A shader part to attach</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.BindBuffer(StgSharp.Graphics.BufferType,System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.BindBuffer(StgSharp.Graphics.BufferType,StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Bind the indexed buffer object to certain type of buffer
|
||||
</summary>
|
||||
<param name="bufferType"></param>
|
||||
<param name="handle"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.BindTexture(System.UInt32,System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.BindTexture(System.UInt32,StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Same function as OpenGL api, glBindTexture.
|
||||
</summary>
|
||||
<param name="type">Type of texture to bind</param>
|
||||
<param name="texture">Sign of texture</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.BindVertexArray(System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.BindVertexArray(StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Same function as OpenGL api, glBindVertexArray
|
||||
</summary>
|
||||
@@ -379,15 +398,6 @@
|
||||
<param name="B">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="A">Specify the red values used when the color buffers are cleared.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.CompileShader(StgSharp.Graphics.ShaderType,System.String[])">
|
||||
<summary>
|
||||
Conpile the provided shader code in string form.
|
||||
</summary>
|
||||
<param name="shaderCodeArray">A string array contains all shaders' code</param>
|
||||
<param name="shaderType">An <see cref="T:StgSharp.Graphics.ShaderType"/> enum represent the type of the shader to
|
||||
conpile, including vertex shader and fragment shader.</param>
|
||||
<returns>An handle of conpiled shader</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.CreateProgram">
|
||||
<summary>
|
||||
Same function as OpenGL api, glCreateProgram
|
||||
@@ -412,19 +422,19 @@
|
||||
<param name="share"></param>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.DeleteBuffer(System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.DeleteBuffer(StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Same function as OpenGL api, glDeleteBuffer. This method can delete one buffer in one call
|
||||
</summary>
|
||||
<param name="handle">a handle representing the buffer to be deleted</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.DeleteBuffers(System.glHandleSet)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.DeleteBuffers(StgSharp.Graphics.glHandleSet)">
|
||||
<summary>
|
||||
Same function as OpenGL api, glDeleteBuffer. This method can delete a sets of buffers in one call.
|
||||
</summary>
|
||||
<param name="handleSet">Array of buffers to be deleted</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.DeleteVertexArrays(System.glHandleSet)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.DeleteVertexArrays(StgSharp.Graphics.glHandleSet)">
|
||||
<summary>
|
||||
Same function as OpenGL api, glDeleteVertexArrays
|
||||
</summary>
|
||||
@@ -458,7 +468,7 @@
|
||||
</summary>
|
||||
<param name="count">Amount of vao to be generated</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.GetUniformLocation(System.glHandle,System.String)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.GetUniformLocation(StgSharp.Graphics.glHandle,System.String)">
|
||||
<summary>
|
||||
Same fucntion as OpenGL api, glGetUniformLocation
|
||||
</summary>
|
||||
@@ -545,7 +555,7 @@
|
||||
<param name="stride">Pixels stride of each sets of data</param>
|
||||
<param name="pointer"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.TextureImage2d``1(System.Int32,System.Int32,System.UInt32,System.UInt32,System.UInt32,System.UInt32,System.UInt32,System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.TextureImage2d``1(System.Int32,System.Int32,System.UInt32,System.UInt32,System.UInt32,System.UInt32,System.UInt32,StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Same function as OpenGL api glTexImage2d
|
||||
</summary>
|
||||
@@ -566,7 +576,7 @@
|
||||
<param name="pname">name of parameter</param>
|
||||
<param name="param">value of parameter</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.IglFunc.UseProgram(System.glHandle)">
|
||||
<member name="M:StgSharp.Graphics.IglFunc.UseProgram(StgSharp.Graphics.glHandle)">
|
||||
<summary>
|
||||
Same fucntion as OpenGL api glUseShader.
|
||||
</summary>
|
||||
@@ -905,31 +915,6 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:System.glHandle">
|
||||
<summary>
|
||||
A handle to an OpenGL object,
|
||||
must be indexed from a <see cref="T:System.glHandleSet"/>.
|
||||
Direct call will cause <see langword="InvalidOperationException"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:System.glHandleSet">
|
||||
<summary>
|
||||
A handle to an OpenGL object.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:System.glHandleSet.Free">
|
||||
<summary>
|
||||
temporarily release the handle of GLhandle sets.
|
||||
Please call <see cref="M:System.glHandleSet.Pin"/> method before indexing.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:System.glHandleSet.Release">
|
||||
<summary>
|
||||
Realse all resource in this handle.
|
||||
This will release all resource in this <see cref="T:System.glHandle"/>.
|
||||
This <see langword="glHandle"/> will be not usable.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Windows.Win32.Foundation.COLORREF">
|
||||
<summary>The COLORREF value is used to specify an RGB color.</summary>
|
||||
<remarks>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user