HLSL: Add missing BuiltInLayer to HLSL backend.

This commit is contained in:
Laura Hermanns 2022-04-28 16:42:03 -04:00
parent 6ae7ddb92a
commit 65431446f4

View File

@ -643,6 +643,13 @@ void CompilerHLSL::emit_builtin_outputs_in_struct()
else
SPIRV_CROSS_THROW("Unsupported builtin in HLSL.");
case BuiltInLayer:
if (hlsl_options.shader_model < 50 || get_entry_point().model != ExecutionModelGeometry)
SPIRV_CROSS_THROW("Render target index output is only supported in GS 5.0 or higher.");
type = "uint";
semantic = "SV_RenderTargetIndex";
break;
default:
SPIRV_CROSS_THROW("Unsupported builtin in HLSL.");
}
@ -788,6 +795,13 @@ void CompilerHLSL::emit_builtin_inputs_in_struct()
else
SPIRV_CROSS_THROW("Unsupported builtin in HLSL.");
case BuiltInLayer:
if (hlsl_options.shader_model < 50 || get_entry_point().model != ExecutionModelFragment)
SPIRV_CROSS_THROW("Render target index input is only supported in PS 5.0 or higher.");
type = "uint";
semantic = "SV_RenderTargetIndex";
break;
default:
SPIRV_CROSS_THROW("Unsupported builtin in HLSL.");
}
@ -1147,6 +1161,7 @@ void CompilerHLSL::emit_builtin_variables()
case BuiltInPrimitiveId:
case BuiltInViewIndex:
case BuiltInLayer:
type = "uint";
break;