Generalize the native fullscreen pass and descriptor plumbing so managed SRP can request shader-driven fullscreen stages without being locked to the ColorScale path. Keep ColorScale as a convenience descriptor mapped to the builtin color-scale shader, and add native fullscreen factory coverage for the new shader-vector path.
54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
namespace XCEngine
|
|
{
|
|
public enum FullscreenPassType
|
|
{
|
|
ColorScale = 0,
|
|
ShaderVector = 1
|
|
}
|
|
|
|
public struct FullscreenPassDescriptor
|
|
{
|
|
public FullscreenPassType type;
|
|
public string shaderPath;
|
|
public string passName;
|
|
public Vector4 vectorPayload;
|
|
|
|
public static FullscreenPassDescriptor CreateColorScale(
|
|
Vector4 colorScale)
|
|
{
|
|
FullscreenPassDescriptor descriptor = new FullscreenPassDescriptor();
|
|
descriptor.type = FullscreenPassType.ColorScale;
|
|
descriptor.shaderPath = string.Empty;
|
|
descriptor.passName = string.Empty;
|
|
descriptor.vectorPayload = colorScale;
|
|
return descriptor;
|
|
}
|
|
|
|
public static FullscreenPassDescriptor CreateShaderVector(
|
|
string shaderPath,
|
|
Vector4 vectorPayload,
|
|
string passName = null)
|
|
{
|
|
FullscreenPassDescriptor descriptor = new FullscreenPassDescriptor();
|
|
descriptor.type = FullscreenPassType.ShaderVector;
|
|
descriptor.shaderPath = shaderPath ?? string.Empty;
|
|
descriptor.passName = passName ?? string.Empty;
|
|
descriptor.vectorPayload = vectorPayload;
|
|
return descriptor;
|
|
}
|
|
|
|
public bool IsValid()
|
|
{
|
|
switch (type)
|
|
{
|
|
case FullscreenPassType.ColorScale:
|
|
return true;
|
|
case FullscreenPassType.ShaderVector:
|
|
return !string.IsNullOrEmpty(shaderPath);
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|