MoonWorks/src/Graphics/State/GraphicsShaderInfo.cs

45 lines
1.0 KiB
C#
Raw Normal View History

using System.Runtime.InteropServices;
namespace MoonWorks.Graphics
{
2022-02-23 05:14:32 +00:00
/// <summary>
2023-09-19 20:19:41 +00:00
/// Information that the pipeline needs about a graphics shader.
2022-02-23 05:14:32 +00:00
/// </summary>
2022-03-02 19:42:26 +00:00
public struct GraphicsShaderInfo
2022-02-23 05:14:32 +00:00
{
public ShaderModule ShaderModule;
public string EntryPointName;
public uint UniformBufferSize;
2022-03-02 19:42:26 +00:00
public uint SamplerBindingCount;
2022-04-27 21:14:15 +00:00
public unsafe static GraphicsShaderInfo Create<T>(
ShaderModule shaderModule,
string entryPointName,
uint samplerBindingCount
) where T : unmanaged
{
return new GraphicsShaderInfo
{
ShaderModule = shaderModule,
EntryPointName = entryPointName,
UniformBufferSize = (uint) Marshal.SizeOf<T>(),
SamplerBindingCount = samplerBindingCount
};
}
public static GraphicsShaderInfo Create(
ShaderModule shaderModule,
string entryPointName,
uint samplerBindingCount
) {
return new GraphicsShaderInfo
{
ShaderModule = shaderModule,
EntryPointName = entryPointName,
UniformBufferSize = 0,
SamplerBindingCount = samplerBindingCount
};
}
2022-02-23 05:14:32 +00:00
}
}