daily update on 20240305 by nitload youmu

This commit is contained in:
YoumuLiu
2024-03-05 10:17:02 +08:00
parent 1f2fca4c8f
commit 6a0cccae79
156 changed files with 23040 additions and 1385 deletions
@@ -1,4 +1,5 @@
using StgSharp;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
@@ -19,9 +20,10 @@ namespace StgSharp.Graphics
return new ShaderProgram(GL);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected Shader CreateShader(ShaderType type, int count)
{
return new Shader(this.gl, new glHandleSet(count), type);
return new Shader(this.gl, gl.CreateShaderSet(count, type), type);
}
}
@@ -38,18 +40,20 @@ namespace StgSharp.Graphics
type = usage;
}
/// <summary>
/// Compile the vertex shader to be attached to this shader.
/// </summary>
/// <param name="code">GLSL code of vertex shader.</param>
public unsafe void Compile(params string[] code)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void Compile(int index, string code)
{
glHandleSet.Copy(GL.CompileShader(type, code), handle);
if (code == null)
{
throw new ArgumentNullException("Must provide enough code");
}
GL.LoadShaderSource(handle[index], code + '\0');
GL.CompileShader(handle[index]);
}
//TODO:写链接着色器的文档注释
/// <summary>
///
///
/// </summary>
/// <param name="target"></param>
/// <param name="index"></param>
@@ -103,8 +107,8 @@ namespace StgSharp.Graphics
}
/// <summary>
/// Get a uniform form current shader,
/// the value type of the uniform should be provided.
/// Get a uniform form current shader,
/// the value type of the uniform should be provided.
/// </summary>
/// <param name="name">Name of the Uniform in shader code</param>
/// <returns></returns>
@@ -113,9 +117,10 @@ namespace StgSharp.Graphics
{
return new Uniform<T>(this, name, GL);
}
/// <summary>
/// Get a uniform form current shader,
/// the value type of the uniform should be provided.
/// Get a uniform form current shader,
/// the value type of the uniform should be provided.
/// </summary>
/// <param name="name">Name of the Uniform in shader code</param>
/// <returns></returns>
@@ -125,9 +130,10 @@ namespace StgSharp.Graphics
{
return new Uniform<T, U>(this, name, GL);
}
/// <summary>
/// Get a uniform form current shader,
/// the value type of the uniform should be provided.
/// Get a uniform form current shader,
/// the value type of the uniform should be provided.
/// </summary>
/// <param name="name">Name of the Uniform in shader code</param>
/// <returns></returns>
@@ -148,4 +154,4 @@ namespace StgSharp.Graphics
GL.UseProgram(handle);
}
}
}
}