daily update on 20240610 by nitload youmu

This commit is contained in:
Nitload
2024-06-10 15:11:01 +08:00
parent c0093f7b5c
commit f6963b8e00
96 changed files with 2927 additions and 2290 deletions
@@ -60,14 +60,14 @@ namespace StgSharp.Graphics.GL
}
}
public class Shader : SSDSerializable
public class Shader : ISSDSerializable
{
private readonly IntPtr context;
internal readonly glHandleSet handle;
public readonly ShaderType type;
public override SerializableTypeCode SSDTypeCode => SerializableTypeCode.Shader;
public SerializableTypeCode SSDTypeCode => SerializableTypeCode.Shader;
internal unsafe Shader(glHandleSet handle, ShaderType usage)
{
@@ -126,27 +126,26 @@ namespace StgSharp.Graphics.GL
return $"This is a {type} shader, its shader handles are {handle.ToString()}.";
}
//TODO shader 的序列化究极麻烦,原因是shader的架构问题
public override byte[] GetBytes()
public byte[] GetBytes()
{
throw new NotImplementedException();
return Array.Empty<byte>();
}
public void CheckStatus(int index, ShaderStatus status)
{
string log = glFunc.GetShaderStatus(this,index, (int)status);
if (log != "")
if (!string.IsNullOrEmpty(log))
{
throw new Exception($"Shader Error\n{status}\n" + log);
throw new Exception($"Shader Error \t{status}\n" + log);
}
}
public override byte[] GetBytes(out int length)
public byte[] GetBytes(out int length)
{
throw new NotImplementedException();
}
internal override void BuildFromByteStream(byte[] stream)
public void FromBytes(byte[] stream)
{
throw new NotImplementedException();
}
@@ -175,7 +174,7 @@ namespace StgSharp.Graphics.GL
/// 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>
/// <param name="name">ContextName of the Uniform in shader code</param>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe Uniform<T> GetUniform<T>(string name) where T : struct
@@ -187,7 +186,7 @@ namespace StgSharp.Graphics.GL
/// 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>
/// <param name="name">ContextName of the Uniform in shader code</param>
/// <returns></returns>
public unsafe Uniform<T, U> GetUniform<T, U>(string name)
where T : struct
@@ -200,7 +199,7 @@ namespace StgSharp.Graphics.GL
/// 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>
/// <param name="name">ContextName of the Uniform in shader code</param>
/// <returns></returns>
public unsafe Uniform<T, U, V> GetUniform<T, U, V>(string name)
where T : struct
@@ -213,7 +212,7 @@ namespace StgSharp.Graphics.GL
/// 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>
/// <param name="name">ContextName of the Uniform in shader code</param>
/// <returns></returns>
public unsafe Uniform<T, U, V, W> GetUniform<T, U, V, W>(string name)
where T : struct