daily update on 20240506 by nitload youmu
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user