Skip to content

Commit

Permalink
Merge pull request #2081 from cdavis5e/agx-cube-grad-fixup
Browse files Browse the repository at this point in the history
MVKPipeline: Enable the cube texture gradient workaround for Apple Silicon
  • Loading branch information
billhollings authored Nov 29, 2023
2 parents 5bd65fc + d0dba76 commit 8820c53
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Docs/Whats_New.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.



Expand Down
2 changes: 1 addition & 1 deletion ExternalRevisions/SPIRV-Cross_repo_revision
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4818f7e7ef7b7078a3a7a5a52c4a338e0dda22f4
50e90dd74e0e43e243f12a70f0326d2cf8ed3945
1 change: 1 addition & 0 deletions MoltenVK/MoltenVK/API/mvk_private_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
1 change: 1 addition & 0 deletions MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1759,6 +1759,7 @@
if (!mvkOSVersionIsAtLeast(14.0, 17.0, 1.0)) {
_metalFeatures.needsSampleDrefLodArrayWorkaround = true;
}
_metalFeatures.needsCubeGradWorkaround = true;
// fallthrough
case kIntelVendorId:
case kNVVendorId:
Expand Down
4 changes: 3 additions & 1 deletion MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1680,6 +1680,7 @@ static MTLVertexFormat mvkAdjustFormatVectorToSize(MTLVertexFormat format, uint3
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);
Expand Down Expand Up @@ -2517,7 +2518,8 @@ void serialize(Archive & archive, CompilerMSL::Options& opt) {
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>
Expand Down

0 comments on commit 8820c53

Please sign in to comment.