Merge pull request #1635 from bangnoise/pr/maxTotalThreadsPerThreadgroup-crash-macOS_10_13

Fix crash creating compute pipelines on macOS versions < 10.14
This commit is contained in:
Bill Hollings 2022-07-13 10:50:42 -04:00 committed by GitHub
commit 313c64df38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1834,7 +1834,10 @@ MVKComputePipeline::MVKComputePipeline(MVKDevice* device,
if (mtlFunc) {
MTLComputePipelineDescriptor* plDesc = [MTLComputePipelineDescriptor new]; // temp retain
plDesc.computeFunction = mtlFunc;
// Only available macOS 10.14+
if ([plDesc respondsToSelector:@selector(setMaxTotalThreadsPerThreadgroup:)]) {
plDesc.maxTotalThreadsPerThreadgroup = _mtlThreadgroupSize.width * _mtlThreadgroupSize.height * _mtlThreadgroupSize.depth;
}
plDesc.threadGroupSizeIsMultipleOfThreadExecutionWidth = mvkIsAnyFlagEnabled(pCreateInfo->stage.flags, VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT);
// Metal does not allow the name of the pipeline to be changed after it has been created,