daily update on 20240213 by nitload youmu. 逐步弃用GLFW,正在使用wgl重写glfw底层,相关实现转移到C#实现,SSC彻底变成线性代数计算器。
This commit is contained in:
@@ -17,25 +17,24 @@ namespace StgSharp
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "linkShaderProgram",
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern uint InternalLinkShaderProgram(uint shaderProgram);
|
||||
internal static extern unsafe uint InternalLinkShaderProgram(GLcontext* context, uint shaderProgram);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "loadShaderCode",
|
||||
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
internal static extern unsafe uint InternalLoadShaderCode(byte* shaderCode, int shaderType);
|
||||
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "setCurrentGLContext",
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe void InternalSetCurrentGLContext(IntPtr windowID, GLcontext* context);
|
||||
internal static extern unsafe uint InternalLoadShaderCode(GLcontext* context, byte* shaderCode, int shaderType);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "readLog",
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe IntPtr InternalReadLog();
|
||||
internal static extern unsafe IntPtr InternalReadSSCLog();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "loadImageData",
|
||||
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
internal static extern unsafe void InternalLoadImage(string fileName, Image.ImageInfo* output, ImageLoader loader);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "unloadImageData",
|
||||
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
internal static extern unsafe void InternalUnloadImage(Image.ImageInfo* output);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -53,7 +52,6 @@ namespace StgSharp.Graphics
|
||||
|
||||
#region glapi
|
||||
|
||||
|
||||
internal unsafe delegate*<uint, GLfixed, void> glAccumxOES;
|
||||
internal unsafe delegate*<uint, ulong, uint, bool> glAcquireKeyedMutexWin32EXT;
|
||||
internal unsafe delegate*<uint, void> glActiveProgramEXT;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Foundation;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
@@ -16,7 +19,20 @@ namespace StgSharp
|
||||
InfoWarning,
|
||||
}
|
||||
|
||||
internal class LibHandle : SafeHandle
|
||||
{
|
||||
|
||||
public LibHandle(IntPtr invalidHandleValue, bool ownsHandle) : base(invalidHandleValue, ownsHandle)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool IsInvalid => throw new NotImplementedException();
|
||||
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
return PInvoke.FreeLibrary(new HMODULE(handle));
|
||||
}
|
||||
}
|
||||
|
||||
internal static unsafe partial class InternalIO
|
||||
{
|
||||
@@ -42,11 +58,16 @@ namespace StgSharp
|
||||
GLtype.Add(TypeCode.Byte, GLconst.UNSIGNED_BYTE);
|
||||
}
|
||||
|
||||
internal static T InternalLoadProc<T>(IntPtr libPtr, string name) where T : Delegate
|
||||
internal static T InternalLoadProc<T>(LibHandle lib, string name) where T : Delegate
|
||||
{
|
||||
try
|
||||
{
|
||||
IntPtr procPtr = InternalGetWINproc(libPtr, name);
|
||||
IntPtr procPtr =
|
||||
#if Windows
|
||||
PInvoke.GetProcAddress(lib, name);
|
||||
#elif Linux
|
||||
|
||||
#endif
|
||||
T ret = Marshal.GetDelegateForFunctionPointer<T>(procPtr);
|
||||
return ret;
|
||||
}
|
||||
@@ -70,17 +91,6 @@ namespace StgSharp
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("kernal32.dll", EntryPoint = "FreeLibrary",
|
||||
CharSet = CharSet.Ansi)]
|
||||
internal extern static IntPtr InternalFreeWINlib(IntPtr libPtr);
|
||||
|
||||
[DllImport("kernel32.dll", EntryPoint = "GetPeocAddress",
|
||||
CharSet = CharSet.Ansi)]
|
||||
internal extern static IntPtr InternalGetWINproc(IntPtr libPtr, string procName);
|
||||
|
||||
[DllImport("kernel32.dll", EntryPoint = "LoadLibrary",
|
||||
CharSet = CharSet.Ansi)]
|
||||
internal extern static IntPtr InternalLoadWINlib(string name);
|
||||
|
||||
internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user