daily update on 20240506 by nitload youmu

This commit is contained in:
YoumuLiu
2024-05-07 05:12:28 +08:00
parent 66efce19fc
commit fc19ab3298
83 changed files with 1161 additions and 741 deletions
+14 -1
View File
@@ -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);
}
}