[+] Dummy SM3.0 MSAA intrins

This commit is contained in:
Reece Wilson 2024-08-17 18:54:44 +01:00
parent 48a4ee0a35
commit d79affbb0d

View File

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