adding generated opengl function binding
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.14.36705.20
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenerateGL", "StgSharp.GenerateGL\GenerateGL.csproj", "{9FD27EE6-E94D-4E64-A13B-5A349DEA215A}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StgSharp.Common", "StgSharp.Common\StgSharp.Common.csproj", "{5D646C0E-CCF8-B5B4-7DE8-1C37542E7B4D}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{9FD27EE6-E94D-4E64-A13B-5A349DEA215A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9FD27EE6-E94D-4E64-A13B-5A349DEA215A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9FD27EE6-E94D-4E64-A13B-5A349DEA215A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9FD27EE6-E94D-4E64-A13B-5A349DEA215A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{5D646C0E-CCF8-B5B4-7DE8-1C37542E7B4D}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||||
|
{5D646C0E-CCF8-B5B4-7DE8-1C37542E7B4D}.Release|Any CPU.ActiveCfg = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {AC71C01F-9867-4E43-85AB-4A8A7896B1BC}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="glFunction"
|
// file="glFunction"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -92,13 +92,17 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void ActiveTextureUnit(uint type)
|
public void ActiveTextureUnit(
|
||||||
|
uint type
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glActiveTexture(type);
|
Context.glActiveTexture(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Conditional("DEBUG")]
|
[Conditional("DEBUG")]
|
||||||
public void Assert(bool shouldReportWhenNormal)
|
public void Assert(
|
||||||
|
bool shouldReportWhenNormal
|
||||||
|
)
|
||||||
{
|
{
|
||||||
uint code = Context.glGetError();
|
uint code = Context.glGetError();
|
||||||
if (code != glConst.NO_ERROR) {
|
if (code != glConst.NO_ERROR) {
|
||||||
@@ -110,20 +114,26 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void AttachShader(GlHandle program, GlHandle shader)
|
public void AttachShader(
|
||||||
|
GlHandle program,
|
||||||
|
GlHandle shader
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glAttachShader(program.Value, shader.Value);
|
Context.glAttachShader(program.Value, shader.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void BindBuffer(BufferType bufferType, GlHandle handle)
|
public void BindBuffer(
|
||||||
|
BufferType bufferType,
|
||||||
|
GlHandle handle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glBindBuffer((uint)bufferType, handle.Value);
|
Context.glBindBuffer((uint)bufferType, handle.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bind a frame BufferHandle to a frame BufferHandle target Same function as <see ///
|
/// Bind a frame BufferHandle to a frame BufferHandle target Same function as <see ///
|
||||||
/// href="https://docs._gl/gl3/glBindFramebuffer">glBindFramebuffer</see>.
|
/// href="https://docs._gl/gl3/glBindFramebuffer"> glBindFramebuffer </see>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param _label="target">
|
/// <param _label="target">
|
||||||
/// The frame BufferHandle target of the binding operation.
|
/// The frame BufferHandle target of the binding operation.
|
||||||
@@ -132,43 +142,62 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
/// The handle of the frame BufferHandle object to bind.
|
/// The handle of the frame BufferHandle object to bind.
|
||||||
/// </param>
|
/// </param>
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void BindFrameBuffer(FrameBufferTarget target, GlHandle handle)
|
public void BindFrameBuffer(
|
||||||
|
FrameBufferTarget target,
|
||||||
|
GlHandle handle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glBindFramebuffer((uint)target, handle.Value);
|
Context.glBindFramebuffer((uint)target, handle.SignedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void BindRenderBuffer(GlHandle handle)
|
public void BindRenderBuffer(
|
||||||
|
GlHandle handle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glBindRenderbuffer(glConst.RENDERBUFFER, handle.Value);
|
Context.glBindRenderbuffer(glConst.RENDERBUFFER, handle.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void BindTexture(uint type, GlHandle texture)
|
public void BindTexture(
|
||||||
|
uint type,
|
||||||
|
GlHandle texture
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glBindTexture(type, texture.Value);
|
Context.glBindTexture(type, texture.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void BindVertexArray(GlHandle handle)
|
public void BindVertexArray(
|
||||||
|
GlHandle handle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glBindVertexArray(handle.Value);
|
Context.glBindVertexArray(handle.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public FrameBufferStatus CheckFrameBufferStatus(FrameBufferTarget target)
|
public FrameBufferStatus CheckFrameBufferStatus(
|
||||||
|
FrameBufferTarget target
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return (FrameBufferStatus)Context.glCheckFramebufferStatus((uint)target);
|
return (FrameBufferStatus)Context.glCheckFramebufferStatus((uint)target);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Clear(MaskBufferBit mask)
|
public void Clear(
|
||||||
|
MaskBufferBit mask
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glClear((uint)mask);
|
Context.glClear((uint)mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void ClearColor(float R, float G, float B, float A)
|
public unsafe void ClearColor(
|
||||||
|
float R,
|
||||||
|
float G,
|
||||||
|
float B,
|
||||||
|
float A
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glClearColor(R, G, B, A);
|
Context.glClearColor(R, G, B, A);
|
||||||
}
|
}
|
||||||
@@ -199,14 +228,19 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void CombineFrameBufferRenderBuffer(FrameBufferAttachment attachment, GlHandle rboHandle)
|
public void CombineFrameBufferRenderBuffer(
|
||||||
|
FrameBufferAttachment attachment,
|
||||||
|
GlHandle rboHandle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glFramebufferRenderbuffer(glConst.FRAMEBUFFER, (uint)attachment, glConst.RENDERBUFFER,
|
Context.glFramebufferRenderbuffer(glConst.FRAMEBUFFER, (uint)attachment,
|
||||||
rboHandle.Value);
|
glConst.RENDERBUFFER, rboHandle.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void CompileShader(GlHandle shaderhandle)
|
public void CompileShader(
|
||||||
|
GlHandle shaderhandle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glCompileShader(shaderhandle.Value);
|
Context.glCompileShader(shaderhandle.Value);
|
||||||
}
|
}
|
||||||
@@ -224,7 +258,9 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe GlHandle[] CreateProgram(int count)
|
public unsafe GlHandle[] CreateProgram(
|
||||||
|
int count
|
||||||
|
)
|
||||||
{
|
{
|
||||||
GlHandle[] h = new GlHandle[count];
|
GlHandle[] h = new GlHandle[count];
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
@@ -234,7 +270,10 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public GlHandle[] CreateShaderSet(int count, ShaderType type)
|
public GlHandle[] CreateShaderSet(
|
||||||
|
int count,
|
||||||
|
ShaderType type
|
||||||
|
)
|
||||||
{
|
{
|
||||||
GlHandle[] ret = new GlHandle[count];
|
GlHandle[] ret = new GlHandle[count];
|
||||||
uint t = (uint)type;
|
uint t = (uint)type;
|
||||||
@@ -252,13 +291,17 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void DeleteBuffer(GlHandle handle)
|
public unsafe void DeleteBuffer(
|
||||||
|
GlHandle handle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glDeleteBuffers(1, (uint*)&handle);
|
Context.glDeleteBuffers(1, (uint*)&handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void DeleteBuffers(GlHandle[] handle)
|
public unsafe void DeleteBuffers(
|
||||||
|
GlHandle[] handle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if ((handle == null) || (handle.Length == 0)) {
|
if ((handle == null) || (handle.Length == 0)) {
|
||||||
throw new ArgumentNullException(nameof(handle));
|
throw new ArgumentNullException(nameof(handle));
|
||||||
@@ -274,19 +317,24 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete a render BufferHandle object Very simlilar function as <see ///
|
/// Delete a render BufferHandle object Very simlilar function as <see ///
|
||||||
/// href="https://docs.gl/gl3/glDeleteRenderbuffers">glDeleteRenderbuffers</see>. The only
|
/// href="https://docs.gl/gl3/glDeleteRenderbuffers"> glDeleteRenderbuffers </see>. The
|
||||||
/// deifference is that this mehtod can only delete one renderbuffer at the same time.
|
/// only deifference is that this mehtod can only delete one renderbuffer at the same
|
||||||
|
/// time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param _label="bufferHandle">
|
/// <param _label="bufferHandle">
|
||||||
/// Handle to BufferHandle to delete.
|
/// Handle to BufferHandle to delete.
|
||||||
/// </param>
|
/// </param>
|
||||||
public unsafe void DeleteRenderBuffer(GlHandle bufferHandle)
|
public unsafe void DeleteRenderBuffer(
|
||||||
|
GlHandle bufferHandle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glDeleteRenderbuffers(1, &bufferHandle.Value);
|
Context.glDeleteRenderbuffers(1, &bufferHandle.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void DeleteVertexArrays(GlHandle[] arrays)
|
public unsafe void DeleteVertexArrays(
|
||||||
|
GlHandle[] arrays
|
||||||
|
)
|
||||||
{
|
{
|
||||||
fixed (GlHandle* hptr = arrays)
|
fixed (GlHandle* hptr = arrays)
|
||||||
{
|
{
|
||||||
@@ -297,25 +345,38 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DepthMaskAccess(bool isWrite)
|
public void DepthMaskAccess(
|
||||||
|
bool isWrite
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glDepthMask(isWrite);
|
Context.glDepthMask(isWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Disable(glOperation operation)
|
public void Disable(
|
||||||
|
glOperation operation
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glDisable((uint)operation);
|
Context.glDisable((uint)operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void DrawArrays(GeometryType mode, int first, uint count)
|
public unsafe void DrawArrays(
|
||||||
|
GeometryType mode,
|
||||||
|
int first,
|
||||||
|
uint count
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glDrawArrays((uint)mode, first, count);
|
Context.glDrawArrays((uint)mode, first, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void DrawElements(GeometryType mode, uint count, TypeCode type, IntPtr ptr)
|
public unsafe void DrawElements(
|
||||||
|
GeometryType mode,
|
||||||
|
uint count,
|
||||||
|
TypeCode type,
|
||||||
|
IntPtr ptr
|
||||||
|
)
|
||||||
{
|
{
|
||||||
uint a;
|
uint a;
|
||||||
a = type switch
|
a = type switch
|
||||||
@@ -330,7 +391,13 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void DrawElementsInstanced(GeometryType mode, uint count, TypeCode type, IntPtr ptr, uint amount)
|
public void DrawElementsInstanced(
|
||||||
|
GeometryType mode,
|
||||||
|
uint count,
|
||||||
|
TypeCode type,
|
||||||
|
IntPtr ptr,
|
||||||
|
uint amount
|
||||||
|
)
|
||||||
{
|
{
|
||||||
uint a;
|
uint a;
|
||||||
switch (type)
|
switch (type)
|
||||||
@@ -356,7 +423,9 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Enable(glOperation operation)
|
public void Enable(
|
||||||
|
glOperation operation
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glEnable((uint)operation);
|
Context.glEnable((uint)operation);
|
||||||
}
|
}
|
||||||
@@ -367,13 +436,17 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
uint attachment,
|
uint attachment,
|
||||||
Texture2DTarget texTarget,
|
Texture2DTarget texTarget,
|
||||||
GlHandle textureHandle,
|
GlHandle textureHandle,
|
||||||
int level)
|
int level
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glFramebufferTexture2D((uint)target, attachment, (uint)texTarget, textureHandle.Value, level);
|
Context.glFramebufferTexture2D((uint)target, attachment, (uint)texTarget,
|
||||||
|
textureHandle.Value, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe GlHandle[] GenBuffers(int count)
|
public unsafe GlHandle[] GenBuffers(
|
||||||
|
int count
|
||||||
|
)
|
||||||
{
|
{
|
||||||
GlHandle[] h = new GlHandle[count];
|
GlHandle[] h = new GlHandle[count];
|
||||||
fixed (GlHandle* hptr = h)
|
fixed (GlHandle* hptr = h)
|
||||||
@@ -386,12 +459,16 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void GenerateMipmap(Texture2DTarget target)
|
public void GenerateMipmap(
|
||||||
|
Texture2DTarget target
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glGenerateMipmap((uint)target);
|
Context.glGenerateMipmap((uint)target);
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe GlHandle[] GenFrameBuffers(int count)
|
public unsafe GlHandle[] GenFrameBuffers(
|
||||||
|
int count
|
||||||
|
)
|
||||||
{
|
{
|
||||||
GlHandle[] h = new GlHandle[count];
|
GlHandle[] h = new GlHandle[count];
|
||||||
fixed (GlHandle* hptr = h) {
|
fixed (GlHandle* hptr = h) {
|
||||||
@@ -401,7 +478,9 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe GlHandle[] GenRenderBuffer(int count)
|
public unsafe GlHandle[] GenRenderBuffer(
|
||||||
|
int count
|
||||||
|
)
|
||||||
{
|
{
|
||||||
GlHandle[] h = new GlHandle[count];
|
GlHandle[] h = new GlHandle[count];
|
||||||
fixed (GlHandle* hptr = h) {
|
fixed (GlHandle* hptr = h) {
|
||||||
@@ -411,7 +490,9 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe GlHandle[] GenTextures(int count)
|
public unsafe GlHandle[] GenTextures(
|
||||||
|
int count
|
||||||
|
)
|
||||||
{
|
{
|
||||||
GlHandle[] h = new GlHandle[count];
|
GlHandle[] h = new GlHandle[count];
|
||||||
fixed (GlHandle* hptr = h) {
|
fixed (GlHandle* hptr = h) {
|
||||||
@@ -420,7 +501,9 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe GlHandle[] GenVertexArrays(int count)
|
public unsafe GlHandle[] GenVertexArrays(
|
||||||
|
int count
|
||||||
|
)
|
||||||
{
|
{
|
||||||
GlHandle[] h = new GlHandle[count];
|
GlHandle[] h = new GlHandle[count];
|
||||||
fixed (GlHandle* hptr = h) {
|
fixed (GlHandle* hptr = h) {
|
||||||
@@ -435,17 +518,24 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
return Context.glGetError();
|
return Context.glGetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe int GetMaskInteger(uint statusCode)
|
public unsafe int GetMaskInteger(
|
||||||
|
uint statusCode
|
||||||
|
)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
Context.glGetIntegerv(statusCode, &ret);
|
Context.glGetIntegerv(statusCode, &ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetShaderStatus(Shader s, int index, int key)
|
public string GetShaderStatus(
|
||||||
|
Shader s,
|
||||||
|
int index,
|
||||||
|
int key
|
||||||
|
)
|
||||||
{
|
{
|
||||||
IntPtr sptr = IntPtr.Zero;
|
IntPtr sptr = IntPtr.Zero;
|
||||||
if (GraphicFramework.glCheckShaderStatus(ref Context, s.handle[index].Value, key, ref sptr) == 0) {
|
if (GraphicFramework.glCheckShaderStatus(ref Context, s.handle[index].Value, key,
|
||||||
|
ref sptr) == 0) {
|
||||||
return Marshal.PtrToStringAnsi(sptr);
|
return Marshal.PtrToStringAnsi(sptr);
|
||||||
}
|
}
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
@@ -457,16 +547,22 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
int level,
|
int level,
|
||||||
ImageChannel channel,
|
ImageChannel channel,
|
||||||
PixelChannelLayout channelLayout,
|
PixelChannelLayout channelLayout,
|
||||||
T[] dataStream)
|
T[] dataStream
|
||||||
where T: unmanaged,INumber<T>
|
) where T : unmanaged,INumber<T>
|
||||||
{
|
{
|
||||||
fixed (T* tptr = dataStream) {
|
fixed (T* tptr = dataStream) {
|
||||||
Context.glGetTexImage((uint)target, level, (uint)channel, (uint)channelLayout, tptr);
|
Context.glGetTexImage((uint)target, level, (uint)channel, (uint)channelLayout,
|
||||||
|
tptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void GetTextureLevelProperty(uint textureTypeMask, int level, uint propertyMask, out int propertyValue)
|
public void GetTextureLevelProperty(
|
||||||
|
uint textureTypeMask,
|
||||||
|
int level,
|
||||||
|
uint propertyMask,
|
||||||
|
out int propertyValue
|
||||||
|
)
|
||||||
{
|
{
|
||||||
fixed (int* iptr = &propertyValue) {
|
fixed (int* iptr = &propertyValue) {
|
||||||
Context.glGetTexLevelParameteriv(textureTypeMask, level, propertyMask, iptr);
|
Context.glGetTexLevelParameteriv(textureTypeMask, level, propertyMask, iptr);
|
||||||
@@ -474,7 +570,10 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe GlHandle GetUniformLocation(GlHandle program, string name)
|
public unsafe GlHandle GetUniformLocation(
|
||||||
|
GlHandle program,
|
||||||
|
string name
|
||||||
|
)
|
||||||
{
|
{
|
||||||
byte[] code = Encoding.UTF8.GetBytes(name);
|
byte[] code = Encoding.UTF8.GetBytes(name);
|
||||||
fixed (byte* ptr = code)
|
fixed (byte* ptr = code)
|
||||||
@@ -494,14 +593,20 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void LoadShaderSource(GlHandle shaderHandle, byte[] codeStream)
|
public unsafe void LoadShaderSource(
|
||||||
|
GlHandle shaderHandle,
|
||||||
|
byte[] codeStream
|
||||||
|
)
|
||||||
{
|
{
|
||||||
fixed (byte* streamPtr = codeStream) {
|
fixed (byte* streamPtr = codeStream) {
|
||||||
Context.glShaderSource(shaderHandle.Value, 1, &streamPtr, (void*)0);
|
Context.glShaderSource(shaderHandle.Value, 1, &streamPtr, (void*)0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe void LoadShaderSource(GlHandle shaderHandle, ReadOnlySpan<char> codeStream)
|
public unsafe void LoadShaderSource(
|
||||||
|
GlHandle shaderHandle,
|
||||||
|
ReadOnlySpan<char> codeStream
|
||||||
|
)
|
||||||
{
|
{
|
||||||
fixed (char* streamPtr = codeStream)
|
fixed (char* streamPtr = codeStream)
|
||||||
{
|
{
|
||||||
@@ -510,7 +615,10 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe void LoadShaderSource(GlHandle shaderHandle, ReadOnlySpan<byte> codeStream)
|
public unsafe void LoadShaderSource(
|
||||||
|
GlHandle shaderHandle,
|
||||||
|
ReadOnlySpan<byte> codeStream
|
||||||
|
)
|
||||||
{
|
{
|
||||||
fixed (byte* streamPtr = codeStream)
|
fixed (byte* streamPtr = codeStream)
|
||||||
{
|
{
|
||||||
@@ -520,13 +628,18 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void PolygonMode(FaceMode mode)
|
public void PolygonMode(
|
||||||
|
FaceMode mode
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glPolygonMode(glConst.FRONT_AND_BACK, (uint)mode);
|
Context.glPolygonMode(glConst.FRONT_AND_BACK, (uint)mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void PolygonOffset(float factor, float unit)
|
public void PolygonOffset(
|
||||||
|
float factor,
|
||||||
|
float unit
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glPolygonOffset(factor, unit);
|
Context.glPolygonOffset(factor, unit);
|
||||||
}
|
}
|
||||||
@@ -537,11 +650,12 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
(int width, int height) size,
|
(int width, int height) size,
|
||||||
FrameBufferChannel format,
|
FrameBufferChannel format,
|
||||||
PixelChannelLayout dataType,
|
PixelChannelLayout dataType,
|
||||||
ref byte[] stream)
|
ref byte[] stream
|
||||||
|
)
|
||||||
{
|
{
|
||||||
fixed (byte* bptr = stream) {
|
fixed (byte* bptr = stream) {
|
||||||
Context.glReadPixels(beginPosition.X, beginPosition.Y, size.width, size.height, (uint)format,
|
Context.glReadPixels(beginPosition.X, beginPosition.Y, size.width, size.height,
|
||||||
(uint)dataType, bptr);
|
(uint)format, (uint)dataType, bptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,22 +663,26 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
in Image i,
|
in Image i,
|
||||||
(int X, int Y) beginPosition,
|
(int X, int Y) beginPosition,
|
||||||
FrameBufferChannel format,
|
FrameBufferChannel format,
|
||||||
PixelChannelLayout dataType)
|
PixelChannelLayout dataType
|
||||||
|
)
|
||||||
{
|
{
|
||||||
byte[] pixels = i.PixelBuffer;
|
byte[] pixels = i.PixelBuffer;
|
||||||
if (!pixels.CheckArrayFormat(dataType)) {
|
if (!pixels.CheckArrayFormat(dataType)) {
|
||||||
throw new GlArrayFormatException(dataType, "i.PixelArray");
|
throw new GlArrayFormatException(dataType, "i.PixelArray");
|
||||||
}
|
}
|
||||||
fixed (byte* bptr = pixels) {
|
fixed (byte* bptr = pixels) {
|
||||||
Context.glReadPixels(beginPosition.X, beginPosition.Y, i.Width, i.Height, (uint)format, (uint)dataType,
|
Context.glReadPixels(beginPosition.X, beginPosition.Y, i.Width, i.Height,
|
||||||
bptr);
|
(uint)format, (uint)dataType, bptr);
|
||||||
}
|
}
|
||||||
i.PixelUpdateCount++;
|
i.PixelUpdateCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void SetBufferData<T>(BufferType bufferType, T bufferData, BufferUsage usage)
|
public unsafe void SetBufferData<T>(
|
||||||
where T: unmanaged,INumber<T>
|
BufferType bufferType,
|
||||||
|
T bufferData,
|
||||||
|
BufferUsage usage
|
||||||
|
) where T : unmanaged,INumber<T>
|
||||||
{
|
{
|
||||||
int size = Marshal.SizeOf<T>();
|
int size = Marshal.SizeOf<T>();
|
||||||
|
|
||||||
@@ -574,8 +692,11 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void SetBufferData<T>(BufferType bufferType, T[] bufferArray, BufferUsage usage)
|
public unsafe void SetBufferData<T>(
|
||||||
where T: unmanaged,INumber<T>
|
BufferType bufferType,
|
||||||
|
T[] bufferArray,
|
||||||
|
BufferUsage usage
|
||||||
|
) where T : unmanaged,INumber<T>
|
||||||
{
|
{
|
||||||
int size = bufferArray.Length * Marshal.SizeOf(typeof(T));
|
int size = bufferArray.Length * Marshal.SizeOf(typeof(T));
|
||||||
if (bufferArray == null) {
|
if (bufferArray == null) {
|
||||||
@@ -583,13 +704,17 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
fixed (void* bufferPtr = bufferArray) {
|
fixed (void* bufferPtr = bufferArray) {
|
||||||
Context.glBufferData((uint)bufferType, (IntPtr)size, (IntPtr)bufferPtr, (uint)usage);
|
Context.glBufferData((uint)bufferType, (IntPtr)size, (IntPtr)bufferPtr,
|
||||||
|
(uint)usage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void SetBufferData<T>(BufferType bufferType, ReadOnlySpan<T> bufferSpan, BufferUsage usage)
|
public unsafe void SetBufferData<T>(
|
||||||
where T: unmanaged,INumber<T>
|
BufferType bufferType,
|
||||||
|
ReadOnlySpan<T> bufferSpan,
|
||||||
|
BufferUsage usage
|
||||||
|
) where T : unmanaged,INumber<T>
|
||||||
{
|
{
|
||||||
int size = bufferSpan.Length * Marshal.SizeOf(typeof(T));
|
int size = bufferSpan.Length * Marshal.SizeOf(typeof(T));
|
||||||
if (bufferSpan == null) {
|
if (bufferSpan == null) {
|
||||||
@@ -597,13 +722,17 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
fixed (void* bufferPtr = bufferSpan) {
|
fixed (void* bufferPtr = bufferSpan) {
|
||||||
Context.glBufferData((uint)bufferType, (IntPtr)size, (IntPtr)bufferPtr, (uint)usage);
|
Context.glBufferData((uint)bufferType, (IntPtr)size, (IntPtr)bufferPtr,
|
||||||
|
(uint)usage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void SetBufferData<T>(BufferType bufferType, Span<T> bufferArray, BufferUsage usage)
|
public unsafe void SetBufferData<T>(
|
||||||
where T: unmanaged, INumber<T>
|
BufferType bufferType,
|
||||||
|
Span<T> bufferArray,
|
||||||
|
BufferUsage usage
|
||||||
|
) where T : unmanaged, INumber<T>
|
||||||
{
|
{
|
||||||
int size = bufferArray.Length * Marshal.SizeOf(typeof(T));
|
int size = bufferArray.Length * Marshal.SizeOf(typeof(T));
|
||||||
if (bufferArray == null) {
|
if (bufferArray == null) {
|
||||||
@@ -612,56 +741,76 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
|
|
||||||
|
|
||||||
fixed (void* bufferPtr = bufferArray) {
|
fixed (void* bufferPtr = bufferArray) {
|
||||||
Context.glBufferData((uint)bufferType, (IntPtr)size, (IntPtr)bufferPtr, (uint)usage);
|
Context.glBufferData((uint)bufferType, (IntPtr)size, (IntPtr)bufferPtr,
|
||||||
|
(uint)usage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void SetBufferVectorData<T>(BufferType bufferType, ReadOnlySpan<T> bufferSpan, BufferUsage usage)
|
public unsafe void SetBufferVectorData<T>(
|
||||||
where T: unmanaged, IUnmanagedVector<T>
|
BufferType bufferType,
|
||||||
|
ReadOnlySpan<T> bufferSpan,
|
||||||
|
BufferUsage usage
|
||||||
|
) where T : unmanaged, IUnmanagedVector<T>
|
||||||
{
|
{
|
||||||
int size = bufferSpan.Length * Marshal.SizeOf(typeof(T));
|
int size = bufferSpan.Length * Marshal.SizeOf(typeof(T));
|
||||||
|
|
||||||
fixed (void* bufferPtr = bufferSpan) {
|
fixed (void* bufferPtr = bufferSpan) {
|
||||||
Context.glBufferData((uint)bufferType, (IntPtr)size, (IntPtr)bufferPtr, (uint)usage);
|
Context.glBufferData((uint)bufferType, (IntPtr)size, (IntPtr)bufferPtr,
|
||||||
|
(uint)usage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void SetBufferVectorData<T>(BufferType bufferType, T[] bufferArray, BufferUsage usage)
|
public unsafe void SetBufferVectorData<T>(
|
||||||
where T: unmanaged, IUnmanagedVector<T>
|
BufferType bufferType,
|
||||||
|
T[] bufferArray,
|
||||||
|
BufferUsage usage
|
||||||
|
) where T : unmanaged, IUnmanagedVector<T>
|
||||||
{
|
{
|
||||||
int size = bufferArray.Length * Marshal.SizeOf(typeof(T));
|
int size = bufferArray.Length * Marshal.SizeOf(typeof(T));
|
||||||
if (bufferArray == null) {
|
if (bufferArray == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fixed (void* bufferPtr = bufferArray) {
|
fixed (void* bufferPtr = bufferArray) {
|
||||||
Context.glBufferData((uint)bufferType, (IntPtr)size, (IntPtr)bufferPtr, (uint)usage);
|
Context.glBufferData((uint)bufferType, (IntPtr)size, (IntPtr)bufferPtr,
|
||||||
|
(uint)usage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void SetRenderBufferStorage(
|
public unsafe void SetRenderBufferStorage(
|
||||||
RenderBufferInternalFormat internalFormat,
|
RenderBufferInternalFormat internalFormat,
|
||||||
(int width, int height) size)
|
(int width, int height) size
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glRenderbufferStorage(glConst.RENDERBUFFER, (uint)internalFormat, size.width, size.height);
|
Context.glRenderbufferStorage(glConst.RENDERBUFFER, (uint)internalFormat, size.width,
|
||||||
|
size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void SetRenderBufferStorage(
|
public unsafe void SetRenderBufferStorage(
|
||||||
RenderBufferInternalFormat internalFormat,
|
RenderBufferInternalFormat internalFormat,
|
||||||
(uint width, uint height) size)
|
(uint width, uint height) size
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glRenderbufferStorage(glConst.RENDERBUFFER, (uint)internalFormat, (int)size.width,
|
Context.glRenderbufferStorage(glConst.RENDERBUFFER, (uint)internalFormat,
|
||||||
(int)size.height);
|
(int)size.width, (int)size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void SetVertexAttribute(uint index, int size, TypeCode t, bool normalized, uint stride, int pointer)
|
public void SetVertexAttribute(
|
||||||
|
uint index,
|
||||||
|
int size,
|
||||||
|
TypeCode t,
|
||||||
|
bool normalized,
|
||||||
|
uint stride,
|
||||||
|
int pointer
|
||||||
|
)
|
||||||
{
|
{
|
||||||
uint type = GraphicFramework.GLtype[(int)t];
|
uint type = GraphicFramework.GLtype[(int)t];
|
||||||
Context.glVertexAttribPointer(index, size, type, normalized ? 1 : 0, stride, (void*)pointer);
|
Context.glVertexAttribPointer(index, size, type, normalized ? 1 : 0, stride,
|
||||||
|
(void*)pointer);
|
||||||
Context.glEnableVertexAttribArray(index);
|
Context.glEnableVertexAttribArray(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -674,14 +823,14 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
uint height,
|
uint height,
|
||||||
ImageChannel targetChannel,
|
ImageChannel targetChannel,
|
||||||
PixelChannelLayout type,
|
PixelChannelLayout type,
|
||||||
T[] pixels)
|
T[] pixels
|
||||||
where T: unmanaged, INumber<T>
|
) where T : unmanaged, INumber<T>
|
||||||
{
|
{
|
||||||
fixed (T* tptr = pixels)
|
fixed (T* tptr = pixels)
|
||||||
{
|
{
|
||||||
T* ptr = ((pixels == null) || (pixels.Length == 0)) ? (T*)IntPtr.Zero : tptr;
|
T* ptr = ((pixels == null) || (pixels.Length == 0)) ? (T*)IntPtr.Zero : tptr;
|
||||||
Context.glTexImage2D((uint)target, level, (uint)sourceChannel, width, height, 0, (uint)targetChannel,
|
Context.glTexImage2D((uint)target, level, (uint)sourceChannel, width, height, 0,
|
||||||
(uint)type, tptr);
|
(uint)targetChannel, (uint)type, tptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -694,40 +843,57 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
uint height,
|
uint height,
|
||||||
ImageChannel targetChannel,
|
ImageChannel targetChannel,
|
||||||
PixelChannelLayout type,
|
PixelChannelLayout type,
|
||||||
Span<T> pixelSpan)
|
Span<T> pixelSpan
|
||||||
where T: unmanaged, INumber<T>
|
) where T : unmanaged, INumber<T>
|
||||||
{
|
{
|
||||||
fixed (T* tPtr = pixelSpan) {
|
fixed (T* tPtr = pixelSpan) {
|
||||||
Context.glTexImage2D((uint)target, level, (uint)sourceChannel, width, height, 0, (uint)targetChannel,
|
Context.glTexImage2D((uint)target, level, (uint)sourceChannel, width, height, 0,
|
||||||
(uint)type, tPtr);
|
(uint)targetChannel, (uint)type, tPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void TextureParameter(int target, uint pname, int param)
|
public void TextureParameter(
|
||||||
|
int target,
|
||||||
|
uint pname,
|
||||||
|
int param
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glTexParameteri((uint)target, pname, param);
|
Context.glTexParameteri((uint)target, pname, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool TryGetFunctionPackage(IntPtr handle, out OpenGLFunction functionPackage)
|
public static bool TryGetFunctionPackage(
|
||||||
|
IntPtr handle,
|
||||||
|
out OpenGLFunction functionPackage
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return contextToGLMap.TryGetValue(handle, out functionPackage);
|
return contextToGLMap.TryGetValue(handle, out functionPackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void UseProgram(GlHandle program)
|
public void UseProgram(
|
||||||
|
GlHandle program
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glUseProgram(program.Value);
|
Context.glUseProgram(program.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void VertexAttributeDivisor(uint layoutIndex, uint divisor)
|
public void VertexAttributeDivisor(
|
||||||
|
uint layoutIndex,
|
||||||
|
uint divisor
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glVertexAttribDivisor(layoutIndex, divisor);
|
Context.glVertexAttribDivisor(layoutIndex, divisor);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Viewport(int x, int y, uint width, uint height)
|
public void Viewport(
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
uint width,
|
||||||
|
uint height
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Context.glViewport(x, y, width, height);
|
Context.glViewport(x, y, width, height);
|
||||||
}
|
}
|
||||||
@@ -738,7 +904,9 @@ namespace StgSharp.Graphics.OpenGL
|
|||||||
Context.glFinish();
|
Context.glFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static OpenGLFunction BuildGlFunctionPackage(IntPtr handle)
|
internal static OpenGLFunction BuildGlFunctionPackage(
|
||||||
|
IntPtr handle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (contextToGLMap.TryGetValue(handle, out OpenGLFunction pack)) {
|
if (contextToGLMap.TryGetValue(handle, out OpenGLFunction pack)) {
|
||||||
return pack;
|
return pack;
|
||||||
|
|||||||
@@ -0,0 +1,182 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// Generated by StgSharp.GenerateGL on 2025-12-29 08:55:37Z
|
||||||
|
// Version: 3.3
|
||||||
|
// </auto-generated>
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using StgSharp.Graphics.OpenGL;
|
||||||
|
|
||||||
|
namespace StgSharp.Graphics.OpenGL
|
||||||
|
{
|
||||||
|
public unsafe partial class OpenGLFunction
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BindFragDataLocationIndexed(GlHandle program, uint colorNumber, uint index, byte* name)
|
||||||
|
{
|
||||||
|
Context.glBindFragDataLocationIndexed(program.Value, colorNumber, index, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BindSampler(uint unit, GlHandle sampler)
|
||||||
|
{
|
||||||
|
Context.glBindSampler(unit, sampler.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DeleteSamplers(int count, uint* samplers)
|
||||||
|
{
|
||||||
|
Context.glDeleteSamplers(count, samplers);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GenSamplers(int count, uint* samplers)
|
||||||
|
{
|
||||||
|
Context.glGenSamplers(count, samplers);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public int GetFragDataIndex(GlHandle program, byte* name)
|
||||||
|
{
|
||||||
|
return Context.glGetFragDataIndex(program.Value, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetQueryObjecti64v(uint id, uint pname, IntPtr* @params)
|
||||||
|
{
|
||||||
|
Context.glGetQueryObjecti64v(id, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetQueryObjectui64v(uint id, uint pname, IntPtr* @params)
|
||||||
|
{
|
||||||
|
Context.glGetQueryObjectui64v(id, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetSamplerParameterIiv(GlHandle sampler, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetSamplerParameterIiv(sampler.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetSamplerParameterIuiv(GlHandle sampler, uint pname, uint* @params)
|
||||||
|
{
|
||||||
|
Context.glGetSamplerParameterIuiv(sampler.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetSamplerParameterfv(GlHandle sampler, uint pname, float* @params)
|
||||||
|
{
|
||||||
|
Context.glGetSamplerParameterfv(sampler.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetSamplerParameteriv(GlHandle sampler, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetSamplerParameteriv(sampler.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public byte IsSampler(GlHandle sampler)
|
||||||
|
{
|
||||||
|
return Context.glIsSampler(sampler.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void QueryCounter(uint id, uint target)
|
||||||
|
{
|
||||||
|
Context.glQueryCounter(id, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void SamplerParameterIiv(GlHandle sampler, uint pname, int* param)
|
||||||
|
{
|
||||||
|
Context.glSamplerParameterIiv(sampler.Value, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void SamplerParameterIuiv(GlHandle sampler, uint pname, uint* param)
|
||||||
|
{
|
||||||
|
Context.glSamplerParameterIuiv(sampler.Value, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void SamplerParameterf(GlHandle sampler, uint pname, float param)
|
||||||
|
{
|
||||||
|
Context.glSamplerParameterf(sampler.Value, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void SamplerParameterfv(GlHandle sampler, uint pname, float* param)
|
||||||
|
{
|
||||||
|
Context.glSamplerParameterfv(sampler.Value, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void SamplerParameteri(GlHandle sampler, uint pname, int param)
|
||||||
|
{
|
||||||
|
Context.glSamplerParameteri(sampler.Value, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void SamplerParameteriv(GlHandle sampler, uint pname, int* param)
|
||||||
|
{
|
||||||
|
Context.glSamplerParameteriv(sampler.Value, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribDivisor(uint index, uint divisor)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribDivisor(index, divisor);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribP1ui(uint index, uint type, byte normalized, uint value)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribP1ui(index, type, normalized, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribP1uiv(uint index, uint type, byte normalized, uint* value)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribP1uiv(index, type, normalized, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribP2ui(uint index, uint type, byte normalized, uint value)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribP2ui(index, type, normalized, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribP2uiv(uint index, uint type, byte normalized, uint* value)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribP2uiv(index, type, normalized, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribP3ui(uint index, uint type, byte normalized, uint value)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribP3ui(index, type, normalized, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribP3uiv(uint index, uint type, byte normalized, uint* value)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribP3uiv(index, type, normalized, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribP4ui(uint index, uint type, byte normalized, uint value)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribP4ui(index, type, normalized, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribP4uiv(uint index, uint type, byte normalized, uint* value)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribP4uiv(index, type, normalized, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,278 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// Generated by StgSharp.GenerateGL on 2025-12-29 08:55:37Z
|
||||||
|
// Version: 4.0
|
||||||
|
// </auto-generated>
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using StgSharp.Graphics.OpenGL;
|
||||||
|
|
||||||
|
namespace StgSharp.Graphics.OpenGL
|
||||||
|
{
|
||||||
|
public unsafe partial class OpenGLFunction
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BindTransformFeedback(uint target, uint id)
|
||||||
|
{
|
||||||
|
Context.glBindTransformFeedback(target, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BlendEquationSeparatei(uint buf, uint modeRGB, uint modeAlpha)
|
||||||
|
{
|
||||||
|
Context.glBlendEquationSeparatei(buf, modeRGB, modeAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BlendEquationi(uint buf, uint mode)
|
||||||
|
{
|
||||||
|
Context.glBlendEquationi(buf, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BlendFuncSeparatei(uint buf, uint srcRGB, uint dstRGB, uint srcAlpha, uint dstAlpha)
|
||||||
|
{
|
||||||
|
Context.glBlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BlendFunci(uint buf, uint src, uint dst)
|
||||||
|
{
|
||||||
|
Context.glBlendFunci(buf, src, dst);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DeleteTransformFeedbacks(int n, uint* ids)
|
||||||
|
{
|
||||||
|
Context.glDeleteTransformFeedbacks(n, ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DrawArraysIndirect(uint mode, IntPtr* indirect)
|
||||||
|
{
|
||||||
|
Context.glDrawArraysIndirect(mode, indirect);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DrawElementsIndirect(uint mode, uint type, IntPtr* indirect)
|
||||||
|
{
|
||||||
|
Context.glDrawElementsIndirect(mode, type, indirect);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DrawTransformFeedback(uint mode, uint id)
|
||||||
|
{
|
||||||
|
Context.glDrawTransformFeedback(mode, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DrawTransformFeedbackStream(uint mode, uint id, uint stream)
|
||||||
|
{
|
||||||
|
Context.glDrawTransformFeedbackStream(mode, id, stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GenTransformFeedbacks(int n, uint* ids)
|
||||||
|
{
|
||||||
|
Context.glGenTransformFeedbacks(n, ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetActiveSubroutineName(GlHandle program, uint shadertype, uint index, int bufSize, int* length, byte* name)
|
||||||
|
{
|
||||||
|
Context.glGetActiveSubroutineName(program.Value, shadertype, index, bufSize, length, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetActiveSubroutineUniformName(GlHandle program, uint shadertype, uint index, int bufSize, int* length, byte* name)
|
||||||
|
{
|
||||||
|
Context.glGetActiveSubroutineUniformName(program.Value, shadertype, index, bufSize, length, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetActiveSubroutineUniformiv(GlHandle program, uint shadertype, uint index, uint pname, int* values)
|
||||||
|
{
|
||||||
|
Context.glGetActiveSubroutineUniformiv(program.Value, shadertype, index, pname, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetProgramStageiv(GlHandle program, uint shadertype, uint pname, int* values)
|
||||||
|
{
|
||||||
|
Context.glGetProgramStageiv(program.Value, shadertype, pname, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetQueryIndexediv(uint target, uint index, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetQueryIndexediv(target, index, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public uint GetSubroutineIndex(GlHandle program, uint shadertype, byte* name)
|
||||||
|
{
|
||||||
|
return Context.glGetSubroutineIndex(program.Value, shadertype, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public int GetSubroutineUniformLocation(GlHandle program, uint shadertype, byte* name)
|
||||||
|
{
|
||||||
|
return Context.glGetSubroutineUniformLocation(program.Value, shadertype, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetUniformSubroutineuiv(uint shadertype, int location, uint* @params)
|
||||||
|
{
|
||||||
|
Context.glGetUniformSubroutineuiv(shadertype, location, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetUniformdv(GlHandle program, int location, double* @params)
|
||||||
|
{
|
||||||
|
Context.glGetUniformdv(program.Value, location, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public byte IsTransformFeedback(uint id)
|
||||||
|
{
|
||||||
|
return Context.glIsTransformFeedback(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void MinSampleShading(float value)
|
||||||
|
{
|
||||||
|
Context.glMinSampleShading(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void PatchParameterfv(uint pname, float* values)
|
||||||
|
{
|
||||||
|
Context.glPatchParameterfv(pname, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void PatchParameteri(uint pname, int value)
|
||||||
|
{
|
||||||
|
Context.glPatchParameteri(pname, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void PauseTransformFeedback()
|
||||||
|
{
|
||||||
|
Context.glPauseTransformFeedback();
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ResumeTransformFeedback()
|
||||||
|
{
|
||||||
|
Context.glResumeTransformFeedback();
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void Uniform1d(int location, double x)
|
||||||
|
{
|
||||||
|
Context.glUniform1d(location, x);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void Uniform1dv(int location, int count, double* value)
|
||||||
|
{
|
||||||
|
Context.glUniform1dv(location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void Uniform2d(int location, double x, double y)
|
||||||
|
{
|
||||||
|
Context.glUniform2d(location, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void Uniform2dv(int location, int count, double* value)
|
||||||
|
{
|
||||||
|
Context.glUniform2dv(location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void Uniform3d(int location, double x, double y, double z)
|
||||||
|
{
|
||||||
|
Context.glUniform3d(location, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void Uniform3dv(int location, int count, double* value)
|
||||||
|
{
|
||||||
|
Context.glUniform3dv(location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void Uniform4d(int location, double x, double y, double z, double w)
|
||||||
|
{
|
||||||
|
Context.glUniform4d(location, x, y, z, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void Uniform4dv(int location, int count, double* value)
|
||||||
|
{
|
||||||
|
Context.glUniform4dv(location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void UniformMatrix2dv(int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glUniformMatrix2dv(location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void UniformMatrix2x3dv(int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glUniformMatrix2x3dv(location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void UniformMatrix2x4dv(int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glUniformMatrix2x4dv(location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void UniformMatrix3dv(int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glUniformMatrix3dv(location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void UniformMatrix3x2dv(int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glUniformMatrix3x2dv(location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void UniformMatrix3x4dv(int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glUniformMatrix3x4dv(location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void UniformMatrix4dv(int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glUniformMatrix4dv(location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void UniformMatrix4x2dv(int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glUniformMatrix4x2dv(location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void UniformMatrix4x3dv(int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glUniformMatrix4x3dv(location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void UniformSubroutinesuiv(uint shadertype, int count, uint* indices)
|
||||||
|
{
|
||||||
|
Context.glUniformSubroutinesuiv(shadertype, count, indices);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,542 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// Generated by StgSharp.GenerateGL on 2025-12-29 08:55:37Z
|
||||||
|
// Version: 4.1
|
||||||
|
// </auto-generated>
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using StgSharp.Graphics.OpenGL;
|
||||||
|
|
||||||
|
namespace StgSharp.Graphics.OpenGL
|
||||||
|
{
|
||||||
|
public unsafe partial class OpenGLFunction
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ActiveShaderProgram(uint pipeline, GlHandle program)
|
||||||
|
{
|
||||||
|
Context.glActiveShaderProgram(pipeline, program.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BindProgramPipeline(uint pipeline)
|
||||||
|
{
|
||||||
|
Context.glBindProgramPipeline(pipeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ClearDepthf(float d)
|
||||||
|
{
|
||||||
|
Context.glClearDepthf(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public uint CreateShaderProgramv(uint type, int count, byte* strings)
|
||||||
|
{
|
||||||
|
return Context.glCreateShaderProgramv(type, count, strings);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DeleteProgramPipelines(int n, uint* pipelines)
|
||||||
|
{
|
||||||
|
Context.glDeleteProgramPipelines(n, pipelines);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DepthRangeArrayv(uint first, int count, double* v)
|
||||||
|
{
|
||||||
|
Context.glDepthRangeArrayv(first, count, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DepthRangeIndexed(uint index, double n, double f)
|
||||||
|
{
|
||||||
|
Context.glDepthRangeIndexed(index, n, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DepthRangef(float n, float f)
|
||||||
|
{
|
||||||
|
Context.glDepthRangef(n, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GenProgramPipelines(int n, uint* pipelines)
|
||||||
|
{
|
||||||
|
Context.glGenProgramPipelines(n, pipelines);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetDoublei_v(uint target, uint index, double* data)
|
||||||
|
{
|
||||||
|
Context.glGetDoublei_v(target, index, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetFloati_v(uint target, uint index, float* data)
|
||||||
|
{
|
||||||
|
Context.glGetFloati_v(target, index, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetProgramBinary(GlHandle program, int bufSize, int* length, uint* binaryFormat, IntPtr* binary)
|
||||||
|
{
|
||||||
|
Context.glGetProgramBinary(program.Value, bufSize, length, binaryFormat, binary);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetProgramPipelineInfoLog(uint pipeline, int bufSize, int* length, byte* infoLog)
|
||||||
|
{
|
||||||
|
Context.glGetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetProgramPipelineiv(uint pipeline, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetProgramPipelineiv(pipeline, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetShaderPrecisionFormat(uint shadertype, uint precisiontype, int* range, int* precision)
|
||||||
|
{
|
||||||
|
Context.glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetVertexAttribLdv(uint index, uint pname, double* @params)
|
||||||
|
{
|
||||||
|
Context.glGetVertexAttribLdv(index, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public byte IsProgramPipeline(uint pipeline)
|
||||||
|
{
|
||||||
|
return Context.glIsProgramPipeline(pipeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramBinary(GlHandle program, uint binaryFormat, IntPtr* binary, int length)
|
||||||
|
{
|
||||||
|
Context.glProgramBinary(program.Value, binaryFormat, binary, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramParameteri(GlHandle program, uint pname, int value)
|
||||||
|
{
|
||||||
|
Context.glProgramParameteri(program.Value, pname, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform1d(GlHandle program, int location, double v0)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform1d(program.Value, location, v0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform1dv(GlHandle program, int location, int count, double* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform1dv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform1f(GlHandle program, int location, float v0)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform1f(program.Value, location, v0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform1fv(GlHandle program, int location, int count, float* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform1fv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform1i(GlHandle program, int location, int v0)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform1i(program.Value, location, v0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform1iv(GlHandle program, int location, int count, int* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform1iv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform1ui(GlHandle program, int location, uint v0)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform1ui(program.Value, location, v0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform1uiv(GlHandle program, int location, int count, uint* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform1uiv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform2d(GlHandle program, int location, double v0, double v1)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform2d(program.Value, location, v0, v1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform2dv(GlHandle program, int location, int count, double* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform2dv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform2f(GlHandle program, int location, float v0, float v1)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform2f(program.Value, location, v0, v1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform2fv(GlHandle program, int location, int count, float* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform2fv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform2i(GlHandle program, int location, int v0, int v1)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform2i(program.Value, location, v0, v1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform2iv(GlHandle program, int location, int count, int* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform2iv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform2ui(GlHandle program, int location, uint v0, uint v1)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform2ui(program.Value, location, v0, v1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform2uiv(GlHandle program, int location, int count, uint* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform2uiv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform3d(GlHandle program, int location, double v0, double v1, double v2)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform3d(program.Value, location, v0, v1, v2);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform3dv(GlHandle program, int location, int count, double* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform3dv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform3f(GlHandle program, int location, float v0, float v1, float v2)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform3f(program.Value, location, v0, v1, v2);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform3fv(GlHandle program, int location, int count, float* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform3fv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform3i(GlHandle program, int location, int v0, int v1, int v2)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform3i(program.Value, location, v0, v1, v2);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform3iv(GlHandle program, int location, int count, int* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform3iv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform3ui(GlHandle program, int location, uint v0, uint v1, uint v2)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform3ui(program.Value, location, v0, v1, v2);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform3uiv(GlHandle program, int location, int count, uint* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform3uiv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform4d(GlHandle program, int location, double v0, double v1, double v2, double v3)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform4d(program.Value, location, v0, v1, v2, v3);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform4dv(GlHandle program, int location, int count, double* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform4dv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform4f(GlHandle program, int location, float v0, float v1, float v2, float v3)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform4f(program.Value, location, v0, v1, v2, v3);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform4fv(GlHandle program, int location, int count, float* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform4fv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform4i(GlHandle program, int location, int v0, int v1, int v2, int v3)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform4i(program.Value, location, v0, v1, v2, v3);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform4iv(GlHandle program, int location, int count, int* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform4iv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform4ui(GlHandle program, int location, uint v0, uint v1, uint v2, uint v3)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform4ui(program.Value, location, v0, v1, v2, v3);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniform4uiv(GlHandle program, int location, int count, uint* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniform4uiv(program.Value, location, count, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix2dv(GlHandle program, int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix2dv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix2fv(GlHandle program, int location, int count, byte transpose, float* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix2fv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix2x3dv(GlHandle program, int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix2x3dv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix2x3fv(GlHandle program, int location, int count, byte transpose, float* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix2x3fv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix2x4dv(GlHandle program, int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix2x4dv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix2x4fv(GlHandle program, int location, int count, byte transpose, float* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix2x4fv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix3dv(GlHandle program, int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix3dv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix3fv(GlHandle program, int location, int count, byte transpose, float* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix3fv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix3x2dv(GlHandle program, int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix3x2dv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix3x2fv(GlHandle program, int location, int count, byte transpose, float* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix3x2fv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix3x4dv(GlHandle program, int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix3x4dv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix3x4fv(GlHandle program, int location, int count, byte transpose, float* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix3x4fv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix4dv(GlHandle program, int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix4dv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix4fv(GlHandle program, int location, int count, byte transpose, float* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix4fv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix4x2dv(GlHandle program, int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix4x2dv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix4x2fv(GlHandle program, int location, int count, byte transpose, float* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix4x2fv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix4x3dv(GlHandle program, int location, int count, byte transpose, double* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix4x3dv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ProgramUniformMatrix4x3fv(GlHandle program, int location, int count, byte transpose, float* value)
|
||||||
|
{
|
||||||
|
Context.glProgramUniformMatrix4x3fv(program.Value, location, count, transpose, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ReleaseShaderCompiler()
|
||||||
|
{
|
||||||
|
Context.glReleaseShaderCompiler();
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ScissorArrayv(uint first, int count, int* v)
|
||||||
|
{
|
||||||
|
Context.glScissorArrayv(first, count, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ScissorIndexed(uint index, int left, int bottom, int width, int height)
|
||||||
|
{
|
||||||
|
Context.glScissorIndexed(index, left, bottom, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ScissorIndexedv(uint index, int* v)
|
||||||
|
{
|
||||||
|
Context.glScissorIndexedv(index, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ShaderBinary(int count, uint* shaders, uint binaryFormat, IntPtr* binary, int length)
|
||||||
|
{
|
||||||
|
Context.glShaderBinary(count, shaders, binaryFormat, binary, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void UseProgramStages(uint pipeline, uint stages, GlHandle program)
|
||||||
|
{
|
||||||
|
Context.glUseProgramStages(pipeline, stages, program.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ValidateProgramPipeline(uint pipeline)
|
||||||
|
{
|
||||||
|
Context.glValidateProgramPipeline(pipeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribL1d(uint index, double x)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribL1d(index, x);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribL1dv(uint index, double* v)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribL1dv(index, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribL2d(uint index, double x, double y)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribL2d(index, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribL2dv(uint index, double* v)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribL2dv(index, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribL3d(uint index, double x, double y, double z)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribL3d(index, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribL3dv(uint index, double* v)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribL3dv(index, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribL4d(uint index, double x, double y, double z, double w)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribL4d(index, x, y, z, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribL4dv(uint index, double* v)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribL4dv(index, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribLPointer(uint index, int size, uint type, int stride, IntPtr* pointer)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribLPointer(index, size, type, stride, pointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ViewportArrayv(uint first, int count, float* v)
|
||||||
|
{
|
||||||
|
Context.glViewportArrayv(first, count, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ViewportIndexedf(uint index, float x, float y, float w, float h)
|
||||||
|
{
|
||||||
|
Context.glViewportIndexedf(index, x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ViewportIndexedfv(uint index, float* v)
|
||||||
|
{
|
||||||
|
Context.glViewportIndexedfv(index, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// Generated by StgSharp.GenerateGL on 2025-12-29 08:55:37Z
|
||||||
|
// Version: 4.2
|
||||||
|
// </auto-generated>
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using StgSharp.Graphics.OpenGL;
|
||||||
|
|
||||||
|
namespace StgSharp.Graphics.OpenGL
|
||||||
|
{
|
||||||
|
public unsafe partial class OpenGLFunction
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BindImageTexture(uint unit, GlHandle texture, int level, byte layered, int layer, uint access, uint format)
|
||||||
|
{
|
||||||
|
Context.glBindImageTexture(unit, texture.Value, level, layered, layer, access, format);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DrawArraysInstancedBaseInstance(uint mode, int first, int count, int instancecount, uint baseinstance)
|
||||||
|
{
|
||||||
|
Context.glDrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DrawElementsInstancedBaseInstance(uint mode, int count, uint type, IntPtr* indices, int instancecount, uint baseinstance)
|
||||||
|
{
|
||||||
|
Context.glDrawElementsInstancedBaseInstance(mode, count, type, indices, instancecount, baseinstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DrawElementsInstancedBaseVertexBaseInstance(uint mode, int count, uint type, IntPtr* indices, int instancecount, int basevertex, uint baseinstance)
|
||||||
|
{
|
||||||
|
Context.glDrawElementsInstancedBaseVertexBaseInstance(mode, count, type, indices, instancecount, basevertex, baseinstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DrawTransformFeedbackInstanced(uint mode, uint id, int instancecount)
|
||||||
|
{
|
||||||
|
Context.glDrawTransformFeedbackInstanced(mode, id, instancecount);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DrawTransformFeedbackStreamInstanced(uint mode, uint id, uint stream, int instancecount)
|
||||||
|
{
|
||||||
|
Context.glDrawTransformFeedbackStreamInstanced(mode, id, stream, instancecount);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetActiveAtomicCounterBufferiv(GlHandle program, GlHandle bufferIndex, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetActiveAtomicCounterBufferiv(program.Value, bufferIndex.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetInternalformativ(uint target, uint internalformat, uint pname, int count, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetInternalformativ(target, internalformat, pname, count, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void MemoryBarrier(uint barriers)
|
||||||
|
{
|
||||||
|
Context.glMemoryBarrier(barriers);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TexStorage1D(uint target, int levels, uint internalformat, int width)
|
||||||
|
{
|
||||||
|
Context.glTexStorage1D(target, levels, internalformat, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TexStorage2D(uint target, int levels, uint internalformat, int width, int height)
|
||||||
|
{
|
||||||
|
Context.glTexStorage2D(target, levels, internalformat, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TexStorage3D(uint target, int levels, uint internalformat, int width, int height, int depth)
|
||||||
|
{
|
||||||
|
Context.glTexStorage3D(target, levels, internalformat, width, height, depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,278 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// Generated by StgSharp.GenerateGL on 2025-12-29 08:55:37Z
|
||||||
|
// Version: 4.3
|
||||||
|
// </auto-generated>
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using StgSharp.Graphics.OpenGL;
|
||||||
|
|
||||||
|
namespace StgSharp.Graphics.OpenGL
|
||||||
|
{
|
||||||
|
public unsafe partial class OpenGLFunction
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BindVertexBuffer(uint bindingindex, GlHandle buffer, nint offset, int stride)
|
||||||
|
{
|
||||||
|
Context.glBindVertexBuffer(bindingindex, buffer.Value, offset, stride);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ClearBufferData(uint target, uint internalformat, uint format, uint type, IntPtr* data)
|
||||||
|
{
|
||||||
|
Context.glClearBufferData(target, internalformat, format, type, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ClearBufferSubData(uint target, uint internalformat, nint offset, nuint size, uint format, uint type, IntPtr* data)
|
||||||
|
{
|
||||||
|
Context.glClearBufferSubData(target, internalformat, offset, size, format, type, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CopyImageSubData(uint srcName, uint srcTarget, int srcLevel, int srcX, int srcY, int srcZ, uint dstName, uint dstTarget, int dstLevel, int dstX, int dstY, int dstZ, int srcWidth, int srcHeight, int srcDepth)
|
||||||
|
{
|
||||||
|
Context.glCopyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DebugMessageCallback(IntPtr callback, IntPtr* userParam)
|
||||||
|
{
|
||||||
|
Context.glDebugMessageCallback(callback, userParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DebugMessageControl(uint source, uint type, uint severity, int count, uint* ids, byte enabled)
|
||||||
|
{
|
||||||
|
Context.glDebugMessageControl(source, type, severity, count, ids, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DebugMessageInsert(uint source, uint type, uint id, uint severity, int length, byte* buf)
|
||||||
|
{
|
||||||
|
Context.glDebugMessageInsert(source, type, id, severity, length, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DispatchCompute(uint num_groups_x, uint num_groups_y, uint num_groups_z)
|
||||||
|
{
|
||||||
|
Context.glDispatchCompute(num_groups_x, num_groups_y, num_groups_z);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DispatchComputeIndirect(nint indirect)
|
||||||
|
{
|
||||||
|
Context.glDispatchComputeIndirect(indirect);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void FramebufferParameteri(uint target, uint pname, int param)
|
||||||
|
{
|
||||||
|
Context.glFramebufferParameteri(target, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public uint GetDebugMessageLog(uint count, int bufSize, uint* sources, uint* types, uint* ids, uint* severities, int* lengths, byte* messageLog)
|
||||||
|
{
|
||||||
|
return Context.glGetDebugMessageLog(count, bufSize, sources, types, ids, severities, lengths, messageLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetFramebufferParameteriv(uint target, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetFramebufferParameteriv(target, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetInternalformati64v(uint target, uint internalformat, uint pname, int count, IntPtr* @params)
|
||||||
|
{
|
||||||
|
Context.glGetInternalformati64v(target, internalformat, pname, count, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetObjectLabel(uint identifier, uint name, int bufSize, int* length, byte* label)
|
||||||
|
{
|
||||||
|
Context.glGetObjectLabel(identifier, name, bufSize, length, label);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetObjectPtrLabel(IntPtr* ptr, int bufSize, int* length, byte* label)
|
||||||
|
{
|
||||||
|
Context.glGetObjectPtrLabel(ptr, bufSize, length, label);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetPointerv(uint pname, IntPtr* @params)
|
||||||
|
{
|
||||||
|
Context.glGetPointerv(pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetProgramInterfaceiv(GlHandle program, uint programInterface, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetProgramInterfaceiv(program.Value, programInterface, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public uint GetProgramResourceIndex(GlHandle program, uint programInterface, byte* name)
|
||||||
|
{
|
||||||
|
return Context.glGetProgramResourceIndex(program.Value, programInterface, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public int GetProgramResourceLocation(GlHandle program, uint programInterface, byte* name)
|
||||||
|
{
|
||||||
|
return Context.glGetProgramResourceLocation(program.Value, programInterface, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public int GetProgramResourceLocationIndex(GlHandle program, uint programInterface, byte* name)
|
||||||
|
{
|
||||||
|
return Context.glGetProgramResourceLocationIndex(program.Value, programInterface, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetProgramResourceName(GlHandle program, uint programInterface, uint index, int bufSize, int* length, byte* name)
|
||||||
|
{
|
||||||
|
Context.glGetProgramResourceName(program.Value, programInterface, index, bufSize, length, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetProgramResourceiv(GlHandle program, uint programInterface, uint index, int propCount, uint* props, int count, int* length, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetProgramResourceiv(program.Value, programInterface, index, propCount, props, count, length, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void InvalidateBufferData(GlHandle buffer)
|
||||||
|
{
|
||||||
|
Context.glInvalidateBufferData(buffer.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void InvalidateBufferSubData(GlHandle buffer, nint offset, nuint length)
|
||||||
|
{
|
||||||
|
Context.glInvalidateBufferSubData(buffer.Value, offset, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void InvalidateFramebuffer(uint target, int numAttachments, uint* attachments)
|
||||||
|
{
|
||||||
|
Context.glInvalidateFramebuffer(target, numAttachments, attachments);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void InvalidateSubFramebuffer(uint target, int numAttachments, uint* attachments, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
Context.glInvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void InvalidateTexImage(GlHandle texture, int level)
|
||||||
|
{
|
||||||
|
Context.glInvalidateTexImage(texture.Value, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void InvalidateTexSubImage(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth)
|
||||||
|
{
|
||||||
|
Context.glInvalidateTexSubImage(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void MultiDrawArraysIndirect(uint mode, IntPtr* indirect, int drawcount, int stride)
|
||||||
|
{
|
||||||
|
Context.glMultiDrawArraysIndirect(mode, indirect, drawcount, stride);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void MultiDrawElementsIndirect(uint mode, uint type, IntPtr* indirect, int drawcount, int stride)
|
||||||
|
{
|
||||||
|
Context.glMultiDrawElementsIndirect(mode, type, indirect, drawcount, stride);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ObjectLabel(uint identifier, uint name, int length, byte* label)
|
||||||
|
{
|
||||||
|
Context.glObjectLabel(identifier, name, length, label);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ObjectPtrLabel(IntPtr* ptr, int length, byte* label)
|
||||||
|
{
|
||||||
|
Context.glObjectPtrLabel(ptr, length, label);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void PopDebugGroup()
|
||||||
|
{
|
||||||
|
Context.glPopDebugGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void PushDebugGroup(uint source, uint id, int length, byte* message)
|
||||||
|
{
|
||||||
|
Context.glPushDebugGroup(source, id, length, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ShaderStorageBlockBinding(GlHandle program, uint storageBlockIndex, uint storageBlockBinding)
|
||||||
|
{
|
||||||
|
Context.glShaderStorageBlockBinding(program.Value, storageBlockIndex, storageBlockBinding);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TexBufferRange(uint target, uint internalformat, GlHandle buffer, nint offset, nuint size)
|
||||||
|
{
|
||||||
|
Context.glTexBufferRange(target, internalformat, buffer.Value, offset, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TexStorage2DMultisample(uint target, int samples, uint internalformat, int width, int height, byte fixedsamplelocations)
|
||||||
|
{
|
||||||
|
Context.glTexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TexStorage3DMultisample(uint target, int samples, uint internalformat, int width, int height, int depth, byte fixedsamplelocations)
|
||||||
|
{
|
||||||
|
Context.glTexStorage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureView(GlHandle texture, uint target, GlHandle origtexture, uint internalformat, uint minlevel, uint numlevels, uint minlayer, uint numlayers)
|
||||||
|
{
|
||||||
|
Context.glTextureView(texture.Value, target, origtexture.Value, internalformat, minlevel, numlevels, minlayer, numlayers);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribBinding(uint attribindex, uint bindingindex)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribBinding(attribindex, bindingindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribFormat(uint attribindex, int size, uint type, byte normalized, uint relativeoffset)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribFormat(attribindex, size, type, normalized, relativeoffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribIFormat(uint attribindex, int size, uint type, uint relativeoffset)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribIFormat(attribindex, size, type, relativeoffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexAttribLFormat(uint attribindex, int size, uint type, uint relativeoffset)
|
||||||
|
{
|
||||||
|
Context.glVertexAttribLFormat(attribindex, size, type, relativeoffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexBindingDivisor(uint bindingindex, uint divisor)
|
||||||
|
{
|
||||||
|
Context.glVertexBindingDivisor(bindingindex, divisor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// Generated by StgSharp.GenerateGL on 2025-12-29 08:55:37Z
|
||||||
|
// Version: 4.4
|
||||||
|
// </auto-generated>
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using StgSharp.Graphics.OpenGL;
|
||||||
|
|
||||||
|
namespace StgSharp.Graphics.OpenGL
|
||||||
|
{
|
||||||
|
public unsafe partial class OpenGLFunction
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BindBuffersBase(uint target, uint first, int count, uint* buffers)
|
||||||
|
{
|
||||||
|
Context.glBindBuffersBase(target, first, count, buffers);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BindBuffersRange(uint target, uint first, int count, uint* buffers, nint* offsets, nuint* sizes)
|
||||||
|
{
|
||||||
|
Context.glBindBuffersRange(target, first, count, buffers, offsets, sizes);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BindImageTextures(uint first, int count, uint* textures)
|
||||||
|
{
|
||||||
|
Context.glBindImageTextures(first, count, textures);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BindSamplers(uint first, int count, uint* samplers)
|
||||||
|
{
|
||||||
|
Context.glBindSamplers(first, count, samplers);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BindTextures(uint first, int count, uint* textures)
|
||||||
|
{
|
||||||
|
Context.glBindTextures(first, count, textures);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BindVertexBuffers(uint first, int count, uint* buffers, nint* offsets, int* strides)
|
||||||
|
{
|
||||||
|
Context.glBindVertexBuffers(first, count, buffers, offsets, strides);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BufferStorage(uint target, nuint size, IntPtr* data, uint flags)
|
||||||
|
{
|
||||||
|
Context.glBufferStorage(target, size, data, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ClearTexImage(GlHandle texture, int level, uint format, uint type, IntPtr* data)
|
||||||
|
{
|
||||||
|
Context.glClearTexImage(texture.Value, level, format, type, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ClearTexSubImage(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, uint type, IntPtr* data)
|
||||||
|
{
|
||||||
|
Context.glClearTexSubImage(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,746 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// Generated by StgSharp.GenerateGL on 2025-12-29 08:55:37Z
|
||||||
|
// Version: 4.5
|
||||||
|
// </auto-generated>
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using StgSharp.Graphics.OpenGL;
|
||||||
|
|
||||||
|
namespace StgSharp.Graphics.OpenGL
|
||||||
|
{
|
||||||
|
public unsafe partial class OpenGLFunction
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BindTextureUnit(uint unit, GlHandle texture)
|
||||||
|
{
|
||||||
|
Context.glBindTextureUnit(unit, texture.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void BlitNamedFramebuffer(GlHandle readFramebuffer, GlHandle drawFramebuffer, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, uint mask, uint filter)
|
||||||
|
{
|
||||||
|
Context.glBlitNamedFramebuffer(readFramebuffer.Value, drawFramebuffer.Value, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public uint CheckNamedFramebufferStatus(GlHandle framebuffer, uint target)
|
||||||
|
{
|
||||||
|
return Context.glCheckNamedFramebufferStatus(framebuffer.Value, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ClearNamedBufferData(GlHandle buffer, uint internalformat, uint format, uint type, IntPtr* data)
|
||||||
|
{
|
||||||
|
Context.glClearNamedBufferData(buffer.Value, internalformat, format, type, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ClearNamedBufferSubData(GlHandle buffer, uint internalformat, nint offset, nuint size, uint format, uint type, IntPtr* data)
|
||||||
|
{
|
||||||
|
Context.glClearNamedBufferSubData(buffer.Value, internalformat, offset, size, format, type, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ClearNamedFramebufferfi(GlHandle framebuffer, uint buffer, int drawbuffer, float depth, int stencil)
|
||||||
|
{
|
||||||
|
Context.glClearNamedFramebufferfi(framebuffer.Value, buffer, drawbuffer, depth, stencil);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ClearNamedFramebufferfv(GlHandle framebuffer, uint buffer, int drawbuffer, float* value)
|
||||||
|
{
|
||||||
|
Context.glClearNamedFramebufferfv(framebuffer.Value, buffer, drawbuffer, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ClearNamedFramebufferiv(GlHandle framebuffer, uint buffer, int drawbuffer, int* value)
|
||||||
|
{
|
||||||
|
Context.glClearNamedFramebufferiv(framebuffer.Value, buffer, drawbuffer, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ClearNamedFramebufferuiv(GlHandle framebuffer, uint buffer, int drawbuffer, uint* value)
|
||||||
|
{
|
||||||
|
Context.glClearNamedFramebufferuiv(framebuffer.Value, buffer, drawbuffer, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ClipControl(uint origin, uint depth)
|
||||||
|
{
|
||||||
|
Context.glClipControl(origin, depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CompressedTextureSubImage1D(GlHandle texture, int level, int xoffset, int width, uint format, int imageSize, IntPtr* data)
|
||||||
|
{
|
||||||
|
Context.glCompressedTextureSubImage1D(texture.Value, level, xoffset, width, format, imageSize, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CompressedTextureSubImage2D(GlHandle texture, int level, int xoffset, int yoffset, int width, int height, uint format, int imageSize, IntPtr* data)
|
||||||
|
{
|
||||||
|
Context.glCompressedTextureSubImage2D(texture.Value, level, xoffset, yoffset, width, height, format, imageSize, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CompressedTextureSubImage3D(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, int imageSize, IntPtr* data)
|
||||||
|
{
|
||||||
|
Context.glCompressedTextureSubImage3D(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CopyNamedBufferSubData(GlHandle readBuffer, GlHandle writeBuffer, nint readOffset, nint writeOffset, nuint size)
|
||||||
|
{
|
||||||
|
Context.glCopyNamedBufferSubData(readBuffer.Value, writeBuffer.Value, readOffset, writeOffset, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CopyTextureSubImage1D(GlHandle texture, int level, int xoffset, int x, int y, int width)
|
||||||
|
{
|
||||||
|
Context.glCopyTextureSubImage1D(texture.Value, level, xoffset, x, y, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CopyTextureSubImage2D(GlHandle texture, int level, int xoffset, int yoffset, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
Context.glCopyTextureSubImage2D(texture.Value, level, xoffset, yoffset, x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CopyTextureSubImage3D(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
Context.glCopyTextureSubImage3D(texture.Value, level, xoffset, yoffset, zoffset, x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CreateBuffers(int n, uint* buffers)
|
||||||
|
{
|
||||||
|
Context.glCreateBuffers(n, buffers);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CreateFramebuffers(int n, uint* framebuffers)
|
||||||
|
{
|
||||||
|
Context.glCreateFramebuffers(n, framebuffers);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CreateProgramPipelines(int n, uint* pipelines)
|
||||||
|
{
|
||||||
|
Context.glCreateProgramPipelines(n, pipelines);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CreateQueries(uint target, int n, uint* ids)
|
||||||
|
{
|
||||||
|
Context.glCreateQueries(target, n, ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CreateRenderbuffers(int n, uint* renderbuffers)
|
||||||
|
{
|
||||||
|
Context.glCreateRenderbuffers(n, renderbuffers);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CreateSamplers(int n, uint* samplers)
|
||||||
|
{
|
||||||
|
Context.glCreateSamplers(n, samplers);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CreateTextures(uint target, int n, uint* textures)
|
||||||
|
{
|
||||||
|
Context.glCreateTextures(target, n, textures);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CreateTransformFeedbacks(int n, uint* ids)
|
||||||
|
{
|
||||||
|
Context.glCreateTransformFeedbacks(n, ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void CreateVertexArrays(int n, uint* arrays)
|
||||||
|
{
|
||||||
|
Context.glCreateVertexArrays(n, arrays);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void DisableVertexArrayAttrib(uint vaobj, uint index)
|
||||||
|
{
|
||||||
|
Context.glDisableVertexArrayAttrib(vaobj, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void EnableVertexArrayAttrib(uint vaobj, uint index)
|
||||||
|
{
|
||||||
|
Context.glEnableVertexArrayAttrib(vaobj, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void FlushMappedNamedBufferRange(GlHandle buffer, nint offset, nuint length)
|
||||||
|
{
|
||||||
|
Context.glFlushMappedNamedBufferRange(buffer.Value, offset, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GenerateTextureMipmap(GlHandle texture)
|
||||||
|
{
|
||||||
|
Context.glGenerateTextureMipmap(texture.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetCompressedTextureImage(GlHandle texture, int level, int bufSize, IntPtr* pixels)
|
||||||
|
{
|
||||||
|
Context.glGetCompressedTextureImage(texture.Value, level, bufSize, pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetCompressedTextureSubImage(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int bufSize, IntPtr* pixels)
|
||||||
|
{
|
||||||
|
Context.glGetCompressedTextureSubImage(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public uint GetGraphicsResetStatus()
|
||||||
|
{
|
||||||
|
return Context.glGetGraphicsResetStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetNamedBufferParameteri64v(GlHandle buffer, uint pname, IntPtr* @params)
|
||||||
|
{
|
||||||
|
Context.glGetNamedBufferParameteri64v(buffer.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetNamedBufferParameteriv(GlHandle buffer, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetNamedBufferParameteriv(buffer.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetNamedBufferPointerv(GlHandle buffer, uint pname, IntPtr* @params)
|
||||||
|
{
|
||||||
|
Context.glGetNamedBufferPointerv(buffer.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetNamedBufferSubData(GlHandle buffer, nint offset, nuint size, IntPtr* data)
|
||||||
|
{
|
||||||
|
Context.glGetNamedBufferSubData(buffer.Value, offset, size, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetNamedFramebufferAttachmentParameteriv(GlHandle framebuffer, uint attachment, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetNamedFramebufferAttachmentParameteriv(framebuffer.Value, attachment, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetNamedFramebufferParameteriv(GlHandle framebuffer, uint pname, int* param)
|
||||||
|
{
|
||||||
|
Context.glGetNamedFramebufferParameteriv(framebuffer.Value, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetNamedRenderbufferParameteriv(GlHandle renderbuffer, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetNamedRenderbufferParameteriv(renderbuffer.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetQueryBufferObjecti64v(uint id, GlHandle buffer, uint pname, nint offset)
|
||||||
|
{
|
||||||
|
Context.glGetQueryBufferObjecti64v(id, buffer.Value, pname, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetQueryBufferObjectiv(uint id, GlHandle buffer, uint pname, nint offset)
|
||||||
|
{
|
||||||
|
Context.glGetQueryBufferObjectiv(id, buffer.Value, pname, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetQueryBufferObjectui64v(uint id, GlHandle buffer, uint pname, nint offset)
|
||||||
|
{
|
||||||
|
Context.glGetQueryBufferObjectui64v(id, buffer.Value, pname, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetQueryBufferObjectuiv(uint id, GlHandle buffer, uint pname, nint offset)
|
||||||
|
{
|
||||||
|
Context.glGetQueryBufferObjectuiv(id, buffer.Value, pname, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetTextureImage(GlHandle texture, int level, uint format, uint type, int bufSize, IntPtr* pixels)
|
||||||
|
{
|
||||||
|
Context.glGetTextureImage(texture.Value, level, format, type, bufSize, pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetTextureLevelParameterfv(GlHandle texture, int level, uint pname, float* @params)
|
||||||
|
{
|
||||||
|
Context.glGetTextureLevelParameterfv(texture.Value, level, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetTextureLevelParameteriv(GlHandle texture, int level, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetTextureLevelParameteriv(texture.Value, level, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetTextureParameterIiv(GlHandle texture, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetTextureParameterIiv(texture.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetTextureParameterIuiv(GlHandle texture, uint pname, uint* @params)
|
||||||
|
{
|
||||||
|
Context.glGetTextureParameterIuiv(texture.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetTextureParameterfv(GlHandle texture, uint pname, float* @params)
|
||||||
|
{
|
||||||
|
Context.glGetTextureParameterfv(texture.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetTextureParameteriv(GlHandle texture, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetTextureParameteriv(texture.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetTextureSubImage(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, uint type, int bufSize, IntPtr* pixels)
|
||||||
|
{
|
||||||
|
Context.glGetTextureSubImage(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize, pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetTransformFeedbacki64_v(uint xfb, uint pname, uint index, IntPtr* param)
|
||||||
|
{
|
||||||
|
Context.glGetTransformFeedbacki64_v(xfb, pname, index, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetTransformFeedbacki_v(uint xfb, uint pname, uint index, int* param)
|
||||||
|
{
|
||||||
|
Context.glGetTransformFeedbacki_v(xfb, pname, index, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetTransformFeedbackiv(uint xfb, uint pname, int* param)
|
||||||
|
{
|
||||||
|
Context.glGetTransformFeedbackiv(xfb, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetVertexArrayIndexed64iv(uint vaobj, uint index, uint pname, IntPtr* param)
|
||||||
|
{
|
||||||
|
Context.glGetVertexArrayIndexed64iv(vaobj, index, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetVertexArrayIndexediv(uint vaobj, uint index, uint pname, int* param)
|
||||||
|
{
|
||||||
|
Context.glGetVertexArrayIndexediv(vaobj, index, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetVertexArrayiv(uint vaobj, uint pname, int* param)
|
||||||
|
{
|
||||||
|
Context.glGetVertexArrayiv(vaobj, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnColorTable(uint target, uint format, uint type, int bufSize, IntPtr* table)
|
||||||
|
{
|
||||||
|
Context.glGetnColorTable(target, format, type, bufSize, table);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnCompressedTexImage(uint target, int lod, int bufSize, IntPtr* pixels)
|
||||||
|
{
|
||||||
|
Context.glGetnCompressedTexImage(target, lod, bufSize, pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnConvolutionFilter(uint target, uint format, uint type, int bufSize, IntPtr* image)
|
||||||
|
{
|
||||||
|
Context.glGetnConvolutionFilter(target, format, type, bufSize, image);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnHistogram(uint target, byte reset, uint format, uint type, int bufSize, IntPtr* values)
|
||||||
|
{
|
||||||
|
Context.glGetnHistogram(target, reset, format, type, bufSize, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnMapdv(uint target, uint query, int bufSize, double* v)
|
||||||
|
{
|
||||||
|
Context.glGetnMapdv(target, query, bufSize, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnMapfv(uint target, uint query, int bufSize, float* v)
|
||||||
|
{
|
||||||
|
Context.glGetnMapfv(target, query, bufSize, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnMapiv(uint target, uint query, int bufSize, int* v)
|
||||||
|
{
|
||||||
|
Context.glGetnMapiv(target, query, bufSize, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnMinmax(uint target, byte reset, uint format, uint type, int bufSize, IntPtr* values)
|
||||||
|
{
|
||||||
|
Context.glGetnMinmax(target, reset, format, type, bufSize, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnPixelMapfv(uint map, int bufSize, float* values)
|
||||||
|
{
|
||||||
|
Context.glGetnPixelMapfv(map, bufSize, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnPixelMapuiv(uint map, int bufSize, uint* values)
|
||||||
|
{
|
||||||
|
Context.glGetnPixelMapuiv(map, bufSize, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnPixelMapusv(uint map, int bufSize, ushort* values)
|
||||||
|
{
|
||||||
|
Context.glGetnPixelMapusv(map, bufSize, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnPolygonStipple(int bufSize, byte* pattern)
|
||||||
|
{
|
||||||
|
Context.glGetnPolygonStipple(bufSize, pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnSeparableFilter(uint target, uint format, uint type, int rowBufSize, IntPtr* row, int columnBufSize, IntPtr* column, IntPtr* span)
|
||||||
|
{
|
||||||
|
Context.glGetnSeparableFilter(target, format, type, rowBufSize, row, columnBufSize, column, span);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnTexImage(uint target, int level, uint format, uint type, int bufSize, IntPtr* pixels)
|
||||||
|
{
|
||||||
|
Context.glGetnTexImage(target, level, format, type, bufSize, pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnUniformdv(GlHandle program, int location, int bufSize, double* @params)
|
||||||
|
{
|
||||||
|
Context.glGetnUniformdv(program.Value, location, bufSize, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnUniformfv(GlHandle program, int location, int bufSize, float* @params)
|
||||||
|
{
|
||||||
|
Context.glGetnUniformfv(program.Value, location, bufSize, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnUniformiv(GlHandle program, int location, int bufSize, int* @params)
|
||||||
|
{
|
||||||
|
Context.glGetnUniformiv(program.Value, location, bufSize, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void GetnUniformuiv(GlHandle program, int location, int bufSize, uint* @params)
|
||||||
|
{
|
||||||
|
Context.glGetnUniformuiv(program.Value, location, bufSize, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void InvalidateNamedFramebufferData(GlHandle framebuffer, int numAttachments, uint* attachments)
|
||||||
|
{
|
||||||
|
Context.glInvalidateNamedFramebufferData(framebuffer.Value, numAttachments, attachments);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void InvalidateNamedFramebufferSubData(GlHandle framebuffer, int numAttachments, uint* attachments, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
Context.glInvalidateNamedFramebufferSubData(framebuffer.Value, numAttachments, attachments, x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void MapNamedBuffer(GlHandle buffer, uint access)
|
||||||
|
{
|
||||||
|
Context.glMapNamedBuffer(buffer.Value, access);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void MapNamedBufferRange(GlHandle buffer, nint offset, nuint length, uint access)
|
||||||
|
{
|
||||||
|
Context.glMapNamedBufferRange(buffer.Value, offset, length, access);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void MemoryBarrierByRegion(uint barriers)
|
||||||
|
{
|
||||||
|
Context.glMemoryBarrierByRegion(barriers);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void NamedBufferData(GlHandle buffer, nuint size, IntPtr* data, uint usage)
|
||||||
|
{
|
||||||
|
Context.glNamedBufferData(buffer.Value, size, data, usage);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void NamedBufferStorage(GlHandle buffer, nuint size, IntPtr* data, uint flags)
|
||||||
|
{
|
||||||
|
Context.glNamedBufferStorage(buffer.Value, size, data, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void NamedBufferSubData(GlHandle buffer, nint offset, nuint size, IntPtr* data)
|
||||||
|
{
|
||||||
|
Context.glNamedBufferSubData(buffer.Value, offset, size, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void NamedFramebufferDrawBuffer(GlHandle framebuffer, uint buf)
|
||||||
|
{
|
||||||
|
Context.glNamedFramebufferDrawBuffer(framebuffer.Value, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void NamedFramebufferDrawBuffers(GlHandle framebuffer, int n, uint* bufs)
|
||||||
|
{
|
||||||
|
Context.glNamedFramebufferDrawBuffers(framebuffer.Value, n, bufs);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void NamedFramebufferParameteri(GlHandle framebuffer, uint pname, int param)
|
||||||
|
{
|
||||||
|
Context.glNamedFramebufferParameteri(framebuffer.Value, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void NamedFramebufferReadBuffer(GlHandle framebuffer, uint src)
|
||||||
|
{
|
||||||
|
Context.glNamedFramebufferReadBuffer(framebuffer.Value, src);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void NamedFramebufferRenderbuffer(GlHandle framebuffer, uint attachment, uint renderbuffertarget, GlHandle renderbuffer)
|
||||||
|
{
|
||||||
|
Context.glNamedFramebufferRenderbuffer(framebuffer.Value, attachment, renderbuffertarget, renderbuffer.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void NamedFramebufferTexture(GlHandle framebuffer, uint attachment, GlHandle texture, int level)
|
||||||
|
{
|
||||||
|
Context.glNamedFramebufferTexture(framebuffer.Value, attachment, texture.Value, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void NamedFramebufferTextureLayer(GlHandle framebuffer, uint attachment, GlHandle texture, int level, int layer)
|
||||||
|
{
|
||||||
|
Context.glNamedFramebufferTextureLayer(framebuffer.Value, attachment, texture.Value, level, layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void NamedRenderbufferStorage(GlHandle renderbuffer, uint internalformat, int width, int height)
|
||||||
|
{
|
||||||
|
Context.glNamedRenderbufferStorage(renderbuffer.Value, internalformat, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void NamedRenderbufferStorageMultisample(GlHandle renderbuffer, int samples, uint internalformat, int width, int height)
|
||||||
|
{
|
||||||
|
Context.glNamedRenderbufferStorageMultisample(renderbuffer.Value, samples, internalformat, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ReadnPixels(int x, int y, int width, int height, uint format, uint type, int bufSize, IntPtr* data)
|
||||||
|
{
|
||||||
|
Context.glReadnPixels(x, y, width, height, format, type, bufSize, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureBarrier()
|
||||||
|
{
|
||||||
|
Context.glTextureBarrier();
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureBuffer(GlHandle texture, uint internalformat, GlHandle buffer)
|
||||||
|
{
|
||||||
|
Context.glTextureBuffer(texture.Value, internalformat, buffer.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureBufferRange(GlHandle texture, uint internalformat, GlHandle buffer, nint offset, nuint size)
|
||||||
|
{
|
||||||
|
Context.glTextureBufferRange(texture.Value, internalformat, buffer.Value, offset, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureParameterIiv(GlHandle texture, uint pname, int* @params)
|
||||||
|
{
|
||||||
|
Context.glTextureParameterIiv(texture.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureParameterIuiv(GlHandle texture, uint pname, uint* @params)
|
||||||
|
{
|
||||||
|
Context.glTextureParameterIuiv(texture.Value, pname, @params);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureParameterf(GlHandle texture, uint pname, float param)
|
||||||
|
{
|
||||||
|
Context.glTextureParameterf(texture.Value, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureParameterfv(GlHandle texture, uint pname, float* param)
|
||||||
|
{
|
||||||
|
Context.glTextureParameterfv(texture.Value, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureParameteri(GlHandle texture, uint pname, int param)
|
||||||
|
{
|
||||||
|
Context.glTextureParameteri(texture.Value, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureParameteriv(GlHandle texture, uint pname, int* param)
|
||||||
|
{
|
||||||
|
Context.glTextureParameteriv(texture.Value, pname, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureStorage1D(GlHandle texture, int levels, uint internalformat, int width)
|
||||||
|
{
|
||||||
|
Context.glTextureStorage1D(texture.Value, levels, internalformat, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureStorage2D(GlHandle texture, int levels, uint internalformat, int width, int height)
|
||||||
|
{
|
||||||
|
Context.glTextureStorage2D(texture.Value, levels, internalformat, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureStorage2DMultisample(GlHandle texture, int samples, uint internalformat, int width, int height, byte fixedsamplelocations)
|
||||||
|
{
|
||||||
|
Context.glTextureStorage2DMultisample(texture.Value, samples, internalformat, width, height, fixedsamplelocations);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureStorage3D(GlHandle texture, int levels, uint internalformat, int width, int height, int depth)
|
||||||
|
{
|
||||||
|
Context.glTextureStorage3D(texture.Value, levels, internalformat, width, height, depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureStorage3DMultisample(GlHandle texture, int samples, uint internalformat, int width, int height, int depth, byte fixedsamplelocations)
|
||||||
|
{
|
||||||
|
Context.glTextureStorage3DMultisample(texture.Value, samples, internalformat, width, height, depth, fixedsamplelocations);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureSubImage1D(GlHandle texture, int level, int xoffset, int width, uint format, uint type, IntPtr* pixels)
|
||||||
|
{
|
||||||
|
Context.glTextureSubImage1D(texture.Value, level, xoffset, width, format, type, pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureSubImage2D(GlHandle texture, int level, int xoffset, int yoffset, int width, int height, uint format, uint type, IntPtr* pixels)
|
||||||
|
{
|
||||||
|
Context.glTextureSubImage2D(texture.Value, level, xoffset, yoffset, width, height, format, type, pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TextureSubImage3D(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, uint type, IntPtr* pixels)
|
||||||
|
{
|
||||||
|
Context.glTextureSubImage3D(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TransformFeedbackBufferBase(uint xfb, uint index, GlHandle buffer)
|
||||||
|
{
|
||||||
|
Context.glTransformFeedbackBufferBase(xfb, index, buffer.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void TransformFeedbackBufferRange(uint xfb, uint index, GlHandle buffer, nint offset, nuint size)
|
||||||
|
{
|
||||||
|
Context.glTransformFeedbackBufferRange(xfb, index, buffer.Value, offset, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public byte UnmapNamedBuffer(GlHandle buffer)
|
||||||
|
{
|
||||||
|
return Context.glUnmapNamedBuffer(buffer.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexArrayAttribBinding(uint vaobj, uint attribindex, uint bindingindex)
|
||||||
|
{
|
||||||
|
Context.glVertexArrayAttribBinding(vaobj, attribindex, bindingindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexArrayAttribFormat(uint vaobj, uint attribindex, int size, uint type, byte normalized, uint relativeoffset)
|
||||||
|
{
|
||||||
|
Context.glVertexArrayAttribFormat(vaobj, attribindex, size, type, normalized, relativeoffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexArrayAttribIFormat(uint vaobj, uint attribindex, int size, uint type, uint relativeoffset)
|
||||||
|
{
|
||||||
|
Context.glVertexArrayAttribIFormat(vaobj, attribindex, size, type, relativeoffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexArrayAttribLFormat(uint vaobj, uint attribindex, int size, uint type, uint relativeoffset)
|
||||||
|
{
|
||||||
|
Context.glVertexArrayAttribLFormat(vaobj, attribindex, size, type, relativeoffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexArrayBindingDivisor(uint vaobj, uint bindingindex, uint divisor)
|
||||||
|
{
|
||||||
|
Context.glVertexArrayBindingDivisor(vaobj, bindingindex, divisor);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexArrayElementBuffer(uint vaobj, GlHandle buffer)
|
||||||
|
{
|
||||||
|
Context.glVertexArrayElementBuffer(vaobj, buffer.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexArrayVertexBuffer(uint vaobj, uint bindingindex, GlHandle buffer, nint offset, int stride)
|
||||||
|
{
|
||||||
|
Context.glVertexArrayVertexBuffer(vaobj, bindingindex, buffer.Value, offset, stride);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void VertexArrayVertexBuffers(uint vaobj, uint first, int count, uint* buffers, nint* offsets, int* strides)
|
||||||
|
{
|
||||||
|
Context.glVertexArrayVertexBuffers(vaobj, first, count, buffers, offsets, strides);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// Generated by StgSharp.GenerateGL on 2025-12-29 08:55:37Z
|
||||||
|
// Version: 4.6
|
||||||
|
// </auto-generated>
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using StgSharp.Graphics.OpenGL;
|
||||||
|
|
||||||
|
namespace StgSharp.Graphics.OpenGL
|
||||||
|
{
|
||||||
|
public unsafe partial class OpenGLFunction
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void MultiDrawArraysIndirectCount(uint mode, IntPtr* indirect, nint drawcount, int maxdrawcount, int stride)
|
||||||
|
{
|
||||||
|
Context.glMultiDrawArraysIndirectCount(mode, indirect, drawcount, maxdrawcount, stride);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void MultiDrawElementsIndirectCount(uint mode, uint type, IntPtr* indirect, nint drawcount, int maxdrawcount, int stride)
|
||||||
|
{
|
||||||
|
Context.glMultiDrawElementsIndirectCount(mode, type, indirect, drawcount, maxdrawcount, stride);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void PolygonOffsetClamp(float factor, float units, float clamp)
|
||||||
|
{
|
||||||
|
Context.glPolygonOffsetClamp(factor, units, clamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void SpecializeShader(GlHandle shader, byte* pEntryPoint, uint numSpecializationConstants, uint* pConstantIndex, uint* pConstantValue)
|
||||||
|
{
|
||||||
|
Context.glSpecializeShader(shader.Value, pEntryPoint, numSpecializationConstants, pConstantIndex, pConstantValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="framework"
|
// file="framework"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -43,15 +43,25 @@ namespace StgSharp.Graphics
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// An Intptr value representing the pointer to the function
|
/// An Intptr value representing the pointer to the function
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public delegate IntPtr glLoader(string name);
|
public delegate IntPtr glLoader(
|
||||||
|
string name
|
||||||
|
);
|
||||||
|
|
||||||
#region StgSharpDele
|
#region StgSharpDele
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public unsafe delegate void FrameBufferSizeHandler(IntPtr window, int width, int height);
|
public unsafe delegate void FrameBufferSizeHandler(
|
||||||
|
IntPtr window,
|
||||||
|
int width,
|
||||||
|
int height
|
||||||
|
);
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public unsafe delegate void FramePositionHandler(IntPtr window, float width, float height);
|
public unsafe delegate void FramePositionHandler(
|
||||||
|
IntPtr window,
|
||||||
|
float width,
|
||||||
|
float height
|
||||||
|
);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -65,7 +75,8 @@ namespace StgSharp.Graphics
|
|||||||
int severity,
|
int severity,
|
||||||
int length,
|
int length,
|
||||||
sbyte* message,
|
sbyte* message,
|
||||||
void* userParam);
|
void* userParam
|
||||||
|
);
|
||||||
internal unsafe delegate void GLDEBUGPROCARB(
|
internal unsafe delegate void GLDEBUGPROCARB(
|
||||||
int source,
|
int source,
|
||||||
int type,
|
int type,
|
||||||
@@ -73,7 +84,8 @@ namespace StgSharp.Graphics
|
|||||||
int severity,
|
int severity,
|
||||||
int length,
|
int length,
|
||||||
sbyte* message,
|
sbyte* message,
|
||||||
void* userParam);
|
void* userParam
|
||||||
|
);
|
||||||
internal unsafe delegate void GLDEBUGPROCKHR(
|
internal unsafe delegate void GLDEBUGPROCKHR(
|
||||||
int source,
|
int source,
|
||||||
int type,
|
int type,
|
||||||
@@ -81,14 +93,16 @@ namespace StgSharp.Graphics
|
|||||||
int severity,
|
int severity,
|
||||||
int length,
|
int length,
|
||||||
sbyte* message,
|
sbyte* message,
|
||||||
void* userParam);
|
void* userParam
|
||||||
|
);
|
||||||
internal unsafe delegate void GLDEBUGPROCAMD(
|
internal unsafe delegate void GLDEBUGPROCAMD(
|
||||||
uint id,
|
uint id,
|
||||||
int category,
|
int category,
|
||||||
int severity,
|
int severity,
|
||||||
int length,
|
int length,
|
||||||
sbyte* message,
|
sbyte* message,
|
||||||
void* userParam);
|
void* userParam
|
||||||
|
);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,31 @@ using System.Runtime.InteropServices.Marshalling;
|
|||||||
|
|
||||||
namespace StgSharp.Internal.Intrinsic
|
namespace StgSharp.Internal.Intrinsic
|
||||||
{
|
{
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal unsafe struct MatrixIntrinsic
|
||||||
|
{
|
||||||
|
|
||||||
|
public delegate* unmanaged[Cdecl]<void*, void*, void*, long, void> buffer_add; //f32_buffer_add
|
||||||
|
public delegate* unmanaged[Cdecl]<void*, ScalarPacket*, long, void> buffer_fill; //f32_buffer_fill
|
||||||
|
public delegate* unmanaged[Cdecl]<void*, void*, ScalarPacket*, long, void> buffer_scalar_mul; //f32_buffer_s_m
|
||||||
|
public delegate* unmanaged[Cdecl]<void*, void*, void*, long, void> buffer_sub; //f32_kernel_sub
|
||||||
|
public delegate* unmanaged[Cdecl]<void*, void*, void> buffer_transpose; //f32_kernel_transpose
|
||||||
|
public delegate* unmanaged[Cdecl]<MatrixPanel*, MatrixKernel*, int, int, int, int, void> build_panel; //f32_build_panel
|
||||||
|
public delegate* unmanaged[Cdecl]<MatrixPanel*, void> clear_panel; //f32_clear_panel
|
||||||
|
public delegate* unmanaged[Cdecl]<void*, void*, void*, void> panel_fma; //f32_panel_fma
|
||||||
|
public delegate* unmanaged[Cdecl]<void*, ulong, ulong, ulong, void> pivot; //f32_panel_mul
|
||||||
|
public delegate* unmanaged[Cdecl]<void*, void*, int, int, int, int, void> store_panel; //f32_store_panel
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[InlineArray(4)]
|
||||||
|
internal unsafe struct MatrixIntrinsicArray
|
||||||
|
{
|
||||||
|
|
||||||
|
private MatrixIntrinsic e0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
internal unsafe struct IntrinsicContext
|
internal unsafe struct IntrinsicContext
|
||||||
{
|
{
|
||||||
@@ -41,27 +66,8 @@ namespace StgSharp.Internal.Intrinsic
|
|||||||
public delegate* unmanaged[Cdecl]<char*, int, int> city_hash_simplify; //city_hash_simplify
|
public delegate* unmanaged[Cdecl]<char*, int, int> city_hash_simplify; //city_hash_simplify
|
||||||
public delegate* unmanaged[Cdecl]<int, ulong> factorial_simd; //factorial_simd
|
public delegate* unmanaged[Cdecl]<int, ulong> factorial_simd; //factorial_simd
|
||||||
public delegate* unmanaged[Cdecl]<char*, int, int, int> index_pair; //index_pair
|
public delegate* unmanaged[Cdecl]<char*, int, int, int> index_pair; //index_pair
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, void*, long, void> mat_f32_buffer_add; //f32_buffer_add
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, ScalarPacket*, long, void> mat_f32_buffer_fill; //f32_buffer_fill
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, ScalarPacket*, long, void> mat_f32_buffer_scalar_mul; //f32_buffer_s_m
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, void*, long, void> mat_f32_buffer_sub; //f32_kernel_sub
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, void> mat_f32_buffer_transpose; //f32_kernel_transpose
|
|
||||||
public delegate* unmanaged[Cdecl]<MatrixPanel*, MatrixKernel*, int, int, int, int, void> mat_f32_build_panel; //f32_build_panel
|
|
||||||
public delegate* unmanaged[Cdecl]<MatrixPanel*, void> mat_f32_clear_panel; //f32_clear_panel
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, void*, void> mat_f32_panel_fma; //f32_panel_fma
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, ulong, ulong, ulong, void> mat_f32_pivot; //f32_panel_mul
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, int, int, int, int, void> mat_f32_store_panel; //f32_store_panel
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, void*, long, void> mat_f64_buffer_add; //f32_buffer_add
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, ScalarPacket*, long, void> mat_f64_buffer_fill; //f32_buffer_fill
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, ScalarPacket*, long, void> mat_f64_buffer_scalar_mul; //f32_buffer_s_m
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, void*, long, void> mat_f64_buffer_sub; //f32_kernel_sub
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, void> mat_f64_buffer_transpose; //f32_kernel_transpose
|
|
||||||
public delegate* unmanaged[Cdecl]<MatrixPanel*, MatrixKernel*, int, int, int, int, void> mat_f64_build_panel; //f32_build_panel
|
|
||||||
public delegate* unmanaged[Cdecl]<MatrixPanel*, void> mat_f64_clear_panel; //f32_clear_panel
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, void*, void> mat_f64_panel_fma; //f32_panel_fma
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, ulong, ulong, ulong, void> mat_f64_pivot; //f32_panel_mul
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, int, int, int, int, void> mat_f64_store_panel; //f32_store_panel
|
|
||||||
public delegate* unmanaged[Cdecl]<Vector4*, Vector4*, void> vec_f32_normalize_3; //f32_normalize_3
|
public delegate* unmanaged[Cdecl]<Vector4*, Vector4*, void> vec_f32_normalize_3; //f32_normalize_3
|
||||||
|
public MatrixIntrinsicArray mat; // mat[4] in native order
|
||||||
|
|
||||||
public IntrinsicContext()
|
public IntrinsicContext()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,13 +45,20 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
[FieldOffset(0)] internal ColumnSet4 mat;
|
[FieldOffset(0)] internal ColumnSet4 mat;
|
||||||
[FieldOffset(0)] internal MatrixKernel<float> kernel;
|
[FieldOffset(0)] internal MatrixKernel<float> kernel;
|
||||||
|
|
||||||
internal Matrix44(ColumnSet4 mat)
|
internal Matrix44(
|
||||||
|
ColumnSet4 mat
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out this);
|
Unsafe.SkipInit(out this);
|
||||||
this.mat = mat;
|
this.mat = mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Matrix44(Vector4 vec0, Vector4 vec1, Vector4 vec2, Vector4 vec3)
|
internal Matrix44(
|
||||||
|
Vector4 vec0,
|
||||||
|
Vector4 vec1,
|
||||||
|
Vector4 vec2,
|
||||||
|
Vector4 vec3
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out this);
|
Unsafe.SkipInit(out this);
|
||||||
mat.colum0 = vec0;
|
mat.colum0 = vec0;
|
||||||
@@ -81,7 +88,8 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
float a30,
|
float a30,
|
||||||
float a31,
|
float a31,
|
||||||
float a32,
|
float a32,
|
||||||
float a33)
|
float a33
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out this);
|
Unsafe.SkipInit(out this);
|
||||||
mat.colum0 = new Vector4(a00, a10, a20, a30);
|
mat.colum0 = new Vector4(a00, a10, a20, a30);
|
||||||
@@ -90,7 +98,10 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
mat.colum3 = new Vector4(a03, a13, a23, a33);
|
mat.colum3 = new Vector4(a03, a13, a23, a33);
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe float this[int rowNum, int columNum]
|
public unsafe float this[
|
||||||
|
int rowNum,
|
||||||
|
int columNum
|
||||||
|
]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -132,29 +143,29 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
|
|
||||||
public static Matrix44 Unit => new Matrix44(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
public static Matrix44 Unit => new Matrix44(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
||||||
|
|
||||||
public static Matrix44 WNegativeUnit => new Matrix44(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0,
|
public static Matrix44 WNegativeUnit => new Matrix44(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1);
|
||||||
0, 0, -1);
|
|
||||||
|
|
||||||
public static Matrix44 XNegativeUnit => new Matrix44(-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0,
|
public static Matrix44 XNegativeUnit => new Matrix44(-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
||||||
0, 0, 1);
|
|
||||||
|
|
||||||
public static Matrix44 YNegativeUnit => new Matrix44(1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0,
|
public static Matrix44 YNegativeUnit => new Matrix44(1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
||||||
0, 0, 1);
|
|
||||||
|
|
||||||
public static Matrix44 ZNegativeUnit => new Matrix44(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0,
|
public static Matrix44 ZNegativeUnit => new Matrix44(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1);
|
||||||
0, 0, 1);
|
|
||||||
|
|
||||||
public ReadOnlySpan<float> AsSpan()
|
public ReadOnlySpan<float> AsSpan()
|
||||||
{
|
{
|
||||||
return MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<ColumnSet4, float>(ref mat), 16);
|
return MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<ColumnSet4, float>(ref mat), 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object? obj)
|
public override bool Equals(
|
||||||
|
object? obj
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return obj is Matrix44 x && Equals(x);
|
return obj is Matrix44 x && Equals(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(Matrix44 other)
|
public bool Equals(
|
||||||
|
Matrix44 other
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return mat.Equals(other.mat);
|
return mat.Equals(other.mat);
|
||||||
}
|
}
|
||||||
@@ -166,64 +177,72 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
internal unsafe void InternalTranspose(ref Matrix44 transpose)
|
internal unsafe void InternalTranspose(
|
||||||
|
ref Matrix44 transpose
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
const int f32 = 0;
|
||||||
fixed (MatrixKernel<float>* source = &this.kernel, target = &transpose.kernel) {
|
fixed (MatrixKernel<float>* source = &this.kernel, target = &transpose.kernel) {
|
||||||
NativeIntrinsic.Context.mat_f32_buffer_transpose(source, target);
|
NativeIntrinsic.Context.mat[f32].buffer_transpose(source, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static unsafe Matrix44 operator -(Matrix44 left, Matrix44 right)
|
public static unsafe Matrix44 operator -(
|
||||||
|
Matrix44 left,
|
||||||
|
Matrix44 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Matrix44 ret = new();
|
Matrix44 ret = new();
|
||||||
NativeIntrinsic.Context.mat_f32_buffer_sub(&left, &right, &ret, 1);
|
const int f32 = 0;
|
||||||
|
NativeIntrinsic.Context.mat[f32].buffer_sub(&left, &right, &ret, 1);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator !=(Matrix44 left, Matrix44 right)
|
public static bool operator !=(
|
||||||
|
Matrix44 left,
|
||||||
|
Matrix44 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return !(left == right);
|
return !(left == right);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static unsafe Matrix44 operator *(Matrix44 mat, float value)
|
public static unsafe Matrix44 operator *(
|
||||||
|
Matrix44 mat,
|
||||||
|
float value
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return new Matrix44(mat.mat.colum0 * value, mat.mat.colum1 * value,
|
return new Matrix44(mat.mat.colum0 * value, mat.mat.colum1 * value,
|
||||||
mat.mat.colum2 * value, mat.mat.colum3 * value);
|
mat.mat.colum2 * value, mat.mat.colum3 * value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static Matrix44 operator *(Matrix44 left, Matrix44 right)
|
public static Matrix44 operator *(
|
||||||
|
Matrix44 left,
|
||||||
|
Matrix44 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Matrix44 transpose = left.Transpose;
|
Matrix44 transpose = left.Transpose;
|
||||||
return new Matrix44(Vector4.Dot(transpose.mat.colum0, right.mat.colum0),
|
return new Matrix44(Vector4.Dot(transpose.mat.colum0, right.mat.colum0), Vector4.Dot(transpose.mat.colum0, right.mat.colum1), Vector4.Dot(transpose.mat.colum0, right.mat.colum2), Vector4.Dot(transpose.mat.colum0, right.mat.colum3), Vector4.Dot(transpose.mat.colum1, right.mat.colum0), Vector4.Dot(transpose.mat.colum1, right.mat.colum1), Vector4.Dot(transpose.mat.colum1, right.mat.colum2), Vector4.Dot(transpose.mat.colum1, right.mat.colum3), Vector4.Dot(transpose.mat.colum2, right.mat.colum0), Vector4.Dot(transpose.mat.colum2, right.mat.colum1), Vector4.Dot(transpose.mat.colum2, right.mat.colum2), Vector4.Dot(transpose.mat.colum2, right.mat.colum3), Vector4.Dot(transpose.mat.colum3, right.mat.colum0), Vector4.Dot(transpose.mat.colum3, right.mat.colum1), Vector4.Dot(transpose.mat.colum3, right.mat.colum2), Vector4.Dot(transpose.mat.colum3, right.mat.colum3));
|
||||||
Vector4.Dot(transpose.mat.colum0, right.mat.colum1),
|
|
||||||
Vector4.Dot(transpose.mat.colum0, right.mat.colum2),
|
|
||||||
Vector4.Dot(transpose.mat.colum0, right.mat.colum3),
|
|
||||||
Vector4.Dot(transpose.mat.colum1, right.mat.colum0),
|
|
||||||
Vector4.Dot(transpose.mat.colum1, right.mat.colum1),
|
|
||||||
Vector4.Dot(transpose.mat.colum1, right.mat.colum2),
|
|
||||||
Vector4.Dot(transpose.mat.colum1, right.mat.colum3),
|
|
||||||
Vector4.Dot(transpose.mat.colum2, right.mat.colum0),
|
|
||||||
Vector4.Dot(transpose.mat.colum2, right.mat.colum1),
|
|
||||||
Vector4.Dot(transpose.mat.colum2, right.mat.colum2),
|
|
||||||
Vector4.Dot(transpose.mat.colum2, right.mat.colum3),
|
|
||||||
Vector4.Dot(transpose.mat.colum3, right.mat.colum0),
|
|
||||||
Vector4.Dot(transpose.mat.colum3, right.mat.colum1),
|
|
||||||
Vector4.Dot(transpose.mat.colum3, right.mat.colum2),
|
|
||||||
Vector4.Dot(transpose.mat.colum3, right.mat.colum3));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static unsafe Matrix44 operator +(Matrix44 left, Matrix44 right)
|
public static unsafe Matrix44 operator +(
|
||||||
|
Matrix44 left,
|
||||||
|
Matrix44 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Matrix44 ret = new();
|
Matrix44 ret = new();
|
||||||
NativeIntrinsic.Context.mat_f32_buffer_add(&left, &right, &ret, 1);
|
const int f32 = 0;
|
||||||
|
NativeIntrinsic.Context.mat[f32].buffer_add(&left, &right, &ret, 1);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator ==(Matrix44 left, Matrix44 right)
|
public static bool operator ==(
|
||||||
|
Matrix44 left,
|
||||||
|
Matrix44 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return left.Equals(right);
|
return left.Equals(right);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,146 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// file="CsTypeMapper"
|
||||||
|
// Project: StgSharp
|
||||||
|
// AuthorGroup: Nitload
|
||||||
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
//
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace GenerateGL.CodeGen
|
||||||
|
{
|
||||||
|
internal static class CsTypeMapper
|
||||||
|
{
|
||||||
|
|
||||||
|
public static string MapDelegateParameter(
|
||||||
|
GlParam param
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// For delegate signatures, handles are kept as uint (not GlHandle) to match function pointer fields.
|
||||||
|
if (param.CType.Equals("GLchar", StringComparison.Ordinal) && param.IsPointer)
|
||||||
|
{
|
||||||
|
return "byte*";
|
||||||
|
}
|
||||||
|
|
||||||
|
string mapped = MapType(param.CType, allowVoid:false);
|
||||||
|
if (param.IsPointer)
|
||||||
|
{
|
||||||
|
if (mapped == "void") {
|
||||||
|
return "void*";
|
||||||
|
}
|
||||||
|
return $"{mapped}*";
|
||||||
|
}
|
||||||
|
return mapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string MapDelegateReturn(
|
||||||
|
string cType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return MapType(cType, allowVoid:true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string MapParameter(
|
||||||
|
GlParam param
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Handle GlHandle-like cases: if the C type is GLuint and name hints an object, map to GlHandle
|
||||||
|
if (param.CType.Equals("GLuint", StringComparison.Ordinal) &&
|
||||||
|
LooksLikeHandle(param.Name) &&
|
||||||
|
!param.IsPointer)
|
||||||
|
{
|
||||||
|
return "GlHandle";
|
||||||
|
}
|
||||||
|
|
||||||
|
string mapped = MapType(param.CType, allowVoid:false);
|
||||||
|
if (param.IsPointer)
|
||||||
|
{
|
||||||
|
// const GLchar* -> byte*; other pointers -> void*/IntPtr depending on base
|
||||||
|
if (param.CType.Equals("GLchar", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
return "byte*";
|
||||||
|
}
|
||||||
|
if (mapped == "void") {
|
||||||
|
return "void*";
|
||||||
|
}
|
||||||
|
return $"{mapped}*";
|
||||||
|
}
|
||||||
|
return mapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string MapReturn(
|
||||||
|
string cType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return MapType(cType, allowVoid:true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool LooksLikeHandle(
|
||||||
|
string name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(name)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return name.Contains("program", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
name.Contains("shader", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
name.Contains("buffer", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
name.Contains("texture", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
name.Contains("framebuffer", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
name.Contains("renderbuffer", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
name.Contains("vertexarray", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
name.Contains("query", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
name.Contains("sampler", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
name.Contains("transformfeedback", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string MapType(
|
||||||
|
string cType,
|
||||||
|
bool allowVoid
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return cType switch
|
||||||
|
{
|
||||||
|
"void" when allowVoid => "void",
|
||||||
|
"GLenum" or "GLbitfield" => "uint",
|
||||||
|
"GLboolean" => "byte",
|
||||||
|
"GLuint" or "GLhandleARB" => "uint",
|
||||||
|
"GLint" or "GLsizei" or "GLfixed" => "int",
|
||||||
|
"GLshort" => "short",
|
||||||
|
"GLbyte" => "sbyte",
|
||||||
|
"GLubyte" => "byte",
|
||||||
|
"GLushort" => "ushort",
|
||||||
|
"GLfloat" => "float",
|
||||||
|
"GLdouble" => "double",
|
||||||
|
"GLclampf" or "GLclampd" => "float",
|
||||||
|
"GLintptr" => "nint",
|
||||||
|
"GLsizeiptr" => "nuint",
|
||||||
|
"GLchar" => "byte",
|
||||||
|
"GLsync" => "GLsync",
|
||||||
|
_ => allowVoid && cType == "void" ? "void" : "IntPtr"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,270 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// file="Generator"
|
||||||
|
// Project: StgSharp
|
||||||
|
// AuthorGroup: Nitload
|
||||||
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
//
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace GenerateGL.CodeGen
|
||||||
|
{
|
||||||
|
internal sealed class Generator
|
||||||
|
{
|
||||||
|
|
||||||
|
private static readonly string[] SkipPrefixes = {
|
||||||
|
"glBegin", "glEnd", "glVertexP", "glVertex2", "glVertex3", "glVertex4", "glTexCoordP", "glTexCoord1", "glTexCoord2", "glTexCoord3", "glTexCoord4", "glColorP", "glColor3", "glColor4", "glNormalP", "glNormal3", "glMultiTexCoordP", "glMultiTexCoord1", "glMultiTexCoord2", "glMultiTexCoord3", "glMultiTexCoord4", "glSecondaryColor", "glFog", "glLight", "glMaterial", "glEval", "glMap1", "glMap2", "glRasterPos", "glBitmap"
|
||||||
|
};
|
||||||
|
|
||||||
|
private static readonly string[] TargetVersions = {
|
||||||
|
"3.3", "4.0", "4.1", "4.2", "4.3", "4.4", "4.5", "4.6"
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly IReadOnlyDictionary<string, GlCommand> _commands;
|
||||||
|
private readonly IReadOnlyList<GlFeature> _features;
|
||||||
|
private readonly string _outputRoot;
|
||||||
|
|
||||||
|
public Generator(
|
||||||
|
IReadOnlyDictionary<string, GlCommand> commands,
|
||||||
|
IReadOnlyList<GlFeature> features,
|
||||||
|
string outputRoot
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_commands = commands;
|
||||||
|
_features = features;
|
||||||
|
_outputRoot = outputRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Run()
|
||||||
|
{
|
||||||
|
if (Directory.Exists(_outputRoot)) {
|
||||||
|
Directory.Delete(_outputRoot, recursive:true);
|
||||||
|
}
|
||||||
|
Directory.CreateDirectory(_outputRoot);
|
||||||
|
List<GlCommand> all = new List<GlCommand>();
|
||||||
|
foreach (string v in TargetVersions)
|
||||||
|
{
|
||||||
|
IReadOnlyList<GlCommand> cmds = CollectCommandsForVersion(v)
|
||||||
|
.Where(c => !ShouldSkip(c.Name))
|
||||||
|
.ToList();
|
||||||
|
all.AddRange(cmds);
|
||||||
|
WriteOpenGLFunctionFile(v, cmds);
|
||||||
|
WriteGlContextFile(v, cmds);
|
||||||
|
}
|
||||||
|
WriteMergedGlContextFile(all);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IReadOnlyList<GlCommand> CollectCommandsForVersion(
|
||||||
|
string version
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IEnumerable<GlCommand?> selected = _features.Where(f => string.Equals(f.Version, version, StringComparison.Ordinal))
|
||||||
|
.SelectMany(f => f.RequiresCommands)
|
||||||
|
.Distinct(StringComparer.Ordinal)
|
||||||
|
.Select(name => _commands.TryGetValue(name, out GlCommand? c) ?
|
||||||
|
c :
|
||||||
|
null)
|
||||||
|
.Where(c => c != null)!;
|
||||||
|
return selected.ToList()!;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string DelegateSignature(
|
||||||
|
string ret,
|
||||||
|
IReadOnlyList<string> paramTypes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (paramTypes.Count == 0) {
|
||||||
|
return $"delegate*<{ret}>";
|
||||||
|
}
|
||||||
|
return $"delegate*<{string.Join(", ", paramTypes)}, {ret}>";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string SafeName(
|
||||||
|
string name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return string.IsNullOrWhiteSpace(name) ?
|
||||||
|
"arg" :
|
||||||
|
name switch
|
||||||
|
{
|
||||||
|
"params" => "@params",
|
||||||
|
"event" => "@event",
|
||||||
|
_ => name
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool ShouldSkip(
|
||||||
|
string name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
foreach (string prefix in SkipPrefixes)
|
||||||
|
{
|
||||||
|
if (name.StartsWith(prefix, StringComparison.Ordinal)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string TrimGlPrefix(
|
||||||
|
string name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (name.StartsWith("gl", StringComparison.Ordinal) && name.Length > 2) {
|
||||||
|
return name.Substring(2);
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteGlContextFile(
|
||||||
|
string version,
|
||||||
|
IReadOnlyList<GlCommand> commands
|
||||||
|
)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("// <auto-generated>");
|
||||||
|
sb.AppendLine($"// Generated by StgSharp.GenerateGL on {DateTime.UtcNow.ToString("u", CultureInfo.InvariantCulture)}");
|
||||||
|
sb.AppendLine($"// Version: {version}");
|
||||||
|
sb.AppendLine("// </auto-generated>");
|
||||||
|
sb.AppendLine("using System;\nusing System.Runtime.CompilerServices;\n");
|
||||||
|
sb.AppendLine("namespace StgSharp.Graphics.OpenGL");
|
||||||
|
sb.AppendLine("{");
|
||||||
|
sb.AppendLine(" public unsafe partial struct OpenglContext");
|
||||||
|
sb.AppendLine(" {");
|
||||||
|
foreach (GlCommand cmd in commands.OrderBy(c => c!.Name, StringComparer.Ordinal))
|
||||||
|
{
|
||||||
|
string ret = CsTypeMapper.MapDelegateReturn(cmd.ReturnType);
|
||||||
|
List<string> paramTypes = new List<string>();
|
||||||
|
foreach (GlParam p in cmd.Parameters)
|
||||||
|
{
|
||||||
|
string mapped = CsTypeMapper.MapDelegateParameter(p);
|
||||||
|
paramTypes.Add(mapped);
|
||||||
|
}
|
||||||
|
string decl = DelegateSignature(ret, paramTypes);
|
||||||
|
sb.AppendLine($" internal unsafe {decl} {cmd.Name};");
|
||||||
|
}
|
||||||
|
sb.AppendLine(" }");
|
||||||
|
sb.AppendLine("}");
|
||||||
|
|
||||||
|
string fileName = Path.Combine(_outputRoot, $"glContext.v{version.Replace('.', '_')}.cs");
|
||||||
|
File.WriteAllText(fileName, sb.ToString(), Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteMergedGlContextFile(
|
||||||
|
IReadOnlyList<GlCommand> commands
|
||||||
|
)
|
||||||
|
{
|
||||||
|
List<GlCommand> distinct = commands.Where(c => !ShouldSkip(c.Name))
|
||||||
|
.GroupBy(c => c.Name, StringComparer.Ordinal)
|
||||||
|
.Select(g => g.First())
|
||||||
|
.OrderBy(c => c.Name, StringComparer.Ordinal)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("// <auto-generated>");
|
||||||
|
sb.AppendLine($"// Generated by StgSharp.GenerateGL on {DateTime.UtcNow.ToString("u", CultureInfo.InvariantCulture)}");
|
||||||
|
sb.AppendLine("// Aggregated GL3+ commands");
|
||||||
|
sb.AppendLine("// </auto-generated>");
|
||||||
|
sb.AppendLine("using System;\nusing System.Runtime.CompilerServices;\n");
|
||||||
|
sb.AppendLine("namespace StgSharp.Graphics.OpenGL");
|
||||||
|
sb.AppendLine("{");
|
||||||
|
sb.AppendLine(" public unsafe partial struct OpenglContext");
|
||||||
|
sb.AppendLine(" {");
|
||||||
|
foreach (GlCommand cmd in distinct)
|
||||||
|
{
|
||||||
|
string ret = CsTypeMapper.MapDelegateReturn(cmd.ReturnType);
|
||||||
|
List<string> paramTypes = new List<string>();
|
||||||
|
foreach (GlParam p in cmd.Parameters)
|
||||||
|
{
|
||||||
|
string mapped = CsTypeMapper.MapDelegateParameter(p);
|
||||||
|
paramTypes.Add(mapped);
|
||||||
|
}
|
||||||
|
string decl = DelegateSignature(ret, paramTypes);
|
||||||
|
sb.AppendLine($" internal unsafe {decl} {cmd.Name};");
|
||||||
|
}
|
||||||
|
sb.AppendLine(" }");
|
||||||
|
sb.AppendLine("}");
|
||||||
|
|
||||||
|
string fileName = Path.Combine(_outputRoot, "glContext.cs");
|
||||||
|
File.WriteAllText(fileName, sb.ToString(), Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteOpenGLFunctionFile(
|
||||||
|
string version,
|
||||||
|
IReadOnlyList<GlCommand> commands
|
||||||
|
)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("// <auto-generated>");
|
||||||
|
sb.AppendLine($"// Generated by StgSharp.GenerateGL on {DateTime.UtcNow.ToString("u", CultureInfo.InvariantCulture)}");
|
||||||
|
sb.AppendLine($"// Version: {version}");
|
||||||
|
sb.AppendLine("// </auto-generated>");
|
||||||
|
sb.AppendLine("using System;\nusing System.Runtime.CompilerServices;\nusing StgSharp.Graphics.OpenGL;\n");
|
||||||
|
sb.AppendLine("namespace StgSharp.Graphics.OpenGL");
|
||||||
|
sb.AppendLine("{");
|
||||||
|
sb.AppendLine(" public unsafe partial class OpenGLFunction");
|
||||||
|
sb.AppendLine(" {");
|
||||||
|
foreach (GlCommand cmd in commands.OrderBy(c => c!.Name, StringComparer.Ordinal))
|
||||||
|
{
|
||||||
|
string ret = CsTypeMapper.MapReturn(cmd.ReturnType);
|
||||||
|
string rawName = cmd.Name; // original glXxx
|
||||||
|
string methodName = TrimGlPrefix(rawName);
|
||||||
|
List<string> paramList = new List<string>();
|
||||||
|
List<string> callArgs = new List<string>();
|
||||||
|
foreach (GlParam p in cmd.Parameters)
|
||||||
|
{
|
||||||
|
string mapped = CsTypeMapper.MapParameter(p);
|
||||||
|
string pname = SafeName(p.Name);
|
||||||
|
paramList.Add($"{mapped} {pname}");
|
||||||
|
if (mapped == "GlHandle")
|
||||||
|
{
|
||||||
|
callArgs.Add($"{pname}.Value");
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
callArgs.Add(pname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string signature = string.Join(", ", paramList);
|
||||||
|
string call = string.Join(", ", callArgs);
|
||||||
|
sb.AppendLine($" [MethodImpl(MethodImplOptions.AggressiveInlining)]");
|
||||||
|
sb.AppendLine($" public {ret} {methodName}({signature})");
|
||||||
|
sb.AppendLine(" {");
|
||||||
|
string prefix = ret == "void" ? string.Empty : "return ";
|
||||||
|
sb.AppendLine($" {prefix}Context.{rawName}({call});");
|
||||||
|
sb.AppendLine(" }");
|
||||||
|
sb.AppendLine();
|
||||||
|
}
|
||||||
|
sb.AppendLine(" }");
|
||||||
|
sb.AppendLine("}");
|
||||||
|
|
||||||
|
string fileName = Path.Combine(_outputRoot, $"glFunction.v{version.Replace('.', '_')}.cs");
|
||||||
|
File.WriteAllText(fileName, sb.ToString(), Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// file="GlXmlParser"
|
||||||
|
// Project: StgSharp
|
||||||
|
// AuthorGroup: Nitload
|
||||||
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
//
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace GenerateGL.CodeGen
|
||||||
|
{
|
||||||
|
internal static class GlXmlParser
|
||||||
|
{
|
||||||
|
|
||||||
|
public static (IReadOnlyDictionary<string, GlCommand> Commands, IReadOnlyList<GlFeature> Features) Parse(
|
||||||
|
string xmlPath
|
||||||
|
)
|
||||||
|
{
|
||||||
|
XDocument doc = XDocument.Load(xmlPath, LoadOptions.PreserveWhitespace);
|
||||||
|
Dictionary<string, GlCommand> commands = ParseCommands(doc);
|
||||||
|
List<GlFeature> features = ParseFeatures(doc);
|
||||||
|
return (commands, features);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string BuildCType(
|
||||||
|
XElement element
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return BuildCType(element, out _, out _);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string BuildCType(
|
||||||
|
XElement element,
|
||||||
|
out bool isPointer,
|
||||||
|
out bool isConst
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// CType is usually text parts + <ptype>
|
||||||
|
IEnumerable<string> parts = element.Nodes()
|
||||||
|
.Select(n => n switch
|
||||||
|
{
|
||||||
|
XText t => t.Value,
|
||||||
|
XElement el when el.Name == "ptype" => el.Value,
|
||||||
|
_ => string.Empty
|
||||||
|
});
|
||||||
|
string raw = string.Concat(parts).Trim();
|
||||||
|
isPointer = raw.Contains('*');
|
||||||
|
isConst = raw.Contains("const", StringComparison.OrdinalIgnoreCase);
|
||||||
|
string cleaned = raw.Replace("const", string.Empty, StringComparison.OrdinalIgnoreCase)
|
||||||
|
.Replace("*", string.Empty)
|
||||||
|
.Trim();
|
||||||
|
return cleaned;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Dictionary<string, GlCommand> ParseCommands(
|
||||||
|
XDocument doc
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Dictionary<string, GlCommand> dict = new Dictionary<string, GlCommand>(StringComparer.Ordinal);
|
||||||
|
IEnumerable<XElement> commandElements = doc.Root?.Element("commands")?.Elements("command") ??
|
||||||
|
Enumerable.Empty<XElement>();
|
||||||
|
foreach (XElement cmd in commandElements)
|
||||||
|
{
|
||||||
|
XElement? proto = cmd.Element("proto");
|
||||||
|
if (proto is null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
string name = proto.Element("name")?.Value ?? string.Empty;
|
||||||
|
string returnType = BuildCType(proto);
|
||||||
|
|
||||||
|
List<GlParam> parameters = new List<GlParam>();
|
||||||
|
foreach (XElement p in cmd.Elements("param"))
|
||||||
|
{
|
||||||
|
string pName = p.Element("name")?.Value ?? string.Empty;
|
||||||
|
string cType = BuildCType(p, out bool isPtr, out bool isConst);
|
||||||
|
parameters.Add(new GlParam(pName, cType, isPtr, isConst));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(name)) {
|
||||||
|
dict[name] = new GlCommand(name, returnType, parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<GlFeature> ParseFeatures(
|
||||||
|
XDocument doc
|
||||||
|
)
|
||||||
|
{
|
||||||
|
List<GlFeature> list = new List<GlFeature>();
|
||||||
|
IEnumerable<XElement> featureElements = doc.Root?.Elements("feature") ??
|
||||||
|
Enumerable.Empty<XElement>();
|
||||||
|
foreach (XElement feature in featureElements)
|
||||||
|
{
|
||||||
|
string? api = feature.Attribute("api")?.Value;
|
||||||
|
if (!string.Equals(api, "gl", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
string? profile = feature.Attribute("profile")?.Value;
|
||||||
|
|
||||||
|
// Keep core; also accept missing profile (core by default)
|
||||||
|
if (!string.IsNullOrEmpty(profile) &&
|
||||||
|
!string.Equals(profile, "core", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
string version = feature.Attribute("number")?.Value ?? string.Empty;
|
||||||
|
List<string> requires = new List<string>();
|
||||||
|
foreach (XElement req in feature.Elements("require"))
|
||||||
|
{
|
||||||
|
foreach (XElement cmd in req.Elements("command"))
|
||||||
|
{
|
||||||
|
string? name = cmd.Attribute("name")?.Value;
|
||||||
|
if (!string.IsNullOrEmpty(name)) {
|
||||||
|
requires.Add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.Add(new GlFeature(version, requires));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// file="Models"
|
||||||
|
// Project: StgSharp
|
||||||
|
// AuthorGroup: Nitload
|
||||||
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
//
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace GenerateGL.CodeGen
|
||||||
|
{
|
||||||
|
internal sealed record GlCommand(
|
||||||
|
string Name,
|
||||||
|
string ReturnType,
|
||||||
|
IReadOnlyList<GlParam> Parameters
|
||||||
|
);
|
||||||
|
|
||||||
|
internal sealed record GlParam(
|
||||||
|
string Name,
|
||||||
|
string CType,
|
||||||
|
bool IsPointer,
|
||||||
|
bool IsConst
|
||||||
|
);
|
||||||
|
|
||||||
|
internal sealed record GlFeature(
|
||||||
|
string Version,
|
||||||
|
IReadOnlyList<string> RequiresCommands
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
# StgSharp.GenerateGL 源生成器技术文档
|
||||||
|
|
||||||
|
## 目标与范围
|
||||||
|
- **输入**:Khronos OpenGL Registry `gl.xml`(Core Profile 为主,版本 3.3→4.6,可选扩展)。
|
||||||
|
- **输出**:分版本 partial `glContext`(`delegate*` 字段)与 `OpenGLFunction` 包装方法(调用 `Context.glXxx`),以及新增常量/枚举补全文件,写入 `StgSharp.Common\Graphics\OpenGL\Generated\`。不改动现有手写文件。
|
||||||
|
- **风格**:保持现有函数指针字段 + 薄封装方法模式;兼容现有命名和类型定义(如 `GlHandle`)。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 阶段 1:输入解析(XML 读取与过滤)
|
||||||
|
- 将 `gl.xml` 作为 AdditionalFile 或 EmbeddedResource,使用 `XmlReader` 流式解析。
|
||||||
|
- 解析节点:
|
||||||
|
- `<commands><command>`:函数名、返回类型、参数。
|
||||||
|
- `<enums>`:常量。
|
||||||
|
- `<feature profile="core">`:按 `version` 收录命令/常量。
|
||||||
|
- `<extensions>`:可选扩展(ARB/KHR/EXT/NV)。
|
||||||
|
- 过滤策略:仅 Core Profile 且版本 ≥ 3.3(3.3→4.6 递进);扩展按启用列表追加。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 阶段 2:类型映射与句柄规则
|
||||||
|
- 整数:`GLenum`/`GLbitfield`→`uint`;`GLint`/`GLsizei`/`GLfixed`→`int`;`GLuint`→`uint`;`GLboolean`→`byte`(包装层可 bool→byte)。
|
||||||
|
- 浮点:`GLfloat`→`float`;`GLdouble`→`double`。
|
||||||
|
- 指针与尺寸:`void*`/`const void*`→`void*`;`GLintptr`→`nint`/`IntPtr`;`GLsizeiptr`/`size_t`→`nuint`/`UIntPtr`;`GLsync`→现有 `GLsync`/`IntPtr` 包装。
|
||||||
|
- 字符串:`const GLchar*`→`byte*`(UTF-8),包装层可另行提供 string/Span<byte> 重载。
|
||||||
|
- 调用约定:OpenGL APIENTRY 通常 stdcall(Windows);保持与现有 `glContext` 字段一致(`delegate* unmanaged[Stdcall]` 或 `unmanaged[Cdecl]`,需与 loader 对齐)。
|
||||||
|
- 句柄识别:包含 program/shader/buffer/texture/framebuffer/renderbuffer/vertexarray/query/sampler/transformfeedback 等对象名的 `GLuint` 参数 → 包装层使用 `GlHandle`,内部传 `handle.Value`。
|
||||||
|
- glGet* 输出:保留指针签名,或另行生成 unsafe Span/stackalloc 适配器;核心先生成指针版。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 阶段 3:版本分组与文件组织
|
||||||
|
- 输出目录:`StgSharp.Common\Graphics\OpenGL\Generated\`
|
||||||
|
- 每个版本生成独立 partial:
|
||||||
|
- `glContext.v33.cs`, `glContext.v40.cs`, …, `glContext.v46.cs`:`delegate*` 字段。
|
||||||
|
- `OpenGLFunction.v33.cs`, …:包装方法 `public void Foo(...) => Context.glFoo(...);`
|
||||||
|
- 常量/枚举:`glConst.generated.cs`(或分版本补丁),避免与现有重复,先查已有定义再生成。
|
||||||
|
- 命名空间:`StgSharp.Graphics.OpenGL`;类声明:`partial struct/partial class glContext`(按现有定义),`partial class OpenGLFunction`。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 阶段 4:生成规则(函数表与包装)
|
||||||
|
- `glContext` 字段:`internal unsafe delegate*<converted_sig> glFoo;`
|
||||||
|
- `OpenGLFunction` 包装:薄封装直接转发;句柄参数用 `GlHandle`,内部传 `handle.Value`;`bool` 参数按底层 `GLboolean` 需要转换为 `byte/uint`。
|
||||||
|
- 去重:若同名字段/方法已存在,跳过或比对签名避免重复生成。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 阶段 5:增量源生成器结构
|
||||||
|
- 步骤:
|
||||||
|
1. 收集 AdditionalFiles(`gl.xml`)。
|
||||||
|
2. 解析→建模(CommandModel, EnumModel, FeatureModel)。
|
||||||
|
3. 按版本/profile 过滤。
|
||||||
|
4. Emit:分文件输出(`SourceProductionContext.AddSource`)。
|
||||||
|
- 配置建议:`LangVersion=preview`(支持 `delegate* unmanaged[Stdcall]`);仅引用必要的 XML 解析库。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 阶段 6:兼容性与发布注意
|
||||||
|
- 不改动现有手写文件,仅追加 partial。
|
||||||
|
- 常量值需与现有 `glConst` 保持一致,生成前检查重复。
|
||||||
|
- 大 `gl.xml` 使用流式解析避免内存压力。
|
||||||
|
- Loader(`wglGetProcAddress/glXGetProcAddress/eglGetProcAddress`)不在本轮生成,字段调用约定需与 loader 对齐。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 下一步实施建议
|
||||||
|
1. 将 `gl.xml` 添加为 AdditionalFile。
|
||||||
|
2. 搭建增量生成器骨架:Parse → Filter → Emit。
|
||||||
|
3. 先生成 3.3 子集验证编译,再扩展到 4.6。
|
||||||
|
4. 按需追加扩展(ARB/KHR),保持可配置启用列表。
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="xml\Genglvnd">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\genglvnd.py">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\genheaders.py">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\gl.xml">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\glx.xml">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\glxproto.reserved.txt">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\Makefile">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\README.adoc">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\readme.pdf">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\readme.tex">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\reg.py">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\registry.rnc">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\testesext.c">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\testglext.c">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\vendors.txt">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\wgl.xml">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="xml\wgltypes.txt">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// file="Program"
|
||||||
|
// Project: StgSharp
|
||||||
|
// AuthorGroup: Nitload
|
||||||
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
//
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
using GenerateGL.CodeGen;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace GenerateGL
|
||||||
|
{
|
||||||
|
internal class Program
|
||||||
|
{
|
||||||
|
|
||||||
|
private static void Main(
|
||||||
|
string[] args
|
||||||
|
)
|
||||||
|
{
|
||||||
|
string baseDir = AppContext.BaseDirectory;
|
||||||
|
string xmlPath = Path.GetFullPath(Path.Combine(baseDir, "xml", "gl.xml"));
|
||||||
|
string outputRoot = Path.GetFullPath(Path.Combine(baseDir, "Generated"));
|
||||||
|
|
||||||
|
Console.WriteLine($"[GenerateGL] Loading registry: {xmlPath}");
|
||||||
|
var (commands, features) = GlXmlParser.Parse(xmlPath);
|
||||||
|
Console.WriteLine($"[GenerateGL] Commands: {commands.Count}, Features: {features.Count}");
|
||||||
|
|
||||||
|
Generator generator = new Generator(commands, features, outputRoot);
|
||||||
|
generator.Run();
|
||||||
|
|
||||||
|
Console.WriteLine($"[GenerateGL] Generated files under: {outputRoot}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
for header in glcorearb.h glext.h gl.h ; do
|
||||||
|
./genglvnd.py -registry drafts/GL/gl.xml drafts/GL/$header
|
||||||
|
done
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
# Copyright 2013-2025 The Khronos Group Inc.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# Generator scripts and options
|
||||||
|
# GENOPTS can be e.g. '-noprotect'
|
||||||
|
|
||||||
|
PYFILES = genheaders.py reg.py
|
||||||
|
GENOPTS =
|
||||||
|
GENHEADERS = ./genheaders.py $(GENOPTS)
|
||||||
|
|
||||||
|
# Generate all headers for GL / GLES / WGL / GLX
|
||||||
|
# Different headers depend on different XML registry files
|
||||||
|
# The $(GENHEADERS) script has targets for the additional headers
|
||||||
|
# $(API)/GL/gl.h
|
||||||
|
# $(API)/GL/glx.h
|
||||||
|
# $(API)/GL/wgl.h
|
||||||
|
# but these are experimental and not supported by Khronos. OpenGL
|
||||||
|
# drivers and SDKs provided by OS vendors and IHVs include their own
|
||||||
|
# platform-specific versions of these headers, where appropriate.
|
||||||
|
|
||||||
|
API = ../api
|
||||||
|
GLHEADERS = $(API)/GL/glext.h \
|
||||||
|
$(API)/GL/glcorearb.h \
|
||||||
|
$(API)/GLES/gl.h \
|
||||||
|
$(API)/GLES/glext.h \
|
||||||
|
$(API)/GLES2/gl2.h \
|
||||||
|
$(API)/GLES2/gl2ext.h \
|
||||||
|
$(API)/GLES3/gl3.h \
|
||||||
|
$(API)/GLSC2/glsc2.h \
|
||||||
|
$(API)/GLSC2/glsc2ext.h
|
||||||
|
|
||||||
|
GLXHEADERS = $(API)/GL/glxext.h
|
||||||
|
WGLHEADERS = $(API)/GL/wglext.h \
|
||||||
|
$(API)/GL/wgl.h
|
||||||
|
ALLHEADERS = $(GLHEADERS) $(GLXHEADERS) $(WGLHEADERS)
|
||||||
|
|
||||||
|
# Generated files to clean up
|
||||||
|
TEXDIRT = readme.aux readme.idx readme.ilg readme.ind readme.log readme.toc readme.out
|
||||||
|
PYDIRT = diag.txt dumpReg.txt errwarn.txt reg.pyc
|
||||||
|
|
||||||
|
default: $(ALLHEADERS)
|
||||||
|
|
||||||
|
$(GLHEADERS): gl.xml $(PYFILES)
|
||||||
|
$(GENHEADERS) $@
|
||||||
|
|
||||||
|
$(GLXHEADERS): glx.xml $(PYFILES)
|
||||||
|
$(GENHEADERS) $@ -registry glx.xml
|
||||||
|
|
||||||
|
$(WGLHEADERS): wgl.xml $(PYFILES)
|
||||||
|
$(GENHEADERS) $@ -registry wgl.xml
|
||||||
|
|
||||||
|
# Generate Relax NG XML schema from Compact schema
|
||||||
|
|
||||||
|
registry.rng: registry.rnc
|
||||||
|
trang registry.rnc registry.rng
|
||||||
|
|
||||||
|
# Verify all registry XML files against the schema
|
||||||
|
|
||||||
|
validate:
|
||||||
|
jing -c registry.rnc gl.xml
|
||||||
|
jing -c registry.rnc glx.xml
|
||||||
|
jing -c registry.rnc wgl.xml
|
||||||
|
|
||||||
|
# Documentation target
|
||||||
|
|
||||||
|
readme.pdf: readme.tex
|
||||||
|
touch readme.ind
|
||||||
|
pdflatex readme.tex
|
||||||
|
pdflatex readme.tex
|
||||||
|
makeindex readme.idx
|
||||||
|
pdflatex readme.tex
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-rm -f $(PYDIRT) $(TEXDIRT)
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// Copyright 2017-2021 The Khronos Group Inc.
|
||||||
|
// SPDX-License-Identifier: CC-BY-4.0
|
||||||
|
|
||||||
|
# OpenGL XML API Registry
|
||||||
|
|
||||||
|
This directory contains the OpenGL, GLX, and WGL XML API registries, in
|
||||||
|
gl.xml, glx.xml, and wgl.xml respectively. They are used to reserve
|
||||||
|
enumerant ranges for vendors working on new extensions, to register
|
||||||
|
extension interfaces when an extension is published, and to generate the
|
||||||
|
Khronos-supplied header files in ../api .
|
||||||
|
|
||||||
|
The canonical versions are always found in the master branch of the github
|
||||||
|
repository at https://github.com/KhronosGroup/OpenGL-Registry
|
||||||
|
|
||||||
|
The 'validate' Makefile target uses the 'jing' tool to confirm that each XML
|
||||||
|
file is structurally valid and conforms to the registry schema in
|
||||||
|
registry.rnc. The schema is described in detail in readme.pdf.
|
||||||
|
|
||||||
|
The 'default' Makefile target generates updated headers in ../api/ from the
|
||||||
|
XML files.
|
||||||
|
|
||||||
|
Note that while there are targets for ../api/{gl.h,glx.h,wgl.h} in
|
||||||
|
genglvnd.py and genheaders.py, these targets are not generated by default
|
||||||
|
and are experimental. At present, you should use the versions of these
|
||||||
|
headers shipped with your OS or IHV SDK.
|
||||||
@@ -0,0 +1,628 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
# Copyright 2013-2025 The Khronos Group Inc.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import sys, time, pdb, string, cProfile
|
||||||
|
from reg import *
|
||||||
|
|
||||||
|
# debug - start header generation in debugger
|
||||||
|
# dump - dump registry after loading
|
||||||
|
# profile - enable Python profiling
|
||||||
|
# protect - whether to use #ifndef protections
|
||||||
|
# registry <filename> - use specified XML registry instead of gl.xml
|
||||||
|
# target - string name of target header, or all targets if None
|
||||||
|
# timeit - time length of registry loading & header generation
|
||||||
|
# validate - validate return & parameter group tags against <group>
|
||||||
|
debug = False
|
||||||
|
dump = False
|
||||||
|
profile = False
|
||||||
|
protect = True
|
||||||
|
target = None
|
||||||
|
timeit = False
|
||||||
|
validate= False
|
||||||
|
# Default input / log files
|
||||||
|
errFilename = None
|
||||||
|
diagFilename = 'diag.txt'
|
||||||
|
regFilename = 'gl.xml'
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
i = 1
|
||||||
|
while (i < len(sys.argv)):
|
||||||
|
arg = sys.argv[i]
|
||||||
|
i = i + 1
|
||||||
|
if (arg == '-debug'):
|
||||||
|
write('Enabling debug (-debug)', file=sys.stderr)
|
||||||
|
debug = True
|
||||||
|
elif (arg == '-dump'):
|
||||||
|
write('Enabling dump (-dump)', file=sys.stderr)
|
||||||
|
dump = True
|
||||||
|
elif (arg == '-noprotect'):
|
||||||
|
write('Disabling inclusion protection in output headers', file=sys.stderr)
|
||||||
|
protect = False
|
||||||
|
elif (arg == '-profile'):
|
||||||
|
write('Enabling profiling (-profile)', file=sys.stderr)
|
||||||
|
profile = True
|
||||||
|
elif (arg == '-registry'):
|
||||||
|
regFilename = sys.argv[i]
|
||||||
|
i = i+1
|
||||||
|
write('Using registry ', regFilename, file=sys.stderr)
|
||||||
|
elif (arg == '-time'):
|
||||||
|
write('Enabling timing (-time)', file=sys.stderr)
|
||||||
|
timeit = True
|
||||||
|
elif (arg == '-validate'):
|
||||||
|
write('Enabling group validation (-validate)', file=sys.stderr)
|
||||||
|
validate = True
|
||||||
|
elif (arg[0:1] == '-'):
|
||||||
|
write('Unrecognized argument:', arg, file=sys.stderr)
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
target = arg
|
||||||
|
write('Using target', target, file=sys.stderr)
|
||||||
|
|
||||||
|
# Simple timer functions
|
||||||
|
startTime = None
|
||||||
|
def startTimer():
|
||||||
|
global startTime
|
||||||
|
startTime = time.process_time()
|
||||||
|
def endTimer(msg):
|
||||||
|
global startTime
|
||||||
|
endTime = time.process_time()
|
||||||
|
if (timeit):
|
||||||
|
write(msg, endTime - startTime)
|
||||||
|
startTime = None
|
||||||
|
|
||||||
|
# Load & parse registry
|
||||||
|
reg = Registry()
|
||||||
|
|
||||||
|
startTimer()
|
||||||
|
tree = etree.parse(regFilename)
|
||||||
|
endTimer('Time to make ElementTree =')
|
||||||
|
|
||||||
|
startTimer()
|
||||||
|
reg.loadElementTree(tree)
|
||||||
|
endTimer('Time to parse ElementTree =')
|
||||||
|
|
||||||
|
if (validate):
|
||||||
|
reg.validateGroups()
|
||||||
|
|
||||||
|
if (dump):
|
||||||
|
write('***************************************')
|
||||||
|
write('Performing Registry dump to regdump.txt')
|
||||||
|
write('***************************************')
|
||||||
|
reg.dumpReg(filehandle = open('regdump.txt','w'))
|
||||||
|
|
||||||
|
# Turn a list of strings into a regexp string matching exactly those strings
|
||||||
|
def makeREstring(list):
|
||||||
|
return '^(' + '|'.join(list) + ')$'
|
||||||
|
|
||||||
|
# These are "mandatory" OpenGL ES 1 extensions, to
|
||||||
|
# be included in the core GLES/gl.h header.
|
||||||
|
es1CoreList = [
|
||||||
|
'GL_OES_read_format',
|
||||||
|
'GL_OES_compressed_paletted_texture',
|
||||||
|
'GL_OES_point_size_array',
|
||||||
|
'GL_OES_point_sprite'
|
||||||
|
]
|
||||||
|
|
||||||
|
# These are extensions to be included in the libglvnd GL/gl.h header.
|
||||||
|
glVndList = [
|
||||||
|
'GL_ARB_imaging',
|
||||||
|
'GL_ARB_multitexture'
|
||||||
|
]
|
||||||
|
|
||||||
|
# Descriptive names for various regexp patterns used to select
|
||||||
|
# versions and extensions
|
||||||
|
|
||||||
|
allVersions = allExtensions = '.*'
|
||||||
|
noVersions = noExtensions = None
|
||||||
|
gl13Pat = r'1\.[0-3]'
|
||||||
|
gl12andLaterPat = r'1\.[2-9]|[234]\.[0-9]'
|
||||||
|
gles2onlyPat = r'2\.[0-9]'
|
||||||
|
gles2through30Pat = r'2\.[0-9]|3\.0'
|
||||||
|
gles2through31Pat = r'2\.[0-9]|3\.[01]'
|
||||||
|
gles2through32Pat = r'2\.[0-9]|3\.[012]'
|
||||||
|
es1CorePat = makeREstring(es1CoreList)
|
||||||
|
glVndPat = makeREstring(glVndList)
|
||||||
|
|
||||||
|
# Extensions in old glcorearb.h but not yet tagged accordingly in gl.xml
|
||||||
|
glCoreARBPat = None
|
||||||
|
glx13andLaterPat = r'1\.[3-9]'
|
||||||
|
|
||||||
|
# Copyright text prefixing all headers (list of strings).
|
||||||
|
prefixStrings = [
|
||||||
|
'/*',
|
||||||
|
'** Copyright 2013-2025 The Khronos Group Inc.',
|
||||||
|
'** SPDX-' + 'License-Identifier: MIT',
|
||||||
|
'**',
|
||||||
|
'** This header is generated from the Khronos OpenGL / OpenGL ES XML',
|
||||||
|
'** API Registry. The current version of the Registry, generator scripts',
|
||||||
|
'** used to make the header, and the header can be found at',
|
||||||
|
'** https://github.com/KhronosGroup/OpenGL-Registry',
|
||||||
|
'*/',
|
||||||
|
''
|
||||||
|
]
|
||||||
|
|
||||||
|
# glext.h / glcorearb.h define calling conventions inline (no GL *platform.h)
|
||||||
|
glExtPlatformStrings = [
|
||||||
|
'#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)',
|
||||||
|
'#ifndef WIN32_LEAN_AND_MEAN',
|
||||||
|
'#define WIN32_LEAN_AND_MEAN 1',
|
||||||
|
'#endif',
|
||||||
|
'#include <windows.h>',
|
||||||
|
'#endif',
|
||||||
|
'',
|
||||||
|
'#ifndef APIENTRY',
|
||||||
|
'#define APIENTRY',
|
||||||
|
'#endif',
|
||||||
|
'#ifndef APIENTRYP',
|
||||||
|
'#define APIENTRYP APIENTRY *',
|
||||||
|
'#endif',
|
||||||
|
'#ifndef GLAPI',
|
||||||
|
'#define GLAPI extern',
|
||||||
|
'#endif',
|
||||||
|
''
|
||||||
|
]
|
||||||
|
|
||||||
|
glCorearbPlatformStrings = glExtPlatformStrings + [
|
||||||
|
'/* glcorearb.h is for use with OpenGL core profile implementations.',
|
||||||
|
'** It should should be placed in the same directory as gl.h and',
|
||||||
|
'** included as <GL/glcorearb.h>.',
|
||||||
|
'**',
|
||||||
|
'** glcorearb.h includes only APIs in the latest OpenGL core profile',
|
||||||
|
'** implementation together with APIs in newer ARB extensions which ',
|
||||||
|
'** can be supported by the core profile. It does not, and never will',
|
||||||
|
'** include functionality removed from the core profile, such as',
|
||||||
|
'** fixed-function vertex and fragment processing.',
|
||||||
|
'**',
|
||||||
|
'** Do not #include both <GL/glcorearb.h> and either of <GL/gl.h> or',
|
||||||
|
'** <GL/glext.h> in the same source file.',
|
||||||
|
'*/',
|
||||||
|
''
|
||||||
|
]
|
||||||
|
|
||||||
|
# wglext.h needs Windows include
|
||||||
|
wglPlatformStrings = [
|
||||||
|
'#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)',
|
||||||
|
'#define WIN32_LEAN_AND_MEAN 1',
|
||||||
|
'#include <windows.h>',
|
||||||
|
'#endif',
|
||||||
|
'',
|
||||||
|
]
|
||||||
|
|
||||||
|
# Different APIs use different *platform.h files to define calling
|
||||||
|
# conventions
|
||||||
|
glPlatformStrings = [ '#include <GL/glplatform.h>', '' ]
|
||||||
|
gles1PlatformStrings = [ '#include <GLES/glplatform.h>', '' ]
|
||||||
|
gles2PlatformStrings = [ '#include <GLES2/gl2platform.h>', '' ]
|
||||||
|
gles3PlatformStrings = [ '#include <GLES3/gl3platform.h>', '' ]
|
||||||
|
glsc2PlatformStrings = [ '#include <GLSC2/gl2platform.h>', '' ]
|
||||||
|
eglPlatformStrings = [ '#include <EGL/eglplatform.h>', '' ]
|
||||||
|
|
||||||
|
# GLES headers have a small addition to calling convention headers for function pointer typedefs
|
||||||
|
apiEntryPrefixStrings = [
|
||||||
|
'#ifndef GL_APIENTRYP',
|
||||||
|
'#define GL_APIENTRYP GL_APIENTRY*',
|
||||||
|
'#endif',
|
||||||
|
''
|
||||||
|
]
|
||||||
|
|
||||||
|
# Insert generation date in a comment for headers not having *GLEXT_VERSION macros
|
||||||
|
genDateCommentString = [
|
||||||
|
format("/* Generated on date %s */" % time.strftime("%Y%m%d")),
|
||||||
|
''
|
||||||
|
]
|
||||||
|
|
||||||
|
# GL_GLEXT_VERSION is defined only in glext.h and gl2ext.h
|
||||||
|
glextVersionStrings = [
|
||||||
|
format("#define GL_GLEXT_VERSION %s" % time.strftime("%Y%m%d")),
|
||||||
|
''
|
||||||
|
]
|
||||||
|
# WGL_WGLEXT_VERSION is defined only in wglext.h
|
||||||
|
wglextVersionStrings = [
|
||||||
|
format("#define WGL_WGLEXT_VERSION %s" % time.strftime("%Y%m%d")),
|
||||||
|
''
|
||||||
|
]
|
||||||
|
# GLX_GLXEXT_VERSION is defined only in glxext.h
|
||||||
|
glxextVersionStrings = [
|
||||||
|
format("#define GLX_GLXEXT_VERSION %s" % time.strftime("%Y%m%d")),
|
||||||
|
''
|
||||||
|
]
|
||||||
|
# EGL_EGLEXT_VERSION is defined only in eglext.h
|
||||||
|
eglextVersionStrings = [
|
||||||
|
format("#define EGL_EGLEXT_VERSION %s" % time.strftime("%Y%m%d")),
|
||||||
|
''
|
||||||
|
]
|
||||||
|
|
||||||
|
# Defaults for generating re-inclusion protection wrappers (or not)
|
||||||
|
protectFile = protect
|
||||||
|
protectFeature = protect
|
||||||
|
protectProto = protect
|
||||||
|
|
||||||
|
buildList = [
|
||||||
|
# GL API 1.2+ + extensions - GL/glext.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'drafts/GL/glext.h',
|
||||||
|
apiname = 'gl',
|
||||||
|
profile = 'compatibility',
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = gl12andLaterPat,
|
||||||
|
defaultExtensions = 'gl', # Default extensions for GL
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + glExtPlatformStrings + glextVersionStrings,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GLAPI ',
|
||||||
|
apientry = 'APIENTRY ',
|
||||||
|
apientryp = 'APIENTRYP '),
|
||||||
|
# GL compatibility profile through GL 1.3 (for libglvnd) - GL/gl.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'drafts/GL/gl.h',
|
||||||
|
apiname = 'gl',
|
||||||
|
profile = 'compatibility',
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = gl13Pat,
|
||||||
|
defaultExtensions = None, # No extensions for gl.h
|
||||||
|
addExtensions = glVndPat,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + glPlatformStrings,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = False, # gl.h always includes prototypes
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GLAPI ',
|
||||||
|
apientry = 'APIENTRY ',
|
||||||
|
apientryp = 'APIENTRYP '),
|
||||||
|
# GL core profile + extensions - GL/glcorearb.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'drafts/GL/glcorearb.h',
|
||||||
|
apiname = 'gl',
|
||||||
|
profile = 'core',
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = 'glcore', # Default extensions for GL core profile (only)
|
||||||
|
addExtensions = glCoreARBPat,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + glCorearbPlatformStrings,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GLAPI ',
|
||||||
|
apientry = 'APIENTRY ',
|
||||||
|
apientryp = 'APIENTRYP '),
|
||||||
|
# GLES 1.x API + mandatory extensions - GLES/gl.h (no function pointers)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'GLES/gl.h',
|
||||||
|
apiname = 'gles1',
|
||||||
|
profile = 'common',
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = es1CorePat, # Add mandatory ES1 extensions in GLES1/gl.h
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + gles1PlatformStrings + genDateCommentString,
|
||||||
|
genFuncPointers = False,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = False, # Core ES API functions are in the static link libraries
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_API ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLES 1.x extensions - GLES/glext.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'GLES/glext.h',
|
||||||
|
apiname = 'gles1',
|
||||||
|
profile = 'common',
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = noVersions,
|
||||||
|
defaultExtensions = 'gles1', # Default extensions for GLES 1
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = es1CorePat, # Remove mandatory ES1 extensions in GLES1/glext.h
|
||||||
|
prefixText = prefixStrings + apiEntryPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_API ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLES 2.0 API - GLES2/gl2.h (now with function pointers)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'GLES2/gl2.h',
|
||||||
|
apiname = 'gles2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2onlyPat,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + gles2PlatformStrings + apiEntryPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto, # Core ES API functions are in the static link libraries
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLES 3.1 / 3.0 / 2.0 extensions - GLES2/gl2ext.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'GLES2/gl2ext.h',
|
||||||
|
apiname = 'gles2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2onlyPat,
|
||||||
|
emitversions = None,
|
||||||
|
defaultExtensions = 'gles2', # Default extensions for GLES 2
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + apiEntryPrefixStrings + glextVersionStrings,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLES 3.2 API - GLES3/gl32.h (now with function pointers)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'GLES3/gl32.h',
|
||||||
|
apiname = 'gles2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2through32Pat,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + gles3PlatformStrings + apiEntryPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto, # Core ES API functions are in the static link libraries
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLES 3.1 API - GLES3/gl31.h (now with function pointers)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'GLES3/gl31.h',
|
||||||
|
apiname = 'gles2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2through31Pat,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + gles3PlatformStrings + apiEntryPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto, # Core ES API functions are in the static link libraries
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLES 3.0 API - GLES3/gl3.h (now with function pointers)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'GLES3/gl3.h',
|
||||||
|
apiname = 'gles2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2through30Pat,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + gles3PlatformStrings + apiEntryPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto, # Core ES API functions are in the static link libraries
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLSC 2.0 API - GLSC2/glsc2.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'GLSC2/glsc2.h',
|
||||||
|
apiname = 'glsc2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2onlyPat,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + glsc2PlatformStrings + apiEntryPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = False,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = False,
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLSC 2.0 extensions - GLSC2/gl2ext.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'GLSC2/glsc2ext.h',
|
||||||
|
apiname = 'glsc2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2onlyPat,
|
||||||
|
emitversions = None,
|
||||||
|
defaultExtensions = 'glsc2', # Default extensions for GLSC 2
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + apiEntryPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = False,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = False,
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# EGL API - EGL/egl.h (no function pointers, yet @@@)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'EGL/egl.h',
|
||||||
|
apiname = 'egl',
|
||||||
|
profile = None,
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + eglPlatformStrings + genDateCommentString,
|
||||||
|
genFuncPointers = False,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = False,
|
||||||
|
protectProtoStr = 'EGL_EGLEXT_PROTOTYPES',
|
||||||
|
apicall = 'EGLAPI ',
|
||||||
|
apientry = 'EGLAPIENTRY ',
|
||||||
|
apientryp = 'EGLAPIENTRYP '),
|
||||||
|
# EGL extensions - EGL/eglext.h (no function pointers, yet @@@)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'EGL/eglext.h',
|
||||||
|
apiname = 'egl',
|
||||||
|
profile = None,
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = None,
|
||||||
|
defaultExtensions = 'egl', # Default extensions for EGL
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + eglPlatformStrings + eglextVersionStrings,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'EGL_EGLEXT_PROTOTYPES',
|
||||||
|
apicall = 'EGLAPI ',
|
||||||
|
apientry = 'EGLAPIENTRY ',
|
||||||
|
apientryp = 'EGLAPIENTRYP '),
|
||||||
|
# GLX 1.* API - GL/glx.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'GL/glx.h',
|
||||||
|
apiname = 'glx',
|
||||||
|
profile = None,
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
# add glXPlatformStrings?
|
||||||
|
prefixText = prefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'GLX_GLXEXT_PROTOTYPES',
|
||||||
|
apicall = '',
|
||||||
|
apientry = '',
|
||||||
|
apientryp = ' *'),
|
||||||
|
# GLX 1.3+ API + extensions - GL/glxext.h (no function pointers, yet @@@)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'GL/glxext.h',
|
||||||
|
apiname = 'glx',
|
||||||
|
profile = None,
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = glx13andLaterPat,
|
||||||
|
defaultExtensions = 'glx', # Default extensions for GLX
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
# add glXPlatformStrings?
|
||||||
|
prefixText = prefixStrings + glxextVersionStrings,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'GLX_GLXEXT_PROTOTYPES',
|
||||||
|
apicall = '',
|
||||||
|
apientry = '',
|
||||||
|
apientryp = ' *'),
|
||||||
|
# WGL API + extensions - GL/wgl.h (no function pointers, yet @@@)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'GL/wgl.h',
|
||||||
|
apiname = 'wgl',
|
||||||
|
profile = None,
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = 'wgl', # Default extensions for WGL
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + wglPlatformStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'WGL_WGLEXT_PROTOTYPES',
|
||||||
|
apicall = '',
|
||||||
|
apientry = 'WINAPI ',
|
||||||
|
apientryp = 'WINAPI * '),
|
||||||
|
# WGL extensions - GL/wglext.h (no function pointers, yet @@@)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = 'GL/wglext.h',
|
||||||
|
apiname = 'wgl',
|
||||||
|
profile = None,
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = None,
|
||||||
|
defaultExtensions = 'wgl', # Default extensions for WGL
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + wglPlatformStrings + wglextVersionStrings,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'WGL_WGLEXT_PROTOTYPES',
|
||||||
|
apicall = '',
|
||||||
|
apientry = 'WINAPI ',
|
||||||
|
apientryp = 'WINAPI * '),
|
||||||
|
# End of list
|
||||||
|
None
|
||||||
|
]
|
||||||
|
|
||||||
|
# create error/warning & diagnostic files
|
||||||
|
if (errFilename):
|
||||||
|
errWarn = open(errFilename,'w')
|
||||||
|
else:
|
||||||
|
errWarn = sys.stderr
|
||||||
|
diag = open(diagFilename, 'w')
|
||||||
|
|
||||||
|
def genHeaders():
|
||||||
|
# Loop over targets, building each
|
||||||
|
generated = 0
|
||||||
|
for genOpts in buildList:
|
||||||
|
if (genOpts == None):
|
||||||
|
break
|
||||||
|
if (target and target != genOpts.filename):
|
||||||
|
# write('*** Skipping', genOpts.filename)
|
||||||
|
continue
|
||||||
|
write('*** Building', genOpts.filename)
|
||||||
|
generated = generated + 1
|
||||||
|
startTimer()
|
||||||
|
gen = COutputGenerator(errFile=errWarn,
|
||||||
|
warnFile=errWarn,
|
||||||
|
diagFile=diag)
|
||||||
|
reg.setGenerator(gen)
|
||||||
|
reg.apiGen(genOpts)
|
||||||
|
write('** Generated', genOpts.filename)
|
||||||
|
endTimer('Time to generate ' + genOpts.filename + ' =')
|
||||||
|
if (target and generated == 0):
|
||||||
|
write('Failed to generate target:', target)
|
||||||
|
|
||||||
|
if (debug):
|
||||||
|
pdb.run('genHeaders()')
|
||||||
|
elif (profile):
|
||||||
|
import cProfile, pstats
|
||||||
|
cProfile.run('genHeaders()', 'profile.txt')
|
||||||
|
p = pstats.Stats('profile.txt')
|
||||||
|
p.strip_dirs().sort_stats('time').print_stats(50)
|
||||||
|
else:
|
||||||
|
genHeaders()
|
||||||
@@ -0,0 +1,577 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# Copyright 2013-2025 The Khronos Group Inc.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import sys, time, pdb, string, cProfile
|
||||||
|
from reg import *
|
||||||
|
|
||||||
|
# debug - start header generation in debugger
|
||||||
|
# dump - dump registry after loading
|
||||||
|
# profile - enable Python profiling
|
||||||
|
# protect - whether to use #ifndef protections
|
||||||
|
# registry <filename> - use specified XML registry instead of gl.xml
|
||||||
|
# target - string name of target header, or all targets if None
|
||||||
|
# timeit - time length of registry loading & header generation
|
||||||
|
# validate - validate return & parameter group tags against <group>
|
||||||
|
debug = False
|
||||||
|
dump = False
|
||||||
|
profile = False
|
||||||
|
protect = True
|
||||||
|
target = None
|
||||||
|
timeit = False
|
||||||
|
validate= False
|
||||||
|
# Default input / log files
|
||||||
|
errFilename = None
|
||||||
|
diagFilename = 'diag.txt'
|
||||||
|
regFilename = 'gl.xml'
|
||||||
|
|
||||||
|
# Simple timer functions
|
||||||
|
startTime = None
|
||||||
|
def startTimer():
|
||||||
|
global startTime
|
||||||
|
startTime = time.process_time()
|
||||||
|
def endTimer(msg):
|
||||||
|
global startTime
|
||||||
|
endTime = time.process_time()
|
||||||
|
if (timeit):
|
||||||
|
write(msg, endTime - startTime)
|
||||||
|
startTime = None
|
||||||
|
|
||||||
|
# Turn a list of strings into a regexp string matching exactly those strings
|
||||||
|
def makeREstring(list):
|
||||||
|
return '^(' + '|'.join(list) + ')$'
|
||||||
|
|
||||||
|
# These are "mandatory" OpenGL ES 1 extensions, to
|
||||||
|
# be included in the core GLES/gl.h header.
|
||||||
|
es1CoreList = [
|
||||||
|
'GL_OES_read_format',
|
||||||
|
'GL_OES_compressed_paletted_texture',
|
||||||
|
'GL_OES_point_size_array',
|
||||||
|
'GL_OES_point_sprite'
|
||||||
|
]
|
||||||
|
|
||||||
|
# Descriptive names for various regexp patterns used to select
|
||||||
|
# versions and extensions
|
||||||
|
|
||||||
|
allVersions = allExtensions = '.*'
|
||||||
|
noVersions = noExtensions = None
|
||||||
|
gl12andLaterPat = r'1\.[2-9]|[234]\.[0-9]'
|
||||||
|
gles2onlyPat = r'2\.[0-9]'
|
||||||
|
gles2through30Pat = r'2\.[0-9]|3\.0'
|
||||||
|
gles2through31Pat = r'2\.[0-9]|3\.[01]'
|
||||||
|
gles2through32Pat = r'2\.[0-9]|3\.[012]'
|
||||||
|
es1CorePat = makeREstring(es1CoreList)
|
||||||
|
# Extensions in old glcorearb.h but not yet tagged accordingly in gl.xml
|
||||||
|
glCoreARBPat = None
|
||||||
|
glx13andLaterPat = r'1\.[3-9]'
|
||||||
|
|
||||||
|
# Copyright text prefixing all headers (list of strings).
|
||||||
|
prefixStrings = [
|
||||||
|
'/*',
|
||||||
|
'** Copyright 2013-2025 The Khronos Group Inc.',
|
||||||
|
'** SPDX-' + 'License-Identifier: MIT',
|
||||||
|
'**',
|
||||||
|
'** This header is generated from the Khronos OpenGL / OpenGL ES XML',
|
||||||
|
'** API Registry. The current version of the Registry, generator scripts',
|
||||||
|
'** used to make the header, and the header can be found at',
|
||||||
|
'** https://github.com/KhronosGroup/OpenGL-Registry',
|
||||||
|
'*/',
|
||||||
|
''
|
||||||
|
]
|
||||||
|
|
||||||
|
# glext.h / glcorearb.h define calling conventions inline (no GL *platform.h)
|
||||||
|
glExtPlatformStrings = [
|
||||||
|
'#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)',
|
||||||
|
'#ifndef WIN32_LEAN_AND_MEAN',
|
||||||
|
'#define WIN32_LEAN_AND_MEAN 1',
|
||||||
|
'#endif',
|
||||||
|
'#include <windows.h>',
|
||||||
|
'#endif',
|
||||||
|
'',
|
||||||
|
'#ifndef APIENTRY',
|
||||||
|
'#define APIENTRY',
|
||||||
|
'#endif',
|
||||||
|
'#ifndef APIENTRYP',
|
||||||
|
'#define APIENTRYP APIENTRY *',
|
||||||
|
'#endif',
|
||||||
|
'#ifndef GLAPI',
|
||||||
|
'#define GLAPI extern',
|
||||||
|
'#endif',
|
||||||
|
''
|
||||||
|
]
|
||||||
|
|
||||||
|
glCorearbPlatformStrings = glExtPlatformStrings + [
|
||||||
|
'/* glcorearb.h is for use with OpenGL core profile implementations.',
|
||||||
|
'** It should should be placed in the same directory as gl.h and',
|
||||||
|
'** included as <GL/glcorearb.h>.',
|
||||||
|
'**',
|
||||||
|
'** glcorearb.h includes only APIs in the latest OpenGL core profile',
|
||||||
|
'** implementation together with APIs in newer ARB extensions which ',
|
||||||
|
'** can be supported by the core profile. It does not, and never will',
|
||||||
|
'** include functionality removed from the core profile, such as',
|
||||||
|
'** fixed-function vertex and fragment processing.',
|
||||||
|
'**',
|
||||||
|
'** Do not #include both <GL/glcorearb.h> and either of <GL/gl.h> or',
|
||||||
|
'** <GL/glext.h> in the same source file.',
|
||||||
|
'*/',
|
||||||
|
''
|
||||||
|
]
|
||||||
|
|
||||||
|
# wglext.h needs Windows include
|
||||||
|
wglPlatformStrings = [
|
||||||
|
'#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)',
|
||||||
|
'#define WIN32_LEAN_AND_MEAN 1',
|
||||||
|
'#include <windows.h>',
|
||||||
|
'#endif',
|
||||||
|
'',
|
||||||
|
]
|
||||||
|
|
||||||
|
# Different APIs use different *platform.h files to define calling
|
||||||
|
# conventions
|
||||||
|
gles1PlatformStrings = [ '#include <GLES/glplatform.h>', '' ]
|
||||||
|
gles2PlatformStrings = [ '#include <GLES2/gl2platform.h>', '' ]
|
||||||
|
gles3PlatformStrings = [ '#include <GLES3/gl3platform.h>', '' ]
|
||||||
|
glsc2PlatformStrings = [ '#include <GLSC2/gl2platform.h>', '' ]
|
||||||
|
eglPlatformStrings = [ '#include <EGL/eglplatform.h>', '' ]
|
||||||
|
|
||||||
|
# GLES headers have a small addition to calling convention headers for function pointer typedefs
|
||||||
|
apiEntryPrefixStrings = [
|
||||||
|
'#ifndef GL_APIENTRYP',
|
||||||
|
'#define GL_APIENTRYP GL_APIENTRY*',
|
||||||
|
'#endif',
|
||||||
|
''
|
||||||
|
]
|
||||||
|
|
||||||
|
# GLES 2/3 core API headers use a different protection mechanism for
|
||||||
|
# prototypes, per bug 14206.
|
||||||
|
glesProtoPrefixStrings = [
|
||||||
|
'#ifndef GL_GLES_PROTOTYPES',
|
||||||
|
'#define GL_GLES_PROTOTYPES 1',
|
||||||
|
'#endif',
|
||||||
|
''
|
||||||
|
]
|
||||||
|
|
||||||
|
# Insert generation date in a comment for headers not having *GLEXT_VERSION macros
|
||||||
|
genDateCommentString = [
|
||||||
|
format('/* Generated on date %s */' % time.strftime('%Y%m%d')),
|
||||||
|
''
|
||||||
|
]
|
||||||
|
|
||||||
|
# GL_GLEXT_VERSION is defined only in glext.h and gl2ext.h
|
||||||
|
glextVersionStrings = [
|
||||||
|
format('#define GL_GLEXT_VERSION %s' % time.strftime('%Y%m%d')),
|
||||||
|
''
|
||||||
|
]
|
||||||
|
# WGL_WGLEXT_VERSION is defined only in wglext.h
|
||||||
|
wglextVersionStrings = [
|
||||||
|
format('#define WGL_WGLEXT_VERSION %s' % time.strftime('%Y%m%d')),
|
||||||
|
''
|
||||||
|
]
|
||||||
|
# GLX_GLXEXT_VERSION is defined only in glxext.h
|
||||||
|
glxextVersionStrings = [
|
||||||
|
format('#define GLX_GLXEXT_VERSION %s' % time.strftime('%Y%m%d')),
|
||||||
|
''
|
||||||
|
]
|
||||||
|
# This is a bad but functional workaround for a structural problem in the scripts
|
||||||
|
# identified in https://github.com/KhronosGroup/OpenGL-Registry/pull/186#issuecomment-416196246
|
||||||
|
glextKHRplatformStrings = [
|
||||||
|
'#include <KHR/khrplatform.h>',
|
||||||
|
''
|
||||||
|
]
|
||||||
|
# EGL_EGLEXT_VERSION is defined only in eglext.h
|
||||||
|
eglextVersionStrings = [
|
||||||
|
format('#define EGL_EGLEXT_VERSION %s' % time.strftime('%Y%m%d')),
|
||||||
|
''
|
||||||
|
]
|
||||||
|
|
||||||
|
# Defaults for generating re-inclusion protection wrappers (or not)
|
||||||
|
protectFile = protect
|
||||||
|
protectFeature = protect
|
||||||
|
protectProto = protect
|
||||||
|
|
||||||
|
buildList = [
|
||||||
|
# GL API 1.2+ + extensions - GL/glext.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GL/glext.h',
|
||||||
|
apiname = 'gl',
|
||||||
|
profile = 'compatibility',
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = gl12andLaterPat,
|
||||||
|
defaultExtensions = 'gl', # Default extensions for GL
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + glExtPlatformStrings + glextVersionStrings + glextKHRplatformStrings,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GLAPI ',
|
||||||
|
apientry = 'APIENTRY ',
|
||||||
|
apientryp = 'APIENTRYP '),
|
||||||
|
# GL core profile + extensions - GL/glcorearb.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GL/glcorearb.h',
|
||||||
|
apiname = 'gl',
|
||||||
|
profile = 'core',
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = 'glcore', # Default extensions for GL core profile (only)
|
||||||
|
addExtensions = glCoreARBPat,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + glCorearbPlatformStrings,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GLAPI ',
|
||||||
|
apientry = 'APIENTRY ',
|
||||||
|
apientryp = 'APIENTRYP '),
|
||||||
|
# GLES 1.x API + mandatory extensions - GLES/gl.h (no function pointers)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GLES/gl.h',
|
||||||
|
apiname = 'gles1',
|
||||||
|
profile = 'common',
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = es1CorePat, # Add mandatory ES1 extensions in GLES1/gl.h
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + gles1PlatformStrings + genDateCommentString,
|
||||||
|
genFuncPointers = False,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = False, # Core ES API functions are in the static link libraries
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_API ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLES 1.x extensions - GLES/glext.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GLES/glext.h',
|
||||||
|
apiname = 'gles1',
|
||||||
|
profile = 'common',
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = noVersions,
|
||||||
|
defaultExtensions = 'gles1', # Default extensions for GLES 1
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = es1CorePat, # Remove mandatory ES1 extensions in GLES1/glext.h
|
||||||
|
prefixText = prefixStrings + apiEntryPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_API ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLES 2.0 API - GLES2/gl2.h (now with function pointers)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GLES2/gl2.h',
|
||||||
|
apiname = 'gles2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2onlyPat,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + gles2PlatformStrings + apiEntryPrefixStrings + glesProtoPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = 'nonzero', # Core ES API functions are in the static link libraries
|
||||||
|
protectProtoStr = 'GL_GLES_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLES 3.1 / 3.0 / 2.0 extensions - GLES2/gl2ext.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GLES2/gl2ext.h',
|
||||||
|
apiname = 'gles2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2onlyPat,
|
||||||
|
emitversions = None,
|
||||||
|
defaultExtensions = 'gles2', # Default extensions for GLES 2
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + apiEntryPrefixStrings + glextVersionStrings,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLES 3.2 API - GLES3/gl32.h (now with function pointers)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GLES3/gl32.h',
|
||||||
|
apiname = 'gles2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2through32Pat,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + gles3PlatformStrings + apiEntryPrefixStrings + glesProtoPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = 'nonzero', # Core ES API functions are in the static link libraries
|
||||||
|
protectProtoStr = 'GL_GLES_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLES 3.1 API - GLES3/gl31.h (now with function pointers)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GLES3/gl31.h',
|
||||||
|
apiname = 'gles2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2through31Pat,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + gles3PlatformStrings + apiEntryPrefixStrings + glesProtoPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = 'nonzero', # Core ES API functions are in the static link libraries
|
||||||
|
protectProtoStr = 'GL_GLES_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLES 3.0 API - GLES3/gl3.h (now with function pointers)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GLES3/gl3.h',
|
||||||
|
apiname = 'gles2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2through30Pat,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + gles3PlatformStrings + apiEntryPrefixStrings + glesProtoPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = 'nonzero', # Core ES API functions are in the static link libraries
|
||||||
|
protectProtoStr = 'GL_GLES_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLSC 2.0 API - GLSC2/glsc2.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GLSC2/glsc2.h',
|
||||||
|
apiname = 'glsc2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2onlyPat,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + glsc2PlatformStrings + apiEntryPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = False,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = False,
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLSC 2.0 extensions - GLSC2/gl2ext.h
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GLSC2/glsc2ext.h',
|
||||||
|
apiname = 'glsc2',
|
||||||
|
profile = 'common',
|
||||||
|
versions = gles2onlyPat,
|
||||||
|
emitversions = None,
|
||||||
|
defaultExtensions = 'glsc2', # Default extensions for GLSC 2
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + apiEntryPrefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = False,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = False,
|
||||||
|
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
|
||||||
|
apicall = 'GL_APICALL ',
|
||||||
|
apientry = 'GL_APIENTRY ',
|
||||||
|
apientryp = 'GL_APIENTRYP '),
|
||||||
|
# GLX 1.* API - GL/glx.h (experimental)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GL/glx.h',
|
||||||
|
apiname = 'glx',
|
||||||
|
profile = None,
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = None, # No default extensions
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
# add glXPlatformStrings?
|
||||||
|
prefixText = prefixStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'GLX_GLXEXT_PROTOTYPES',
|
||||||
|
apicall = '',
|
||||||
|
apientry = '',
|
||||||
|
apientryp = ' *'),
|
||||||
|
# GLX 1.3+ API + extensions - GL/glxext.h (no function pointers, yet @@@)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GL/glxext.h',
|
||||||
|
apiname = 'glx',
|
||||||
|
profile = None,
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = glx13andLaterPat,
|
||||||
|
defaultExtensions = 'glx', # Default extensions for GLX
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
# add glXPlatformStrings?
|
||||||
|
prefixText = prefixStrings + glxextVersionStrings,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'GLX_GLXEXT_PROTOTYPES',
|
||||||
|
apicall = '',
|
||||||
|
apientry = '',
|
||||||
|
apientryp = ' *'),
|
||||||
|
# WGL API + extensions - GL/wgl.h (experimenta; no function pointers, yet @@@)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GL/wgl.h',
|
||||||
|
apiname = 'wgl',
|
||||||
|
profile = None,
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = allVersions,
|
||||||
|
defaultExtensions = 'wgl', # Default extensions for WGL
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + wglPlatformStrings + genDateCommentString,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'WGL_WGLEXT_PROTOTYPES',
|
||||||
|
apicall = '',
|
||||||
|
apientry = 'WINAPI ',
|
||||||
|
apientryp = 'WINAPI * '),
|
||||||
|
# WGL extensions - GL/wglext.h (no function pointers, yet @@@)
|
||||||
|
CGeneratorOptions(
|
||||||
|
filename = '../api/GL/wglext.h',
|
||||||
|
apiname = 'wgl',
|
||||||
|
profile = None,
|
||||||
|
versions = allVersions,
|
||||||
|
emitversions = None,
|
||||||
|
defaultExtensions = 'wgl', # Default extensions for WGL
|
||||||
|
addExtensions = None,
|
||||||
|
removeExtensions = None,
|
||||||
|
prefixText = prefixStrings + wglPlatformStrings + wglextVersionStrings,
|
||||||
|
genFuncPointers = True,
|
||||||
|
protectFile = protectFile,
|
||||||
|
protectFeature = protectFeature,
|
||||||
|
protectProto = protectProto,
|
||||||
|
protectProtoStr = 'WGL_WGLEXT_PROTOTYPES',
|
||||||
|
apicall = '',
|
||||||
|
apientry = 'WINAPI ',
|
||||||
|
apientryp = 'WINAPI * '),
|
||||||
|
# End of list
|
||||||
|
None
|
||||||
|
]
|
||||||
|
|
||||||
|
def genHeaders():
|
||||||
|
# Loop over targets, building each
|
||||||
|
generated = 0
|
||||||
|
for genOpts in buildList:
|
||||||
|
if (genOpts == None):
|
||||||
|
break
|
||||||
|
if (target and target != genOpts.filename):
|
||||||
|
# write('*** Skipping', genOpts.filename)
|
||||||
|
continue
|
||||||
|
write('*** Building', genOpts.filename)
|
||||||
|
generated = generated + 1
|
||||||
|
startTimer()
|
||||||
|
gen = COutputGenerator(errFile=errWarn,
|
||||||
|
warnFile=errWarn,
|
||||||
|
diagFile=diag)
|
||||||
|
reg.setGenerator(gen)
|
||||||
|
reg.apiGen(genOpts)
|
||||||
|
write('** Generated', genOpts.filename)
|
||||||
|
endTimer('Time to generate ' + genOpts.filename + ' =')
|
||||||
|
if (target and generated == 0):
|
||||||
|
write('Failed to generate target:', target)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
i = 1
|
||||||
|
while (i < len(sys.argv)):
|
||||||
|
arg = sys.argv[i]
|
||||||
|
i = i + 1
|
||||||
|
if (arg == '-debug'):
|
||||||
|
write('Enabling debug (-debug)', file=sys.stderr)
|
||||||
|
debug = True
|
||||||
|
elif (arg == '-dump'):
|
||||||
|
write('Enabling dump (-dump)', file=sys.stderr)
|
||||||
|
dump = True
|
||||||
|
elif (arg == '-noprotect'):
|
||||||
|
write('Disabling inclusion protection in output headers', file=sys.stderr)
|
||||||
|
protect = False
|
||||||
|
elif (arg == '-profile'):
|
||||||
|
write('Enabling profiling (-profile)', file=sys.stderr)
|
||||||
|
profile = True
|
||||||
|
elif (arg == '-registry'):
|
||||||
|
regFilename = sys.argv[i]
|
||||||
|
i = i+1
|
||||||
|
write('Using registry ', regFilename, file=sys.stderr)
|
||||||
|
elif (arg == '-time'):
|
||||||
|
write('Enabling timing (-time)', file=sys.stderr)
|
||||||
|
timeit = True
|
||||||
|
elif (arg == '-validate'):
|
||||||
|
write('Enabling group validation (-validate)', file=sys.stderr)
|
||||||
|
validate = True
|
||||||
|
elif (arg[0:1] == '-'):
|
||||||
|
write('Unrecognized argument:', arg, file=sys.stderr)
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
target = arg
|
||||||
|
write('Using target', target, file=sys.stderr)
|
||||||
|
|
||||||
|
# Load & parse registry
|
||||||
|
reg = Registry()
|
||||||
|
|
||||||
|
startTimer()
|
||||||
|
tree = etree.parse(regFilename)
|
||||||
|
endTimer('Time to make ElementTree =')
|
||||||
|
|
||||||
|
startTimer()
|
||||||
|
reg.loadElementTree(tree)
|
||||||
|
endTimer('Time to parse ElementTree =')
|
||||||
|
|
||||||
|
if (validate):
|
||||||
|
reg.validateGroups()
|
||||||
|
|
||||||
|
if (dump):
|
||||||
|
write('***************************************')
|
||||||
|
write('Performing Registry dump to regdump.txt')
|
||||||
|
write('***************************************')
|
||||||
|
reg.dumpReg(filehandle = open('regdump.txt','w'))
|
||||||
|
|
||||||
|
# create error/warning & diagnostic files
|
||||||
|
if (errFilename):
|
||||||
|
errWarn = open(errFilename,'w')
|
||||||
|
else:
|
||||||
|
errWarn = sys.stderr
|
||||||
|
diag = open(diagFilename, 'w')
|
||||||
|
|
||||||
|
if (debug):
|
||||||
|
pdb.run('genHeaders()')
|
||||||
|
elif (profile):
|
||||||
|
import cProfile, pstats
|
||||||
|
cProfile.run('genHeaders()', 'profile.txt')
|
||||||
|
p = pstats.Stats('profile.txt')
|
||||||
|
p.strip_dirs().sort_stats('time').print_stats(50)
|
||||||
|
else:
|
||||||
|
genHeaders()
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,729 @@
|
|||||||
|
This is the registry of GLX opcodes, error codes, and event codes. It is
|
||||||
|
very rarely modified since there is almost no interest in supporting GLX
|
||||||
|
with modern OpenGL features, and the work of extending the XML schema to
|
||||||
|
express it is not worthwhile.
|
||||||
|
|
||||||
|
When new GLX protocol is needed for extension specifications, allocate it
|
||||||
|
here and reflect it in the extension specification document as well as, if
|
||||||
|
appropriate, glx.xml.
|
||||||
|
|
||||||
|
Reserved opcode ranges assigned to vendors, and in some cases, opcodes
|
||||||
|
actually assigned within that range are tracked here. Not all opcodes used
|
||||||
|
by vendors are known.
|
||||||
|
|
||||||
|
GLX Opcodes (8 bits)
|
||||||
|
====================
|
||||||
|
1-15 GLX 1.0
|
||||||
|
16 Vendor Private
|
||||||
|
17 Vendor Private with Reply
|
||||||
|
18-20 GLX 1.1
|
||||||
|
21-32 GLX 1.3
|
||||||
|
33 glXSetClientInfoARB (GLX_ARB_create_context)
|
||||||
|
34 glXCreateContextAttribsARB (GLX_ARB_create_context)
|
||||||
|
35 glXSetClientInfo2ARB (GLX_ARB_create_context)
|
||||||
|
|
||||||
|
GLX Vendor Private / Vendor Private with Reply opcodes (32-bits)
|
||||||
|
(first 4 bytes past standard X header)
|
||||||
|
================================================================
|
||||||
|
|
||||||
|
0 255 EXT (various - contact SGI)
|
||||||
|
256 271 HP (originally Compaq)
|
||||||
|
(272-511 unused)
|
||||||
|
512 575 E&S
|
||||||
|
(576-1023 unused)
|
||||||
|
1024 1269 EXT (various - contact SGI)
|
||||||
|
1024 GLX_EXT_import_context
|
||||||
|
1270 1275 NV_register_combiners
|
||||||
|
1276 1280 NV_fence
|
||||||
|
1281 1292 NVIDIA (use TBD; was intended for NV_vertex_program)
|
||||||
|
1293 1308 NV_vertex_program / ARB_vertex_program / ARB_fragment_program
|
||||||
|
1309 NVIDIA (use TBD)
|
||||||
|
1310 1311 NV_fragment_program
|
||||||
|
1312 NV_fence
|
||||||
|
1313 1318 GLX_NV_video_output
|
||||||
|
1319 1320 NV_vertex_program
|
||||||
|
1321 1326 NVIDIA (use TBD)
|
||||||
|
1327 NV_register_combiners2
|
||||||
|
1328 1329 EXT_timer_query
|
||||||
|
1330 1331 GLX_EXT_texture_from_pixmap
|
||||||
|
1332 1339 NV_present_video
|
||||||
|
1340 NVIDIA (use TBD)
|
||||||
|
1341 GLX_NV_delay_before_swap
|
||||||
|
1342 1359 NVIDIA (use TBD)
|
||||||
|
1360 GLX_NV_copy_image
|
||||||
|
1361 1364 NVIDIA (use TBD)
|
||||||
|
1365 1368 NV_gpu_program4
|
||||||
|
1369 1386 NVIDIA (use TBD)
|
||||||
|
1387 1388 GLX_NV_copy_buffer
|
||||||
|
1389 1399 NVIDIA (use TBD)
|
||||||
|
1400 1415 NV_video_capture
|
||||||
|
1416 GLX_EXT_swap_control
|
||||||
|
1417 1420 NVIDIA (use TBD)
|
||||||
|
1421 OES_single_precision (Khronos OpenGL ES 1.0)
|
||||||
|
1422 1428 EXT_framebuffer_object
|
||||||
|
(1429-2047 unused)
|
||||||
|
2048 2064 SUN
|
||||||
|
3000 3999 IBM
|
||||||
|
4096 5151 SGI (4106-5151 unused)
|
||||||
|
4096 SGIS_detail_texture
|
||||||
|
4097 SGIS_sharpen_texture
|
||||||
|
4098 4100 SGI_color_table
|
||||||
|
4101 SGIS_texture_filter4
|
||||||
|
4102 4104 SGIX_instruments
|
||||||
|
4105 SGIX_flush_raster
|
||||||
|
5152 5184 Mesa (unknown use)
|
||||||
|
8192 8207 HP
|
||||||
|
16384 16399 ADD
|
||||||
|
65536 66575 SGI (various GLX extensions)
|
||||||
|
65536 GLX_SGI_swap_control
|
||||||
|
65537 GLX_SGI_make_current_read
|
||||||
|
65538 65539 GLX_SGIX_video_source
|
||||||
|
65540 65542 GLX_SGIX_fbconfig
|
||||||
|
65543 65546 GLX_SGIX_pbuffer
|
||||||
|
65547 GLX_SGIX_swap_group
|
||||||
|
65548 65549 GLX_SGIX_swap_barrier
|
||||||
|
65550 65553 GLX_SGIX_hyperpipe_group
|
||||||
|
65554 GLX_SGIX_query_board_num (internal, for shm)
|
||||||
|
|
||||||
|
OpenGL Single Opcodes (8 Bits)
|
||||||
|
===============================
|
||||||
|
|
||||||
|
167-up Reserved
|
||||||
|
0 146 OpenGL 1.0/1.1 core
|
||||||
|
147 159 OpenGL 1.2 core
|
||||||
|
160 160 ARB_texture_compression
|
||||||
|
161 166 ARB_occlusion_query
|
||||||
|
167 178 ARB_shader_objects
|
||||||
|
179 181 ARB_vertex_shader
|
||||||
|
182 183 EXT_gpu_shader4
|
||||||
|
184 185 NV_vertex_program4
|
||||||
|
186 194 ARB_vertex_buffer_object
|
||||||
|
195 202 OpenGL 2.0 core
|
||||||
|
203 204 EXT_texture_integer
|
||||||
|
205 205 ARB_map_buffer_range
|
||||||
|
206 209 ARB_vertex_array_object
|
||||||
|
210 212 EXT_draw_buffers2
|
||||||
|
213 214 OpenGL 3.0 core
|
||||||
|
215 220 ARB_uniform_buffer_object
|
||||||
|
221 ARB_copy_buffer
|
||||||
|
|
||||||
|
OpenGL Rendering Opcodes (16 Bits)
|
||||||
|
==================================
|
||||||
|
|
||||||
|
0-1007 Reserved to ARB (231-1007 unused)
|
||||||
|
0 191 OpenGL 1.0 core (140 deprecated?)
|
||||||
|
192 194 OpenGL 1.1 core
|
||||||
|
195 196 OpenGL 1.2 core
|
||||||
|
197 213 ARB_multitexture
|
||||||
|
214 219 ARB_texture_compression
|
||||||
|
220 228 ARB_vertex_blend
|
||||||
|
229 ARB_multisample
|
||||||
|
230 ARB_window_pos
|
||||||
|
231 232 ARB_occlusion_query
|
||||||
|
233 ARB_draw_buffers
|
||||||
|
234 ARB_color_buffer_float
|
||||||
|
235 237 ARB_framebuffer_object
|
||||||
|
238 264 ARB_shader_object
|
||||||
|
265 ARB_vertex_shader
|
||||||
|
266 268 ARB_geometry_shader4
|
||||||
|
269 277 EXT_gpu_shader4
|
||||||
|
278 289 NV_vertex_program4
|
||||||
|
290 301 ARB_vertex_buffer_object
|
||||||
|
302 304 ARB_stencil_two_side
|
||||||
|
305 310 OpenGL 2.1 core
|
||||||
|
311 345 ARB_pixel_buffer_object
|
||||||
|
346 347 EXT_texture_integer
|
||||||
|
348 349 NV_conditional_render
|
||||||
|
350 351 ARB_vertex_array_object
|
||||||
|
352 354 EXT_draw_buffers2
|
||||||
|
355 363 OpenGL 3.0 core
|
||||||
|
364 365 NV_primitive_restart
|
||||||
|
366 ARB_uniform_buffer_object
|
||||||
|
367 ARB_texture_buffer_object
|
||||||
|
1008-1023 Reserved to IBM (unknown usage)
|
||||||
|
1024-1039 Reserved to HP (originally Compaq) (unknown usage)
|
||||||
|
1040-2047 Unused
|
||||||
|
2048-3071 Reserved to SGI (2083-3071 unused)
|
||||||
|
2048 2049 SGIS_multisample
|
||||||
|
2050 SGIX_tag_sample_buffer
|
||||||
|
2051 SGIS_detail_texture
|
||||||
|
2052 SGIS_sharpen_texture
|
||||||
|
2053 2056 SGI_color_table
|
||||||
|
2057 2058 SGIS_texture4D
|
||||||
|
2059 SGIX_pixel_texture
|
||||||
|
2060 2063 SGIX_sprite
|
||||||
|
2064 SGIS_texture_filter4
|
||||||
|
2065 2066 EXT_point_parameters/SGIS_point_parameters
|
||||||
|
2067 SGIS_fog_function
|
||||||
|
2068 unused?
|
||||||
|
2069 2070 SGIX_instruments
|
||||||
|
2071 SGIX_reference_plane
|
||||||
|
2072 SGIX_framezoom
|
||||||
|
2073 2076 unused?
|
||||||
|
2077 SGIX_instruments
|
||||||
|
2078 2081 SGIX_list_priority
|
||||||
|
2082 SGIS_texture_color_mask
|
||||||
|
3072-4095 Reserved to ARB (unused)
|
||||||
|
4096-5151 Reserved to EXT (4460-5151 unused)
|
||||||
|
4096 EXT_blend_color/1.2
|
||||||
|
4097 EXT_blend_minmax/1.2
|
||||||
|
4098 EXT_polygon_offset
|
||||||
|
4099 4100 EXT_subtexture
|
||||||
|
4101 4109 EXT_convolution/1.2
|
||||||
|
4110 4113 EXT_histogram/1.2
|
||||||
|
4114 EXT_texture3D/1.2
|
||||||
|
4115 EXT_subtexture/1.2
|
||||||
|
4116 EXT_vertex_array
|
||||||
|
4117 4118 EXT_texture_object/1.1
|
||||||
|
4119 4123 EXT_copy_texture/1.1
|
||||||
|
4124 4125 EXT_fog_coord
|
||||||
|
4126 4133 EXT_secondary_color
|
||||||
|
4134 EXT_blend_func_separate
|
||||||
|
4135 EXT_vertex_weighting
|
||||||
|
4136 4142 NV_register_combiners
|
||||||
|
4143 4144 NV_fence (4144 retired, used to be for FinishFence)
|
||||||
|
4145 4179 NVIDIA (use TBD; was intended for NV_vertex_program)
|
||||||
|
4180 4214 NV_vertex_program
|
||||||
|
4215 4217 ARB_vertex_program
|
||||||
|
4218 4219 NV_fragment_program
|
||||||
|
4220 EXT_stencil_two_side
|
||||||
|
4221 4222 NV_point_sprite
|
||||||
|
4223 EXT_stencil_clear_tag
|
||||||
|
4225 EXT_polygon_offset_clamp
|
||||||
|
4228 EXT_blend_equation_separate
|
||||||
|
4229 EXT_depth_bounds_test
|
||||||
|
4230 4239 ARB_vertex_program
|
||||||
|
4240 4264 NV_half_float
|
||||||
|
4265 4280 NVIDIA (use TBD)
|
||||||
|
4281 4282 EXT_gpu_program_parameters
|
||||||
|
4283 4285 NV_depth_buffer_float
|
||||||
|
4286 4290 NVIDIA (use TBD)
|
||||||
|
4291 NV_copy_image
|
||||||
|
4292 4293 EXT_texture_integer
|
||||||
|
4294 4307 NVIDIA (use TBD)
|
||||||
|
4308 4312 OES_single_precision (Khronos OpenGL ES 1.0)
|
||||||
|
4313 4315 SUN (use TBD)
|
||||||
|
4316 4325 EXT_framebuffer_object
|
||||||
|
4326 4329 ARB_matrix_palette
|
||||||
|
4330 EXT_framebuffer_blit
|
||||||
|
4331 EXT_framebuffer_multisample
|
||||||
|
4332 4347 NVIDIA (use TBD, bug 6720)
|
||||||
|
4348 NV_texture_barrier
|
||||||
|
4349 4459 NVIDIA (use TBD, bug 6720)
|
||||||
|
|
||||||
|
8192-8207 Reserved to HP (unknown usage)
|
||||||
|
16384-16415 Reserved to SUN (unknown usage)
|
||||||
|
24576-24607 Reserved to ADD (unknown usage)
|
||||||
|
|
||||||
|
|
||||||
|
GLX Enumerateds (32 Bits)
|
||||||
|
=========================
|
||||||
|
0x0-0xFF Reserved to EXT (visual attribute names)
|
||||||
|
0x1 0x11 GLX 1.0 (attribute names)
|
||||||
|
0x12 0x1F unused?
|
||||||
|
0x20 GLX_EXT_visual_rating (attribute names)
|
||||||
|
0x21 unused?
|
||||||
|
0x22 0x28 GLX_EXT_visual_info (attribute names)
|
||||||
|
0x1F00-0x1F02 Reserved to ARB (shared with WGL)
|
||||||
|
0x1F00 0x1F02 GLX_AMD_gpu_association
|
||||||
|
0x2070-0x209F Reserved to ARB (shared with WGL)
|
||||||
|
0x2090 0x2094 GLX_ARB_create_context
|
||||||
|
0x2095 GL_ARB_vertex_buffer_object
|
||||||
|
0x2097 0x2098 GLX_ARB_context_flush_control
|
||||||
|
0x20A0-0x219F Reserved to NVIDIA (shared with WGL)
|
||||||
|
0x20B0 GLX_NV_float_buffer
|
||||||
|
0x20B1 GLX_EXT_fbconfig_packed_float
|
||||||
|
0x20B2 GLX_ARB_framebuffer_sRGB (nee EXT)
|
||||||
|
0x20B3 GLX_NV_multisample_coverage
|
||||||
|
0x20B9 GLX_ARB_fbconfig_float
|
||||||
|
0x20C3 0x20CC GLX_NV_video_out
|
||||||
|
0x20CD 0x20CF GLX_NV_video_capture
|
||||||
|
0x20D0 0x20EB GLX_EXT_texture_from_pixmap
|
||||||
|
0x20F0 GLX_NV_present_video
|
||||||
|
0x20F1 0x20F2 GLX_EXT_swap_control
|
||||||
|
0x20F3 GLX_EXT_swap_control_tear
|
||||||
|
0x20F4 GLX_EXT_buffer_age
|
||||||
|
0x20F5 GLX_EXT_stereo_tree
|
||||||
|
0x20F6 GLX_EXT_libglvnd
|
||||||
|
0x20F7 GLX_NV_robustness_video_memory_purge
|
||||||
|
0x21A0-0x21AF Reserved to AMD (shared with WGL)
|
||||||
|
0x21A2 0x21A8 GLX_AMD_gpu_association
|
||||||
|
0x31B3 Reserved to ARB (shared with WGL)
|
||||||
|
0x31B3 GLX_ARB_create_context_no_error
|
||||||
|
0x8000-0x800F Reserved to EXT (0x800E-0x800F unused)
|
||||||
|
0x8000 0x8009 GLX_EXT_visual_info
|
||||||
|
0x800A 0x800C GLX_EXT_import_context
|
||||||
|
0x800D GLX_EXT_visual_rating
|
||||||
|
0x8010-0x803F Reserved to SGI (0x8029-0x803F unused)
|
||||||
|
0x8010 0x8015 GLX_SGIX_fbconfig
|
||||||
|
0x8016 0x8023 GLX_SGIX_pbuffer
|
||||||
|
0x8024 GLX_SGIX_dm_buffer
|
||||||
|
0x8025 GLX_SGIS_blended_overlay
|
||||||
|
0x8026 0x8027 GLX_SGIS_shared_multisample
|
||||||
|
0x8028 GLX_SGIX_visual_select_group
|
||||||
|
0x8030 GLX_SGIX_hyperpipe
|
||||||
|
0x8040-0x804F Reserved to OpenGL ARB
|
||||||
|
0x8040 0x8041 GLX 1.3
|
||||||
|
0x8050-0x805F Reserved to 3Dfx
|
||||||
|
0x8050 0x8051 GLX_3DFX_multisample
|
||||||
|
0x8060-0x806F Reserved to OpenML SIG
|
||||||
|
0x8060 0x8063 GLX_OML_swap_method
|
||||||
|
0x8070-0x816F Reserved to NVIDIA
|
||||||
|
0x8170-0x817F Reserved to SUN
|
||||||
|
0x8180-0x818F Reserved to Intel (0x818F unused)
|
||||||
|
0x8180 0x8182 GLX_INTEL_swap_event
|
||||||
|
0x8183 0x818E GLX_MESA_query_renderer
|
||||||
|
0x8250-0x826F Reserved to ARB (Shared with GL and WGL)
|
||||||
|
0x8252 GLX_ARB_create_context_robustness
|
||||||
|
0x8256 GLX_ARB_create_context_robustness
|
||||||
|
0x8261 GLX_ARB_create_context_robustness
|
||||||
|
0x9126 GLX_ARB_create_context_profile (shared with WGL)
|
||||||
|
|
||||||
|
100000-100011 Reserved to SGI (100002-100011 unused)
|
||||||
|
100000 100001 GLX_SGIS_multisample/GLX_ARB_multisample
|
||||||
|
|
||||||
|
GLX Error Codes
|
||||||
|
===============
|
||||||
|
|
||||||
|
(Extension reservations for vendor extensions should start sufficiently
|
||||||
|
high so they don't interfere with GLX core and GLX ARB extensions.)
|
||||||
|
|
||||||
|
0 GLXBadContext OpenGL ARB (GLX core)
|
||||||
|
1 GLXBadContextState OpenGL ARB (GLX core)
|
||||||
|
2 GLXBadDrawable OpenGL ARB (GLX core)
|
||||||
|
3 GLXBadPixmap OpenGL ARB (GLX core)
|
||||||
|
4 GLXBadContextTag OpenGL ARB (GLX core)
|
||||||
|
5 GLXBadCurrentWindow OpenGL ARB (GLX core)
|
||||||
|
6 GLXBadRenderRequest OpenGL ARB (GLX core)
|
||||||
|
7 GLXBadLargeRequest OpenGL ARB (GLX core)
|
||||||
|
8 GLXUnsupportedPrivateRequest OpenGL ARB (GLX core)
|
||||||
|
9 GLXBadFBConfig OpenGL ARB (GLX core)
|
||||||
|
10 GLXBadPbuffer OpenGL ARB (GLX core)
|
||||||
|
11 GLXBadCurrentDrawable OpenGL ARB (GLX core)
|
||||||
|
12 GLXBadWindow OpenGL ARB (GLX core)
|
||||||
|
13 GLXBadProfileARB OpenGL ARB (GLX_ARB_create_context)
|
||||||
|
|
||||||
|
|
||||||
|
GLX Event Masks
|
||||||
|
===============
|
||||||
|
0x08000000 GLX 1.3 / SGIX_pbuffer
|
||||||
|
0x04000000 Intel (INTEL_swap_event)
|
||||||
|
|
||||||
|
GLX Event Codes
|
||||||
|
===============
|
||||||
|
|
||||||
|
(The X.org/Mesa GLX implementation derived from the SGI Sample
|
||||||
|
Implementation has __GLX_NUMBER_EVENTS == 17, suggesting that vendor
|
||||||
|
events should be allocated downwards from the first free value <= 16
|
||||||
|
(14), and core GLX events allocated upwards).
|
||||||
|
|
||||||
|
0 OpenGL ARB (GLX_PbufferClobber in GLX 1.3)
|
||||||
|
15 Intel (GLX_BufferSwapINTEL)
|
||||||
|
16 SGI (GLX_PbufferClobberSGIX)
|
||||||
|
64 SGI
|
||||||
|
|
||||||
|
GLX protocol encoding for GL >= 2.0
|
||||||
|
===================================
|
||||||
|
|
||||||
|
(This section - this whole file really - should eventually be incorporated
|
||||||
|
in a proper update of the GLX protocol specification.)
|
||||||
|
|
||||||
|
OpenGL 2.0
|
||||||
|
----------
|
||||||
|
|
||||||
|
DeleteShader
|
||||||
|
|
||||||
|
1 CARD8 opcode (X assigned)
|
||||||
|
1 195 GLX opcode
|
||||||
|
2 3 request length
|
||||||
|
4 GLX_CONTEXT_TAG context tag
|
||||||
|
4 CARD32 shader
|
||||||
|
|
||||||
|
IsShader
|
||||||
|
|
||||||
|
1 CARD8 opcode (X assigned)
|
||||||
|
1 196 GLX opcode
|
||||||
|
2 3 request length
|
||||||
|
4 GLX_CONTEXT_TAG context tag
|
||||||
|
4 CARD32 shader
|
||||||
|
=>
|
||||||
|
1 1 reply
|
||||||
|
1 unused
|
||||||
|
2 CARD16 sequence number
|
||||||
|
4 0 reply length
|
||||||
|
4 BOOL32 return value
|
||||||
|
20 unused
|
||||||
|
|
||||||
|
IsProgram
|
||||||
|
|
||||||
|
1 CARD8 opcode (X assigned)
|
||||||
|
1 197 GLX opcode
|
||||||
|
2 3 request length
|
||||||
|
4 GLX_CONTEXT_TAG context tag
|
||||||
|
4 CARD32 program
|
||||||
|
=>
|
||||||
|
1 1 reply
|
||||||
|
1 unused
|
||||||
|
2 CARD16 sequence number
|
||||||
|
4 0 reply length
|
||||||
|
4 BOOL32 return value
|
||||||
|
20 unused
|
||||||
|
|
||||||
|
GetShaderiv
|
||||||
|
|
||||||
|
1 CARD8 opcode (X assigned)
|
||||||
|
1 198 GLX opcode
|
||||||
|
2 4 request length
|
||||||
|
4 GLX_CONTEXT_TAG context tag
|
||||||
|
4 CARD32 program
|
||||||
|
4 CARD32 pname
|
||||||
|
=>
|
||||||
|
1 1 reply
|
||||||
|
1 unused
|
||||||
|
2 CARD16 sequence number
|
||||||
|
4 m reply length, m = (n == 1 ? 0 : n)
|
||||||
|
4 unused
|
||||||
|
4 CARD32 n
|
||||||
|
|
||||||
|
if (n == 1) this follows:
|
||||||
|
|
||||||
|
4 CARD32 params
|
||||||
|
12 unused
|
||||||
|
|
||||||
|
otherwise this follows:
|
||||||
|
|
||||||
|
16 unused
|
||||||
|
n*4 LISTOFCARD32 params
|
||||||
|
|
||||||
|
Note that n may be 0, indicating that a GL error occurred.
|
||||||
|
|
||||||
|
GetProgramiv
|
||||||
|
|
||||||
|
1 CARD8 opcode (X assigned)
|
||||||
|
1 199 GLX opcode
|
||||||
|
2 4 request length
|
||||||
|
4 GLX_CONTEXT_TAG context tag
|
||||||
|
4 CARD32 program
|
||||||
|
4 CARD32 pname
|
||||||
|
=>
|
||||||
|
1 1 reply
|
||||||
|
1 unused
|
||||||
|
2 CARD16 sequence number
|
||||||
|
4 m reply length, m = (n == 1 ? 0 : n)
|
||||||
|
4 unused
|
||||||
|
4 CARD32 n
|
||||||
|
|
||||||
|
if (n == 1) this follows:
|
||||||
|
|
||||||
|
4 CARD32 params
|
||||||
|
12 unused
|
||||||
|
|
||||||
|
otherwise this follows:
|
||||||
|
|
||||||
|
16 unused
|
||||||
|
n*4 LISTofCARD32 params
|
||||||
|
|
||||||
|
Note that n may be 0, indicating that a GL error occurred.
|
||||||
|
|
||||||
|
GetShaderInfoLog
|
||||||
|
|
||||||
|
1 CARD8 opcode (X assigned)
|
||||||
|
1 200 GLX opcode
|
||||||
|
2 4 request length
|
||||||
|
4 GLX_CONTEXT_TAG context tag
|
||||||
|
4 CARD32 shader
|
||||||
|
4 CARD32 bufSize
|
||||||
|
=>
|
||||||
|
1 1 reply
|
||||||
|
1 unused
|
||||||
|
2 CARD16 sequence number
|
||||||
|
4 m reply length, m = (n + p) / 4
|
||||||
|
4 unused
|
||||||
|
4 CARD32 n, n = length + 1
|
||||||
|
16 unused
|
||||||
|
n LISTofBYTE infoLog
|
||||||
|
p unused, p=pad(n)
|
||||||
|
|
||||||
|
Note that n may be 0, indicating that a GL error occurred.
|
||||||
|
|
||||||
|
GetProgramInfoLog
|
||||||
|
|
||||||
|
1 CARD8 opcode (X assigned)
|
||||||
|
1 201 GLX opcode
|
||||||
|
2 4 request length
|
||||||
|
4 GLX_CONTEXT_TAG context tag
|
||||||
|
4 CARD32 program
|
||||||
|
4 CARD32 bufSize
|
||||||
|
=>
|
||||||
|
1 1 reply
|
||||||
|
1 unused
|
||||||
|
2 CARD16 sequence number
|
||||||
|
4 m reply length, m = (n + p) / 4
|
||||||
|
4 unused
|
||||||
|
4 CARD32 n, n = length + 1
|
||||||
|
16 unused
|
||||||
|
n LISTofBYTE infoLog
|
||||||
|
p unused, p=pad(n)
|
||||||
|
|
||||||
|
Note that n may be 0, indicating that a GL error occurred.
|
||||||
|
|
||||||
|
DeleteProgram
|
||||||
|
|
||||||
|
1 CARD8 opcode (X assigned)
|
||||||
|
1 202 GLX opcode
|
||||||
|
2 3 request length
|
||||||
|
4 GLX_CONTEXT_TAG context tag
|
||||||
|
4 CARD32 program
|
||||||
|
|
||||||
|
OpenGL 2.1
|
||||||
|
----------
|
||||||
|
|
||||||
|
UniformMatrix2x3fv
|
||||||
|
|
||||||
|
2 16+4*count*2*3 rendering command length
|
||||||
|
2 305 rendering command opcode
|
||||||
|
4 CARD32 location
|
||||||
|
4 CARD32 count
|
||||||
|
1 BOOL transpose
|
||||||
|
3 unused
|
||||||
|
4*count*2*3 LISTofFLOAT32 value
|
||||||
|
|
||||||
|
If the command is encoded in a glXRenderLarge request, the
|
||||||
|
command opcode and command length fields above are expanded to
|
||||||
|
4 bytes each:
|
||||||
|
|
||||||
|
4 20+4*count*2*2 rendering command length
|
||||||
|
4 305 rendering command opcode
|
||||||
|
|
||||||
|
UniformMatrix3x2fv
|
||||||
|
|
||||||
|
2 16+4*count*3*2 rendering command length
|
||||||
|
2 306 rendering command opcode
|
||||||
|
4 CARD32 location
|
||||||
|
4 CARD32 count
|
||||||
|
1 BOOL transpose
|
||||||
|
3 unused
|
||||||
|
4*count*3*2 LISTofFLOAT32 value
|
||||||
|
|
||||||
|
If the command is encoded in a glXRenderLarge request, the
|
||||||
|
command opcode and command length fields above are expanded to
|
||||||
|
4 bytes each:
|
||||||
|
|
||||||
|
4 20+4*count*3*2 rendering command length
|
||||||
|
4 306 rendering command opcode
|
||||||
|
|
||||||
|
UniformMatrix2x4fv
|
||||||
|
|
||||||
|
2 16+4*count*2*4 rendering command length
|
||||||
|
2 307 rendering command opcode
|
||||||
|
4 CARD32 location
|
||||||
|
4 CARD32 count
|
||||||
|
1 BOOL transpose
|
||||||
|
3 unused
|
||||||
|
4*count*2*4 LISTofFLOAT32 value
|
||||||
|
|
||||||
|
If the command is encoded in a glXRenderLarge request, the
|
||||||
|
command opcode and command length fields above are expanded to
|
||||||
|
4 bytes each:
|
||||||
|
|
||||||
|
4 20+4*count*2*4 rendering command length
|
||||||
|
4 307 rendering command opcode
|
||||||
|
|
||||||
|
UniformMatrix4x2fv
|
||||||
|
|
||||||
|
2 16+4*count*4*2 rendering command length
|
||||||
|
2 308 rendering command opcode
|
||||||
|
4 CARD32 location
|
||||||
|
4 CARD32 count
|
||||||
|
1 BOOL transpose
|
||||||
|
3 unused
|
||||||
|
4*count*4*2 LISTofFLOAT32 value
|
||||||
|
|
||||||
|
If the command is encoded in a glXRenderLarge request, the
|
||||||
|
command opcode and command length fields above are expanded to
|
||||||
|
4 bytes each:
|
||||||
|
|
||||||
|
4 20+4*count*4*2 rendering command length
|
||||||
|
4 308 rendering command opcode
|
||||||
|
|
||||||
|
UniformMatrix3x4fv
|
||||||
|
|
||||||
|
2 16+4*count*3*4 rendering command length
|
||||||
|
2 309 rendering command opcode
|
||||||
|
4 CARD32 location
|
||||||
|
4 CARD32 count
|
||||||
|
1 BOOL transpose
|
||||||
|
3 unused
|
||||||
|
4*count*3*4 LISTofFLOAT32 value
|
||||||
|
|
||||||
|
If the command is encoded in a glXRenderLarge request, the
|
||||||
|
command opcode and command length fields above are expanded to
|
||||||
|
4 bytes each:
|
||||||
|
|
||||||
|
4 20+4*count*3*4 rendering command length
|
||||||
|
4 309 rendering command opcode
|
||||||
|
|
||||||
|
UniformMatrix4x3fv
|
||||||
|
|
||||||
|
2 16+4*count*4*3 rendering command length
|
||||||
|
2 310 rendering command opcode
|
||||||
|
4 CARD32 location
|
||||||
|
4 CARD32 count
|
||||||
|
1 BOOL transpose
|
||||||
|
3 unused
|
||||||
|
4*count*4*3 LISTofFLOAT32 value
|
||||||
|
|
||||||
|
If the command is encoded in a glXRenderLarge request, the
|
||||||
|
command opcode and command length fields above are expanded to
|
||||||
|
4 bytes each:
|
||||||
|
|
||||||
|
4 20+4*count*4*3 rendering command length
|
||||||
|
4 310 rendering command opcode
|
||||||
|
|
||||||
|
OpenGL 3.0
|
||||||
|
----------
|
||||||
|
|
||||||
|
The following rendering commands are sent to the sever as part of a
|
||||||
|
glXRender request:
|
||||||
|
|
||||||
|
BindBufferRange
|
||||||
|
|
||||||
|
2 32 rendering command length
|
||||||
|
2 355 rendering command opcode
|
||||||
|
8 INT64 offset
|
||||||
|
8 INT64 size
|
||||||
|
4 ENUM target
|
||||||
|
4 CARD32 index
|
||||||
|
4 CARD32 buffer
|
||||||
|
|
||||||
|
BindBufferBase
|
||||||
|
|
||||||
|
2 16 rendering command length
|
||||||
|
2 356 rendering command opcode
|
||||||
|
4 ENUM target
|
||||||
|
4 CARD32 index
|
||||||
|
4 CARD32 buffer
|
||||||
|
|
||||||
|
BeginTransformFeedback
|
||||||
|
|
||||||
|
2 8 rendering command length
|
||||||
|
2 357 rendering command opcode
|
||||||
|
4 ENUM primitiveMode
|
||||||
|
|
||||||
|
EndTransformFeedback
|
||||||
|
|
||||||
|
2 4 rendering command length
|
||||||
|
2 358 rendering command opcode
|
||||||
|
|
||||||
|
ClearBufferfi
|
||||||
|
|
||||||
|
2 20 rendering command length
|
||||||
|
2 360 rendering command opcode
|
||||||
|
4 ENUM buffer
|
||||||
|
4 CARD32 drawbuffer
|
||||||
|
4 FLOAT32 depth
|
||||||
|
4 CARD32 stencil
|
||||||
|
|
||||||
|
ClearBufferfv
|
||||||
|
|
||||||
|
2 12+(4*n) rendering command length
|
||||||
|
2 361 rendering command opcode
|
||||||
|
4 ENUM buffer
|
||||||
|
0x1800 n=4 GL_COLOR
|
||||||
|
0x1801 n=1 GL_STENCIL
|
||||||
|
0x1802 n=1 GL_DEPTH
|
||||||
|
else n=0
|
||||||
|
4 CARD32 drawbuffer
|
||||||
|
4*n LISTofFLOAT32 value
|
||||||
|
|
||||||
|
ClearBufferiv
|
||||||
|
|
||||||
|
2 12+(4*n) rendering command length
|
||||||
|
2 362 rendering command opcode
|
||||||
|
4 ENUM buffer
|
||||||
|
0x1800 n=4 GL_COLOR
|
||||||
|
0x1801 n=1 GL_STENCIL
|
||||||
|
0x1802 n=1 GL_DEPTH
|
||||||
|
else n=0
|
||||||
|
4 CARD32 drawbuffer
|
||||||
|
4*n LISTofINT32 value
|
||||||
|
|
||||||
|
ClearBufferuiv
|
||||||
|
|
||||||
|
2 12+(4*n) rendering command length
|
||||||
|
2 363 rendering command opcode
|
||||||
|
4 ENUM buffer
|
||||||
|
0x1800 n=4 GL_COLOR
|
||||||
|
0x1801 n=1 GL_STENCIL
|
||||||
|
0x1802 n=1 GL_DEPTH
|
||||||
|
else n=0
|
||||||
|
4 CARD32 drawbuffer
|
||||||
|
4*n LISTofCARD32 value
|
||||||
|
|
||||||
|
The following rendering commands can be sent in a glXRender
|
||||||
|
or glXRenderLarge request.
|
||||||
|
|
||||||
|
TransformFeedbackVaryings
|
||||||
|
|
||||||
|
2 16+(n*4)+s+p rendering command length
|
||||||
|
2 359 rendering command opcode
|
||||||
|
4 CARD32 program
|
||||||
|
4 INT32 count
|
||||||
|
4 ENUM buffermode
|
||||||
|
n*4 LISTofINT32 lengths[n], n = count
|
||||||
|
s LISTofCHAR varyings, s = sum of all entries in the lengths
|
||||||
|
array
|
||||||
|
p unused, p = pad(s)
|
||||||
|
|
||||||
|
If the command is encoded in a glXRenderLarge request, the command
|
||||||
|
opcode and command length fields are expanded to 4 bytes each.
|
||||||
|
|
||||||
|
4 20+(n*4)+s+p rendering command length
|
||||||
|
4 359 rendering command opcode
|
||||||
|
|
||||||
|
lengths[i] is calculated as strlen(varyings[i]) + 1. The NUL terminator
|
||||||
|
is included when sending the varyings.
|
||||||
|
|
||||||
|
The following single commands are sent to the server as part of a
|
||||||
|
glXSingle request:
|
||||||
|
|
||||||
|
GetTransformFeedbackVarying
|
||||||
|
|
||||||
|
1 CARD8 opcode(X assigned)
|
||||||
|
1 213 GLX opcode
|
||||||
|
2 5 request length
|
||||||
|
4 GLX_CONTEXT_TAG context tag
|
||||||
|
4 CARD32 program
|
||||||
|
4 CARD32 index
|
||||||
|
4 CARD32 bufsize
|
||||||
|
=>
|
||||||
|
1 1 reply
|
||||||
|
1 unused
|
||||||
|
2 CARD16 sequence number
|
||||||
|
4 m reply length, m = (n == 0 ? 0 : (n + p) / 4)
|
||||||
|
4 unused
|
||||||
|
4 n-1 length
|
||||||
|
4 INT32 size
|
||||||
|
4 INT32 type
|
||||||
|
8 unused
|
||||||
|
n LISTofCHAR name, n = strlen(name)+1
|
||||||
|
p unused, p = pad(m)
|
||||||
|
|
||||||
|
GetStringi
|
||||||
|
|
||||||
|
1 CARD8 opcode (X assigned)
|
||||||
|
1 214 GLX opcode
|
||||||
|
2 4 request length
|
||||||
|
4 GLX_CONTEXT_TAG context tag
|
||||||
|
4 ENUM name
|
||||||
|
4 CARD32 index
|
||||||
|
=>
|
||||||
|
1 1 reply
|
||||||
|
1 1 unused
|
||||||
|
2 CARD16 sequence number
|
||||||
|
4 m reply length, m = (n + p) / 4
|
||||||
|
4 unused
|
||||||
|
4 CARD32 n
|
||||||
|
16 unused
|
||||||
|
n STRING8 string
|
||||||
|
p unused, p=pad(n)
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,289 @@
|
|||||||
|
# Copyright 2013-2020 The Khronos Group Inc.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# Relax NG schema for Khronos Registry XML
|
||||||
|
# See https://github.com/KhronosGroup/OpenGL-Registry
|
||||||
|
#
|
||||||
|
# Last modified 2013/06/14
|
||||||
|
# This definition is subject to change (mostly in the form of additions)
|
||||||
|
|
||||||
|
namespace xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
|
||||||
|
|
||||||
|
# Toplevel is a <registry> tag.
|
||||||
|
# May be led by an optional <comment> tag containing e.g. copyrights.
|
||||||
|
start = element registry {
|
||||||
|
(
|
||||||
|
element comment { text } ? |
|
||||||
|
Types * |
|
||||||
|
Kinds * |
|
||||||
|
Groups * |
|
||||||
|
Enums * |
|
||||||
|
Commands * |
|
||||||
|
Feature * |
|
||||||
|
Extensions *
|
||||||
|
) *
|
||||||
|
}
|
||||||
|
|
||||||
|
# <types> defines a group of types
|
||||||
|
Types = element types {
|
||||||
|
Type *
|
||||||
|
}
|
||||||
|
|
||||||
|
# <type> defines a single type. It is usually a C typedef but
|
||||||
|
# may contain arbitrary C code.
|
||||||
|
# name - name of this type, if not present in the <name> tag
|
||||||
|
# api - matches a <feature> api attribute, if present
|
||||||
|
# requires - name of another type definition required by this one
|
||||||
|
# type - "group", if present, indicating a group of values in the
|
||||||
|
# corresponding <enums> definition.
|
||||||
|
# comment - unused
|
||||||
|
# <apientry /> - substitutes for an APIENTRY-style macro on output
|
||||||
|
# <name> - contains typename
|
||||||
|
Type = element type {
|
||||||
|
attribute api { text } ? ,
|
||||||
|
attribute requires { text } ? ,
|
||||||
|
attribute name { TypeName } ? ,
|
||||||
|
attribute type { text } ? ,
|
||||||
|
Comment ? ,
|
||||||
|
text ,
|
||||||
|
element apientry { text } ? ,
|
||||||
|
text ,
|
||||||
|
element name { TypeName } ? ,
|
||||||
|
text
|
||||||
|
}
|
||||||
|
|
||||||
|
# <kinds> defines descriptions for kinds.
|
||||||
|
Kinds = element kinds {
|
||||||
|
Kind *
|
||||||
|
}
|
||||||
|
|
||||||
|
# <kind> defines a description for a single kind.
|
||||||
|
Kind = element kind {
|
||||||
|
Name ,
|
||||||
|
attribute desc { text }
|
||||||
|
}
|
||||||
|
|
||||||
|
# <groups> defines a group of enum groups
|
||||||
|
Groups = element groups {
|
||||||
|
Group *
|
||||||
|
}
|
||||||
|
|
||||||
|
# <group> defines a single enum group. Enums may
|
||||||
|
# be in multiple groups.
|
||||||
|
# name - group name
|
||||||
|
# comment - unused
|
||||||
|
# <enum name=""> - members of the group
|
||||||
|
|
||||||
|
Group = element group {
|
||||||
|
Name ,
|
||||||
|
Comment ? ,
|
||||||
|
element enum { Name } *
|
||||||
|
}
|
||||||
|
|
||||||
|
# <enums> defines a group of enumerants
|
||||||
|
# namespace - identifies a numeric namespace
|
||||||
|
# group - identifies a functional subset of the namespace - same as group=""
|
||||||
|
# start, end - beginning and end of a numeric range in the namespace
|
||||||
|
# vendor - owner of the numeric range
|
||||||
|
# type - "bitmask", if present
|
||||||
|
# comment - unused
|
||||||
|
Enums = element enums {
|
||||||
|
attribute namespace { text } ? ,
|
||||||
|
attribute group { text } ? ,
|
||||||
|
attribute type { text } ? ,
|
||||||
|
attribute start { Integer } ? ,
|
||||||
|
attribute end { Integer } ? ,
|
||||||
|
Vendor ? ,
|
||||||
|
Comment ? ,
|
||||||
|
(Enum | Unused) *
|
||||||
|
}
|
||||||
|
# <enum> defines a single enumerant
|
||||||
|
# value - integer (including hex) value of the enumerant
|
||||||
|
# api - matches a <feature> api attribute, if present
|
||||||
|
# type - "u" (unsigned), "ull" (uint64), or integer if not present
|
||||||
|
# name - enumerant name
|
||||||
|
# group - identifies a functional subset of the namespace
|
||||||
|
# alias - another enumerant this is semantically identical to
|
||||||
|
# comment - unused
|
||||||
|
Enum = element enum {
|
||||||
|
(
|
||||||
|
attribute value { Integer } &
|
||||||
|
attribute api { text } ? &
|
||||||
|
attribute type { TypeSuffix } ? &
|
||||||
|
attribute name { text } &
|
||||||
|
attribute group { text } ? &
|
||||||
|
attribute alias { text } ? &
|
||||||
|
Comment ?
|
||||||
|
)
|
||||||
|
}
|
||||||
|
# <unused> defines a range of enumerants not currently being used
|
||||||
|
# start, end - beginning and end of an unused numeric range
|
||||||
|
# vendor - unused
|
||||||
|
# comment - unused
|
||||||
|
Unused = element unused {
|
||||||
|
attribute start { Integer } ,
|
||||||
|
attribute end { Integer } ? ,
|
||||||
|
Vendor ? ,
|
||||||
|
Comment ?
|
||||||
|
}
|
||||||
|
# <commands> defines a group of commands
|
||||||
|
# namespace - identifies a function namespace
|
||||||
|
Commands = element commands {
|
||||||
|
attribute namespace { text } ? ,
|
||||||
|
Command *
|
||||||
|
}
|
||||||
|
# <command> defines a single command
|
||||||
|
# <proto> is the C function prototype, including the return type
|
||||||
|
# <param> are function parameters, in order
|
||||||
|
# class - type of object name (object handle). Handles with different types are not compatible. So handle created as [class=buffer] can not be passed to [class=shader]
|
||||||
|
# <ptype> is a <type> name, if present
|
||||||
|
# <name> is the function / parameter name
|
||||||
|
# The textual contents of <proto> and <param> should be legal C
|
||||||
|
# for those parts of a function declaration.
|
||||||
|
# <alias> - denotes function aliasing
|
||||||
|
# name - name of aliased function
|
||||||
|
# <vecequiv> - denotes scalar / vector function equivalence
|
||||||
|
# name - name of corresponding vector form, e.g. (glColor3f -> glColor3fv)
|
||||||
|
# <glx> - information about GLX protocol
|
||||||
|
# type - "render", "single", or "vendor" for GLXRender, GLXSingle, GLXVendorPrivate{WithReply}
|
||||||
|
# opcode - numeric opcode of specified type for this function
|
||||||
|
# name - if present, protocol name (defaults to command name)
|
||||||
|
# comment - unused
|
||||||
|
Command = element command {
|
||||||
|
Comment ? ,
|
||||||
|
element proto {
|
||||||
|
attribute group { text } ? ,
|
||||||
|
attribute kind { text } ? ,
|
||||||
|
attribute class { text } ? ,
|
||||||
|
text ,
|
||||||
|
element ptype { TypeName } ? ,
|
||||||
|
text ,
|
||||||
|
element name { text } ,
|
||||||
|
text
|
||||||
|
} ,
|
||||||
|
element param {
|
||||||
|
attribute group { text } ? ,
|
||||||
|
attribute kind { text } ? ,
|
||||||
|
attribute class { text } ? ,
|
||||||
|
attribute len { text } ? ,
|
||||||
|
text ,
|
||||||
|
element ptype { TypeName } ? ,
|
||||||
|
text ,
|
||||||
|
element name { text } ,
|
||||||
|
text
|
||||||
|
} * ,
|
||||||
|
(
|
||||||
|
element alias {
|
||||||
|
Name
|
||||||
|
} ? &
|
||||||
|
element vecequiv {
|
||||||
|
Name
|
||||||
|
} ? &
|
||||||
|
element glx {
|
||||||
|
attribute type { text } ,
|
||||||
|
attribute opcode { xsd:integer } ,
|
||||||
|
Name ? ,
|
||||||
|
Comment ?
|
||||||
|
} *
|
||||||
|
)
|
||||||
|
}
|
||||||
|
# Each <feature> defines the interface of an API version (e.g. OpenGL 1.2)
|
||||||
|
# api - API tag (e.g. 'gl', 'gles2', etc. - used internally, not
|
||||||
|
# neccessarily an actual API name
|
||||||
|
# name - version name (C preprocessor name, e.g. GL_VERSION_4_2)
|
||||||
|
# number - version number, e.g. 4.2
|
||||||
|
# protect - additional #ifdef symbol to place around the feature
|
||||||
|
# <require> / <remove> contains features to require or remove in
|
||||||
|
# this version
|
||||||
|
# profile - only require/remove when generated profile matches
|
||||||
|
# comment - unused
|
||||||
|
Feature = element feature {
|
||||||
|
attribute api { text } ,
|
||||||
|
Name ,
|
||||||
|
attribute number { xsd:float } ,
|
||||||
|
attribute protect { text } ?,
|
||||||
|
Comment ? ,
|
||||||
|
(
|
||||||
|
element require {
|
||||||
|
ProfileName ? ,
|
||||||
|
Comment ? ,
|
||||||
|
InterfaceElement *
|
||||||
|
} |
|
||||||
|
element remove {
|
||||||
|
ProfileName ? ,
|
||||||
|
Comment ? ,
|
||||||
|
InterfaceElement *
|
||||||
|
}
|
||||||
|
) *
|
||||||
|
}
|
||||||
|
Extensions = element extensions {
|
||||||
|
Extension *
|
||||||
|
}
|
||||||
|
# Defines the interface of an API <extension>. Like a <feature>
|
||||||
|
# tag, but with a slightly different api attribute.
|
||||||
|
# api - regexp pattern matching one or more API tags, indicating
|
||||||
|
# which APIs the extension is known to work with. The only
|
||||||
|
# syntax supported is <name>{|<name>}* and each name must
|
||||||
|
# exactly match an API being generated (implicit ^$ surrounding).
|
||||||
|
# In addition, <require> / <remove> tags also support an
|
||||||
|
# api attribute:
|
||||||
|
# api - only require/remove these features for the matching API.
|
||||||
|
# Not a regular expression.
|
||||||
|
Extension = element extension {
|
||||||
|
Name ,
|
||||||
|
attribute protect { text } ?,
|
||||||
|
attribute supported { StringGroup } ? ,
|
||||||
|
Comment ? ,
|
||||||
|
(
|
||||||
|
element require {
|
||||||
|
attribute api { text } ? ,
|
||||||
|
ProfileName ? ,
|
||||||
|
Comment ? ,
|
||||||
|
InterfaceElement *
|
||||||
|
} |
|
||||||
|
element remove {
|
||||||
|
attribute api { text } ? ,
|
||||||
|
ProfileName ? ,
|
||||||
|
Comment ? ,
|
||||||
|
InterfaceElement *
|
||||||
|
}
|
||||||
|
) *
|
||||||
|
}
|
||||||
|
# Contents of a <require> / <remove> tag, defining a group
|
||||||
|
# of features to require or remove.
|
||||||
|
# <type> / <enum> / <command> all have attributes
|
||||||
|
# name - feature name which must match
|
||||||
|
InterfaceElement =
|
||||||
|
element type {
|
||||||
|
Name ,
|
||||||
|
Comment ?
|
||||||
|
} |
|
||||||
|
element enum {
|
||||||
|
Name ,
|
||||||
|
Comment ?
|
||||||
|
} |
|
||||||
|
element command {
|
||||||
|
Name ,
|
||||||
|
Comment ?
|
||||||
|
}
|
||||||
|
|
||||||
|
# Integers are allowed to be either decimal or C-hex (0x[0-9A-F]+), but
|
||||||
|
# XML Schema types don't seem to support hex notation, so we use this
|
||||||
|
# as a placeholder.
|
||||||
|
Integer = text
|
||||||
|
|
||||||
|
# TypeName is an argument/return value C type name
|
||||||
|
TypeName = text
|
||||||
|
|
||||||
|
# TypeSuffix is a C numeric type suffix, e.g. 'u' or 'ull'
|
||||||
|
TypeSuffix = text
|
||||||
|
|
||||||
|
# StringGroup is a regular expression with an implicit
|
||||||
|
# '^(' and ')$' bracketing it.
|
||||||
|
StringGroup = text
|
||||||
|
|
||||||
|
# Repeatedly used attributes
|
||||||
|
ProfileName = attribute profile { text }
|
||||||
|
Vendor = attribute vendor { text }
|
||||||
|
Comment = attribute comment { text }
|
||||||
|
Name = attribute name { text }
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
/*% cc -I. -I../api -I../../../../../registry/trunk/egl/api/ -c % ; rm testesext.o
|
||||||
|
*
|
||||||
|
* Test to make sure gl3.h builds properly.
|
||||||
|
* Will also use SVN internal versions of gl3platform.h
|
||||||
|
* and khrplatform.h (if needed) (via GLES and KHR symlinks into
|
||||||
|
* appropriate parts of the tree).
|
||||||
|
*/
|
||||||
|
#define GL_GLEXT_PROTOTYPES
|
||||||
|
#include "GLES3/gl31.h"
|
||||||
|
#include "GLES2/gl2ext.h"
|
||||||
|
|
||||||
|
#if GL_NV_non_square_matrices != 1
|
||||||
|
#error "No extension GL_NV_non_square_matrices!"
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/*% /lib/cpp -I../api testglext.c > testglext.i ; cc -c % ; rm testglext.[oi]
|
||||||
|
*/
|
||||||
|
#define GL_GLEXT_LEGACY
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#define GL_GLEXT_PROTOTYPES
|
||||||
|
#include "GL/glext.h"
|
||||||
|
|
||||||
|
#define GLX_GLXEXT_LEGACY
|
||||||
|
#include <GL/glx.h>
|
||||||
|
|
||||||
|
/* Necessary to avoid token redefinition warnings */
|
||||||
|
#undef GLX_SAMPLE_BUFFERS
|
||||||
|
#undef GLX_SAMPLES
|
||||||
|
#undef GLX_FRONT_EXT
|
||||||
|
#undef GLX_BACK_EXT
|
||||||
|
|
||||||
|
#define GLX_GLXEXT_PROTOTYPES
|
||||||
|
#include "GL/glxext.h"
|
||||||
|
|
||||||
|
int VERSION_4_3 = GL_VERSION_4_3;
|
||||||
|
/* These should be the same */
|
||||||
|
int mcsor = GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES;
|
||||||
|
int mciufo = GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS;
|
||||||
|
|
||||||
|
/* See if latest extension is included */
|
||||||
|
int latest_ext = GL_NV_blend_equation_advanced;
|
||||||
|
GLenum latest_enum = GL_CONJOINT_NV;
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
Miscellaneous data about extensions:
|
||||||
|
|
||||||
|
- GLU enumerant reserved values
|
||||||
|
- Information about extension vendors (probably out of date and incomplete)
|
||||||
|
|
||||||
|
GLU Enumerants
|
||||||
|
==============
|
||||||
|
|
||||||
|
Value Range Definition Contact
|
||||||
|
Control (if different)
|
||||||
|
|
||||||
|
100208 SGI
|
||||||
|
|
||||||
|
|
||||||
|
Definition Contact Email
|
||||||
|
Control
|
||||||
|
========== ======= =====
|
||||||
|
OpenGL ARB Jon Leech jon 'at' alumni.caltech.edu
|
||||||
|
Khronos Jon Leech jon 'at' alumni.caltech.edu (OpenML, OpenGL ES)
|
||||||
|
Apple Bob Beretta beretta 'at' apple.com
|
||||||
|
ARM Tom Olson tom.olson 'at' arm.com
|
||||||
|
AMD and ATI Graham Sellers graham.sellers 'at' amd.com
|
||||||
|
ATI/NVIDIA Graham Sellers graham.sellers 'at' amd.com
|
||||||
|
Broadcom Gary Sweet gsweet 'at' broadcom.com
|
||||||
|
HP Andrew Wiltzius andrew.wiltzius 'at' hp.com
|
||||||
|
Imagination Graham Connor gconnor 'at' videologic.com
|
||||||
|
Intel Ian Romanick ian.d.romanick 'at' intel.com
|
||||||
|
Mesa Brian Paul brianp 'at' mesa3d.org
|
||||||
|
Microsoft Dave Aronson daronson 'at' microsoft.com
|
||||||
|
NEC Seiji Uchida uchida 'at' hpc.bs1.fc.nec.co.jp
|
||||||
|
NVIDIA James Jones jajones 'at' nvidia.com
|
||||||
|
S3 Yanjun Zhang YanjunZhang 'at' s3graphics.com
|
||||||
|
Vivante Frido Garritsen TBD
|
||||||
|
Samsung Jeff Vigil j.vigil 'at' samsung.com
|
||||||
|
Qualcomm Ashish Mathur asmathur@qti.qualcomm.com
|
||||||
|
|
||||||
|
Out of business / acquired / unknown:
|
||||||
|
|
||||||
|
3Dfx - Acquired by NVIDIA
|
||||||
|
3Dlabs - Acquired by Creative, refocused on mobile, renamed ZiiLabs
|
||||||
|
ADD - Out of business
|
||||||
|
ATI - Acquired by AMD
|
||||||
|
Compaq - Acquired by HP
|
||||||
|
DEC - Acquired by Compaq, then HP
|
||||||
|
E&S - No longer in the graphics business (sells planetarium displays)
|
||||||
|
HP - No longer in the graphics business (other than as a system integrator)
|
||||||
|
IBM - No longer in the graphics business (other than as a system integrator)
|
||||||
|
Intense3D - Acquired by 3Dlabs
|
||||||
|
Intergraph - Acquired by 3Dlabs. Spinoff of Intense3D.
|
||||||
|
Micron - No longer in the graphics business
|
||||||
|
KPC (Kubota) - Out of business
|
||||||
|
PGI (Pacific Graphics Inc.) - Acquired by Template Graphics Systems
|
||||||
|
Pixelfusion - No longer in the graphics business
|
||||||
|
Rendition - Acquired by Micron
|
||||||
|
SGI (Silicon Graphics Inc.) - Acquired by Silicon Graphics International, then HP
|
||||||
|
SUN - Acquired by Oracle. No longer in the graphics business.
|
||||||
|
XGI - Acquired by Silicon Integrated Systems. No longer in the graphics business.
|
||||||
|
ZiiLabs - Still has a website but appears to be inactive as of 2017-01-12.
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,106 @@
|
|||||||
|
<type>struct <name>_POINTFLOAT</name> {
|
||||||
|
FLOAT x;
|
||||||
|
FLOAT y;
|
||||||
|
};</type>
|
||||||
|
<type>typedef struct _POINTFLOAT <name>POINTFLOAT</name>;</type>
|
||||||
|
<type>typedef struct _POINTFLOAT *<name>PPOINTFLOAT</name>;</type>
|
||||||
|
<type requires="POINTFLOAT">struct <name>_GLYPHMETRICSFLOAT</name> {
|
||||||
|
FLOAT gmfBlackBoxX;
|
||||||
|
FLOAT gmfBlackBoxY;
|
||||||
|
POINTFLOAT gmfptGlyphOrigin;
|
||||||
|
FLOAT gmfCellIncX;
|
||||||
|
FLOAT gmfCellIncY;
|
||||||
|
};</type>
|
||||||
|
<type requires="_GLYPHMETRICSFLOAT">typedef struct _GLYPHMETRICSFLOAT <name>GLYPHMETRICSFLOAT</name>;</type>
|
||||||
|
<type requires="_GLYPHMETRICSFLOAT">typedef struct _GLYPHMETRICSFLOAT *<name>PGLYPHMETRICSFLOAT</name>;</type>
|
||||||
|
|
||||||
|
typedef struct tagPIXELFORMATDESCRIPTOR {
|
||||||
|
WORD nSize;
|
||||||
|
WORD nVersion;
|
||||||
|
DWORD dwFlags;
|
||||||
|
BYTE iPixelType;
|
||||||
|
BYTE cColorBits;
|
||||||
|
BYTE cRedBits;
|
||||||
|
BYTE cRedShift;
|
||||||
|
BYTE cGreenBits;
|
||||||
|
BYTE cGreenShift;
|
||||||
|
BYTE cBlueBits;
|
||||||
|
BYTE cBlueShift;
|
||||||
|
BYTE cAlphaBits;
|
||||||
|
BYTE cAlphaShift;
|
||||||
|
BYTE cAccumBits;
|
||||||
|
BYTE cAccumRedBits;
|
||||||
|
BYTE cAccumGreenBits;
|
||||||
|
BYTE cAccumBlueBits;
|
||||||
|
BYTE cAccumAlphaBits;
|
||||||
|
BYTE cDepthBits;
|
||||||
|
BYTE cStencilBits;
|
||||||
|
BYTE cAuxBuffers;
|
||||||
|
BYTE iLayerType;
|
||||||
|
BYTE bReserved;
|
||||||
|
DWORD dwLayerMask;
|
||||||
|
DWORD dwVisibleMask;
|
||||||
|
DWORD dwDamageMask;
|
||||||
|
} PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR;
|
||||||
|
|
||||||
|
PFD_DRAW_TO_WINDOW The buffer can draw to a window or device surface.
|
||||||
|
PFD_DRAW_TO_BITMAP The buffer can draw to a memory bitmap.
|
||||||
|
PFD_SUPPORT_GDI The buffer supports GDI drawing. This flag and PFD_DOUBLEBUFFER are mutually exclusive in the current generic implementation.
|
||||||
|
PFD_SUPPORT_OPENGL The buffer supports OpenGL drawing.
|
||||||
|
PFD_GENERIC_ACCELERATED The pixel format is supported by a device driver that accelerates the generic implementation. If this flag is clear and the PFD_GENERIC_FORMAT flag is set, the pixel format is supported by the generic implementation only.
|
||||||
|
PFD_GENERIC_FORMAT The pixel format is supported by the GDI software implementation, which is also known as the generic implementation. If this bit is clear, the pixel format is supported by a device driver or hardware.
|
||||||
|
PFD_NEED_PALETTE The buffer uses RGBA pixels on a palette-managed device. A logical palette is required to achieve the best results for this pixel type. Colors in the palette should be specified according to the values of the cRedBits, cRedShift, cGreenBits, cGreenShift, cBluebits, and cBlueShift members. The palette should be created and realized in the device context before calling wglMakeCurrent.
|
||||||
|
PFD_NEED_SYSTEM_PALETTE Defined in the pixel format descriptors of hardware that supports one hardware palette in 256-color mode only. For such systems to use hardware acceleration, the hardware palette must be in a fixed order (for example, 3-3-2) when in RGBA mode or must match the logical palette when in color-index mode.
|
||||||
|
PFD_DOUBLEBUFFER The buffer is double-buffered. This flag and PFD_SUPPORT_GDI are mutually exclusive in the current generic implementation.
|
||||||
|
PFD_STEREO The buffer is stereoscopic. This flag is not supported in the current generic implementation.
|
||||||
|
PFD_SWAP_LAYER_BUFFERS Indicates whether a device can swap individual layer planes with pixel formats that include double-buffered overlay or underlay planes. Otherwise all layer planes are swapped together as a group. When this flag is set, wglSwapLayerBuffers is supported.
|
||||||
|
PFD_DEPTH_DONTCARE The requested pixel format can either have or not have a depth buffer. To select a pixel format without a depth buffer, you must specify this flag. The requested pixel format can be with or without a depth buffer. Otherwise, only pixel formats with a depth buffer are considered.
|
||||||
|
PFD_DOUBLEBUFFER_DONTCARE The requested pixel format can be either single- or double-buffered.
|
||||||
|
PFD_STEREO_DONTCARE The requested pixel format can be either monoscopic or stereoscopic.
|
||||||
|
PFD_SWAP_COPY Specifies the content of the back buffer in the double-buffered main color plane following a buffer swap. Swapping the color buffers causes the content of the back buffer to be copied to the front buffer. The content of the back buffer is not affected by the swap. PFD_SWAP_COPY is a hint only and might not be provided by a driver.
|
||||||
|
PFD_SWAP_EXCHANGE Specifies the content of the back buffer in the double-buffered main color plane following a buffer swap. Swapping the color buffers causes the exchange of the back buffer's content with the front buffer's content. Following the swap, the back buffer's content contains the front buffer's content before the swap. PFD_SWAP_EXCHANGE is a hint only and might not be provided by a driver.
|
||||||
|
PFD_TYPE_RGBA RGBA pixels. Each pixel has four components in this order: red, green, blue, and alpha.
|
||||||
|
PFD_TYPE_COLORINDEX Color-index pixels. Each pixel uses a color-index value.
|
||||||
|
typedef struct tag_LAYERPLANEDESCRIPTOR {
|
||||||
|
WORD nSize;
|
||||||
|
WORD nVersion;
|
||||||
|
DWORD dwFlags;
|
||||||
|
BYTE iPixelType;
|
||||||
|
BYTE cColorBits;
|
||||||
|
BYTE cRedBits;
|
||||||
|
BYTE cRedShift;
|
||||||
|
BYTE cGreenBits;
|
||||||
|
BYTE cGreenShift;
|
||||||
|
BYTE cBlueBits;
|
||||||
|
BYTE cBlueShift;
|
||||||
|
BYTE cAlphaBits;
|
||||||
|
BYTE cAlphaShift;
|
||||||
|
BYTE cAccumBits;
|
||||||
|
BYTE cAccumRedBits;
|
||||||
|
BYTE cAccumGreenBits;
|
||||||
|
BYTE cAccumBlueBits;
|
||||||
|
BYTE cAccumAlphaBits;
|
||||||
|
BYTE cDepthBits;
|
||||||
|
BYTE cStencilBits;
|
||||||
|
BYTE cAuxBuffers;
|
||||||
|
BYTE iLayerType;
|
||||||
|
BYTE bReserved;
|
||||||
|
COLORREF crTransparent;
|
||||||
|
} LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR;
|
||||||
|
LPD_SUPPORT_OPENGL The layer plane supports OpenGL drawing.
|
||||||
|
LPD_SUPPORT_GDI The layer plane supports GDI drawing. The current implementation of OpenGL doesn't support this flag.
|
||||||
|
LPD_DOUBLEBUFFER The layer plane is double-buffered. A layer plane can be double-buffered even when the main plane is single-buffered and vice versa.
|
||||||
|
LPD_STEREO The layer plane is stereoscopic. A layer plane can be stereoscopic even when the main plane is monoscopic and vice versa.
|
||||||
|
LPD_SWAP_EXCHANGE In a double-buffered layer plane, swapping the color buffer exchanges the front buffer and back buffer contents. The back buffer then contains the contents of the front buffer before the swap. This flag is a hint only and might not be provided by a driver.
|
||||||
|
LPD_SWAP_COPY In a double-buffered layer plane, swapping the color buffer copies the back buffer contents to the front buffer. The swap does not affect the back buffer contents. This flag is a hint only and might not be provided by a driver.
|
||||||
|
LPD_TRANSPARENT The crTransparent member of this structure contains a transparent color or index value that enables underlying layers to show through this layer. All layer planes, except the lowest-numbered underlay layer, have a transparent color or index.
|
||||||
|
LPD_SHARE_DEPTH The layer plane shares the depth buffer with the main plane.
|
||||||
|
LPD_SHARE_STENCIL The layer plane shares the stencil buffer with the main plane.
|
||||||
|
LPD_SHARE_ACCUM The layer plane shares the accumulation buffer with the main plane.
|
||||||
|
|
||||||
|
iPixelType
|
||||||
|
Specifies the type of pixel data. The following types are defined.
|
||||||
|
Value Meaning
|
||||||
|
LPD_TYPE_RGBA RGBA pixels. Each pixel has four components: red, green, blue, and alpha.
|
||||||
|
LPD_TYPE_COLORINDEX Color-index pixels. Each pixel uses a color-index value.
|
||||||
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="MatrixCompute.Additional"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using StgSharp.HighPerformance;
|
|
||||||
using StgSharp.Internal;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Numerics;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Numeric
|
|
||||||
{
|
|
||||||
public partial class MatrixCompute
|
|
||||||
{
|
|
||||||
|
|
||||||
internal static unsafe void ComputeFmaPanelF32(
|
|
||||||
MatrixParallelTaskPackage* p
|
|
||||||
)
|
|
||||||
{
|
|
||||||
int size = p->ElementSize;
|
|
||||||
MatrixKernel* leftBuffer = (MatrixKernel*)p->Left;
|
|
||||||
MatrixKernel* rightBuffer = (MatrixKernel*)p->Right;
|
|
||||||
MatrixKernel* ansBuffer = (MatrixKernel*)p->Answer;
|
|
||||||
ref long offsetRef = ref Unsafe.As<int, long>(ref p->PrimTileOffset);
|
|
||||||
ref long lengthRef = ref Unsafe.As<int, long>(ref p->PrimCount);
|
|
||||||
int ansWidth = p->AnsPrimOffset;
|
|
||||||
int ansHeight = p->AnsSecOffset;
|
|
||||||
int commonK = p->LeftPrimOffset;
|
|
||||||
int blocksPerRow = ansWidth / size;
|
|
||||||
if (NativeIntrinsic.Context.mat_f32_build_panel == null)
|
|
||||||
{
|
|
||||||
// in this occasion size must be 1
|
|
||||||
for (long c = offsetRef; c < offsetRef + lengthRef; c++)
|
|
||||||
{
|
|
||||||
int i = (int)(c / blocksPerRow);
|
|
||||||
int j = (int)(c % blocksPerRow);
|
|
||||||
MatrixKernel<float>* ansPanel = GetKernelAddressUnsafe((MatrixKernel<float>*)ansBuffer,
|
|
||||||
ansHeight, i, j);
|
|
||||||
NativeIntrinsic.Context.mat_f32_clear_panel((MatrixPanel*)ansPanel);
|
|
||||||
for (int k = 0; k < commonK; k += size) {
|
|
||||||
NativeIntrinsic.Context
|
|
||||||
.mat_f32_panel_fma(
|
|
||||||
(MatrixPanel*)GetKernelAddressUnsafe((MatrixKernel<float>*)leftBuffer,
|
|
||||||
ansHeight, k, j),
|
|
||||||
(MatrixPanel*)GetKernelAddressUnsafe((MatrixKernel<float>*)rightBuffer,
|
|
||||||
commonK, j, k),
|
|
||||||
(MatrixPanel*)ansPanel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
MatrixPanel<float>* leftPanel = MatrixPanel.Create<float>();
|
|
||||||
MatrixPanel<float>* rightPanel = MatrixPanel.Create<float>();
|
|
||||||
MatrixPanel<float>* ansPanel = MatrixPanel.Create<float>();
|
|
||||||
for (long c = offsetRef; c < offsetRef + lengthRef; c++)
|
|
||||||
{
|
|
||||||
int i = (int)(c / blocksPerRow) * size;
|
|
||||||
int j = (int)(c % blocksPerRow) * size;
|
|
||||||
NativeIntrinsic.Context.mat_f32_clear_panel((MatrixPanel*)ansPanel);
|
|
||||||
for (int k = 0; k < commonK; k += size)
|
|
||||||
{
|
|
||||||
NativeIntrinsic.Context
|
|
||||||
.mat_f32_build_panel((MatrixPanel*)leftPanel, leftBuffer,
|
|
||||||
commonK, ansHeight, k, i);
|
|
||||||
NativeIntrinsic.Context
|
|
||||||
.mat_f32_build_panel((MatrixPanel*)rightPanel, rightBuffer,
|
|
||||||
ansWidth, commonK, j, k);
|
|
||||||
NativeIntrinsic.Context
|
|
||||||
.mat_f32_panel_fma((MatrixPanel*)leftPanel, (MatrixPanel*)rightPanel, (MatrixPanel*)ansPanel);
|
|
||||||
}
|
|
||||||
NativeIntrinsic.Context
|
|
||||||
.mat_f32_store_panel((MatrixPanel*)ansPanel, ansBuffer, ansWidth,
|
|
||||||
ansHeight, j, i);
|
|
||||||
}
|
|
||||||
MatrixPanel.Destroy(leftPanel);
|
|
||||||
MatrixPanel.Destroy(rightPanel);
|
|
||||||
MatrixPanel.Destroy(ansPanel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
internal static unsafe MatrixKernel<T>* GetKernelAddressUnsafe<T>(
|
|
||||||
MatrixKernel<T>* buffer,
|
|
||||||
int colLength,
|
|
||||||
int x,
|
|
||||||
int y
|
|
||||||
) where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
// Caller guarantees: indices in range, layout is dense square.
|
|
||||||
int k_c = y >> 2;
|
|
||||||
int k_r = x >> 2;
|
|
||||||
|
|
||||||
return buffer + colLength * x + y;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -41,7 +41,8 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
Matrix<float> matrix,
|
Matrix<float> matrix,
|
||||||
Span<int> pivot,
|
Span<int> pivot,
|
||||||
Matrix<float> lower,
|
Matrix<float> lower,
|
||||||
Matrix<float> upper)
|
Matrix<float> upper
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (matrix.ColumnLength != matrix.RowLength) {
|
if (matrix.ColumnLength != matrix.RowLength) {
|
||||||
throw new InvalidOperationException("Matrix must be square.");
|
throw new InvalidOperationException("Matrix must be square.");
|
||||||
@@ -77,9 +78,10 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
for (int kBlock = 0; kBlock < n; kBlock += 4)
|
for (int kBlock = 0; kBlock < n; kBlock += 4)
|
||||||
{
|
{
|
||||||
NativeIntrinsic.Context
|
NativeIntrinsic.Context
|
||||||
.mat_f32_pivot(matrix.Buffer, (ulong)(kBlock >> 2),
|
.mat[(int)MatrixElementType.F32].pivot(matrix.Buffer,
|
||||||
(ulong)(matrix.KernelRowLength - (kBlock >> 2)),
|
(ulong)(kBlock >> 2),
|
||||||
(ulong)pivots);
|
(ulong)(matrix.KernelRowLength - (kBlock >> 2)),
|
||||||
|
(ulong)pivots);
|
||||||
int colsInBlock = Math.Min(4, n - kBlock);
|
int colsInBlock = Math.Min(4, n - kBlock);
|
||||||
for (int offset = 0; offset < colsInBlock; offset++)
|
for (int offset = 0; offset < colsInBlock; offset++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,343 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// file="MatrixCompute.Float"
|
||||||
|
// Project: StgSharp
|
||||||
|
// AuthorGroup: Nitload
|
||||||
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
//
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
using StgSharp.Collections;
|
||||||
|
using StgSharp.HighPerformance;
|
||||||
|
using StgSharp.Internal;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Numerics;
|
||||||
|
using System.Security.AccessControl;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StgSharp.Mathematics.Numeric
|
||||||
|
{
|
||||||
|
public static partial class MatrixCompute
|
||||||
|
{
|
||||||
|
|
||||||
|
public static unsafe void Add(
|
||||||
|
Matrix<float> left,
|
||||||
|
Matrix<float> right,
|
||||||
|
Matrix<float> ans
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int f32 = (int)MatrixElementType.F32;
|
||||||
|
if (left.ColumnLength != right.ColumnLength ||
|
||||||
|
left.RowLength != right.RowLength ||
|
||||||
|
left.ColumnLength != ans.ColumnLength ||
|
||||||
|
left.RowLength != ans.RowLength) {
|
||||||
|
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
||||||
|
}
|
||||||
|
long count = (long)left.KernelColumnLength * left.KernelRowLength;
|
||||||
|
if (count <= 256)
|
||||||
|
{
|
||||||
|
MatrixKernel<float>* leftPtr = left.Buffer;
|
||||||
|
MatrixKernel<float>* rightPtr = right.Buffer;
|
||||||
|
MatrixKernel<float>* ansPtr = ans.Buffer;
|
||||||
|
NativeIntrinsic.Context.mat[f32].buffer_add(leftPtr, rightPtr, ansPtr, count);
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else if (count <= 1024)
|
||||||
|
{
|
||||||
|
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
||||||
|
|
||||||
|
MatrixKernel<float>* leftPtr = left.Buffer;
|
||||||
|
MatrixKernel<float>* rightPtr = right.Buffer;
|
||||||
|
MatrixKernel<float>* ansPtr = ans.Buffer;
|
||||||
|
NativeIntrinsic.Context.mat[f32].buffer_add(leftPtr, rightPtr, ansPtr, count);
|
||||||
|
|
||||||
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
||||||
|
package->Left = (nint)left.Buffer;
|
||||||
|
package->Right = (nint)right.Buffer;
|
||||||
|
package->Answer = (nint)ans.Buffer;
|
||||||
|
package->ElementSize = sizeof(float);
|
||||||
|
package->PrimCount = ans.KernelColumnLength;
|
||||||
|
package->SecCount = ans.KernelRowLength;
|
||||||
|
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.LEFT_RIGHT_ANS_PARAM);
|
||||||
|
package->ComputeHandle = (IntPtr)NativeIntrinsic.Context.mat[f32].buffer_add;
|
||||||
|
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
||||||
|
|
||||||
|
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
||||||
|
taskGroup.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static unsafe void Fill(
|
||||||
|
Matrix<float> ans,
|
||||||
|
float value
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int f32 = (int)MatrixElementType.F32;
|
||||||
|
long count = (long)ans.KernelColumnLength * ans.KernelRowLength;
|
||||||
|
ScalarPacket* scalar = MatrixParallelFactory.CreateScalarPacket();
|
||||||
|
scalar->Data<float>(0) = value;
|
||||||
|
if (count <= 256)
|
||||||
|
{
|
||||||
|
NativeIntrinsic.Context.mat[f32].buffer_fill(ans.Buffer, scalar, count);
|
||||||
|
return;
|
||||||
|
} else if (count <= 1024)
|
||||||
|
{
|
||||||
|
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
||||||
|
NativeIntrinsic.Context.mat[f32].buffer_fill(ans.Buffer, scalar, count);
|
||||||
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
||||||
|
package->Answer = (nint)ans.Buffer;
|
||||||
|
package->ElementSize = sizeof(float);
|
||||||
|
package->PrimCount = ans.KernelColumnLength;
|
||||||
|
package->SecCount = ans.KernelRowLength;
|
||||||
|
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.ANS_SCALAR_PARAM);
|
||||||
|
package->ComputeHandle = (IntPtr)NativeIntrinsic.Context.mat[f32].buffer_fill;
|
||||||
|
package->Scalar = scalar;
|
||||||
|
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
||||||
|
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
||||||
|
MatrixParallelFactory.Release(scalar);
|
||||||
|
taskGroup.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static unsafe void Mul(
|
||||||
|
Matrix<float> left,
|
||||||
|
Matrix<float> right,
|
||||||
|
Matrix<float> ans
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int f32 = (int)MatrixElementType.F32;
|
||||||
|
|
||||||
|
// For matrix multiplication (left: MxK) * (right: KxN) => ans: MxN
|
||||||
|
// ColumnLength = number of columns (N), RowLength = number of rows (M)
|
||||||
|
if (left.ColumnLength != right.RowLength ||
|
||||||
|
ans.ColumnLength != right.ColumnLength ||
|
||||||
|
ans.RowLength != left.RowLength)
|
||||||
|
{
|
||||||
|
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
||||||
|
}
|
||||||
|
long count = (long)left.KernelColumnLength * left.KernelRowLength;
|
||||||
|
int size = MatrixPanel.KernelSideCount<float>();
|
||||||
|
if (count <= 1024)
|
||||||
|
{
|
||||||
|
MatrixParallelThread[] pool = null;
|
||||||
|
if (count > 256) {
|
||||||
|
pool = MatrixParallel.LeadParallel(1);
|
||||||
|
}
|
||||||
|
if (NativeIntrinsic.Context.mat[f32].build_panel == null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ans.KernelRowLength; i += size)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < ans.KernelColumnLength; j += size)
|
||||||
|
{
|
||||||
|
MatrixKernel<float>* ansPanel = ans.GetKernelAddressUnsafe(i, j);
|
||||||
|
NativeIntrinsic.Context.mat[f32].clear_panel((MatrixPanel*)ansPanel);
|
||||||
|
|
||||||
|
// Console.WriteLine($"{i}{j}");
|
||||||
|
for (int k = 0; k < left.KernelColumnLength; k += size)
|
||||||
|
{
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f32].panel_fma((MatrixPanel*)left.GetKernelAddressUnsafe(i, k),
|
||||||
|
(MatrixPanel*)right.GetKernelAddressUnsafe(k, j),
|
||||||
|
(MatrixPanel*)ansPanel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MatrixPanel<float>* leftPanel = MatrixPanel.Create<float>();
|
||||||
|
MatrixPanel<float>* rightPanel = MatrixPanel.Create<float>();
|
||||||
|
MatrixPanel<float>* ansPanel = MatrixPanel.Create<float>();
|
||||||
|
for (int i = 0; i < ans.KernelRowLength; i += size)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < ans.KernelColumnLength; j += size)
|
||||||
|
{
|
||||||
|
NativeIntrinsic.Context.mat[f32].clear_panel((MatrixPanel*)ansPanel);
|
||||||
|
|
||||||
|
// Console.WriteLine($"{i}{j}");
|
||||||
|
for (int k = 0; k < left.KernelColumnLength; k += size)
|
||||||
|
{
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f32].build_panel((MatrixPanel*)leftPanel,
|
||||||
|
(MatrixKernel*)left.Buffer,
|
||||||
|
left.KernelColumnLength,
|
||||||
|
left.KernelRowLength, i, k);
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f32].build_panel((MatrixPanel*)rightPanel,
|
||||||
|
(MatrixKernel*)right.Buffer,
|
||||||
|
right.KernelColumnLength,
|
||||||
|
right.KernelRowLength, k, j);
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f32].panel_fma((MatrixPanel*)leftPanel,
|
||||||
|
(MatrixPanel*)rightPanel,
|
||||||
|
(MatrixPanel*)ansPanel);
|
||||||
|
}
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f32].store_panel((MatrixPanel*)ansPanel,
|
||||||
|
(MatrixKernel*)ans.Buffer,
|
||||||
|
ans.KernelColumnLength,
|
||||||
|
ans.KernelRowLength, i, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MatrixPanel.Destroy(leftPanel);
|
||||||
|
MatrixPanel.Destroy(rightPanel);
|
||||||
|
MatrixPanel.Destroy(ansPanel);
|
||||||
|
}
|
||||||
|
if (count > 256) {
|
||||||
|
MatrixParallel.ReturnParallelResources(ref pool!);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
||||||
|
package->Left = (nint)left.Buffer;
|
||||||
|
package->Right = (nint)right.Buffer;
|
||||||
|
package->Answer = (nint)ans.Buffer;
|
||||||
|
package->AnsPrimOffset = ans.KernelRowLength;
|
||||||
|
package->AnsSecOffset = ans.KernelColumnLength;
|
||||||
|
package->LeftPrimOffset = left.KernelColumnLength;
|
||||||
|
package->PrimCount = ans.KernelColumnLength / size;
|
||||||
|
package->SecCount = ans.KernelRowLength / size;
|
||||||
|
package->ElementSize = size;
|
||||||
|
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationSpecial.SEQ_FMA);
|
||||||
|
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
||||||
|
|
||||||
|
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
||||||
|
taskGroup.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static unsafe void Mul(
|
||||||
|
Matrix<float> left,
|
||||||
|
float right,
|
||||||
|
Matrix<float> ans
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int f32 = (int)MatrixElementType.F32;
|
||||||
|
if (left.ColumnLength != ans.ColumnLength || left.RowLength != ans.RowLength) {
|
||||||
|
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
||||||
|
}
|
||||||
|
if (left.Layout != MatrixLayout.DenseRectangle ||
|
||||||
|
ans.Layout != MatrixLayout.DenseRectangle) {
|
||||||
|
throw new NotSupportedException("Only dense rectangle matrices are supported.");
|
||||||
|
}
|
||||||
|
long count = (long)left.KernelColumnLength * left.KernelRowLength;
|
||||||
|
ScalarPacket* scalar = MatrixParallelFactory.CreateScalarPacket();
|
||||||
|
scalar->Data<float>(0) = right;
|
||||||
|
if (count <= 256)
|
||||||
|
{
|
||||||
|
MatrixKernel<float>* leftPtr = left.Buffer;
|
||||||
|
MatrixKernel<float>* ansPtr = ans.Buffer;
|
||||||
|
NativeIntrinsic.Context.mat[f32].buffer_scalar_mul(leftPtr, ansPtr, scalar, count);
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else if (count <= 1024)
|
||||||
|
{
|
||||||
|
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
||||||
|
|
||||||
|
MatrixKernel<float>* leftPtr = left.Buffer;
|
||||||
|
MatrixKernel<float>* ansPtr = ans.Buffer;
|
||||||
|
NativeIntrinsic.Context.mat[f32].buffer_scalar_mul(leftPtr, ansPtr, scalar, count);
|
||||||
|
|
||||||
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
||||||
|
package->Right = (nint)left.Buffer;
|
||||||
|
package->Answer = (nint)ans.Buffer;
|
||||||
|
package->ElementSize = sizeof(float);
|
||||||
|
package->PrimCount = left.KernelColumnLength;
|
||||||
|
package->SecCount = left.KernelRowLength;
|
||||||
|
package->Scalar = scalar;
|
||||||
|
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.RIGHT_ANS_SCALAR_PARAM);
|
||||||
|
package->ComputeHandle = (IntPtr)NativeIntrinsic.Context.mat[f32].buffer_scalar_mul;
|
||||||
|
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
||||||
|
|
||||||
|
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
||||||
|
taskGroup.Dispose();
|
||||||
|
MatrixParallelFactory.Release(scalar);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static unsafe void Sub(
|
||||||
|
Matrix<float> left,
|
||||||
|
Matrix<float> right,
|
||||||
|
Matrix<float> ans
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int f32 = (int)MatrixElementType.F32;
|
||||||
|
if (left.ColumnLength != right.ColumnLength ||
|
||||||
|
left.RowLength != right.RowLength ||
|
||||||
|
left.ColumnLength != ans.ColumnLength ||
|
||||||
|
left.RowLength != ans.RowLength) {
|
||||||
|
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
||||||
|
}
|
||||||
|
if (left.Layout != MatrixLayout.DenseRectangle ||
|
||||||
|
right.Layout != MatrixLayout.DenseRectangle ||
|
||||||
|
ans.Layout != MatrixLayout.DenseRectangle) {
|
||||||
|
throw new NotSupportedException("Only dense rectangle matrices are supported.");
|
||||||
|
}
|
||||||
|
long count = (long)left.KernelColumnLength * left.KernelRowLength;
|
||||||
|
if (count <= 256)
|
||||||
|
{
|
||||||
|
MatrixKernel<float>* leftPtr = left.Buffer;
|
||||||
|
MatrixKernel<float>* rightPtr = right.Buffer;
|
||||||
|
MatrixKernel<float>* ansPtr = ans.Buffer;
|
||||||
|
NativeIntrinsic.Context.mat[f32].buffer_sub(leftPtr, rightPtr, ansPtr, count);
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else if (count <= 1024)
|
||||||
|
{
|
||||||
|
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
||||||
|
|
||||||
|
MatrixKernel<float>* leftPtr = left.Buffer;
|
||||||
|
MatrixKernel<float>* rightPtr = right.Buffer;
|
||||||
|
MatrixKernel<float>* ansPtr = ans.Buffer;
|
||||||
|
NativeIntrinsic.Context.mat[f32].buffer_sub(leftPtr, rightPtr, ansPtr, count);
|
||||||
|
|
||||||
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
||||||
|
package->Left = (nint)left.Buffer;
|
||||||
|
package->Right = (nint)right.Buffer;
|
||||||
|
package->Answer = (nint)ans.Buffer;
|
||||||
|
package->ElementSize = sizeof(float);
|
||||||
|
package->PrimCount = left.KernelColumnLength;
|
||||||
|
package->SecCount = left.KernelRowLength;
|
||||||
|
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.LEFT_RIGHT_ANS_PARAM);
|
||||||
|
package->ComputeHandle = (IntPtr)NativeIntrinsic.Context.mat[f32].buffer_sub;
|
||||||
|
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
||||||
|
|
||||||
|
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
||||||
|
taskGroup.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,293 +25,162 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Collections;
|
|
||||||
using StgSharp.HighPerformance;
|
using StgSharp.HighPerformance;
|
||||||
using StgSharp.Internal;
|
using StgSharp.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Security.AccessControl;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Numeric
|
namespace StgSharp.Mathematics.Numeric
|
||||||
{
|
{
|
||||||
public static partial class MatrixCompute
|
public partial class MatrixCompute
|
||||||
{
|
{
|
||||||
|
|
||||||
public static unsafe void Add(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
|
internal static unsafe void ComputeFmaPanelF32(
|
||||||
|
MatrixParallelTaskPackage* p
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (left.ColumnLength != right.ColumnLength ||
|
int f32 = (int)MatrixElementType.F32;
|
||||||
left.RowLength != right.RowLength ||
|
|
||||||
left.ColumnLength != ans.ColumnLength ||
|
|
||||||
left.RowLength != ans.RowLength) {
|
|
||||||
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
|
||||||
}
|
|
||||||
long count = (long)left.KernelColumnLength * left.KernelRowLength;
|
|
||||||
if (count <= 256)
|
|
||||||
{
|
|
||||||
MatrixKernel<float>* leftPtr = left.Buffer;
|
|
||||||
MatrixKernel<float>* rightPtr = right.Buffer;
|
|
||||||
MatrixKernel<float>* ansPtr = ans.Buffer;
|
|
||||||
NativeIntrinsic.Context.mat_f32_buffer_add(leftPtr, rightPtr, ansPtr, count);
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else if (count <= 1024)
|
|
||||||
{
|
|
||||||
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
|
||||||
|
|
||||||
MatrixKernel<float>* leftPtr = left.Buffer;
|
|
||||||
MatrixKernel<float>* rightPtr = right.Buffer;
|
|
||||||
MatrixKernel<float>* ansPtr = ans.Buffer;
|
|
||||||
NativeIntrinsic.Context.mat_f32_buffer_add(leftPtr, rightPtr, ansPtr, count);
|
|
||||||
|
|
||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
|
||||||
package->Left = (nint)left.Buffer;
|
|
||||||
package->Right = (nint)right.Buffer;
|
|
||||||
package->Answer = (nint)ans.Buffer;
|
|
||||||
package->ElementSize = sizeof(float);
|
|
||||||
package->PrimCount = ans.KernelColumnLength;
|
|
||||||
package->SecCount = ans.KernelRowLength;
|
|
||||||
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.LEFT_RIGHT_ANS_PARAM);
|
|
||||||
package->ComputeHandle = (IntPtr)NativeIntrinsic.Context.mat_f32_buffer_add;
|
|
||||||
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
|
||||||
|
|
||||||
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
|
||||||
taskGroup.Dispose();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static unsafe void Fill(Matrix<float> ans, float value)
|
|
||||||
{
|
|
||||||
long count = (long)ans.KernelColumnLength * ans.KernelRowLength;
|
|
||||||
ScalarPacket* scalar = MatrixParallelFactory.CreateScalarPacket();
|
|
||||||
scalar->Data<float>(0) = value;
|
|
||||||
if (count <= 256)
|
|
||||||
{
|
|
||||||
NativeIntrinsic.Context.mat_f32_buffer_fill(ans.Buffer, scalar, count);
|
|
||||||
return;
|
|
||||||
} else if (count <= 1024)
|
|
||||||
{
|
|
||||||
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
|
||||||
NativeIntrinsic.Context.mat_f32_buffer_fill(ans.Buffer, scalar, count);
|
|
||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
|
||||||
package->Answer = (nint)ans.Buffer;
|
|
||||||
package->ElementSize = sizeof(float);
|
|
||||||
package->PrimCount = ans.KernelColumnLength;
|
|
||||||
package->SecCount = ans.KernelRowLength;
|
|
||||||
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.ANS_SCALAR_PARAM);
|
|
||||||
package->ComputeHandle = (IntPtr)NativeIntrinsic.Context.mat_f32_buffer_fill;
|
|
||||||
package->Scalar = scalar;
|
|
||||||
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
|
||||||
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
|
||||||
MatrixParallelFactory.Release(scalar);
|
|
||||||
taskGroup.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static unsafe void Mul(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
|
|
||||||
{
|
|
||||||
// For matrix multiplication (left: MxK) * (right: KxN) => ans: MxN
|
|
||||||
// ColumnLength = number of columns (N), RowLength = number of rows (M)
|
|
||||||
if (left.ColumnLength != right.RowLength ||
|
|
||||||
ans.ColumnLength != right.ColumnLength ||
|
|
||||||
ans.RowLength != left.RowLength)
|
|
||||||
{
|
|
||||||
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
|
||||||
}
|
|
||||||
long count = (long)left.KernelColumnLength * left.KernelRowLength;
|
|
||||||
int size = MatrixPanel.KernelSideCount<float>();
|
int size = MatrixPanel.KernelSideCount<float>();
|
||||||
if (count <= 1024)
|
MatrixKernel* leftBuffer = (MatrixKernel*)p->Left;
|
||||||
|
MatrixKernel* rightBuffer = (MatrixKernel*)p->Right;
|
||||||
|
MatrixKernel* ansBuffer = (MatrixKernel*)p->Answer;
|
||||||
|
ref long offsetRef = ref Unsafe.As<int, long>(ref p->PrimTileOffset);
|
||||||
|
ref long lengthRef = ref Unsafe.As<int, long>(ref p->PrimCount);
|
||||||
|
int ansWidth = p->AnsPrimOffset;
|
||||||
|
int ansHeight = p->AnsSecOffset;
|
||||||
|
int commonK = p->LeftPrimOffset;
|
||||||
|
int blocksPerRow = ansWidth / size;
|
||||||
|
if (NativeIntrinsic.Context.mat[f32].build_panel == null)
|
||||||
{
|
{
|
||||||
MatrixParallelThread[] pool = null;
|
// in this occasion size must be 1
|
||||||
if (count > 256) {
|
for (long c = offsetRef; c < offsetRef + lengthRef; c++)
|
||||||
pool = MatrixParallel.LeadParallel(1);
|
|
||||||
}
|
|
||||||
if (NativeIntrinsic.Context.mat_f32_build_panel == null)
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ans.KernelRowLength; i += size)
|
int i = (int)(c / blocksPerRow);
|
||||||
{
|
int j = (int)(c % blocksPerRow);
|
||||||
for (int j = 0; j < ans.KernelColumnLength; j += size)
|
MatrixKernel<float>* ansPanel = GetKernelAddressUnsafe((MatrixKernel<float>*)ansBuffer,
|
||||||
{
|
ansHeight, i, j);
|
||||||
MatrixKernel<float>* ansPanel = ans.GetKernelAddressUnsafe(i, j);
|
NativeIntrinsic.Context.mat[f32].clear_panel((MatrixPanel*)ansPanel);
|
||||||
NativeIntrinsic.Context.mat_f32_clear_panel((MatrixPanel*)ansPanel);
|
for (int k = 0; k < commonK; k += size) {
|
||||||
|
NativeIntrinsic.Context
|
||||||
// Console.WriteLine($"{i}{j}");
|
.mat[f32].panel_fma(
|
||||||
for (int k = 0; k < left.KernelColumnLength; k += size)
|
(MatrixPanel*)GetKernelAddressUnsafe((MatrixKernel<float>*)leftBuffer,
|
||||||
{
|
ansHeight, k, j),
|
||||||
NativeIntrinsic.Context
|
(MatrixPanel*)GetKernelAddressUnsafe((MatrixKernel<float>*)rightBuffer,
|
||||||
.mat_f32_panel_fma((MatrixPanel*)left.GetKernelAddressUnsafe(i, k),
|
commonK, j, k),
|
||||||
(MatrixPanel*)right.GetKernelAddressUnsafe(k, j),
|
(MatrixPanel*)ansPanel);
|
||||||
(MatrixPanel*)ansPanel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MatrixPanel<float>* leftPanel = MatrixPanel.Create<float>();
|
||||||
|
MatrixPanel<float>* rightPanel = MatrixPanel.Create<float>();
|
||||||
|
MatrixPanel<float>* ansPanel = MatrixPanel.Create<float>();
|
||||||
|
for (long c = offsetRef; c < offsetRef + lengthRef; c++)
|
||||||
{
|
{
|
||||||
MatrixPanel<float>* leftPanel = MatrixPanel.Create<float>();
|
int i = (int)(c / blocksPerRow) * size;
|
||||||
MatrixPanel<float>* rightPanel = MatrixPanel.Create<float>();
|
int j = (int)(c % blocksPerRow) * size;
|
||||||
MatrixPanel<float>* ansPanel = MatrixPanel.Create<float>();
|
NativeIntrinsic.Context.mat[f32].clear_panel((MatrixPanel*)ansPanel);
|
||||||
for (int i = 0; i < ans.KernelRowLength; i += size)
|
for (int k = 0; k < commonK; k += size)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < ans.KernelColumnLength; j += size)
|
NativeIntrinsic.Context
|
||||||
{
|
.mat[f32].build_panel((MatrixPanel*)leftPanel, leftBuffer,
|
||||||
NativeIntrinsic.Context.mat_f32_clear_panel((MatrixPanel*)ansPanel);
|
commonK, ansHeight, k, i);
|
||||||
|
NativeIntrinsic.Context
|
||||||
// Console.WriteLine($"{i}{j}");
|
.mat[f32].build_panel((MatrixPanel*)rightPanel, rightBuffer,
|
||||||
for (int k = 0; k < left.KernelColumnLength; k += size)
|
ansWidth, commonK, j, k);
|
||||||
{
|
NativeIntrinsic.Context
|
||||||
NativeIntrinsic.Context
|
.mat[f32].panel_fma((MatrixPanel*)leftPanel, (MatrixPanel*)rightPanel, (MatrixPanel*)ansPanel);
|
||||||
.mat_f32_build_panel((MatrixPanel*)leftPanel,
|
|
||||||
(MatrixKernel*)left.Buffer,
|
|
||||||
left.KernelColumnLength,
|
|
||||||
left.KernelRowLength, i, k);
|
|
||||||
NativeIntrinsic.Context
|
|
||||||
.mat_f32_build_panel((MatrixPanel*)rightPanel,
|
|
||||||
(MatrixKernel*)right.Buffer,
|
|
||||||
right.KernelColumnLength,
|
|
||||||
right.KernelRowLength, k, j);
|
|
||||||
NativeIntrinsic.Context
|
|
||||||
.mat_f32_panel_fma((MatrixPanel*)leftPanel,
|
|
||||||
(MatrixPanel*)rightPanel,
|
|
||||||
(MatrixPanel*)ansPanel);
|
|
||||||
}
|
|
||||||
NativeIntrinsic.Context
|
|
||||||
.mat_f32_store_panel((MatrixPanel*)ansPanel,
|
|
||||||
(MatrixKernel*)ans.Buffer,
|
|
||||||
ans.KernelColumnLength,
|
|
||||||
ans.KernelRowLength, i, j);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
MatrixPanel.Destroy(leftPanel);
|
NativeIntrinsic.Context
|
||||||
MatrixPanel.Destroy(rightPanel);
|
.mat[f32].store_panel((MatrixPanel*)ansPanel, ansBuffer,
|
||||||
MatrixPanel.Destroy(ansPanel);
|
ansWidth, ansHeight, j, i);
|
||||||
}
|
}
|
||||||
if (count > 256) {
|
MatrixPanel.Destroy(leftPanel);
|
||||||
MatrixParallel.ReturnParallelResources(ref pool!);
|
MatrixPanel.Destroy(rightPanel);
|
||||||
}
|
MatrixPanel.Destroy(ansPanel);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
|
||||||
package->Left = (nint)left.Buffer;
|
|
||||||
package->Right = (nint)right.Buffer;
|
|
||||||
package->Answer = (nint)ans.Buffer;
|
|
||||||
package->AnsPrimOffset = ans.KernelRowLength;
|
|
||||||
package->AnsSecOffset = ans.KernelColumnLength;
|
|
||||||
package->LeftPrimOffset = left.KernelColumnLength;
|
|
||||||
package->PrimCount = ans.KernelColumnLength / size;
|
|
||||||
package->SecCount = ans.KernelRowLength / size;
|
|
||||||
package->ElementSize = size;
|
|
||||||
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationSpecial.SEQ_FMA);
|
|
||||||
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
|
||||||
|
|
||||||
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
|
||||||
taskGroup.Dispose();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe void Mul(Matrix<float> left, float right, Matrix<float> ans)
|
internal static unsafe void ComputeFmaPanelF64(
|
||||||
|
MatrixParallelTaskPackage* p
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (left.ColumnLength != ans.ColumnLength || left.RowLength != ans.RowLength) {
|
int f64 = (int)MatrixElementType.F64;
|
||||||
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
int size = MatrixPanel.KernelSideCount<double>();
|
||||||
}
|
MatrixKernel* leftBuffer = (MatrixKernel*)p->Left;
|
||||||
if (left.Layout != MatrixLayout.DenseRectangle ||
|
MatrixKernel* rightBuffer = (MatrixKernel*)p->Right;
|
||||||
ans.Layout != MatrixLayout.DenseRectangle) {
|
MatrixKernel* ansBuffer = (MatrixKernel*)p->Answer;
|
||||||
throw new NotSupportedException("Only dense rectangle matrices are supported.");
|
ref long offsetRef = ref Unsafe.As<int, long>(ref p->PrimTileOffset);
|
||||||
}
|
ref long lengthRef = ref Unsafe.As<int, long>(ref p->PrimCount);
|
||||||
long count = (long)left.KernelColumnLength * left.KernelRowLength;
|
int ansWidth = p->AnsPrimOffset;
|
||||||
ScalarPacket* scalar = MatrixParallelFactory.CreateScalarPacket();
|
int ansHeight = p->AnsSecOffset;
|
||||||
scalar->Data<float>(0) = right;
|
int commonK = p->LeftPrimOffset;
|
||||||
if (count <= 256)
|
int blocksPerRow = ansWidth / size;
|
||||||
|
if (NativeIntrinsic.Context.mat[f64].build_panel == null)
|
||||||
{
|
{
|
||||||
MatrixKernel<float>* leftPtr = left.Buffer;
|
// in this occasion size must be 1
|
||||||
MatrixKernel<float>* ansPtr = ans.Buffer;
|
for (long c = offsetRef; c < offsetRef + lengthRef; c++)
|
||||||
NativeIntrinsic.Context.mat_f32_buffer_scalar_mul(leftPtr, ansPtr, scalar, count);
|
{
|
||||||
|
int i = (int)(c / blocksPerRow);
|
||||||
return;
|
int j = (int)(c % blocksPerRow);
|
||||||
} else if (count <= 1024)
|
MatrixKernel<double>* ansPanel = GetKernelAddressUnsafe((MatrixKernel<double>*)ansBuffer,
|
||||||
|
ansHeight, i, j);
|
||||||
|
NativeIntrinsic.Context.mat[f64].clear_panel((MatrixPanel*)ansPanel);
|
||||||
|
for (int k = 0; k < commonK; k += size) {
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f64].panel_fma(
|
||||||
|
(MatrixPanel*)GetKernelAddressUnsafe((MatrixKernel<double>*)leftBuffer,
|
||||||
|
ansHeight, k, j),
|
||||||
|
(MatrixPanel*)GetKernelAddressUnsafe((MatrixKernel<double>*)rightBuffer,
|
||||||
|
commonK, j, k),
|
||||||
|
(MatrixPanel*)ansPanel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
MatrixPanel<double>* leftPanel = MatrixPanel.Create<double>();
|
||||||
|
MatrixPanel<double>* rightPanel = MatrixPanel.Create<double>();
|
||||||
MatrixKernel<float>* leftPtr = left.Buffer;
|
MatrixPanel<double>* ansPanel = MatrixPanel.Create<double>();
|
||||||
MatrixKernel<float>* ansPtr = ans.Buffer;
|
for (long c = offsetRef; c < offsetRef + lengthRef; c++)
|
||||||
NativeIntrinsic.Context.mat_f32_buffer_scalar_mul(leftPtr, ansPtr, scalar, count);
|
{
|
||||||
|
int i = (int)(c / blocksPerRow) * size;
|
||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
int j = (int)(c % blocksPerRow) * size;
|
||||||
return;
|
NativeIntrinsic.Context.mat[f64].clear_panel((MatrixPanel*)ansPanel);
|
||||||
|
for (int k = 0; k < commonK; k += size)
|
||||||
|
{
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f64].build_panel((MatrixPanel*)leftPanel, leftBuffer,
|
||||||
|
commonK, ansHeight, k, i);
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f64].build_panel((MatrixPanel*)rightPanel, rightBuffer,
|
||||||
|
ansWidth, commonK, j, k);
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f64].panel_fma((MatrixPanel*)leftPanel, (MatrixPanel*)rightPanel, (MatrixPanel*)ansPanel);
|
||||||
|
}
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f64].store_panel((MatrixPanel*)ansPanel, ansBuffer,
|
||||||
|
ansWidth, ansHeight, j, i);
|
||||||
|
}
|
||||||
|
MatrixPanel.Destroy(leftPanel);
|
||||||
|
MatrixPanel.Destroy(rightPanel);
|
||||||
|
MatrixPanel.Destroy(ansPanel);
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
|
||||||
package->Right = (nint)left.Buffer;
|
|
||||||
package->Answer = (nint)ans.Buffer;
|
|
||||||
package->ElementSize = sizeof(float);
|
|
||||||
package->PrimCount = left.KernelColumnLength;
|
|
||||||
package->SecCount = left.KernelRowLength;
|
|
||||||
package->Scalar = scalar;
|
|
||||||
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.RIGHT_ANS_SCALAR_PARAM);
|
|
||||||
package->ComputeHandle = (IntPtr)NativeIntrinsic.Context.mat_f32_buffer_scalar_mul;
|
|
||||||
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
|
||||||
|
|
||||||
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
|
||||||
taskGroup.Dispose();
|
|
||||||
MatrixParallelFactory.Release(scalar);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe void Sub(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
internal static unsafe MatrixKernel<T>* GetKernelAddressUnsafe<T>(
|
||||||
|
MatrixKernel<T>* buffer,
|
||||||
|
int colLength,
|
||||||
|
int x,
|
||||||
|
int y
|
||||||
|
) where T : unmanaged, INumber<T>
|
||||||
{
|
{
|
||||||
if (left.ColumnLength != right.ColumnLength ||
|
return buffer + (colLength * x + y);
|
||||||
left.RowLength != right.RowLength ||
|
|
||||||
left.ColumnLength != ans.ColumnLength ||
|
|
||||||
left.RowLength != ans.RowLength) {
|
|
||||||
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
|
||||||
}
|
|
||||||
if (left.Layout != MatrixLayout.DenseRectangle ||
|
|
||||||
right.Layout != MatrixLayout.DenseRectangle ||
|
|
||||||
ans.Layout != MatrixLayout.DenseRectangle) {
|
|
||||||
throw new NotSupportedException("Only dense rectangle matrices are supported.");
|
|
||||||
}
|
|
||||||
long count = (long)left.KernelColumnLength * left.KernelRowLength;
|
|
||||||
if (count <= 256)
|
|
||||||
{
|
|
||||||
MatrixKernel<float>* leftPtr = left.Buffer;
|
|
||||||
MatrixKernel<float>* rightPtr = right.Buffer;
|
|
||||||
MatrixKernel<float>* ansPtr = ans.Buffer;
|
|
||||||
NativeIntrinsic.Context.mat_f32_buffer_sub(leftPtr, rightPtr, ansPtr, count);
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else if (count <= 1024)
|
|
||||||
{
|
|
||||||
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
|
||||||
|
|
||||||
MatrixKernel<float>* leftPtr = left.Buffer;
|
|
||||||
MatrixKernel<float>* rightPtr = right.Buffer;
|
|
||||||
MatrixKernel<float>* ansPtr = ans.Buffer;
|
|
||||||
NativeIntrinsic.Context.mat_f32_buffer_sub(leftPtr, rightPtr, ansPtr, count);
|
|
||||||
|
|
||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
|
||||||
package->Left = (nint)left.Buffer;
|
|
||||||
package->Right = (nint)right.Buffer;
|
|
||||||
package->Answer = (nint)ans.Buffer;
|
|
||||||
package->ElementSize = sizeof(float);
|
|
||||||
package->PrimCount = left.KernelColumnLength;
|
|
||||||
package->SecCount = left.KernelRowLength;
|
|
||||||
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.LEFT_RIGHT_ANS_PARAM);
|
|
||||||
package->ComputeHandle = (IntPtr)NativeIntrinsic.Context.mat_f32_buffer_sub;
|
|
||||||
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
|
||||||
|
|
||||||
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
|
||||||
taskGroup.Dispose();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,339 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// file="MatrixCompute.double"
|
||||||
|
// Project: StgSharp
|
||||||
|
// AuthorGroup: Nitload
|
||||||
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
//
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
using StgSharp.HighPerformance;
|
||||||
|
using StgSharp.Internal;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StgSharp.Mathematics.Numeric
|
||||||
|
{
|
||||||
|
public partial class MatrixCompute
|
||||||
|
{
|
||||||
|
|
||||||
|
public static unsafe void Add(
|
||||||
|
Matrix<double> left,
|
||||||
|
Matrix<double> right,
|
||||||
|
Matrix<double> ans
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int f64 = (int)MatrixElementType.F64;
|
||||||
|
if (left.ColumnLength != right.ColumnLength ||
|
||||||
|
left.RowLength != right.RowLength ||
|
||||||
|
left.ColumnLength != ans.ColumnLength ||
|
||||||
|
left.RowLength != ans.RowLength) {
|
||||||
|
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
||||||
|
}
|
||||||
|
long count = (long)left.KernelColumnLength * left.KernelRowLength;
|
||||||
|
if (count <= 256)
|
||||||
|
{
|
||||||
|
MatrixKernel<double>* leftPtr = left.Buffer;
|
||||||
|
MatrixKernel<double>* rightPtr = right.Buffer;
|
||||||
|
MatrixKernel<double>* ansPtr = ans.Buffer;
|
||||||
|
NativeIntrinsic.Context.mat[f64].buffer_add(leftPtr, rightPtr, ansPtr, count);
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else if (count <= 1024)
|
||||||
|
{
|
||||||
|
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
||||||
|
|
||||||
|
MatrixKernel<double>* leftPtr = left.Buffer;
|
||||||
|
MatrixKernel<double>* rightPtr = right.Buffer;
|
||||||
|
MatrixKernel<double>* ansPtr = ans.Buffer;
|
||||||
|
NativeIntrinsic.Context.mat[f64].buffer_add(leftPtr, rightPtr, ansPtr, count);
|
||||||
|
|
||||||
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<double>();
|
||||||
|
package->Left = (nint)left.Buffer;
|
||||||
|
package->Right = (nint)right.Buffer;
|
||||||
|
package->Answer = (nint)ans.Buffer;
|
||||||
|
package->ElementSize = sizeof(double);
|
||||||
|
package->PrimCount = ans.KernelColumnLength;
|
||||||
|
package->SecCount = ans.KernelRowLength;
|
||||||
|
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.LEFT_RIGHT_ANS_PARAM);
|
||||||
|
package->ComputeHandle = (IntPtr)NativeIntrinsic.Context.mat[f64].buffer_add;
|
||||||
|
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
||||||
|
|
||||||
|
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
||||||
|
taskGroup.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static unsafe void Fill(
|
||||||
|
Matrix<double> ans,
|
||||||
|
double value
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int f64 = (int)MatrixElementType.F64;
|
||||||
|
long count = (long)ans.KernelColumnLength * ans.KernelRowLength;
|
||||||
|
ScalarPacket* scalar = MatrixParallelFactory.CreateScalarPacket();
|
||||||
|
scalar->Data<double>(0) = value;
|
||||||
|
if (count <= 256)
|
||||||
|
{
|
||||||
|
NativeIntrinsic.Context.mat[f64].buffer_fill(ans.Buffer, scalar, count);
|
||||||
|
return;
|
||||||
|
} else if (count <= 1024)
|
||||||
|
{
|
||||||
|
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
||||||
|
NativeIntrinsic.Context.mat[f64].buffer_fill(ans.Buffer, scalar, count);
|
||||||
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<double>();
|
||||||
|
package->Answer = (nint)ans.Buffer;
|
||||||
|
package->ElementSize = sizeof(double);
|
||||||
|
package->PrimCount = ans.KernelColumnLength;
|
||||||
|
package->SecCount = ans.KernelRowLength;
|
||||||
|
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.ANS_SCALAR_PARAM);
|
||||||
|
package->ComputeHandle = (IntPtr)NativeIntrinsic.Context.mat[f64].buffer_fill;
|
||||||
|
package->Scalar = scalar;
|
||||||
|
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
||||||
|
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
||||||
|
MatrixParallelFactory.Release(scalar);
|
||||||
|
taskGroup.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static unsafe void Mul(
|
||||||
|
Matrix<double> left,
|
||||||
|
Matrix<double> right,
|
||||||
|
Matrix<double> ans
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int f64 = (int)MatrixElementType.F64;
|
||||||
|
|
||||||
|
// For matrix multiplication (left: MxK) * (right: KxN) => ans: MxN
|
||||||
|
// ColumnLength = number of columns (N), RowLength = number of rows (M)
|
||||||
|
if (left.ColumnLength != right.RowLength ||
|
||||||
|
ans.ColumnLength != right.ColumnLength ||
|
||||||
|
ans.RowLength != left.RowLength)
|
||||||
|
{
|
||||||
|
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
||||||
|
}
|
||||||
|
long count = (long)left.KernelColumnLength * left.KernelRowLength;
|
||||||
|
int size = MatrixPanel.KernelSideCount<double>();
|
||||||
|
if (count <= 1024)
|
||||||
|
{
|
||||||
|
MatrixParallelThread[] pool = null;
|
||||||
|
if (count > 256) {
|
||||||
|
pool = MatrixParallel.LeadParallel(1);
|
||||||
|
}
|
||||||
|
if (NativeIntrinsic.Context.mat[f64].build_panel == null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ans.KernelRowLength; i += size)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < ans.KernelColumnLength; j += size)
|
||||||
|
{
|
||||||
|
MatrixKernel<double>* ansPanel = ans.GetKernelAddressUnsafe(i, j);
|
||||||
|
NativeIntrinsic.Context.mat[f64].clear_panel((MatrixPanel*)ansPanel);
|
||||||
|
|
||||||
|
// Console.WriteLine($"{i}{j}");
|
||||||
|
for (int k = 0; k < left.KernelColumnLength; k += size)
|
||||||
|
{
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f64].panel_fma((MatrixPanel*)left.GetKernelAddressUnsafe(i, k),
|
||||||
|
(MatrixPanel*)right.GetKernelAddressUnsafe(k, j),
|
||||||
|
(MatrixPanel*)ansPanel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MatrixPanel<double>* leftPanel = MatrixPanel.Create<double>();
|
||||||
|
MatrixPanel<double>* rightPanel = MatrixPanel.Create<double>();
|
||||||
|
MatrixPanel<double>* ansPanel = MatrixPanel.Create<double>();
|
||||||
|
for (int i = 0; i < ans.KernelRowLength; i += size)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < ans.KernelColumnLength; j += size)
|
||||||
|
{
|
||||||
|
NativeIntrinsic.Context.mat[f64].clear_panel((MatrixPanel*)ansPanel);
|
||||||
|
|
||||||
|
// Console.WriteLine($"{i}{j}");
|
||||||
|
for (int k = 0; k < left.KernelColumnLength; k += size)
|
||||||
|
{
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f64].build_panel((MatrixPanel*)leftPanel,
|
||||||
|
(MatrixKernel*)left.Buffer,
|
||||||
|
left.KernelColumnLength,
|
||||||
|
left.KernelRowLength, i, k);
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f64].build_panel((MatrixPanel*)rightPanel,
|
||||||
|
(MatrixKernel*)right.Buffer,
|
||||||
|
right.KernelColumnLength,
|
||||||
|
right.KernelRowLength, k, j);
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f64].panel_fma((MatrixPanel*)leftPanel,
|
||||||
|
(MatrixPanel*)rightPanel,
|
||||||
|
(MatrixPanel*)ansPanel);
|
||||||
|
}
|
||||||
|
NativeIntrinsic.Context
|
||||||
|
.mat[f64].store_panel((MatrixPanel*)ansPanel,
|
||||||
|
(MatrixKernel*)ans.Buffer,
|
||||||
|
ans.KernelColumnLength,
|
||||||
|
ans.KernelRowLength, i, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MatrixPanel.Destroy(leftPanel);
|
||||||
|
MatrixPanel.Destroy(rightPanel);
|
||||||
|
MatrixPanel.Destroy(ansPanel);
|
||||||
|
}
|
||||||
|
if (count > 256) {
|
||||||
|
MatrixParallel.ReturnParallelResources(ref pool!);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<double>();
|
||||||
|
package->Left = (nint)left.Buffer;
|
||||||
|
package->Right = (nint)right.Buffer;
|
||||||
|
package->Answer = (nint)ans.Buffer;
|
||||||
|
package->AnsPrimOffset = ans.KernelRowLength;
|
||||||
|
package->AnsSecOffset = ans.KernelColumnLength;
|
||||||
|
package->LeftPrimOffset = left.KernelColumnLength;
|
||||||
|
package->PrimCount = ans.KernelColumnLength / size;
|
||||||
|
package->SecCount = ans.KernelRowLength / size;
|
||||||
|
package->ElementSize = (int)MatrixElementType.F64;
|
||||||
|
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationSpecial.SEQ_FMA);
|
||||||
|
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
||||||
|
|
||||||
|
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
||||||
|
taskGroup.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static unsafe void Mul(
|
||||||
|
Matrix<double> left,
|
||||||
|
double right,
|
||||||
|
Matrix<double> ans
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int f64 = (int)MatrixElementType.F64;
|
||||||
|
if (left.ColumnLength != ans.ColumnLength || left.RowLength != ans.RowLength) {
|
||||||
|
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
||||||
|
}
|
||||||
|
if (left.Layout != MatrixLayout.DenseRectangle ||
|
||||||
|
ans.Layout != MatrixLayout.DenseRectangle) {
|
||||||
|
throw new NotSupportedException("Only dense rectangle matrices are supported.");
|
||||||
|
}
|
||||||
|
long count = (long)left.KernelColumnLength * left.KernelRowLength;
|
||||||
|
ScalarPacket* scalar = MatrixParallelFactory.CreateScalarPacket();
|
||||||
|
scalar->Data<double>(0) = right;
|
||||||
|
if (count <= 256)
|
||||||
|
{
|
||||||
|
MatrixKernel<double>* leftPtr = left.Buffer;
|
||||||
|
MatrixKernel<double>* ansPtr = ans.Buffer;
|
||||||
|
NativeIntrinsic.Context.mat[f64].buffer_scalar_mul(leftPtr, ansPtr, scalar, count);
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else if (count <= 1024)
|
||||||
|
{
|
||||||
|
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
||||||
|
|
||||||
|
MatrixKernel<double>* leftPtr = left.Buffer;
|
||||||
|
MatrixKernel<double>* ansPtr = ans.Buffer;
|
||||||
|
NativeIntrinsic.Context.mat[f64].buffer_scalar_mul(leftPtr, ansPtr, scalar, count);
|
||||||
|
|
||||||
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<double>();
|
||||||
|
package->Right = (nint)left.Buffer;
|
||||||
|
package->Answer = (nint)ans.Buffer;
|
||||||
|
package->ElementSize = sizeof(double);
|
||||||
|
package->PrimCount = left.KernelColumnLength;
|
||||||
|
package->SecCount = left.KernelRowLength;
|
||||||
|
package->Scalar = scalar;
|
||||||
|
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.RIGHT_ANS_SCALAR_PARAM);
|
||||||
|
package->ComputeHandle = (IntPtr)NativeIntrinsic.Context.mat[f64].buffer_scalar_mul;
|
||||||
|
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
||||||
|
|
||||||
|
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
||||||
|
taskGroup.Dispose();
|
||||||
|
MatrixParallelFactory.Release(scalar);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static unsafe void Sub(
|
||||||
|
Matrix<double> left,
|
||||||
|
Matrix<double> right,
|
||||||
|
Matrix<double> ans
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int f64 = (int)MatrixElementType.F64;
|
||||||
|
if (left.ColumnLength != right.ColumnLength ||
|
||||||
|
left.RowLength != right.RowLength ||
|
||||||
|
left.ColumnLength != ans.ColumnLength ||
|
||||||
|
left.RowLength != ans.RowLength) {
|
||||||
|
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
||||||
|
}
|
||||||
|
if (left.Layout != MatrixLayout.DenseRectangle ||
|
||||||
|
right.Layout != MatrixLayout.DenseRectangle ||
|
||||||
|
ans.Layout != MatrixLayout.DenseRectangle) {
|
||||||
|
throw new NotSupportedException("Only dense rectangle matrices are supported.");
|
||||||
|
}
|
||||||
|
long count = (long)left.KernelColumnLength * left.KernelRowLength;
|
||||||
|
if (count <= 256)
|
||||||
|
{
|
||||||
|
MatrixKernel<double>* leftPtr = left.Buffer;
|
||||||
|
MatrixKernel<double>* rightPtr = right.Buffer;
|
||||||
|
MatrixKernel<double>* ansPtr = ans.Buffer;
|
||||||
|
NativeIntrinsic.Context.mat[f64].buffer_sub(leftPtr, rightPtr, ansPtr, count);
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else if (count <= 1024)
|
||||||
|
{
|
||||||
|
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
||||||
|
|
||||||
|
MatrixKernel<double>* leftPtr = left.Buffer;
|
||||||
|
MatrixKernel<double>* rightPtr = right.Buffer;
|
||||||
|
MatrixKernel<double>* ansPtr = ans.Buffer;
|
||||||
|
NativeIntrinsic.Context.mat[f64].buffer_sub(leftPtr, rightPtr, ansPtr, count);
|
||||||
|
|
||||||
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<double>();
|
||||||
|
package->Left = (nint)left.Buffer;
|
||||||
|
package->Right = (nint)right.Buffer;
|
||||||
|
package->Answer = (nint)ans.Buffer;
|
||||||
|
package->ElementSize = sizeof(double);
|
||||||
|
package->PrimCount = left.KernelColumnLength;
|
||||||
|
package->SecCount = left.KernelRowLength;
|
||||||
|
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.LEFT_RIGHT_ANS_PARAM);
|
||||||
|
package->ComputeHandle = (IntPtr)NativeIntrinsic.Context.mat[f64].buffer_sub;
|
||||||
|
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
||||||
|
|
||||||
|
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
||||||
|
taskGroup.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,7 +34,9 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
internal static class MatrixComputeModel
|
internal static class MatrixComputeModel
|
||||||
{
|
{
|
||||||
|
|
||||||
internal static unsafe void BufferComputeBinary(MatrixParallelTaskPackage* p)
|
internal static unsafe void BufferComputeBinary(
|
||||||
|
MatrixParallelTaskPackage* p
|
||||||
|
)
|
||||||
{
|
{
|
||||||
int size = p->ElementSize * 16;
|
int size = p->ElementSize * 16;
|
||||||
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
||||||
@@ -47,7 +49,9 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallelFactory.Release(p);
|
MatrixParallelFactory.Release(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static unsafe void BufferComputeBinaryScalar(MatrixParallelTaskPackage* p)
|
internal static unsafe void BufferComputeBinaryScalar(
|
||||||
|
MatrixParallelTaskPackage* p
|
||||||
|
)
|
||||||
{
|
{
|
||||||
int size = p->ElementSize * 16;
|
int size = p->ElementSize * 16;
|
||||||
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
||||||
@@ -61,7 +65,9 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallelFactory.Release(p);
|
MatrixParallelFactory.Release(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static unsafe void BufferComputeNoOperatorScalar(MatrixParallelTaskPackage* p)
|
internal static unsafe void BufferComputeNoOperatorScalar(
|
||||||
|
MatrixParallelTaskPackage* p
|
||||||
|
)
|
||||||
{
|
{
|
||||||
int size = p->ElementSize * 16;
|
int size = p->ElementSize * 16;
|
||||||
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
||||||
@@ -71,7 +77,9 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallelFactory.Release(p);
|
MatrixParallelFactory.Release(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static unsafe void BufferComputeUnary(MatrixParallelTaskPackage* p)
|
internal static unsafe void BufferComputeUnary(
|
||||||
|
MatrixParallelTaskPackage* p
|
||||||
|
)
|
||||||
{
|
{
|
||||||
int size = p->ElementSize * 16;
|
int size = p->ElementSize * 16;
|
||||||
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
||||||
@@ -83,7 +91,9 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallelFactory.Release(p);
|
MatrixParallelFactory.Release(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static unsafe void BufferComputeUnaryScalar(MatrixParallelTaskPackage* p)
|
internal static unsafe void BufferComputeUnaryScalar(
|
||||||
|
MatrixParallelTaskPackage* p
|
||||||
|
)
|
||||||
{
|
{
|
||||||
int size = p->ElementSize * 16;
|
int size = p->ElementSize * 16;
|
||||||
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
||||||
@@ -95,12 +105,24 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallelFactory.Release(p);
|
MatrixParallelFactory.Release(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static unsafe void SpecialBufferCompute(MatrixParallelTaskPackage* p)
|
internal static unsafe void SpecialBufferCompute(
|
||||||
|
MatrixParallelTaskPackage* p
|
||||||
|
)
|
||||||
{
|
{
|
||||||
switch ((MatrixOperationSpecial)p->ComputeMode.ParameterStyle)
|
switch ((MatrixOperationSpecial)p->ComputeMode.ParameterStyle)
|
||||||
{
|
{
|
||||||
case MatrixOperationSpecial.SEQ_FMA:
|
case MatrixOperationSpecial.SEQ_FMA:
|
||||||
MatrixCompute.ComputeFmaPanelF32(p);
|
switch ((MatrixElementType)p->ElementSize)
|
||||||
|
{
|
||||||
|
case MatrixElementType.F64:
|
||||||
|
MatrixCompute.ComputeFmaPanelF64(p);
|
||||||
|
return;
|
||||||
|
case MatrixElementType.F32:
|
||||||
|
MatrixCompute.ComputeFmaPanelF32(p);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -78,18 +78,34 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct MatrixOpMode(MatrixIndexStyle style, MatrixOperationParam paramLayout)
|
public struct MatrixOpMode(
|
||||||
|
MatrixIndexStyle style,
|
||||||
|
MatrixOperationParam paramLayout
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
public MatrixIndexStyle OperationStyle = style;
|
public MatrixIndexStyle OperationStyle = style;
|
||||||
|
|
||||||
public MatrixOperationParam ParameterStyle = paramLayout;
|
public MatrixOperationParam ParameterStyle = paramLayout;
|
||||||
|
|
||||||
public MatrixOpMode(MatrixIndexStyle style, MatrixOperationSpecial paramLayout)
|
public MatrixOpMode(
|
||||||
|
MatrixIndexStyle style,
|
||||||
|
MatrixOperationSpecial paramLayout
|
||||||
|
)
|
||||||
: this(style, (MatrixOperationParam)paramLayout) { }
|
: this(style, (MatrixOperationParam)paramLayout) { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum MatrixElementType : int
|
||||||
|
{
|
||||||
|
|
||||||
|
F32 = 0,
|
||||||
|
F64 = 1,
|
||||||
|
I32 = 2,
|
||||||
|
I64 = 3,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 128)]
|
[StructLayout(LayoutKind.Explicit, Size = 128)]
|
||||||
public unsafe struct MatrixParallelTaskPackage
|
public unsafe struct MatrixParallelTaskPackage
|
||||||
{
|
{
|
||||||
@@ -97,7 +113,8 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static unsafe void Copy(
|
public static unsafe void Copy(
|
||||||
MatrixParallelTaskPackage* source,
|
MatrixParallelTaskPackage* source,
|
||||||
MatrixParallelTaskPackage* target)
|
MatrixParallelTaskPackage* target
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Buffer.MemoryCopy(source, target, sizeof(MatrixParallelTaskPackage),
|
Buffer.MemoryCopy(source, target, sizeof(MatrixParallelTaskPackage),
|
||||||
sizeof(MatrixParallelTaskPackage));
|
sizeof(MatrixParallelTaskPackage));
|
||||||
|
|||||||
@@ -295,38 +295,31 @@ INTERNAL int SN_DECL index_pair_sse(short const *str, uint32_t target, int lengt
|
|||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
|
typedef struct mat_intrinsic {
|
||||||
|
BUF_PROC_LRA buffer_add;
|
||||||
|
BUF_PROC_AS buffer_fill;
|
||||||
|
BUF_PROC_RAS buffer_scalar_mul;
|
||||||
|
BUF_PROC_LRA buffer_sub;
|
||||||
|
KER_PROC_RA buffer_transpose;
|
||||||
|
PANEL_PROC build_panel;
|
||||||
|
PANEL_PROC clear_panel;
|
||||||
|
PNL_PROC_LRA panel_fma;
|
||||||
|
PIVOTPROC pivot;
|
||||||
|
PANEL_PROC store_panel;
|
||||||
|
|
||||||
|
} mat_intrinsic;
|
||||||
|
|
||||||
// Mirrors C# IntrinsicContext field order so managed/unmanaged layouts stay in sync.
|
// Mirrors C# IntrinsicContext field order so managed/unmanaged layouts stay in sync.
|
||||||
typedef struct sn_intrinsic {
|
typedef struct sn_intrinsic {
|
||||||
HASH city_hash_simplify;
|
HASH city_hash_simplify;
|
||||||
FACTORIALROC factorial_simd;
|
FACTORIALROC factorial_simd;
|
||||||
INDEX_PAIR index_pair;
|
INDEX_PAIR index_pair;
|
||||||
|
mat_intrinsic mat[4];
|
||||||
BUF_PROC_LRA mat_f32_buffer_add;
|
|
||||||
BUF_PROC_AS mat_f32_buffer_fill;
|
|
||||||
BUF_PROC_RAS mat_f32_buffer_scalar_mul;
|
|
||||||
BUF_PROC_LRA mat_f32_buffer_sub;
|
|
||||||
KER_PROC_RA mat_f32_buffer_transpose;
|
|
||||||
PANEL_PROC mat_f32_build_panel;
|
|
||||||
PANEL_PROC mat_f32_clear_panel;
|
|
||||||
PNL_PROC_LRA mat_f32_panel_fma;
|
|
||||||
PIVOTPROC mat_f32_pivot;
|
|
||||||
PANEL_PROC mat_f32_store_panel;
|
|
||||||
|
|
||||||
// f64 slots (currently unimplemented; filled with NULL in loader)
|
|
||||||
BUF_PROC_LRA mat_f64_buffer_add;
|
|
||||||
BUF_PROC_AS mat_f64_buffer_fill;
|
|
||||||
BUF_PROC_RAS mat_f64_buffer_scalar_mul;
|
|
||||||
BUF_PROC_LRA mat_f64_buffer_sub;
|
|
||||||
KER_PROC_RA mat_f64_buffer_transpose;
|
|
||||||
PANEL_PROC mat_f64_build_panel;
|
|
||||||
PANEL_PROC mat_f64_clear_panel;
|
|
||||||
PNL_PROC_LRA mat_f64_panel_fma;
|
|
||||||
PIVOTPROC mat_f64_pivot;
|
|
||||||
PANEL_PROC mat_f64_store_panel;
|
|
||||||
|
|
||||||
VECTORNORMALIZEPROC vec_f32_normalize_3;
|
VECTORNORMALIZEPROC vec_f32_normalize_3;
|
||||||
} sn_intrinsic;
|
} sn_intrinsic;
|
||||||
|
|
||||||
|
typedef enum elment_type { F32 = 0, F64 = 1, I32 = 2, I64 = 3 } element_type;
|
||||||
|
|
||||||
typedef enum most_advanced_instruction {
|
typedef enum most_advanced_instruction {
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
SSE = __IA_SUPPORT_SSE42,
|
SSE = __IA_SUPPORT_SSE42,
|
||||||
|
|||||||
@@ -66,27 +66,27 @@ void load_intrinsic_sse(sn_intrinsic *context)
|
|||||||
context->factorial_simd = factorial_simd_sse;
|
context->factorial_simd = factorial_simd_sse;
|
||||||
context->index_pair = index_pair_sse;
|
context->index_pair = index_pair_sse;
|
||||||
|
|
||||||
context->mat_f32_buffer_add = BUF_PROC(float, sse, add);
|
context->mat[F32].buffer_add = BUF_PROC(float, sse, add);
|
||||||
context->mat_f32_buffer_fill = BUF_PROC(float, sse, fill);
|
context->mat[F32].buffer_fill = BUF_PROC(float, sse, fill);
|
||||||
context->mat_f32_buffer_scalar_mul = BUF_PROC(float, sse, scalar_mul);
|
context->mat[F32].buffer_scalar_mul = BUF_PROC(float, sse, scalar_mul);
|
||||||
context->mat_f32_buffer_sub = BUF_PROC(float, sse, sub);
|
context->mat[F32].buffer_sub = BUF_PROC(float, sse, sub);
|
||||||
context->mat_f32_buffer_transpose = KER_PROC(float, sse, transpose);
|
context->mat[F32].buffer_transpose = KER_PROC(float, sse, transpose);
|
||||||
context->mat_f32_build_panel = NULL;
|
context->mat[F32].build_panel = NULL;
|
||||||
context->mat_f32_clear_panel = PNL_PROC(float, sse, clear);
|
context->mat[F32].clear_panel = PNL_PROC(float, sse, clear);
|
||||||
context->mat_f32_panel_fma = PNL_PROC(float, sse, fma);
|
context->mat[F32].panel_fma = PNL_PROC(float, sse, fma);
|
||||||
context->mat_f32_pivot = pivot_float;
|
context->mat[F32].pivot = pivot_float;
|
||||||
context->mat_f32_store_panel = NULL;
|
context->mat[F32].store_panel = NULL;
|
||||||
|
|
||||||
context->mat_f64_buffer_add = BUF_PROC(double, sse, add);
|
context->mat[F64].buffer_add = BUF_PROC(double, sse, add);
|
||||||
context->mat_f64_buffer_fill = BUF_PROC(double, sse, fill);
|
context->mat[F64].buffer_fill = BUF_PROC(double, sse, fill);
|
||||||
context->mat_f64_buffer_scalar_mul = BUF_PROC(double, sse, scalar_mul);
|
context->mat[F64].buffer_scalar_mul = BUF_PROC(double, sse, scalar_mul);
|
||||||
context->mat_f64_buffer_sub = BUF_PROC(double, sse, sub);
|
context->mat[F64].buffer_sub = BUF_PROC(double, sse, sub);
|
||||||
context->mat_f64_buffer_transpose = NULL;
|
context->mat[F64].buffer_transpose = NULL;
|
||||||
context->mat_f64_build_panel = NULL;
|
context->mat[F64].build_panel = NULL;
|
||||||
context->mat_f64_clear_panel = PNL_PROC(double, sse, clear);
|
context->mat[F64].clear_panel = PNL_PROC(double, sse, clear);
|
||||||
context->mat_f64_panel_fma = NULL;
|
context->mat[F64].panel_fma = NULL;
|
||||||
context->mat_f64_pivot = NULL;
|
context->mat[F64].pivot = NULL;
|
||||||
context->mat_f64_store_panel = NULL;
|
context->mat[F64].store_panel = NULL;
|
||||||
|
|
||||||
context->vec_f32_normalize_3 = f32_normalize;
|
context->vec_f32_normalize_3 = f32_normalize;
|
||||||
}
|
}
|
||||||
@@ -97,27 +97,27 @@ void load_intrinsic_avx(sn_intrinsic *context)
|
|||||||
context->factorial_simd = factorial_simd_sse;
|
context->factorial_simd = factorial_simd_sse;
|
||||||
context->index_pair = index_pair_sse;
|
context->index_pair = index_pair_sse;
|
||||||
|
|
||||||
context->mat_f32_buffer_add = BUF_PROC(float, avx, add);
|
context->mat[F32].buffer_add = BUF_PROC(float, avx, add);
|
||||||
context->mat_f32_buffer_fill = BUF_PROC(float, avx, fill);
|
context->mat[F32].buffer_fill = BUF_PROC(float, avx, fill);
|
||||||
context->mat_f32_buffer_scalar_mul = BUF_PROC(float, avx, scalar_mul);
|
context->mat[F32].buffer_scalar_mul = BUF_PROC(float, avx, scalar_mul);
|
||||||
context->mat_f32_buffer_sub = BUF_PROC(float, avx, sub);
|
context->mat[F32].buffer_sub = BUF_PROC(float, avx, sub);
|
||||||
context->mat_f32_buffer_transpose = KER_PROC(float, avx, transpose);
|
context->mat[F32].buffer_transpose = KER_PROC(float, avx, transpose);
|
||||||
context->mat_f32_build_panel = BUILD_PANEL(avx, float);
|
context->mat[F32].build_panel = BUILD_PANEL(avx, float);
|
||||||
context->mat_f32_clear_panel = PNL_PROC(float, avx, clear);
|
context->mat[F32].clear_panel = PNL_PROC(float, avx, clear);
|
||||||
context->mat_f32_panel_fma = PNL_PROC(float, avx, fma);
|
context->mat[F32].panel_fma = PNL_PROC(float, avx, fma);
|
||||||
context->mat_f32_pivot = pivot_float;
|
context->mat[F32].pivot = pivot_float;
|
||||||
context->mat_f32_store_panel = STORE_PANEL(avx, float);
|
context->mat[F32].store_panel = STORE_PANEL(avx, float);
|
||||||
|
|
||||||
context->mat_f64_buffer_add = BUF_PROC(double, avx, add);
|
context->mat[F64].buffer_add = BUF_PROC(double, avx, add);
|
||||||
context->mat_f64_buffer_fill = BUF_PROC(double, avx, fill);
|
context->mat[F64].buffer_fill = BUF_PROC(double, avx, fill);
|
||||||
context->mat_f64_buffer_scalar_mul = BUF_PROC(double, avx, scalar_mul);
|
context->mat[F64].buffer_scalar_mul = BUF_PROC(double, avx, scalar_mul);
|
||||||
context->mat_f64_buffer_sub = BUF_PROC(double, avx, sub);
|
context->mat[F64].buffer_sub = BUF_PROC(double, avx, sub);
|
||||||
context->mat_f64_buffer_transpose = NULL;
|
context->mat[F64].buffer_transpose = NULL;
|
||||||
context->mat_f64_build_panel = NULL;
|
context->mat[F64].build_panel = NULL;
|
||||||
context->mat_f64_clear_panel = PNL_PROC(double, avx, clear);
|
context->mat[F64].clear_panel = PNL_PROC(double, avx, clear);
|
||||||
context->mat_f64_panel_fma = NULL;
|
context->mat[F64].panel_fma = NULL;
|
||||||
context->mat_f64_pivot = NULL;
|
context->mat[F64].pivot = NULL;
|
||||||
context->mat_f64_store_panel = NULL;
|
context->mat[F64].store_panel = NULL;
|
||||||
|
|
||||||
context->vec_f32_normalize_3 = f32_normalize;
|
context->vec_f32_normalize_3 = f32_normalize;
|
||||||
}
|
}
|
||||||
@@ -128,27 +128,27 @@ void load_intrinsic_512(sn_intrinsic *context)
|
|||||||
context->factorial_simd = factorial_simd_sse;
|
context->factorial_simd = factorial_simd_sse;
|
||||||
context->index_pair = index_pair_sse;
|
context->index_pair = index_pair_sse;
|
||||||
|
|
||||||
context->mat_f32_buffer_add = BUF_PROC(float, 512, add);
|
context->mat[F32].buffer_add = BUF_PROC(float, 512, add);
|
||||||
context->mat_f32_buffer_fill = BUF_PROC(float, 512, fill);
|
context->mat[F32].buffer_fill = BUF_PROC(float, 512, fill);
|
||||||
context->mat_f32_buffer_scalar_mul = BUF_PROC(float, 512, scalar_mul);
|
context->mat[F32].buffer_scalar_mul = BUF_PROC(float, 512, scalar_mul);
|
||||||
context->mat_f32_buffer_sub = BUF_PROC(float, 512, sub);
|
context->mat[F32].buffer_sub = BUF_PROC(float, 512, sub);
|
||||||
context->mat_f32_buffer_transpose = KER_PROC(float, 512, transpose);
|
context->mat[F32].buffer_transpose = KER_PROC(float, 512, transpose);
|
||||||
context->mat_f32_build_panel = BUILD_PANEL(512, float);
|
context->mat[F32].build_panel = BUILD_PANEL(512, float);
|
||||||
context->mat_f32_clear_panel = PNL_PROC(float, 512, clear);
|
context->mat[F32].clear_panel = PNL_PROC(float, 512, clear);
|
||||||
context->mat_f32_panel_fma = PNL_PROC(float, 512, fma);
|
context->mat[F32].panel_fma = PNL_PROC(float, 512, fma);
|
||||||
context->mat_f32_pivot = pivot_float;
|
context->mat[F32].pivot = pivot_float;
|
||||||
context->mat_f32_store_panel = STORE_PANEL(512, float);
|
context->mat[F32].store_panel = STORE_PANEL(512, float);
|
||||||
|
|
||||||
context->mat_f64_buffer_add = NULL;
|
context->mat[F64].buffer_add = BUF_PROC(double, 512, add);
|
||||||
context->mat_f64_buffer_fill = NULL;
|
context->mat[F64].buffer_fill = BUF_PROC(double, 512, fill);
|
||||||
context->mat_f64_buffer_scalar_mul = NULL;
|
context->mat[F64].buffer_scalar_mul = BUF_PROC(double, 512, scalar_mul);
|
||||||
context->mat_f64_buffer_sub = NULL;
|
context->mat[F64].buffer_sub = BUF_PROC(double, 512, sub);
|
||||||
context->mat_f64_buffer_transpose = NULL;
|
context->mat[F64].buffer_transpose = NULL;
|
||||||
context->mat_f64_build_panel = NULL;
|
context->mat[F64].build_panel = BUILD_PANEL(512, double);
|
||||||
context->mat_f64_clear_panel = NULL;
|
context->mat[F64].clear_panel = PNL_PROC(double, 512, clear);
|
||||||
context->mat_f64_panel_fma = NULL;
|
context->mat[F64].panel_fma = NULL;
|
||||||
context->mat_f64_pivot = NULL;
|
context->mat[F64].pivot = NULL;
|
||||||
context->mat_f64_store_panel = NULL;
|
context->mat[F64].store_panel = STORE_PANEL(512, double);
|
||||||
|
|
||||||
context->vec_f32_normalize_3 = f32_normalize;
|
context->vec_f32_normalize_3 = f32_normalize;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user