From e4d96f6fa23e61bd3256bee922e7598e392b84a5 Mon Sep 17 00:00:00 2001 From: Bill Hollings Date: Tue, 26 Mar 2019 11:50:39 -0400 Subject: [PATCH 1/2] Support Xcode 10.2. --- ExternalDependencies.xcodeproj/project.pbxproj | 5 +++-- .../xcshareddata/xcschemes/ExternalDependencies-iOS.xcscheme | 2 +- .../xcschemes/ExternalDependencies-macOS.xcscheme | 2 +- .../xcshareddata/xcschemes/ExternalDependencies.xcscheme | 2 +- .../xcshareddata/xcschemes/SPIRV-Cross-iOS.xcscheme | 2 +- .../xcshareddata/xcschemes/SPIRV-Cross-macOS.xcscheme | 2 +- .../xcshareddata/xcschemes/SPIRV-Tools-iOS.xcscheme | 2 +- .../xcshareddata/xcschemes/SPIRV-Tools-macOS.xcscheme | 2 +- .../xcshareddata/xcschemes/glslang-iOS.xcscheme | 2 +- .../xcshareddata/xcschemes/glslang-macOS.xcscheme | 2 +- MoltenVK/MoltenVK.xcodeproj/project.pbxproj | 5 +++-- .../xcshareddata/xcschemes/MoltenVK-iOS.xcscheme | 2 +- .../xcshareddata/xcschemes/MoltenVK-macOS.xcscheme | 2 +- MoltenVKPackaging.xcodeproj/project.pbxproj | 5 +++-- .../xcshareddata/xcschemes/MoltenVK Package (Debug).xcscheme | 2 +- .../xcschemes/MoltenVK Package (iOS only).xcscheme | 2 +- .../xcschemes/MoltenVK Package (macOS only).xcscheme | 2 +- .../xcshareddata/xcschemes/MoltenVK Package.xcscheme | 2 +- .../MoltenVKShaderConverter.xcodeproj/project.pbxproj | 5 +++-- .../xcschemes/MoltenVKGLSLToSPIRVConverter-iOS.xcscheme | 2 +- .../xcschemes/MoltenVKGLSLToSPIRVConverter-macOS.xcscheme | 2 +- .../xcschemes/MoltenVKSPIRVToMSLConverter-iOS.xcscheme | 2 +- .../xcschemes/MoltenVKSPIRVToMSLConverter-macOS.xcscheme | 2 +- .../xcshareddata/xcschemes/MoltenVKShaderConverter.xcscheme | 2 +- 24 files changed, 32 insertions(+), 28 deletions(-) diff --git a/ExternalDependencies.xcodeproj/project.pbxproj b/ExternalDependencies.xcodeproj/project.pbxproj index 03950733..ef555d3c 100644 --- a/ExternalDependencies.xcodeproj/project.pbxproj +++ b/ExternalDependencies.xcodeproj/project.pbxproj @@ -2846,7 +2846,7 @@ A9F55D25198BE6A7004EC31B /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1010; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "The Brenwill Workshop Ltd."; TargetAttributes = { A972A7E421CEC72F0013AB25 = { @@ -2863,10 +2863,11 @@ }; buildConfigurationList = A9F55D28198BE6A7004EC31B /* Build configuration list for PBXProject "ExternalDependencies" */; compatibilityVersion = "Xcode 8.0"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = A9F55D24198BE6A7004EC31B; productRefGroup = A9F55D24198BE6A7004EC31B; diff --git a/ExternalDependencies.xcodeproj/xcshareddata/xcschemes/ExternalDependencies-iOS.xcscheme b/ExternalDependencies.xcodeproj/xcshareddata/xcschemes/ExternalDependencies-iOS.xcscheme index fe5c4706..a295522d 100644 --- a/ExternalDependencies.xcodeproj/xcshareddata/xcschemes/ExternalDependencies-iOS.xcscheme +++ b/ExternalDependencies.xcodeproj/xcshareddata/xcschemes/ExternalDependencies-iOS.xcscheme @@ -1,6 +1,6 @@ Date: Tue, 26 Mar 2019 13:31:26 -0400 Subject: [PATCH 2/2] Fix PVRTC texture content loading via memory mapping. MoltenVK_Runtime_UserGuide.md: Add limitation explanation about loading PVRTC using host-visible memory only. Update What's New document. --- Docs/MoltenVK_Runtime_UserGuide.md | 27 +++++------------------- Docs/Whats_New.md | 1 + MoltenVK/MoltenVK/GPUObjects/MVKImage.mm | 23 ++++++++++++++------ 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/Docs/MoltenVK_Runtime_UserGuide.md b/Docs/MoltenVK_Runtime_UserGuide.md index 44e66986..47eb00d8 100644 --- a/Docs/MoltenVK_Runtime_UserGuide.md +++ b/Docs/MoltenVK_Runtime_UserGuide.md @@ -505,28 +505,11 @@ This section documents the known limitations in this version of **MoltenVK**. In order to use Vulkan layers such as the validation layers, use the Vulkan loader and layers from the [LunarG Vulkan SDK](https://vulkan.lunarg.com). -The following *Vulkan 1.0* features have not been implemented in this version of **MoltenVK**: +- `VkEvents` are not supported. -- Tessellation and Geometry shader stages. +- Application-controlled memory allocations using `VkAllocationCallbacks` are ignored. -- Events: - - `vkCreateEvent()` - - `vkDestroyEvent()` - - `vkGetEventStatus()` - - `vkSetEvent()` - - `vkResetEvent()` - - `vkCmdSetEvent()` - - `vkCmdResetEvent()` - - `vkCmdWaitEvents()` - -- Application-controlled memory allocations: - - `VkAllocationCallbacks` are ignored - -- Sparse memory: - - `vkGetImageSparseMemoryRequirements()` - - `vkGetPhysicalDeviceSparseImageFormatProperties()` - - `vkQueueBindSparse()` - -- Pipeline statistics query pool: - - `vkCreateQueryPool(VK_QUERY_TYPE_PIPELINE_STATISTICS)` +- Pipeline statistics query pool using `VK_QUERY_TYPE_PIPELINE_STATISTICS` is not supported. +- Image content in `PVRTC` compressed formats must be loaded directly into a `VkImage` using + host-visible memory mapping. Loading via a staging buffer will result in malformed image content. diff --git a/Docs/Whats_New.md b/Docs/Whats_New.md index e51ec249..36a5d9d9 100644 --- a/Docs/Whats_New.md +++ b/Docs/Whats_New.md @@ -32,6 +32,7 @@ Released TBD - `fetchDependencies`: Stop on first error. - Fix a possible race condition around MVKMTLBufferAllocation. - Fix memory overrun if no vertex buffer found with same binding as a vertex attribute. +- Fix PVRTC texture content loading via memory mapping. - Debug build mode includes `dSYM` file for each `dylib` file. - `Makefile` supports `install` target to install `MoltenVK.framework` into `/Library/Frameworks/`. - Update to latest SPIRV-Cross version: diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm b/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm index a7647baa..46da11ee 100644 --- a/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm +++ b/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm @@ -439,7 +439,7 @@ MTLStorageMode MVKImage::getMTLStorageMode() { } // Updates the contents of the underlying MTLTexture, corresponding to the -//specified subresource definition, from the underlying memory buffer. +// specified subresource definition, from the underlying memory buffer. void MVKImage::updateMTLTextureContent(MVKImageSubresource& subresource, VkDeviceSize offset, VkDeviceSize size) { @@ -486,12 +486,21 @@ void MVKImage::updateMTLTextureContent(MVKImageSubresource& subresource, } #endif - [getMTLTexture() replaceRegion: mtlRegion - mipmapLevel: imgSubRez.mipLevel - slice: imgSubRez.arrayLayer - withBytes: pImgBytes - bytesPerRow: (imgType != VK_IMAGE_TYPE_1D ? imgLayout.rowPitch : 0) - bytesPerImage: (imgType == VK_IMAGE_TYPE_3D ? imgLayout.depthPitch : 0)]; + VkDeviceSize bytesPerRow = (imgType != VK_IMAGE_TYPE_1D) ? imgLayout.rowPitch : 0; + VkDeviceSize bytesPerImage = (imgType == VK_IMAGE_TYPE_3D) ? imgLayout.depthPitch : 0; + + id mtlTex = getMTLTexture(); + if (mvkMTLPixelFormatIsPVRTCFormat(mtlTex.pixelFormat)) { + bytesPerRow = 0; + bytesPerImage = 0; + } + + [mtlTex replaceRegion: mtlRegion + mipmapLevel: imgSubRez.mipLevel + slice: imgSubRez.arrayLayer + withBytes: pImgBytes + bytesPerRow: bytesPerRow + bytesPerImage: bytesPerImage]; } // Updates the contents of the underlying memory buffer from the contents of