daily uodate on 20231215 by nitload youmu

This commit is contained in:
Nitload
2023-12-15 17:07:03 +08:00
parent 8b14599233
commit 659420aa6c
28 changed files with 32 additions and 29 deletions
+16 -18
View File
@@ -31,7 +31,7 @@ namespace StgSharp.Graphics
internal int width;
internal IntPtr windowID;
protected IglFunc GL;
internal IglFunc GL;
internal FormUpdateBuffer UpdateBuffer;
internal FormRenderBuffer RenderBuffer;
@@ -41,12 +41,6 @@ namespace StgSharp.Graphics
private SemaphoreSlim pong = new SemaphoreSlim(0, 1);
internal readonly SemaphoreSlim ouetrPong = new SemaphoreSlim(0, 1);
private UpdateWhenRender updateWhenRender;
private DynamicMethod updateWhenRenderDM;
private ILGenerator updateWhenRenderIL;
private delegate void UpdateWhenRender();
/// <summary>
/// Height of this form, represent in <see cref="int"/>
/// </summary>
@@ -56,6 +50,15 @@ namespace StgSharp.Graphics
set => height = value;
}
private Form()
{
#if NET5_0_OR_GREATER
Unsafe.SkipInit(out UpdateBuffer);
Unsafe.SkipInit(out RenderBuffer);
Unsafe.SkipInit(out GL);
#endif
}
/// <summary>
/// Width of this form, represent in <see cref="int"/>
/// </summary>
@@ -85,6 +88,10 @@ namespace StgSharp.Graphics
public abstract void Deinit(object[] args);
/// <summary>
/// Necessary operation to init this form.
/// </summary>
/// <param name="args"></param>
public abstract void Init(object[] args);
public abstract void OnRenderFrame(object[] args);
@@ -135,16 +142,7 @@ namespace StgSharp.Graphics
internal void InternalInit(object args)
{
updateWhenRenderDM = new DynamicMethod(
name: "updateWhenRender",
returnType: typeof(void),
parameterTypes: new Type[] { typeof(void) },
restrictedSkipVisibility: true
);
updateWhenRenderIL = updateWhenRenderDM.GetILGenerator();
Init((object[])args);
}
@@ -234,8 +232,8 @@ namespace StgSharp.Graphics
{
windowID = windowPtr;
}
glRender = new GLonRender();
glContext = new GLcontext();
GLonRender glRender = new GLonRender();
GLcontext glContext = new GLcontext();
IntPtr ptr = Marshal.AllocHGlobal(sizeof(GLcontextIO));
contextID = (GLcontextIO*)ptr;
*contextID = new GLcontextIO();
+3 -3
View File
@@ -16,11 +16,11 @@ namespace StgSharp.Graphics
internal GLcontext glContext
{
get { return glRender.api; }
get { return RenderBuffer.GL.api; }
set
{
glUpdate.api = value;
glRender.api = value;
UpdateBuffer.GL.api = value;
RenderBuffer.GL.api = value;
}
}
@@ -10,6 +10,11 @@ namespace StgSharp.Graphics
internal unsafe partial class GLonRender : IglFunc
{
internal GLonRender(GLcontext context)
{
api = context;
}
internal GLcontext api;
[MethodImpl(MethodImplOptions.AggressiveInlining)]