Merge pull request #2081 from cdavis5e/agx-cube-grad-fixup

MVKPipeline: Enable the cube texture gradient workaround for Apple Silicon
This commit is contained in:
Bill Hollings 2023-11-29 09:59:06 -05:00 committed by GitHub
commit 8820c53666
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,7 @@ Released TBD
- Fix initial value of `VkPhysicalDeviceLimits::timestampPeriod` on non-Apple Silicon GPUs.
- Update to latest SPIRV-Cross:
- MSL: Fix regression error in argument buffer runtime arrays.
- MSL: Work around broken cube texture gradients on Apple Silicon.

View File

@ -1 +1 @@
4818f7e7ef7b7078a3a7a5a52c4a338e0dda22f4
50e90dd74e0e43e243f12a70f0326d2cf8ed3945

View File

@ -152,6 +152,7 @@ typedef struct {
VkBool32 needsSampleDrefLodArrayWorkaround; /**< If true, sampling from arrayed depth images with explicit LoD is broken and needs a workaround. */
VkDeviceSize hostMemoryPageSize; /**< The size of a page of host memory on this platform. */
VkBool32 dynamicVertexStride; /**< If true, VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE is supported. */
VkBool32 needsCubeGradWorkaround; /**< If true, sampling from cube textures with explicit gradients is broken and needs a workaround. */
} MVKPhysicalDeviceMetalFeatures;
/**

View File

@ -1759,6 +1759,7 @@ void MVKPhysicalDevice::initMetalFeatures() {
if (!mvkOSVersionIsAtLeast(14.0, 17.0, 1.0)) {
_metalFeatures.needsSampleDrefLodArrayWorkaround = true;
}
_metalFeatures.needsCubeGradWorkaround = true;
// fallthrough
case kIntelVendorId:
case kNVVendorId:

View File

@ -1680,6 +1680,7 @@ void MVKGraphicsPipeline::initShaderConversionConfig(SPIRVToMSLConversionConfigu
shaderConfig.options.mslOptions.argument_buffers = useMetalArgBuff;
shaderConfig.options.mslOptions.force_active_argument_buffer_resources = useMetalArgBuff;
shaderConfig.options.mslOptions.pad_argument_buffer_resources = useMetalArgBuff;
shaderConfig.options.mslOptions.agx_manual_cube_grad_fixup = _device->_pMetalFeatures->needsCubeGradWorkaround;
MVKPipelineLayout* layout = (MVKPipelineLayout*)pCreateInfo->layout;
layout->populateShaderConversionConfig(shaderConfig);
@ -2517,7 +2518,8 @@ namespace SPIRV_CROSS_NAMESPACE {
opt.manual_helper_invocation_updates,
opt.check_discarded_frag_stores,
opt.sample_dref_lod_array_as_grad,
opt.replace_recursive_inputs);
opt.replace_recursive_inputs,
opt.agx_manual_cube_grad_fixup);
}
template<class Archive>