2877 Commits

Author SHA1 Message Date
Bill Hollings
789d432156 Avoid Metal validation warning when depth component swizzled away.
- Set Metal depth store action to MTLStoreActionDontCare when
  depth attachment exists, but depth component has been swizzled away.
2023-05-03 22:39:35 -04:00
Bill Hollings
d2f57fc554
Merge pull request #1881 from billhollings/deprecate-VK_MVK_moltenvk-extension
Deprecate the obsolete and non-standard VK_MVK_moltenvk extension.
2023-05-03 12:46:37 -04:00
Bill Hollings
f33e718da4 Expose pointers to functions from removed VK_MVK_moltenvk extension.
- MVKInstance reorganize list of entry points for visual clarity (unrelated).
- Fixes to deprecation documentation (unrelated).
- mvkStringsAreEqual() add small performance optimization (unrelated).
2023-05-03 10:15:53 -04:00
Bill Hollings
937b0bf943 Deprecate the obsolete and non-standard VK_MVK_moltenvk extension.
The VK_MVK_moltenvk extension has never been brought inside Vulkan, and
the functions have never been supported by the Vulkan Loader and Layers.
Most of the functionality has long been replaced by the official
VK_metal_objects extension.

- Remove VK_MVK_moltenvk as an advertised extension.
- Refactor vk_mvk_moltenvk.h header file into separate headers files:
    - mvk_config.h - Valid public config functions
    - mvk_private_api.h - Valid development debugging functions used with care
    - mvk_deprecated_api.h - Formally deprecated functions.
- Retain skeleton vk_mvk_moltenvk.h header file for legacy compatibility only.
- Update documentation and header comments to explain changes.
2023-05-01 17:30:21 -04:00
Bill Hollings
e50cb32127
Merge pull request #1878 from billhollings/dyn-rend-separate-depth-stencil
Support separate depth and stencil attachments during dynamic rendering
2023-04-28 12:38:29 -04:00
Bill Hollings
fd6b97317d Clear attachments support separate depth and stencil attachments.
- Also rename kMVKCachedColorAttachmentCount to kMVKMaxColorAttachmentCount and
  kMVKCachedViewportScissorCount to kMVKMaxViewportScissorCount and (unrelated)
2023-04-27 13:10:30 -04:00
Bill Hollings
331cea9f08
Merge pull request #1877 from billhollings/pipeline-compress-older-os-fix
Disable pipeline cache compression prior to macOS 10.15 and iOS/tvOS 13.0
2023-04-26 06:53:07 -04:00
Bill Hollings
abb12a5288 Fix Metal validation errors with dynamic rendering.
- MVKPipeline validate depth & stencil formats before setting frag shader depth
  and stencil builtins, and before setting formats in MTLRenderPipelineDescriptor.
- MVKCmdClearAttachments always set depth/stencil format if subpass includes
  a depth or stencil attachment, even if they are not being cleared.
- MVKRenderingAttachmentIterator add synthetic attachment if depth or stencil
  attachment is not provided, but image format supports both depth and stencil.
2023-04-26 06:29:07 -04:00
Bill Hollings
4aa2b6dd9f Support separate depth and stencil attachments during dynamic rendering.
- MVKRenderSubpass add separate getDepthFormat() & getStencilFormat(),
  and isDepthAttachmentUsed() & isStencilAttachmentUsed() and use
  instead of testing pixel format for depth and stencil components.
- Add MVKRenderingAttachmentIterator class to consistently iterate,
  and take actions, on the attachments in VkRenderingInfo to create
  synthetic MVKRenderPass and extract image views and clear colors.
- Remove mvkCreateRenderPass() and mvkCreateFramebuffer() in favor
  of additional constructors, and remove mvkGetDepthStencilFormat() in
  favor of retrieving formats for separate depth and stencil attachments.
- MVKRenderpass constructors reorganize order of adding attachments and
  subpasses, and connecting the two.
- Renmame MVKRenderPassAttachment to MVKAttachmentDescription.
- MVKPipeline reorganize member variables to minimize gaps in content
  and remove unnecessary _isRasterizingDepthStencil member var (unrelated).
2023-04-24 15:23:46 -04:00
Bill Hollings
fc8e8182ee Disable pipeline cache compression prior to macOS 10.15 and iOS/tvOS 13.0. 2023-04-24 15:01:41 -04:00
Bill Hollings
5cbeaaa82c
Merge pull request #1868 from billhollings/gpu-addr-buff-use
Ensure shaders using PhysicalStorageBufferAddresses encode the associated MTLBuffer.
2023-04-15 15:10:08 -04:00
Bill Hollings
13e8103651 Ensure shaders using PhysicalStorageBufferAddresses encode the associated MTLBuffer.
- MVKDevice track VkBuffers marked with VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT.
- Add SPIRVToMSLConversionResultInfo::usesPhysicalStorageBufferAddressesCapability
  to detect and track shaders that use PhysicalStorageBufferAddresses capability,
  and track such shader stages within pipeline.
- MVKResourcesCommandEncoderState encode usage of VkBuffers marked with
  VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT when pipeline uses
  PhysicalStorageBufferAddresses capability.
- Rename MVKResourcesCommandEncoderState::encodeArgumentBufferResourceUsage()
  to encodeResourceUsage().
- MVKDevice move some functions to public scope and remove friend classes.
- MVKDeviceMemory ensure _vkMemAllocFlags is always initialized (unrelated).
- Rename MVKFoundation template method contains() to mvkContains() (unrelated).
2023-04-14 17:30:32 -04:00
Bill Hollings
f99ea669ac
Merge pull request #1866 from billhollings/ios-support-bc-compression
Support BC compression on iOS/tvOS, where available.
2023-04-12 16:34:20 -04:00
Bill Hollings
b0e6df6776 Replace references to macOS 10.16 with 11.0, and standardize use
of whitespace in MVKPixelFormats::modifyMTLFormatCapabilities().
2023-04-12 12:05:38 -04:00
Bill Hollings
5092330273 Support BC compression on iOS/tvOS, where available.
- Add MVK_XCODE_14_3 macro to compile for iOS/tvOS 16.4 and above.
- Add support for BC compression on iOS/tvOS 16.4 and above where supported.
- Consolidate MVKPixelFormats::modifyMTLFormatCapabilities(mtlDev)
  and centralize querying MTLDevice format methods for all platforms.
2023-04-12 11:50:09 -04:00
Bill Hollings
1d213e59a2
Merge pull request #1865 from billhollings/timeline-semaphore-mem-leak
Several simple maintenance fixes.
2023-04-11 21:41:05 -04:00
Bill Hollings
518385696b Several simple maintenance fixes.
- Fix memory leak when waiting on timeline semaphores.
- For correctness, set VkPhysicalDeviceLimits::lineWidthGranularity to 1.
- Update MoltenVK to version 1.2.4.
- Update Whats_New.md document with recent changes.
2023-04-11 20:41:59 -04:00
Bill Hollings
912b2edb73
Merge pull request #1861 from italomandara/allow-disable-explicit-lod-workaround
Allow to disable Explicit LOD Workaround for Apple silicon.
2023-04-04 10:35:24 -04:00
Italo Mandara
6f3a2b709f Allow to disable Explicit LOD Workaround 2023-04-04 10:28:41 +01:00
Bill Hollings
7b9a415a33
Merge pull request #1856 from spnda/VK_KHR_map_memory2
Add: VK_KHR_map_memory2
2023-03-27 14:53:22 -04:00
sean
aa03097b4d
Fix order 2023-03-24 15:08:06 +01:00
sean
20e255b4e6
Add: VK_KHR_map_memory2 2023-03-23 22:05:58 +01:00
Bill Hollings
db8512a64f
Merge pull request #1855 from billhollings/sdk-1.3.243
Update dependency libraries to match Vulkan SDK 1.3.243.
2023-03-22 16:06:11 -04:00
Bill Hollings
4e344a6921 Update dependency libraries to match Vulkan SDK 1.3.243.
Update Whats New document.
2023-03-22 14:27:25 -04:00
Bill Hollings
dd5ff2a9b0
Merge pull request #1854 from billhollings/ext-external_memory_host
Add support for VK_EXT_external_memory_host extension.
2023-03-20 21:51:04 -04:00
Bill Hollings
cc83a49b99 Add support for host mapped external memory from another GPU.
- Allow MTLBuffer.contents from another GPU as support for the
  VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT handle type.
2023-03-20 11:16:40 -04:00
Bill Hollings
cd8d0c30bb Add support for VK_EXT_external_memory_host extension.
- To expose host memory page size, add mvkGetHostMemoryPageSize() and
  MVKPhysicalDeviceMetalFeatures::hostMemoryPageSize.
- MVKPhysicalDevice::getProperties() sort EXT property structs alphabetically (unrelated).
- MVKExtensions.def fix alignment in OS versions (unrelated).
2023-03-19 22:53:36 -04:00
Bill Hollings
9f68d74a49
Merge pull request #1851 from js6i/variable-reuse-fix
Fixed invalid local variable reuse.
2023-03-16 14:22:49 -04:00
Jan Sikorski
b69f437cd1 Fixed invalid local variable reuse. 2023-03-16 11:38:30 +01:00
Bill Hollings
641f5c5d66
Merge pull request #1849 from billhollings/various-mtce-fixes
Various maintenance updates.
2023-03-08 19:36:11 -05:00
Bill Hollings
f191b0a31a Various maintenance updates.
- Cleanup VkPhysicalDeviceShaderAtomicFloatFeaturesEXT enablement and documentation.
- Cleanup VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT enablement.
- Expand MVK_CONFIG_TRACE_VULKAN_CALLS to log thread ID only if requested.
2023-03-08 19:04:52 -05:00
Bill Hollings
6d2ccd4505
Merge pull request #1836 from goki/main
WIP: enable availability of EXT_shader_atomic_float
2023-03-08 18:13:07 -05:00
Randall C. O'Reilly
e2e412cf31 undo WhatsNew 2023-03-08 12:21:50 -08:00
Randall C. O'Reilly
8046d82215 updates from latest PR comments from Hollings 2023-03-07 21:06:21 -08:00
Bill Hollings
3ca379ee4b
Merge pull request #1825 from spnda/fix_formats
Allow M1 formats on non-arm64 driver builds
2023-03-07 13:07:29 -05:00
Bill Hollings
4421883eeb
Merge pull request #1847 from billhollings/pipeline-cache-mem-reduction
VK_EXT_pipeline_creation_cache_control & reduce memory footprint of retained MSL source code
2023-03-07 10:15:42 -05:00
Bill Hollings
fb7aa43738 Fix minor typo found in code review. 2023-03-07 09:18:48 -05:00
Bill Hollings
a46dfde1fc Add support extension VK_EXT_pipeline_creation_cache_control.
- Adjust locks and performance timing on shader cache lookups.
2023-03-06 12:12:29 -05:00
Bill Hollings
c205c53ad9 Reduce memory footprint of retained MSL source code.
- Add MVKCompressor template class, and mvkCompress() & mvkDecompress()
  functions to support general data compression.
- Add MVKConfiguration::shaderSourceCompressionAlgorithm and
  env var MVK_CONFIG_SHADER_COMPRESSION_ALGORITHM to support
  compressing MSL shader source code held in a pipeline cache.
- Add MVKShaderCompilationPerformance::mslCompress and mslDecompress
  to allow performance of MSL compression to be tracked and queried.
- Add support for logging performance stats accumulated in a VkDevice,
  when it is destroyed. Good for CTS testing.
- Change MVKConfiguration::logActivityPerformanceInline boolean to
  activityPerformanceLoggingStyle enumeration value.
- Add MVK_CONFIG_ACTIVITY_PERFORMANCE_LOGGING_STYLE environment variable and
  build setting to set MVKConfiguration::activityPerformanceLoggingStyle value.
2023-03-03 10:39:26 -05:00
sean
7f70e3750d
Fix: Remove XCODE_12_2 & only use Apple8 on Xcode 14 2023-02-28 18:30:50 +01:00
Bill Hollings
46d46f5191 Reduce memory footprint of retained MSL source code.
- Don't retain converted MSL source code in MVKShaderModule.
- Add SPIRVToMSLConversionResult and GLSLToSPIRVConversionResult
  structures to capture all feedback from shader conversions.
2023-02-27 14:54:19 -05:00
Bill Hollings
fce178fd75
Merge pull request #1843 from billhollings/fix-reused-visibility-buffer
Use a different visibility buffer for each MTLCommandBuffer in a queue submit.
2023-02-24 11:34:18 -05:00
Bill Hollings
7a80f0249b Use a different visibility buffer for each MTLCommandBuffer in a queue submit. 2023-02-23 11:44:41 -05:00
Bill Hollings
aa6281c4e3
Merge pull request #1842 from billhollings/dyn-rend-occl-qry-fixes
Fixes to dynamic rendering and occlusion queries.
2023-02-22 20:36:56 -05:00
Bill Hollings
5d96a849b0 MVKCommandBuffer track rendering viewMask from commands. 2023-02-22 17:24:46 -05:00
Randall C. O'Reilly
19f19c9aae add VkPhysicalDeviceShaderAtomicFloatFeaturesEXT in MVKDevice.mm, using mslVersion >= 030000 2023-02-22 02:13:17 -08:00
Randall C. O'Reilly
6c044acad6 Update SPIRV-Cross and glslang repo revisions to include support for atomic float (glslang for HLSL support for InterlockedAdd on float) 2023-02-22 01:40:12 -08:00
Bill Hollings
b6835f7298 Fixes to dynamic rendering and occlusion queries.
- Fix crash when VkCommandBufferInheritanceInfo::renderPass is VK_NULL_HANDLE.
- Do not clear attachments when dynamic rendering is resumed.
- Allow ending dynamic rendering to trigger next multiview pass if needed.
- Move deciding to begin next multiview pass to MVKCommandEncoder.
- Fix premature caching of occlusion query results during tessellation rendering.
  Tessellation ends Metal renderpass for compute control and eval stages.
  Wait until end of Metal renderpass after rasterization stage.
- vkCmdCopyQueryPoolResults(): Fix loss of queries when query
  count is not a multiple of GPU threadgroup execution width.
- Disable occlusion recording while clearing attachments or render area.
- MVKCmdClearAttachments improve labelling of MTLDebugGroup to better
  distinguish clearing renderpass render area from vkCmdClearAttachments()
  in an Xcode GPU capture (unrelated but helpful during debugging).
- MVKCmdClearAttachments re-order member variables to
  optimize memory requirements (unrelated).
- MVKCommandBuffer remove unused renderpass tracking functions (unrelated).
2023-02-21 21:54:10 -05:00
Bill Hollings
0ad6d72bbc
Merge pull request #1835 from billhollings/swapchain-mtce1
Add support for VK_EXT_swapchain_maintenance1 and VK_EXT_surface_maintenance1
2023-02-14 22:55:42 +01:00
Bill Hollings
e897f49185 Fixes to recent update, to suit building on older Xcode versions.
- Revert mvkRoundHalfToEven() to static inline instead of constexpr,
  because internal use of std::remainder() is not constexpr until C++23.
- Replace non-template constexpr functions with static constexpr.
- Update Github CI to default to use Xcode 14.2,
  and macos-latest (which is now macos-12).
2023-02-14 15:36:43 -05:00