[*] Dummy SM3.0 MSAA intrins

This commit is contained in:
Reece Wilson 2024-08-17 18:54:44 +01:00
parent c27c89ac92
commit 5d159645ec

View File

@ -579,10 +579,13 @@ void CompilerHLSL::emit_builtin_outputs_in_struct()
break;
case BuiltInSampleMask:
if (hlsl_options.shader_model < 41 || execution.model != ExecutionModelFragment)
if (hlsl_options.shader_model >= 41)
{
if (execution.model != ExecutionModelFragment)
SPIRV_CROSS_THROW("Sample Mask output is only supported in PS 4.1 or higher.");
type = "uint";
semantic = "SV_Coverage";
}
break;
case BuiltInFragDepth:
@ -799,17 +802,21 @@ void CompilerHLSL::emit_builtin_inputs_in_struct()
break;
case BuiltInSampleId:
if (legacy)
SPIRV_CROSS_THROW("Sample ID not supported in SM 3.0 or lower.");
if (hlsl_options.shader_model > 30)
{
type = "uint";
semantic = "SV_SampleIndex";
}
break;
case BuiltInSampleMask:
if (hlsl_options.shader_model < 50 || get_entry_point().model != ExecutionModelFragment)
if (hlsl_options.shader_model >= 50)
{
if (get_entry_point().model != ExecutionModelFragment)
SPIRV_CROSS_THROW("Sample Mask input is only supported in PS 5.0 or higher.");
type = "uint";
semantic = "SV_Coverage";
}
break;
case BuiltInGlobalInvocationId:
@ -3216,7 +3223,25 @@ void CompilerHLSL::emit_hlsl_entry_point()
break;
case BuiltInSampleMask:
if (hlsl_options.shader_model >= 50)
{
statement(builtin, "[0] = stage_input.", builtin, ";");
}
else
{
statement(builtin, "[0] = 0;");
}
break;
case BuiltInSampleId:
if (hlsl_options.shader_model > 30)
{
statement(builtin, " = stage_input.", builtin, ";");
}
else
{
statement(builtin, " = 0;");
}
break;
case BuiltInNumWorkgroups:
@ -3394,7 +3419,10 @@ void CompilerHLSL::emit_hlsl_entry_point()
break;
case BuiltInSampleMask:
if (hlsl_options.shader_model >= 50)
{
statement("stage_output.gl_SampleMask = gl_SampleMask[0];");
}
break;
default: