mirror of
https://github.com/AssetRipper/AssetRipper.git
synced 2025-12-11 20:15:29 +01:00
Shader extensions
This commit is contained in:
parent
6183a71996
commit
5ebaeb1d6f
@ -343,4 +343,18 @@ public static class ShaderGpuProgramTypeExtensions
|
||||
|
||||
throw new NotSupportedException($"Unsupported gpu program type {_this} [{platform}, {type}]");
|
||||
}
|
||||
|
||||
public static int ToShaderModelVersion(this ShaderGpuProgramType _this)
|
||||
{
|
||||
return _this switch
|
||||
{
|
||||
ShaderGpuProgramType.DX9VertexSM20 or ShaderGpuProgramType.DX9PixelSM20 => 20,
|
||||
ShaderGpuProgramType.DX9VertexSM30 or ShaderGpuProgramType.DX9PixelSM30 => 30,
|
||||
ShaderGpuProgramType.DX10Level9Vertex or ShaderGpuProgramType.DX10Level9Pixel => 40,
|
||||
ShaderGpuProgramType.DX11VertexSM40 or ShaderGpuProgramType.DX11PixelSM40 or ShaderGpuProgramType.DX11GeometrySM40 => 40,
|
||||
ShaderGpuProgramType.DX11VertexSM50 or ShaderGpuProgramType.DX11PixelSM50 or ShaderGpuProgramType.DX11GeometrySM50 or
|
||||
ShaderGpuProgramType.DX11HullSM50 or ShaderGpuProgramType.DX11DomainSM50 => 50,
|
||||
_ => default,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ public static class SerializedShaderStateExtensions
|
||||
public static ZTest ZTestValue(this ISerializedShaderState state) => (ZTest)state.ZTest.Val;
|
||||
public static ZWrite ZWriteValue(this ISerializedShaderState state) => (ZWrite)state.ZWrite.Val;
|
||||
public static CullMode CullingValue(this ISerializedShaderState state) => (CullMode)state.Culling.Val;
|
||||
public static bool AlphaToMaskValue(this ISerializedShaderState state) => state.AlphaToMask.Val > 0;
|
||||
public static bool AlphaToMaskValue(this ISerializedShaderState state) => state.AlphaToMask.Val is not 0;
|
||||
public static bool ConservativeValue(this ISerializedShaderState state) => state.Conservative?.Val is not null and not 0;
|
||||
public static string LightingValue(this ISerializedShaderState state) => state.Lighting ? "On" : "Off";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user