daily update on 20240506 by nitload youmu
This commit is contained in:
@@ -330,7 +330,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
~glHandleSet()
|
||||
{
|
||||
//unsafe, 不确定这个句柄组的单一索引是不是完全卸载
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -281,13 +281,26 @@ namespace StgSharp.Graphics
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe glSHandle GetUniformLocation(glHandle program, string name)
|
||||
{
|
||||
byte[] code = Encoding.UTF8.GetBytes(name);
|
||||
fixed (byte* ptr = code)
|
||||
{
|
||||
return glSHandle.Alloc(Context.glGetUniformLocation(program.Value, ptr));
|
||||
int ret = Context.glGetUniformLocation(program.Value, ptr);
|
||||
#if DEBUG
|
||||
if (ret == (int)(GLconst.INVALID_OPERATION) ||
|
||||
ret == (int)(GLconst.INVALID_VALUE))
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
if (ret == -1 )
|
||||
{
|
||||
throw new UniformEmptyReferenceException(nameof(program), name);
|
||||
}
|
||||
#endif
|
||||
return glSHandle.Alloc(ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,9 +41,6 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
public partial class glRenderStream
|
||||
{
|
||||
protected glRenderStream(RenderStreamConstructArgs args) : base(args)
|
||||
{
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected sealed override Shader CreateShaderSegment(ShaderType type, int count)
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace StgSharp.Graphics
|
||||
public unsafe static void SetValue(Uniform<Matrix44> uniform, Matrix44 mat)
|
||||
{
|
||||
Matrix44 temp = mat;
|
||||
Context.glUniformMatrix4fv(uniform.id.Value, 1, false, (float*)&mat);
|
||||
Context.glUniformMatrix4fv(uniform.id.Value, 1, false, (float*)&temp);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
||||
@@ -13,6 +13,9 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
public abstract partial class glRenderStream: RenderStream
|
||||
{
|
||||
protected glRenderStream(RenderStreamConstructArgs args) : base(args)
|
||||
{
|
||||
}
|
||||
|
||||
public static T AsMainStreamOf<T>(Form f, (int x, int y, int z) unitCubeSize) where T : glRenderStream
|
||||
{
|
||||
@@ -77,7 +80,7 @@ namespace StgSharp.Graphics
|
||||
if (GL.CurrentContextHandle != ContextHandle)
|
||||
{
|
||||
GL.CurrentContextHandle = ContextHandle;
|
||||
Console.WriteLine($"context set as {(ulong)GL.CurrentContextHandle}");
|
||||
//Console.WriteLine($"context set as {(ulong)GL.CurrentContextHandle}");
|
||||
InternalIO.glfwMakeContextCurrent(CanvasHandle);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user