2945 Commits

Author SHA1 Message Date
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
Bill Hollings
fbf5159ec2 Fix rounding error when checking if the drawableSize of a CAMetalLayer has changed.
- Add mvkGetNaturalExtent() to consolidate retrieving the natural rounded
  extent of the CAMetalDrawables that will be created by a CAMetalLayer,
  based on its drawableSize and contentsScale properties.
- Replace MVKSwapchain::_mtlLayerDrawableSize with _mtlLayerDrawableExtent.
- MVKSwapchain::hasOptimalSurface() compares last, actual,
  and natural rounded drawable extents of CAMetalLayer.
2023-02-13 23:17:00 -05:00
Bill Hollings
eabede8cdf Replace static inline with constexpr where possible. 2023-02-12 20:14:18 +00:00
Bill Hollings
2f87f85278 Fixes from PR review of VK_EXT_swapchain_maintenance1 and VK_EXT_surface_maintenance1.
- Pass MVKImagePresentInfo struct by reference instead of copy.
- Remove unused boolean to pass around
  VK_SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_EXT status.
2023-02-12 19:02:47 +00:00
sean
79ff67138e
Fix: Don't assume M1/M2 are only available for arm64 targets 2023-02-05 21:18:28 +01:00
Randall C. O'Reilly
160a327cbb enable availability of EXT_shader_atomic_float and add docs for how to replace Vulkan SDK .dylib while avoiding need to reboot. 2023-02-05 00:26:04 -08:00
Bill Hollings
e480e1570b Merge latest main into swapchain-mtce1 branch.
Update VK_MVK_MOLTENVK_SPEC_VERSION to version 37.
2023-02-04 14:37:08 -05:00
Bill Hollings
dc2dad84d6
Merge pull request #1834 from cdavis5e/sample-dref-lod-array-workaround
Work around problems with explicit LoD with arrayed depth images on A…
2023-02-04 13:55:44 -05:00
Bill Hollings
3250569260 Queue submissions retain wait semaphores until MTLCommandBuffer finishes.
Add additional Vulkan error strings (unrelated).
2023-02-04 11:27:16 -05:00
Chip Davis
2c01c8b7e0 Work around problems with explicit LoD with arrayed depth images on Apple Silicon.
Use an explicit gradient to make it sample the correct level.

Update SPIRV-Cross to pull in the change needed for this.
2023-02-03 14:48:25 -08:00
Bill Hollings
fabad21405 Add support for VK_EXT_swapchain_maintenance1 and VK_EXT_surface_maintenance1.
- Support querying scaling capabilities and present mode compatibilies
  when querying surface capabilities.
- Rename MVKPresentTimingInfo to MVKImagePresentInfo and add present mode
  and fence to support dynamic present mode changes and fence signaling.
- MVKPresentableSwapchainImage remove static functions from class declaration.
- MVKSwapchain support releasing swapchain images on command.
- MVKSwapchain support configuring with scaling and gravity info, apply it to
  CAMetalLayer.and do not return VK_SUBOPTIMAL_KHR if swapchain was configured
  with scaling info.
- Rename MVKSwapchain::acquireNextImageKHR to acquireNextImage.
- CAMetalLayer naturalDrawableSizeMVK compute precise drawable size.
- CAMetalLayer remove obsolete and unused updatedDrawableSizeMVK method.
- Rename MVKConfiguration::swapchainMagFilterUseNearest to
  swapchainMinMagFilterUseNearest to apply CAMetalLayer size
  filtering to both magnification and minification, and rename
  corresponding  env var MVK_CONFIG_SWAPCHAIN_MAG_FILTER_USE_NEAREST
  to MVK_CONFIG_SWAPCHAIN_MIN_MAG_FILTER_USE_NEAREST.
- Detect when size of surface has changed under the covers.
- Change rounding of surface size provided by Metal from truncation to
  rounding-with-half-to-even.
- Remove MVKLogSizeOf() logging macro as redundant to mvkPrintSizeOf() macro.
2023-02-02 23:00:37 -05:00
Bill Hollings
e8885a24e8
Merge pull request #1833 from billhollings/rmv-obslt-cmts
Remove a couple of large obsolete list content comments in MVKDevice.mm.
2023-01-31 15:17:02 -05:00
Bill Hollings
007136f2f4 Remove a couple of large obsolete list content comments in MVKDevice.mm. 2023-01-30 17:15:44 -05:00
Bill Hollings
74ea8ae987
Merge pull request #1832 from billhollings/fix-enable-bary-coord
Fix issue where VK_KHR_fragment_shader_barycentric incorrectly disabled
2023-01-30 16:26:09 -05:00
Bill Hollings
7e9b5b73de Fix issue where extension VK_KHR_fragment_shader_barycentric
was sometimes incorrectly disabled due to a Metal driver bug.

Update MoltenVK version to 1.2.3.
2023-01-30 15:22:33 -05:00
Bill Hollings
fb581e457a
Merge pull request #1828 from billhollings/sdk-1.3.239
Update dependency libraries to match Vulkan SDK 1.3.239.
2023-01-23 19:01:12 -05:00
Bill Hollings
8bcbb2eb42 Update dependency libraries to match Vulkan SDK 1.3.239.
Update Whats New document.
2023-01-23 17:57:36 -05:00
Bill Hollings
d880f4c86b
Merge pull request #1823 from billhollings/update-physdev_limits
Set more accurate values for some VkPhysicalDeviceLimits members.
2023-01-14 05:24:56 -05:00
Bill Hollings
e0333509a1 Set more accurate values for some VkPhysicalDeviceLimits members.
- Update maxClipDistances and maxCombinedClipAndCullDistances to more accurate values.
- Update maxDrawIndexedIndexValue to acknowledge primitive restart.
2023-01-13 19:03:00 -05:00
Bill Hollings
1609ad4c20
Merge pull request #1821 from billhollings/update-copyright-2023
Update copyright notices to year 2023.
2023-01-13 17:33:04 -05:00
Bill Hollings
12592abbc9 Update copyright notices to year 2023. 2023-01-13 12:19:37 -05:00
Bill Hollings
4fded82c67
Merge pull request #1818 from billhollings/fix-dyn-link-issues
Fix linking issues with dynamic Vulkan functions.
2023-01-10 13:17:21 -05:00
Bill Hollings
682906976d Fix linking issues with dynamic Vulkan functions.
- Ensure Vulkan public symbols are not stripped from the library when
  statically linked to an app that calls all Vulkan functions dynamically.
- Per Vulkan 1.2 spec, support calling vkGetInstanceProcAddr() with a
  null instance, when vkGetInstanceProcAddr itself is the function name.
- Replace uses of strcmp() with mvkStringsAreEqual() to protect against
  null pointers, and provide a direct bool output (unrelated cleanup).
2023-01-10 07:22:05 -05:00
Bill Hollings
7a320974d1
Merge pull request #1807 from billhollings/rmv-unused-debug-log-calls
Remove some old unused commented-out debug log calls.
2023-01-02 10:11:51 -05:00
Bill Hollings
b6b51aa1f3 Remove some old unused commented-out debug log calls. 2022-12-30 10:14:19 -05:00
Bill Hollings
3d886ca665
Merge pull request #1806 from billhollings/fix-swapchain-mem-issues
Fix small memory issues with MVKPresentableSwapchainImage.
2022-12-30 09:55:31 -05:00
Bill Hollings
be51089f25 Fix small memory issues with MVKPresentableSwapchainImage.
- Fix Metal validation error caused by CAMetalDrawable released before
  MTLCommandBuffer is finished using it.
- When presenting, MVKPresentableSwapchainImage retains in-flight
  CAMetalDrawable until MTLCommandBuffer completion.

- Fix memory leak of MVKFences and MVKSemaphores when a
  swapchain image is acquired more than it is presented.
- Force MVKPresentableSwapchainImage to untrack any tracked fences or
  semaphores when it is destroyed.

- Update MoltenVK version to 1.2.2.
2022-12-29 21:50:04 -05:00
Bill Hollings
2960554d3a
Merge pull request #1804 from billhollings/revert-e102ce1
Revert PR #1797.
2022-12-28 10:06:01 -05:00
Bill Hollings
b09ee9d370 Revert commit e102ce1102dcdfd4d59df3fd5f3f381cb9a4ab81.
The now-reverted commit had caused fragment shader not
to run at all when no render attachment was available.
2022-12-27 14:09:24 -05:00
Bill Hollings
e743bbcd71
Merge pull request #1797 from billhollings/fix-no-attchmt-tile-mem-prealloc
Fix excessive Metal tile memory preallocation when rendering without attachments.
2022-12-12 15:06:06 -05:00
Bill Hollings
e102ce1102 Fix excessive Metal tile memory preallocation when rendering without attachments.
Metal uses MTLRenderPassDescriptor properties renderTargetWidth,
renderTargetHeight, and renderTargetArrayLength to preallocate tile memory
storage on machines using tiled rendering. This memory preallocation is not
necessary if we are not rendering to attachments, and some apps actively
define extremely oversized framebuffers when they know they are not rendering
to actual attachments, making this internal tile memory allocation even more
wasteful, occasionally to the point of triggering OOM crashes.

Update MoltenVK version to 1.2.2.
2022-12-11 19:11:38 -05:00
Bill Hollings
a307b24001
Merge pull request #1795 from billhollings/fix-buff-binding-justoffset-when-overridden
Fix crash when buffer binding updates only offset while it is overridden.
2022-12-08 19:08:40 -05:00
Bill Hollings
8965c87e14 Fix crash when buffer binding updates only offset while it is overridden.
MVKMTLBufferBinding don't allow justOffset if binding was overridden.
2022-12-08 18:38:49 -05:00
Bill Hollings
32da10556e
Merge pull request #1794 from billhollings/sdk-1.3.236
Update dependency libraries to match Vulkan SDK 1.3.236.
2022-12-08 16:15:00 -05:00