Merge pull request #1553 from comex/no-subgroups-in-vertex-shaders

msl: Don't try to use [[thread_index_in_simdgroup]] in vertex shaders.
This commit is contained in:
Hans-Kristian Arntzen 2020-12-02 19:29:19 +01:00 committed by GitHub
commit 6d10da0224
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13328,12 +13328,17 @@ string CompilerMSL::builtin_qualifier(BuiltIn builtin)
SPIRV_CROSS_THROW("thread_index_in_simdgroup requires Metal 2.2 in fragment shaders.");
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))
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";
}
else
SPIRV_CROSS_THROW("Subgroup builtins are not available in this type of function.");
case BuiltInSubgroupEqMask:
case BuiltInSubgroupGeMask: