daily update on 2024.03.18 by itload youmu
This commit is contained in:
@@ -1,4 +1,34 @@
|
||||
using StgSharp;
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="Shader.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. 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;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,6 +40,12 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
public partial class Form
|
||||
{
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected Shader CreateShader(ShaderType type, int count)
|
||||
{
|
||||
return new Shader(this.gl, gl.CreateShaderSet(count, type), type);
|
||||
}
|
||||
/// <summary>
|
||||
/// Create an instance of <see cref="Shader"/> program
|
||||
/// </summary>
|
||||
@@ -20,18 +56,14 @@ namespace StgSharp.Graphics
|
||||
return new ShaderProgram(GL);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected Shader CreateShader(ShaderType type, int count)
|
||||
{
|
||||
return new Shader(this.gl, gl.CreateShaderSet(count, type), type);
|
||||
}
|
||||
}
|
||||
|
||||
public class Shader
|
||||
{
|
||||
|
||||
private readonly IglFunc GL;
|
||||
internal readonly glHandleSet handle;
|
||||
public readonly ShaderType type;
|
||||
private readonly IglFunc GL;
|
||||
|
||||
internal Shader(IglFunc gl, glHandleSet handle, ShaderType usage)
|
||||
{
|
||||
@@ -40,17 +72,6 @@ namespace StgSharp.Graphics
|
||||
type = usage;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void Compile(int index, string code)
|
||||
{
|
||||
if (code == null)
|
||||
{
|
||||
throw new ArgumentNullException("Must provide enough code");
|
||||
}
|
||||
GL.LoadShaderSource(handle[index], code + '\0');
|
||||
GL.CompileShader(handle[index]);
|
||||
}
|
||||
|
||||
//TODO:写链接着色器的文档注释
|
||||
/// <summary>
|
||||
///
|
||||
@@ -63,16 +84,29 @@ namespace StgSharp.Graphics
|
||||
GL.AttachShader(target.handle, handle[index]);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void Compile(int index, string code)
|
||||
{
|
||||
if (code == null)
|
||||
{
|
||||
throw new ArgumentNullException("Must provide enough code");
|
||||
}
|
||||
GL.LoadShaderSource(handle[index], $"{code}\0");
|
||||
GL.CompileShader(handle[index]);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"This is a {type} shader, its shader handles are {handle.ToString()}.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ShaderProgram
|
||||
{
|
||||
internal readonly glHandle handle;
|
||||
|
||||
private readonly IglFunc GL;
|
||||
internal readonly glHandle handle;
|
||||
|
||||
/// <summary>
|
||||
/// Inti a shader with no program attached.
|
||||
@@ -83,29 +117,6 @@ namespace StgSharp.Graphics
|
||||
handle = GL.CreateProgram();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Link the shader to current context.
|
||||
/// </summary>
|
||||
public unsafe void Link()
|
||||
{
|
||||
if (InternalIO.InternalLinkShaderProgram(GL.Context, handle.Value) == 0)
|
||||
{
|
||||
IntPtr logPtr = InternalIO.InternalReadSSCLog();
|
||||
try
|
||||
{
|
||||
byte[] logByte = new byte[512];
|
||||
Marshal.Copy(logPtr, logByte, 0, 512);
|
||||
string log = Encoding.UTF8.GetString(logByte);
|
||||
log = log.Replace("\0", "");
|
||||
InternalIO.InternalWriteLog(log, LogType.Error);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
InternalIO.InternalWriteLog(ex.Message, LogType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a uniform form current shader,
|
||||
/// the value type of the uniform should be provided.
|
||||
@@ -145,6 +156,29 @@ namespace StgSharp.Graphics
|
||||
return new Uniform<T, U, V>(this, name, GL);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Link the shader to current context.
|
||||
/// </summary>
|
||||
public unsafe void Link()
|
||||
{
|
||||
if (InternalIO.InternalLinkShaderProgram(GL.Context, handle.Value) == 0)
|
||||
{
|
||||
IntPtr logPtr = InternalIO.InternalReadSSCLog();
|
||||
try
|
||||
{
|
||||
byte[] logByte = new byte[512];
|
||||
Marshal.Copy(logPtr, logByte, 0, 512);
|
||||
string log = Encoding.UTF8.GetString(logByte);
|
||||
log = log.Replace("\0", string.Empty);
|
||||
InternalIO.InternalWriteLog(log, LogType.Error);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
InternalIO.InternalWriteLog(ex.Message, LogType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Let the current context use this shader.
|
||||
/// </summary>
|
||||
@@ -153,5 +187,6 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
GL.UseProgram(handle);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,34 @@
|
||||
using StgSharp.Graphics;
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ShaderGenerator.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. 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.Graphics;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,6 +41,7 @@ namespace StgSharp.Graphics.GL.ShaderEdit
|
||||
{
|
||||
public class ShaderGenerator
|
||||
{
|
||||
|
||||
private List<string> codeList;
|
||||
private List<ShaderFunction> usedShaderFunctions;
|
||||
|
||||
@@ -18,19 +49,18 @@ namespace StgSharp.Graphics.GL.ShaderEdit
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ShaderFunction
|
||||
{
|
||||
private string name;
|
||||
|
||||
private List<string> codeList;
|
||||
private List<ShaderParameter> inputList;
|
||||
private string name;
|
||||
private ShaderParameter outPut;
|
||||
|
||||
public int ParameterCount
|
||||
{
|
||||
get { return inputList.Count; }
|
||||
}
|
||||
public int ParameterCount => inputList.Count;
|
||||
|
||||
public void EmitCall(ShaderFunction function, ShaderParameter outPut, params ShaderParameter[] inputParams)
|
||||
{
|
||||
@@ -52,7 +82,7 @@ namespace StgSharp.Graphics.GL.ShaderEdit
|
||||
throw new Exception("Provided parameters does not match function's parameter list.");
|
||||
}
|
||||
}
|
||||
string codeLine = ""; // adding a line like " outvalue = Func(input1, input2,...); "
|
||||
string codeLine = string.Empty; // adding a line like " outvalue = Func(input1, input2,...); "
|
||||
if (outPut != ShaderParameter.Void)
|
||||
{
|
||||
codeLine += $"{outPut.name} = ";
|
||||
@@ -65,13 +95,16 @@ namespace StgSharp.Graphics.GL.ShaderEdit
|
||||
codeLine += ");\n";
|
||||
codeList.Add(codeLine);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ShaderParameter
|
||||
{
|
||||
internal readonly InternalShaderType type;
|
||||
internal readonly string name;
|
||||
|
||||
public static readonly ShaderParameter Void = new ShaderParameter(string.Empty, InternalShaderType.Void);
|
||||
internal readonly bool isReadOnly;
|
||||
internal readonly string name;
|
||||
internal readonly InternalShaderType type;
|
||||
|
||||
public ShaderParameter(string name, InternalShaderType type)
|
||||
{
|
||||
@@ -80,8 +113,6 @@ namespace StgSharp.Graphics.GL.ShaderEdit
|
||||
isReadOnly = false;
|
||||
}
|
||||
|
||||
public static readonly ShaderParameter Void = new ShaderParameter("", InternalShaderType.Void);
|
||||
|
||||
public static bool IsSameType(ShaderParameter param1, ShaderParameter param2)
|
||||
{
|
||||
if (param1.type != InternalShaderType.Struct)
|
||||
@@ -93,6 +124,7 @@ namespace StgSharp.Graphics.GL.ShaderEdit
|
||||
throw new Exception("Struct is currently not supported.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum InternalShaderType
|
||||
|
||||
@@ -1,4 +1,34 @@
|
||||
using StgSharp.Math;
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="Uniform.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. 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.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,8 +41,14 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
public class Uniform<T> where T : struct
|
||||
{
|
||||
internal glSHandle id;
|
||||
|
||||
private IglFunc GL;
|
||||
internal glSHandle id;
|
||||
|
||||
internal unsafe Uniform(glSHandle id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
internal unsafe Uniform(
|
||||
ShaderProgram program, string name, IglFunc gl)
|
||||
@@ -21,18 +57,20 @@ namespace StgSharp.Graphics
|
||||
id = GL.GetUniformLocation(program.handle, name);
|
||||
}
|
||||
|
||||
internal unsafe Uniform(glSHandle id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
public class Uniform<T, U>
|
||||
where T : struct
|
||||
where U : struct
|
||||
{
|
||||
internal glSHandle id;
|
||||
|
||||
private IglFunc GL;
|
||||
internal glSHandle id;
|
||||
|
||||
internal unsafe Uniform(glSHandle id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
internal unsafe Uniform(
|
||||
ShaderProgram program, string name, IglFunc gl)
|
||||
@@ -41,10 +79,6 @@ namespace StgSharp.Graphics
|
||||
id = GL.GetUniformLocation(program.handle, name);
|
||||
}
|
||||
|
||||
internal unsafe Uniform(glSHandle id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
public class Uniform<T, U, V>
|
||||
@@ -52,8 +86,14 @@ namespace StgSharp.Graphics
|
||||
where U : struct
|
||||
where V : struct
|
||||
{
|
||||
internal glSHandle id;
|
||||
|
||||
private IglFunc GL;
|
||||
internal glSHandle id;
|
||||
|
||||
internal unsafe Uniform(glSHandle id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public unsafe Uniform(ShaderProgram program, string name, IglFunc gl)
|
||||
{
|
||||
@@ -61,10 +101,6 @@ namespace StgSharp.Graphics
|
||||
id = GL.GetUniformLocation(program.handle, name);
|
||||
}
|
||||
|
||||
internal unsafe Uniform(glSHandle id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
public class Uniform<T, U, V, W>
|
||||
@@ -73,8 +109,14 @@ namespace StgSharp.Graphics
|
||||
where V : struct
|
||||
where W : struct
|
||||
{
|
||||
internal glSHandle id;
|
||||
|
||||
private IglFunc GL;
|
||||
internal glSHandle id;
|
||||
|
||||
internal unsafe Uniform(glSHandle id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
internal unsafe Uniform(ShaderProgram program, string name, IglFunc gl)
|
||||
{
|
||||
@@ -82,14 +124,23 @@ namespace StgSharp.Graphics
|
||||
id = GL.GetUniformLocation(program.handle, name);
|
||||
}
|
||||
|
||||
internal unsafe Uniform(glSHandle id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
internal partial class GLonRender : IglFunc
|
||||
{
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void SetValue(Uniform<float, float, float, float> uniform, Vec4d vec)
|
||||
{
|
||||
api->glUniform1fv(uniform.id.DirectValue, 4, &vec);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void SetValue(Uniform<Vec4d> uniform, Vec4d vec)
|
||||
{
|
||||
api->glUniform1fv(uniform.id.DirectValue, 4, &vec);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.SetValue(Uniform<float> uniform, float v0)
|
||||
{
|
||||
@@ -120,21 +171,11 @@ namespace StgSharp.Graphics
|
||||
api->glUniform4f(uniform.id.DirectValue, v0, v1, v2, v3);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void SetValue(Uniform<float, float, float, float> uniform, Vec4d vec)
|
||||
{
|
||||
api->glUniform1fv(uniform.id.DirectValue, 4, &vec);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void SetValue(Uniform<Vec4d> uniform, Vec4d vec)
|
||||
{
|
||||
api->glUniform1fv(uniform.id.DirectValue, 4, &vec);
|
||||
}
|
||||
}
|
||||
|
||||
internal unsafe partial class GLonUpdate
|
||||
{
|
||||
|
||||
private IntPtr UniformVal1fPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal1f;
|
||||
private IntPtr UniformVal1fvPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal1fv;
|
||||
private IntPtr UniformVal1iPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal1i;
|
||||
@@ -142,6 +183,53 @@ namespace StgSharp.Graphics
|
||||
private IntPtr UniformVal3fPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal3f;
|
||||
private IntPtr UniformVal4fPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal4f;
|
||||
|
||||
private static void UniformVal1f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||
{
|
||||
M128 m = default;
|
||||
frameOpBuffer.TryDequeue(out m);
|
||||
activatedContext->glUniform1f(*(int*)m.Read<ulong>(0), m.Read<uint>(2));
|
||||
}
|
||||
|
||||
private static unsafe void UniformVal1fv(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||
{
|
||||
M128 m = default, v = default;
|
||||
frameOpBuffer.TryDequeue(out m);
|
||||
frameOpBuffer.TryDequeue(out v);
|
||||
activatedContext->glUniform1fv(*(int*)m.Read<ulong>(0), 4, (Vec4d*)&v);
|
||||
}
|
||||
|
||||
private static void UniformVal1i(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||
{
|
||||
M128 m = default;
|
||||
frameOpBuffer.TryDequeue(out m);
|
||||
activatedContext->glUniform1i(*(int*)m.Read<ulong>(0), m.Read<int>(2));
|
||||
}
|
||||
|
||||
private static void UniformVal2f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||
{
|
||||
M128 m = default;
|
||||
frameOpBuffer.TryDequeue(out m);
|
||||
activatedContext->glUniform2f(*(int*)m.Read<ulong>(0), m.Read<float>(2), m.Read<float>(3));
|
||||
}
|
||||
|
||||
private static void UniformVal3f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||
{
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
M128 m = default;
|
||||
frameOpBuffer.TryDequeue(out handle);
|
||||
frameOpBuffer.TryDequeue(out m);
|
||||
activatedContext->glUniform3f(*(int*)handle, m.Read<float>(0), m.Read<float>(1), m.Read<float>(2));
|
||||
}
|
||||
|
||||
private static void UniformVal4f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||
{
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
M128 m = default;
|
||||
frameOpBuffer.TryDequeue(out handle);
|
||||
frameOpBuffer.TryDequeue(out m);
|
||||
activatedContext->glUniform4f(*(int*)handle, m.Read<float>(0), m.Read<float>(1), m.Read<float>(2), m.Read<float>(3));
|
||||
}
|
||||
|
||||
unsafe void IglFunc.SetValue(Uniform<float, float, float> uniform, float f0, float f1, float f2)
|
||||
{
|
||||
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr);
|
||||
@@ -194,55 +282,9 @@ namespace StgSharp.Graphics
|
||||
unsafe void IglFunc.SetValue(Uniform<Vec4d> uniform, Vec4d vec)
|
||||
{
|
||||
Vec4d m = vec;
|
||||
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr, (IntPtr)(Vec4d*)&m);
|
||||
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr, (IntPtr)(&m));
|
||||
frameOpBuffer.MethodEnqueue(UniformVal1fvPtr);
|
||||
}
|
||||
|
||||
private static void UniformVal1f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||
{
|
||||
M128 m = default;
|
||||
frameOpBuffer.TryDequeue(out m);
|
||||
activatedContext->glUniform1f(*(int*)m.Read<ulong>(0), m.Read<uint>(2));
|
||||
}
|
||||
|
||||
private static unsafe void UniformVal1fv(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||
{
|
||||
M128 m = default, v = default;
|
||||
frameOpBuffer.TryDequeue(out m);
|
||||
frameOpBuffer.TryDequeue(out v);
|
||||
activatedContext->glUniform1fv(*(int*)m.Read<ulong>(0), 4, (Vec4d*)&v);
|
||||
}
|
||||
|
||||
private static void UniformVal1i(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||
{
|
||||
M128 m = default;
|
||||
frameOpBuffer.TryDequeue(out m);
|
||||
activatedContext->glUniform1i(*(int*)m.Read<ulong>(0), m.Read<int>(2));
|
||||
}
|
||||
|
||||
private static void UniformVal2f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||
{
|
||||
M128 m = default;
|
||||
frameOpBuffer.TryDequeue(out m);
|
||||
activatedContext->glUniform2f(*(int*)m.Read<ulong>(0), m.Read<float>(2), m.Read<float>(3));
|
||||
}
|
||||
|
||||
private static void UniformVal3f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||
{
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
M128 m = default;
|
||||
frameOpBuffer.TryDequeue(out handle);
|
||||
frameOpBuffer.TryDequeue(out m);
|
||||
activatedContext->glUniform3f(*(int*)handle, m.Read<float>(0), m.Read<float>(1), m.Read<float>(2));
|
||||
}
|
||||
|
||||
private static void UniformVal4f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||
{
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
M128 m = default;
|
||||
frameOpBuffer.TryDequeue(out handle);
|
||||
frameOpBuffer.TryDequeue(out m);
|
||||
activatedContext->glUniform4f(*(int*)handle, m.Read<float>(0), m.Read<float>(1), m.Read<float>(2), m.Read<float>(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user