Skip to content

Commit

Permalink
Merge pull request #1877 from billhollings/pipeline-compress-older-os…
Browse files Browse the repository at this point in the history
…-fix

Disable pipeline cache compression prior to macOS 10.15 and iOS/tvOS 13.0
  • Loading branch information
billhollings authored Apr 26, 2023
2 parents 5cbeaaa + fc8e818 commit 331cea9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions Docs/Whats_New.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Released TBD
- Support BC compression on iOS/tvOS where available (iOS/tvOS 16.4 and above and supported by the GPU).
- Fix memory leak when waiting on timeline semaphores.
- Ensure shaders that use `PhysicalStorageBufferAddresses` encode the use of the associated `MTLBuffer`.
- Disable pipeline cache compression prior to macOS 10.15 and iOS/tvOS 13.0.
- Add `MVK_ENABLE_EXPLICIT_LOD_WORKAROUND` environment variable to selectively
disable recent fixes to handling LOD for arrayed depth images in shaders,
on Apple Silicon, when those fixes cause regression in rendering behavior.
Expand Down
2 changes: 2 additions & 0 deletions MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,8 @@ typedef struct {
* memory. In such a case, this parameter can be used to compress the MSL source code that
* is awaiting export as part of a pipeline cache.
*
* Pipeline cache compression is available for macOS 10.15 and above, and iOS/tvOS 13.0 and above.
*
* The value of this parameter can be changed at any time, and will affect the size of
* the cached MSL from subsequent shader compilations.
*
Expand Down
4 changes: 3 additions & 1 deletion MoltenVK/MoltenVK/Utility/MVKCodec.mm
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ static size_t mvkCompressDecompress(const uint8_t* srcBytes, size_t srcSize,
MVKConfigCompressionAlgorithm compAlgo,
bool isCompressing) {
size_t dstByteCount = 0;
if (compAlgo != MVK_CONFIG_COMPRESSION_ALGORITHM_NONE) {
bool compressionSupported = ([NSData instancesRespondToSelector: @selector(compressedDataUsingAlgorithm:error:)] &&
[NSData instancesRespondToSelector: @selector(decompressedDataUsingAlgorithm:error:)]);
if (compressionSupported && compAlgo != MVK_CONFIG_COMPRESSION_ALGORITHM_NONE) {
@autoreleasepool {
NSDataCompressionAlgorithm sysCompAlgo = getSystemCompressionAlgo(compAlgo);
NSData* srcData = [NSData dataWithBytesNoCopy: (void*)srcBytes length: srcSize freeWhenDone: NO];
Expand Down

0 comments on commit 331cea9

Please sign in to comment.