40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
namespace Dashboard.Drawing
|
|
{
|
|
public record GlslShaderCreateInfo() : IShaderCreateInfo
|
|
{
|
|
public required string VertexShader { get; init; }
|
|
public string? GeometryShader { get; init; } = null;
|
|
public string? TesselationControl { get; init; } = null;
|
|
public string? TesselationEvaluation { get; init; } = null;
|
|
public string? FragmentShader { get; init; } = null;
|
|
}
|
|
|
|
public record GlslComputeShaderCreateInfo(string Source) : IShaderCreateInfo
|
|
{
|
|
}
|
|
|
|
public record SpirvShaderCreateInfo(byte[] Binary) : IShaderCreateInfo
|
|
{
|
|
public int Format { get; init; } = Spirv;
|
|
|
|
public SpirvShaderCreateInfo(Stream stream) : this(GetBinary(stream)) { }
|
|
|
|
private static byte[] GetBinary(Stream stream)
|
|
{
|
|
//FIXME: this might actually be copying twice.
|
|
if (stream is MemoryStream ms)
|
|
{
|
|
return ms.ToArray();
|
|
}
|
|
else
|
|
{
|
|
using MemoryStream memory = new MemoryStream();
|
|
stream.CopyTo(memory);
|
|
return memory.ToArray();
|
|
}
|
|
}
|
|
|
|
private const int Spirv = 38225;
|
|
}
|
|
}
|