daily update on 20240207 by nitload youmu

This commit is contained in:
Nitload
2024-02-07 13:47:12 +08:00
parent 8548757bbf
commit 6fe6b3b3cf
37 changed files with 231 additions and 196 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
+8 -24
View File
@@ -14,32 +14,16 @@ namespace BenchMark
static void Main(string[] args) static void Main(string[] args)
{ {
Calculator c = new Calculator(); uint[] array = new uint[] { 0, 10, 2, 3 };
c.PtrSub();
var sum = BenchmarkRunner.Run(typeof(Calculator).Assembly); fixed (uint* ptr = array)
{
IntPtr p = (IntPtr)ptr;
Console.WriteLine(*((uint*)p + 1));
}
} }
} }
public struct Calculator
{
public static int Sub(int left, int right)
{
return left - right;
}
[Benchmark]
public unsafe void DeleSub()
{
Func<int, int, int> SubDele = Sub;
SubDele(1, 0);
}
[Benchmark]
public unsafe void PtrSub()
{
delegate*<int, int, int> SubPtr = &Sub;
SubPtr(1, 0);
}
}
} }
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("BenchMark")] [assembly: System.Reflection.AssemblyCompanyAttribute("BenchMark")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5d778e0f2f6e677453cebc990919697968c771f9")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8548757bbf17cb04ef554babef5b140fd02c1f53")]
[assembly: System.Reflection.AssemblyProductAttribute("BenchMark")] [assembly: System.Reflection.AssemblyProductAttribute("BenchMark")]
[assembly: System.Reflection.AssemblyTitleAttribute("BenchMark")] [assembly: System.Reflection.AssemblyTitleAttribute("BenchMark")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
a69f4baa1be073def38e9acf0067382f3fca5213a8a52e99918a4b8263c622a4 82cb96ae7382da519b6703c815654474e1b0440eedcbbdfb523d786d8786efff
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/5d778e0f2f6e677453cebc990919697968c771f9/*"}} {"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/8548757bbf17cb04ef554babef5b140fd02c1f53/*"}}
Binary file not shown.
@@ -13,13 +13,13 @@ namespace StgSharp.Graphics
public unsafe class Texture public unsafe class Texture
{ {
internal static bool[] unitActivated = new bool[16]; internal static bool[] unitActivated = new bool[16];
internal glHandle _textureHandle; internal glHandleSet _textureHandle;
internal Image[] sourceList; internal Image[] sourceList;
private IglFunc GL; private IglFunc GL;
internal Texture(uint n, IglFunc gl) internal Texture(uint n, IglFunc gl)
{ {
_textureHandle = new glHandle((int)n); _textureHandle = new glHandleSet((int)n);
sourceList = new Image[n]; sourceList = new Image[n];
GL = gl; GL = gl;
GL.GenTextures(n, _textureHandle); GL.GenTextures(n, _textureHandle);
+42 -3
View File
@@ -21,20 +21,57 @@ namespace System
public unsafe struct glHandle public unsafe struct glHandle
{ {
internal uint* valuePtr; internal uint* valuePtr;
internal glHandleSet source;
public glHandle() public glHandle()
{ {
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
internal glHandle(uint* val) public static glHandle Alloc(uint value)
{ {
glHandle ret = default;
ret.source = new glHandleSet(1);
*ret.valuePtr = value;
return ret;
}
internal glHandle(uint* val, glHandleSet set)
{
source = set;
valuePtr = val; valuePtr = val;
} }
public IntPtr Handle
{
get
{
if (source.handle == (uint*)0)
{
throw new InvalidOperationException($"Handle set {nameof(source)} is not pinned.");
}
return (IntPtr)valuePtr;
}
}
public uint Value public uint Value
{ {
get { return *valuePtr; } get
{
if (source.handle == (uint*)0)
{
throw new InvalidOperationException($"Handle set {nameof(source)} is not pinned.");
}
return *valuePtr;
}
set
{
if (source.handle == (uint*)0)
{
throw new InvalidOperationException($"Handle set {nameof(source)} is not pinned.");
}
*valuePtr = value;
}
} }
} }
@@ -56,10 +93,11 @@ namespace System
{ {
throw new IndexOutOfRangeException(); throw new IndexOutOfRangeException();
} }
return new glHandle(handle + index); return new glHandle(handle + index, this);
} }
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetValue(int index, uint value) public void SetValue(int index, uint value)
{ {
@@ -85,6 +123,7 @@ namespace System
} }
GCHandle h = GCHandle.FromIntPtr((IntPtr)handle); GCHandle h = GCHandle.FromIntPtr((IntPtr)handle);
h.Free(); h.Free();
handle = (uint*)0;
} }
public void Pin() public void Pin()
+50 -37
View File
@@ -52,12 +52,13 @@ namespace StgSharp.Graphics
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.AttachShader(glHandle program, glHandle shader) void IglFunc.AttachShader(glHandle program, glHandle shader)
{ {
api->glAttachShader(program.value, shader.value); api->glAttachShader(*program.valuePtr, *shader.valuePtr);
} }
void IglFunc.BindBuffer(BufferType bufferType, uint index) [MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.BindBuffer(BufferType bufferType, glHandle handle)
{ {
api->glBindBuffer((uint)bufferType, index); api->glBindBuffer((uint)bufferType, *handle.valuePtr);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -67,9 +68,9 @@ namespace StgSharp.Graphics
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.BindVertexArray(uint index) void IglFunc.BindVertexArray(glHandle handle)
{ {
api->glBindVertexArray(index); api->glBindVertexArray(handle.Value);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -90,61 +91,73 @@ namespace StgSharp.Graphics
while (api->glGetError() != 0) { } while (api->glGetError() != 0) { }
} }
glHandle IglFunc.CompileShader(string shaderCode, ShaderType shaderType) glHandleSet IglFunc.CompileShader(ShaderType shaderType, params string[] shaderCodeArray)
{ {
uint shaderID; int l = shaderCodeArray.Length;
shaderCode += '\0'; if (l == 0)
shaderID = InternalIO.InternalLoadShaderCode(shaderCode, (int)shaderType);
if (shaderID == 0) //compile error handler
{ {
IntPtr logPtr = InternalIO.InternalReadLog(); throw new ArgumentException("At least one pice of code is required.");
string log; }
try glHandleSet handleSet = new glHandleSet(l);
for (int i = 0; i < l; i++)
{
uint shaderID;
byte[] data = Encoding.UTF8.GetBytes(shaderCodeArray[i] + '\0');
fixed (byte* codePtr = data)
{ {
byte[] logByte = new byte[512]; shaderID = InternalIO.InternalLoadShaderCode(codePtr, (int)shaderType);
Marshal.Copy(logPtr, logByte, 0, 512); }
log = Encoding.UTF8.GetString(logByte); if (shaderID == 0) //compile error handler
log = log.Replace("\0", ""); {
IntPtr logPtr = InternalIO.InternalReadLog();
bool isUseful = false; string log;
foreach (char item in log) try
{ {
if (!char.IsControl(item)) 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)
{ {
isUseful = true; break; if (!char.IsControl(item))
{
isUseful = true; break;
}
}
if (!isUseful)
{
throw new Exception();
} }
} }
if (!isUseful) catch (Exception)
{ {
throw new Exception(); log = "Failed to compile shader.\n" +
"Failed to get GLSL compiler log";
} }
}
catch (Exception)
{
log = "Failed to compile shader.\n" +
"Failed to get GLSL compiler log";
}
InternalIO.InternalWriteLog(log, LogType.Error); InternalIO.InternalWriteLog(log, LogType.Error);
}
handleSet.SetValue(i, shaderID);
} }
return new glHandle(shaderID); return handleSet;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
glHandle IglFunc.CreateProgram() glHandle IglFunc.CreateProgram()
{ {
return new glHandle(api->glCreateProgram()); return glHandle.Alloc(api->glCreateProgram());
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
unsafe glHandleSet IglFunc.CreateProgram(int count) unsafe glHandleSet IglFunc.CreateProgram(int count)
{ {
glHandleSet h = new glHandleSet(count); glHandleSet h = new glHandleSet(count);
glHandle* p = h.handle;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
*(p + i) = api->glCreateProgram(); h.SetValue(i, api->glCreateProgram());
} }
return h; return h;
} }
@@ -178,7 +191,7 @@ namespace StgSharp.Graphics
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
unsafe glHandle IglFunc.CreatGraphicProgram() unsafe glHandle IglFunc.CreatGraphicProgram()
{ {
return new glHandle(api->glCreateProgram()); return glHandle.Alloc(api->glCreateProgram());
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -260,7 +273,7 @@ namespace StgSharp.Graphics
} }
catch (Exception ex) catch (Exception ex)
{ {
/* /**/
InternalIO.InternalWriteLog( InternalIO.InternalWriteLog(
error + ex.StackTrace, error + ex.StackTrace,
LogType.Error LogType.Error
@@ -27,11 +27,11 @@ namespace StgSharp.Graphics
void IglFunc.AttachShader(glHandle program, glHandle shader) => throw signal; void IglFunc.AttachShader(glHandle program, glHandle shader) => throw signal;
void IglFunc.BindBuffer(BufferType bufferType, uint index) => throw signal; void IglFunc.BindBuffer(BufferType bufferType, glHandle handle) => throw signal;
void IglFunc.BindTexture(uint type, uint texture) => throw signal; void IglFunc.BindTexture(uint type, uint texture) => throw signal;
void IglFunc.BindVertexArray(uint index) => throw signal; void IglFunc.BindVertexArray(glHandle handle) => throw signal;
void IglFunc.Clear(MaskBufferBit mask) => throw signal; void IglFunc.Clear(MaskBufferBit mask) => throw signal;
@@ -51,7 +51,7 @@ namespace StgSharp.Graphics
glHandle IglFunc.CreatGraphicProgram() => throw signal; glHandle IglFunc.CreatGraphicProgram() => throw signal;
public void DeleteBuffer(uint handle) => throw signal; void IglFunc.DeleteBuffer(glHandle handle) => throw signal;
void IglFunc.DeleteBuffers(glHandleSet handle) => throw signal; void IglFunc.DeleteBuffers(glHandleSet handle) => throw signal;
+37 -48
View File
@@ -67,40 +67,39 @@ namespace StgSharp.Graphics
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.BindBuffer(BufferType bufferType, uint index) void IglFunc.BindBuffer(BufferType bufferType, glHandle handle)
{ {
paramQueue.Enqueue((uint)bufferType, index); M128 m = default;
glActionQueue.Enqueue(BindBufferPtr m.UInt32[0] = (uint)bufferType;
); m.IntPtr1 = handle.Handle;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(BindBufferPtr);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.BindTexture(uint type, uint texture) void IglFunc.BindTexture(uint type, uint texture)
{ {
glActionQueue.Enqueue( paramQueue.Enqueue(type, texture);
() => api->glBindTexture((uint)type, texture) glActionQueue.Enqueue(BindTexturePtr);
);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.BindVertexArray(uint index) void IglFunc.BindVertexArray(glHandle index)
{ {
glActionQueue.Enqueue( paramQueue.Enqueue(index);
() => api->glBindVertexArray((uint)index) glActionQueue.Enqueue(BindVertexArrayPtr);
);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.Clear(MaskBufferBit mask) void IglFunc.Clear(MaskBufferBit mask)
{ {
glActionQueue.Enqueue( glActionQueue.Enqueue(ClearPtr);
() => api->glClear((uint)mask)
);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.ClearColor(float R, float G, float B, float A) void IglFunc.ClearColor(float R, float G, float B, float A)
{ {
paramQueue.Enqueue(R, G, B, A);
glActionQueue.Enqueue(ClearColorPtr); glActionQueue.Enqueue(ClearColorPtr);
} }
@@ -138,21 +137,22 @@ namespace StgSharp.Graphics
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
glHandle IglFunc.CreateProgram() glHandle IglFunc.CreateProgram()
{ {
glHandle h = new glHandle(1); glHandle h = glHandle.Alloc(1);
glActionQueue.Enqueue( paramQueue.Enqueue(h);
() => glActionQueue.Enqueue(CreateProgramPtr);
{
int ret = (int)api->glCreateProgram();
Interlocked.Add(ref id, ret + 1);
}
);
return h; return h;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
glHandleSet IglFunc.CreateProgram(int count) glHandleSet IglFunc.CreateProgram(int count)
{ {
throw new NotImplementedException(); M128 m = default;
glHandleSet h = new glHandleSet(count);
m.IntPtr0 = (IntPtr)h.handle;
m.Int32[2] = count;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(CreateProgramSetPtr);
return h;
} }
IntPtr IglFunc.CreateWindowHandle(int width, int height, string tittle, IntPtr monitor, Form share) IntPtr IglFunc.CreateWindowHandle(int width, int height, string tittle, IntPtr monitor, Form share)
@@ -184,42 +184,31 @@ namespace StgSharp.Graphics
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
glHandle IglFunc.CreatGraphicProgram() glHandle IglFunc.CreatGraphicProgram()
{ {
glHandle h = new glHandle(1); glHandle h = glHandle.Alloc(1);
glActionQueue.Enqueue( paramQueue.Enqueue(h);
() => glActionQueue.Enqueue(CreateProgramPtr);
{
Interlocked.Add(ref id, (int)(api->glCreateProgram() + 1));
}
);
return h; return h;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
unsafe void IglFunc.DeleteBuffer(uint handle) unsafe void IglFunc.DeleteBuffer(glHandle handle)
{ {
glActionQueue.Enqueue( M128 m = new M128() { IntPtr0 = handle.Handle };
() => m.UInt32[2] = 1;
{ paramQueue.Enqueue(m);
uint target = handle; glActionQueue.Enqueue(DeleBufferPtr);
api->glDeleteBuffers(1, &target);
}
);
} }
unsafe void IglFunc.DeleteBuffers(glHandleSet handle) unsafe void IglFunc.DeleteBuffers(glHandleSet handle)
{ {
glActionQueue.Enqueue( M128 m = default;
() => m.UInt32[2] = (uint)handle.length;
{ m.IntPtr0 = (IntPtr)handle.handle;
uint[] h = handle; paramQueue.Enqueue(m);
fixed (uint* p = h) glActionQueue.Enqueue(DeleBufferPtr);
{
api->glDeleteBuffers(count, p);
}
}
);
} }
//TODO: 从这里开始
unsafe void IglFunc.DeleteVertexArrays(glHandleSet arrays) unsafe void IglFunc.DeleteVertexArrays(glHandleSet arrays)
{ {
glActionQueue.Enqueue( glActionQueue.Enqueue(
@@ -19,6 +19,8 @@ namespace StgSharp.Graphics
internal IntPtr ClearColorPtr = (IntPtr)(delegate*<void>)&InternalClearColor; internal IntPtr ClearColorPtr = (IntPtr)(delegate*<void>)&InternalClearColor;
internal IntPtr ClearGraphicErrorPtr = (IntPtr)(delegate*<void>)&InternalClearGraphicError; internal IntPtr ClearGraphicErrorPtr = (IntPtr)(delegate*<void>)&InternalClearGraphicError;
internal IntPtr CompileShaderPtr = (IntPtr)(delegate*<void>)&InternalCompileShader; internal IntPtr CompileShaderPtr = (IntPtr)(delegate*<void>)&InternalCompileShader;
IntPtr BindTexturePtr = (IntPtr)(delegate*<void>)&InternalBindTexture;
IntPtr BindVertexArrayPtr = (IntPtr)(delegate*<void>)&InternalBindVertexArray;
private IntPtr ClearPtr = (IntPtr)(delegate*<void>)&InternalClear; private IntPtr ClearPtr = (IntPtr)(delegate*<void>)&InternalClear;
private static void InternalActiveTexture() private static void InternalActiveTexture()
@@ -37,9 +39,23 @@ namespace StgSharp.Graphics
private static void InternalBindBuffer() private static void InternalBindBuffer()
{ {
uint t, i; M128 m = default;
paramQueue.TryDequeue(out t, out i); paramQueue.TryDequeue(out m);
paramQueue.context->glBindBuffer(t, i); paramQueue.context->glBindBuffer(m.UInt32[0], *(uint*)m.IntPtr1);
}
private static void InternalBindTexture()
{
uint t, te;
paramQueue.TryDequeue(out t, out te);
paramQueue.context->glBindTexture(t, te);
}
private static void InternalBindVertexArray()
{
IntPtr i;
paramQueue.TryDequeue(out i);
paramQueue.context->glBindVertexArray(*(uint*)i);
} }
private static void InternalClear() private static void InternalClear()
@@ -115,51 +131,35 @@ namespace StgSharp.Graphics
throw new NotImplementedException(); throw new NotImplementedException();
} }
private void InternalBindTexture(uint type, uint texture) IntPtr CreateProgramPtr = (IntPtr)(delegate*<void>)&InternalCreateProgram;
{ private static void InternalCreateProgram()
uint t, te;
paramQueue.TryDequeue(out t, out te);
paramQueue.context->glBindTexture(t, te);
}
private void InternalBindVertexArray(uint index)
{
uint i;
paramQueue.TryDequeue(out i);
paramQueue.context->glBindVertexArray(i);
}
private glHandle InternalCreateProgram()
{ {
IntPtr programHandle = default; IntPtr programHandle = default;
paramQueue.TryDequeue(out programHandle); paramQueue.TryDequeue(out programHandle);
*(uint*)programHandle = paramQueue.context->glCreateProgram(); *(uint*)programHandle = paramQueue.context->glCreateProgram();
return default;
} }
private glHandleSet InternalCreateProgram(int count)
IntPtr CreateProgramSetPtr = (IntPtr)(delegate*<void>)&InternalCreateProgramSet;
private static void InternalCreateProgramSet()
{ {
throw new NotImplementedException(); IntPtr programHandle;
M128 m = default;
paramQueue.TryDequeue(out m);
programHandle = m.IntPtr0;
for (int i = 0; i < m.Int32[2]; i++)
{
*((uint*)programHandle + i) = paramQueue.context->glCreateProgram();
}
} }
private IntPtr InternalCreateWindowHandle(int width, int height, string tittle, IntPtr monitor, Form share) internal IntPtr DeleBufferPtr = (IntPtr)(delegate*<void>)&InternalDeleteBuffer;
{
throw new NotImplementedException();
}
private glHandle InternalCreatGraphicProgram() private static void InternalDeleteBuffer()
{ {
throw new NotImplementedException(); M128 m = default;
} paramQueue.TryDequeue(out m);
paramQueue.context->glDeleteBuffers(m.UInt32[2], (uint*)m.IntPtr0);
private void InternalDeleteBuffer(uint handle)
{
throw new NotImplementedException();
}
private void InternalDeleteBuffers(glHandleSet handle)
{
throw new NotImplementedException();
} }
private void InternalDeleteVertexArrays(glHandleSet arrays) private void InternalDeleteVertexArrays(glHandleSet arrays)
+7 -6
View File
@@ -45,12 +45,13 @@ namespace StgSharp.Graphics
/// <param name="shader">A shader part to attach</param> /// <param name="shader">A shader part to attach</param>
void AttachShader(glHandle program, glHandle shader); void AttachShader(glHandle program, glHandle shader);
//TODO:BindBuffer注释没写完
/// <summary> /// <summary>
/// Bind the indexed buffer object to certain type of buffer /// Bind the indexed buffer object to certain type of buffer
/// </summary> /// </summary>
/// <param name="bufferType"></param> /// <param name="bufferType"></param>
/// <param name="index"></param> /// <param name="handle"></param>
void BindBuffer(BufferType bufferType, uint index); void BindBuffer(BufferType bufferType, glHandle handle);
/// <summary> /// <summary>
/// Same function as OpenGL api, glBindTexture. /// Same function as OpenGL api, glBindTexture.
@@ -63,7 +64,7 @@ namespace StgSharp.Graphics
/// Same function as OpenGL api, glBindVertexArray /// Same function as OpenGL api, glBindVertexArray
/// </summary> /// </summary>
/// <param name="index"></param> /// <param name="index"></param>
void BindVertexArray(uint index); void BindVertexArray(glHandle index);
/// <summary> /// <summary>
/// Clear buffers to preset values /// Clear buffers to preset values
@@ -87,11 +88,11 @@ namespace StgSharp.Graphics
/// <summary> /// <summary>
/// Conpile the provided shader code in string form. /// Conpile the provided shader code in string form.
/// </summary> /// </summary>
/// <param name="shaderCode">A string represent the shader's code</param> /// <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 /// <param name="shaderType">An <see cref="ShaderType"/> enum represent the type of the shader to
/// conpile, including vertex shader and fragment shader.</param> /// conpile, including vertex shader and fragment shader.</param>
/// <returns>An handle of conpiled shader</returns> /// <returns>An handle of conpiled shader</returns>
glHandleSet CompileShader(ShaderType shaderType, params string[] shaderCode); glHandleSet CompileShader(ShaderType shaderType, params string[] shaderCodeArray);
/// <summary> /// <summary>
/// Same function as OpenGL api, glCreateProgram /// Same function as OpenGL api, glCreateProgram
@@ -123,7 +124,7 @@ namespace StgSharp.Graphics
/// Same function as OpenGL api, glDeleteBuffer. This method can delete one buffer in one call /// Same function as OpenGL api, glDeleteBuffer. This method can delete one buffer in one call
/// </summary> /// </summary>
/// <param name="handle">a handle representing the buffer to be deleted</param> /// <param name="handle">a handle representing the buffer to be deleted</param>
unsafe void DeleteBuffer(uint handle); void DeleteBuffer(glHandle handle);
/// <summary> /// <summary>
/// Same function as OpenGL api, glDeleteBuffer. This method can delete a sets of buffers in one call. /// Same function as OpenGL api, glDeleteBuffer. This method can delete a sets of buffers in one call.
+40 -31
View File
@@ -28,6 +28,12 @@ namespace StgSharp.Logic
paramQueue.Enqueue(v); paramQueue.Enqueue(v);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Enqueue(M128 m)
{
paramQueue.Enqueue(m);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Enqueue(uint u0) public void Enqueue(uint u0)
{ {
@@ -81,21 +87,6 @@ namespace StgSharp.Logic
paramQueue.Enqueue(m); paramQueue.Enqueue(m);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TryDequeue(out glHandle handle)
{
M128 ret;
if (paramQueue.TryDequeue(out ret))
{
handle.valuePtr = (uint*)ret.IntPtr0;
}
else
{
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
throw new Exception();
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Enqueue(glHandle handle, glHandle handle1) public void Enqueue(glHandle handle, glHandle handle1)
{ {
@@ -105,22 +96,6 @@ namespace StgSharp.Logic
paramQueue.Enqueue(m); paramQueue.Enqueue(m);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TryDequeue(out glHandle handle, out glHandle handle1)
{
M128 ret;
if (paramQueue.TryDequeue(out ret))
{
handle.valuePtr = (uint*)ret.IntPtr0;
handle1.valuePtr = (uint*)ret.IntPtr1;
}
else
{
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
throw new Exception();
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Enqueue(int i0) public void Enqueue(int i0)
{ {
@@ -159,6 +134,40 @@ namespace StgSharp.Logic
paramQueue.Enqueue(m); paramQueue.Enqueue(m);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TryDequeue(out M128 m)
{
paramQueue.TryDequeue(out m);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TryDequeue(out glHandle handle)
{
M128 ret;
if (paramQueue.TryDequeue(out ret))
{
handle.valuePtr = (uint*)ret.IntPtr0;
}
else
{
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
throw new Exception();
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TryDequeue(out glHandle handle, out glHandle handle1)
{
M128 ret;
if (paramQueue.TryDequeue(out ret))
{
handle.valuePtr = (uint*)ret.IntPtr0;
handle1.valuePtr = (uint*)ret.IntPtr1;
}
else
{
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
throw new Exception();
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TryDequeue(out int i0) public void TryDequeue(out int i0)
{ {
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharpDebug")] [assembly: System.Reflection.AssemblyCompanyAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Benchmark")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Benchmark")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5d778e0f2f6e677453cebc990919697968c771f9")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharpDebug")] [assembly: System.Reflection.AssemblyProductAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharpDebug")] [assembly: System.Reflection.AssemblyTitleAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
064c7856d60414ec06cfa2c8f7e2587373d5fb684c182dbac647ea2ac6067752 e340c06b75b4a2ce53efde5f4632c7a375a08a6b1987e3663da0e443a4eb16a3