daily update on 20240325 by nitload youmu

This commit is contained in:
YoumuLiu
2024-03-25 09:26:53 +08:00
parent 9a10ec201c
commit 02be081eee
142 changed files with 11277 additions and 572 deletions
@@ -53,7 +53,7 @@ namespace StgSharp.Graphics
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected ShaderProgram CreateShaderProgram()
{
return new ShaderProgram(GL);
return new ShaderProgram(this);
}
}
@@ -105,16 +105,16 @@ namespace StgSharp.Graphics
public class ShaderProgram
{
private readonly IglFunc GL;
private readonly Form binding;
internal readonly glHandle handle;
/// <summary>
/// Inti a shader with no program attached.
/// </summary>
internal unsafe ShaderProgram(IglFunc gl)
internal unsafe ShaderProgram(Form binding)
{
GL = gl;
handle = GL.CreateProgram();
this.binding = binding;
handle = binding.GL.CreateProgram();
}
/// <summary>
@@ -126,7 +126,7 @@ namespace StgSharp.Graphics
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe Uniform<T> GetUniform<T>(string name) where T : struct
{
return new Uniform<T>(this, name, GL);
return new Uniform<T>(this, name, binding);
}
/// <summary>
@@ -139,7 +139,7 @@ namespace StgSharp.Graphics
where T : struct
where U : struct
{
return new Uniform<T, U>(this, name, GL);
return new Uniform<T, U>(this, name, binding);
}
/// <summary>
@@ -153,7 +153,7 @@ namespace StgSharp.Graphics
where U : struct
where V : struct
{
return new Uniform<T, U, V>(this, name, GL);
return new Uniform<T, U, V>(this, name, binding);
}
/// <summary>
@@ -161,7 +161,7 @@ namespace StgSharp.Graphics
/// </summary>
public unsafe void Link()
{
if (InternalIO.InternalLinkShaderProgram(GL.Context, handle.Value) == 0)
if (InternalIO.InternalLinkShaderProgram(binding.GL.Context, handle.Value) == 0)
{
IntPtr logPtr = InternalIO.InternalReadSSCLog();
try
@@ -185,7 +185,7 @@ namespace StgSharp.Graphics
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void Use()
{
GL.UseProgram(handle);
binding.GL.UseProgram(handle);
}
}
@@ -42,7 +42,7 @@ namespace StgSharp.Graphics
public class Uniform<T> where T : struct
{
private IglFunc GL;
private Form binding;
internal glSHandle id;
internal unsafe Uniform(glSHandle id)
@@ -51,10 +51,10 @@ namespace StgSharp.Graphics
}
internal unsafe Uniform(
ShaderProgram program, string name, IglFunc gl)
ShaderProgram program, string name, Form binding)
{
GL = gl;
id = GL.GetUniformLocation(program.handle, name);
this.binding = binding;
id = binding.GL.GetUniformLocation(program.handle, name);
}
}
@@ -64,7 +64,7 @@ namespace StgSharp.Graphics
where U : struct
{
private IglFunc GL;
private Form binding;
internal glSHandle id;
internal unsafe Uniform(glSHandle id)
@@ -73,10 +73,10 @@ namespace StgSharp.Graphics
}
internal unsafe Uniform(
ShaderProgram program, string name, IglFunc gl)
ShaderProgram program, string name, Form binding)
{
GL = gl;
id = GL.GetUniformLocation(program.handle, name);
this.binding = binding;
id = binding.GL.GetUniformLocation(program.handle, name);
}
}
@@ -87,7 +87,7 @@ namespace StgSharp.Graphics
where V : struct
{
private IglFunc GL;
private Form binding;
internal glSHandle id;
internal unsafe Uniform(glSHandle id)
@@ -95,10 +95,10 @@ namespace StgSharp.Graphics
this.id = id;
}
public unsafe Uniform(ShaderProgram program, string name, IglFunc gl)
public unsafe Uniform(ShaderProgram program, string name, Form binding)
{
GL = gl;
id = GL.GetUniformLocation(program.handle, name);
this.binding = binding;
id = binding.GL.GetUniformLocation(program.handle, name);
}
}
@@ -110,7 +110,7 @@ namespace StgSharp.Graphics
where W : struct
{
private IglFunc GL;
private Form binding;
internal glSHandle id;
internal unsafe Uniform(glSHandle id)
@@ -118,10 +118,10 @@ namespace StgSharp.Graphics
this.id = id;
}
internal unsafe Uniform(ShaderProgram program, string name, IglFunc gl)
internal unsafe Uniform(ShaderProgram program, string name, Form binding)
{
GL = gl;
id = GL.GetUniformLocation(program.handle, name);
this.binding = binding;
id = binding.GL.GetUniformLocation(program.handle, name);
}
}
@@ -281,8 +281,8 @@ namespace StgSharp.Graphics
unsafe void IglFunc.SetValue(Uniform<Vec4d> uniform, Vec4d vec)
{
Vec4d m = vec;
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr, (IntPtr)(&m));
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr);
frameOpBuffer.ParamEnqueue(vec);
frameOpBuffer.MethodEnqueue(UniformVal1fvPtr);
}