msl: Don't try to use [[thread_index_in_simdgroup]] in vertex shaders.

According to the Metal Shading Language Specification, it's not
supported for vertex functions in any Metal version, only fragment and
kernel functions.
This commit is contained in:
comex 2020-11-26 17:12:06 -05:00
parent be527632a6
commit 5a85fa9400

View File

@ -13319,12 +13319,17 @@ string CompilerMSL::builtin_qualifier(BuiltIn builtin)
SPIRV_CROSS_THROW("thread_index_in_simdgroup requires Metal 2.2 in fragment shaders."); SPIRV_CROSS_THROW("thread_index_in_simdgroup requires Metal 2.2 in fragment shaders.");
return "thread_index_in_simdgroup"; return "thread_index_in_simdgroup";
} }
else else if (execution.model == ExecutionModelKernel || execution.model == ExecutionModelGLCompute ||
execution.model == ExecutionModelTessellationControl ||
(execution.model == ExecutionModelVertex && msl_options.vertex_for_tessellation))
{ {
// We are generating a Metal kernel function.
if (!msl_options.supports_msl_version(2)) if (!msl_options.supports_msl_version(2))
SPIRV_CROSS_THROW("Subgroup builtins require Metal 2.0."); SPIRV_CROSS_THROW("Subgroup builtins in kernel functions require Metal 2.0.");
return msl_options.is_ios() ? "thread_index_in_quadgroup" : "thread_index_in_simdgroup"; return msl_options.is_ios() ? "thread_index_in_quadgroup" : "thread_index_in_simdgroup";
} }
else
SPIRV_CROSS_THROW("Subgroup builtins are not available in this type of function.");
case BuiltInSubgroupEqMask: case BuiltInSubgroupEqMask:
case BuiltInSubgroupGeMask: case BuiltInSubgroupGeMask: