3102 Commits

Author SHA1 Message Date
Bill Hollings
116e9ec899
Merge pull request #2169 from js6i/fixup-1
Fix uninitialized MVKImage member.
2024-03-06 11:03:51 -05:00
Jan Sikorski
e388a0e3af MVKPixelFormats: Only set MTLTextureUsageShaderAtomic for supported pixel format. 2024-03-06 12:27:34 +01:00
Jan Sikorski
69446d122d MVKBuffer: Only set MTLTextureUsageShaderAtomic on views with supported pixel format. 2024-03-06 12:27:34 +01:00
Jan Sikorski
3056cae106 Fix uninitialized MVKImage member. 2024-03-06 11:14:24 +01:00
Bill Hollings
0d62ff8fb7 Improve support for iOS App Store rules by using dynamic XCFramework.
Apple's iOS App Store does not permit an app to link to naked dylibs.
Instead, these must be placed in frameworks, which are embedded in a
dynamic version of MoltenVK.xcframework.

- Use Xcode to directly generate a MoltenVK.framework for each platform,
  and remove create_dylib*.sh scripts.
- Move static XCFramework, containing libMoltenVK.a static libraries,
  to Package/Latest/MoltenVK/static/MoltenVK.xcframework.
- Generate dynamic XCFramework, containing MoltenVK.framework dynamic
  libraries, in Package/Latest/MoltenVK/dynamic/MoltenVK.xcframework.
- Add macro MVK_VERSION_STRING to create version string at compile time,
  use it to validate the CURRENT_PROJECT_VERSION build setting at compile time,
  and use it at runtime instead of mvkGetMoltenVKVersionString() function.
- Add -w to OTHER_LDFLAGS to dynamic framework builds to suppress
  spurious linker warnings of the type
  "ld: warning: no platform load command found in '...', assuming: iOS"
  issued from the new linker introduced in Xcode 15.
- Add MoltenVK-MacCat Xcode target and MoltenVK Package (MacCat only)
  Xcode scheme to avoid building dynamic MoltenVK.framework for the
  Mac Catalyst platform, because Xcode does not support doing so.
- Always run MoltenVK build scripts, to ensure all components are
  added to the XCFrameworks, and MoltenVK/Package is always refreshed,
  even if code compilation is not required.
- Cube demo link to dynamic MoltenVK.framework through
  dynamic/MoltenVK.xcframework, instead of to naked libMoltenVK.dylib.
- Update the version of Volk used by the Cube demo, to support
  loading MoltenVK from dynamic frameworks inside Volk.
- Update README.md and MoltenVK_Runtime_UserGuide.md documents.
- Update MVK_PRIVATE_API_VERSION to 40.
- Fix make install to install /usr/local/lib/libMoltenVK.dylib on macOS (unrelated).
- Remove unused MTLAttributeStrideStatic declaration prior to Xcode 15 (unrelated).
2024-03-05 20:38:35 -05:00
Mike Krus
9082ca839f Fix visionOS build
This adds a few macros to test which platform is currently being built.
Addresses some compile warnings such as missing return values.
2024-03-01 18:28:16 +00:00
Bill Hollings
b56c152a12
Merge pull request #2164 from js6i/native-atomics
Enable use of native texture atomics.
2024-02-27 10:20:18 -05:00
Jan Sikorski
c03893b5ad Enable use of native texture atomics.
This commit conditionally skips the emulated image atomics paths if native
texture atomics are available and a configuration option is set.

Apart from unlocking some potential performance benefits from not having to
force some textures to be linear, it also makes texture atomics work with
argument buffers.
2024-02-27 12:41:39 +01:00
Bill Hollings
37361ccd55
Merge pull request #2159 from billhollings/no-headless-sub-optimal
Don't return VK_SUBOPTIMAL_KHR for headless surfaces.
2024-02-12 19:46:53 -05:00
Bill Hollings
a62cada021
Merge pull request #2157 from cdavis5e/smallvec-const-correct
MVKSmallVector: Make iterator const correct.
2024-02-12 16:39:47 -05:00
Bill Hollings
4a04f886c7
Merge pull request #2155 from billhollings/private-api-fixes
Consolidation and fixes for MVK_USE_METAL_PRIVATE_API functionality.
2024-02-12 16:08:42 -05:00
Bill Hollings
9c812da6a6 Don't return VK_SUBOPTIMAL_KHR for headless surfaces.
This fixes a regression caused by a recent change that keeps size
of headless surfaces at the special value {0xFFFFFFFF, 0xFFFFFFFF}.
2024-02-12 15:53:58 -05:00
Bill Hollings
efaae79d90 Consolidation and fixes for MVK_USE_METAL_PRIVATE_API functionality.
- Expose MTLRenderPipelineDescriptor.sampleMaskMVK and
  MTLSamplerDescriptor.lodBiasMVK properties when
  MVK_USE_METAL_PRIVATE_API build setting is disabled.
- MVKCmdSetDepthBias & MVKCmdSetDepthBounds subclass from MVKSingleValueCommand.
- MVKRenderingCommandEncoderState simplify calls to set depth bias
  and depth bounds, and make consistent with other settings.
- Refactor MVKRenderingCommandEncoderState::setContent() and
  setMTLContent() to remove need for intermediate value copies.
- MVKPipeline remove test for depth bounds support since
  it's checked before GPU encoding.
- MVKDepthBias member order same as in Vulkan calls.
- Whats_New.md consolidate notes about MVK_USE_METAL_PRIVATE_API.
2024-02-12 13:50:44 -05:00
Chip Davis
995a28808c MVKSmallVector: Make iterator const correct.
Or the newest libc++ in Xcode 15.3 won't build.

Fixes #2156.
2024-02-09 02:50:02 -07:00
Bill Hollings
885960ac99
Merge pull request #2147 from billhollings/runcts-output-failed-tests
runcts script also output a file containing a list of the failed CTS tests.
2024-01-30 17:12:39 -05:00
Bill Hollings
09aceaa981 runcts script also output a file containing a list of the failed CTS tests.
- Add get_failing_cts_tests.py script to extract failures
  from runcts output, and call automatically from runcts.
2024-01-30 14:47:22 -05:00
Bill Hollings
224b14a080
Merge pull request #2142 from cdavis5e/metal-spis
Add more Metal SPI support
2024-01-29 19:49:12 -05:00
Bill Hollings
03d89dfb8a
Merge pull request #2139 from aitor-lunarg/depth-stencil-swizzle-sample
Handle depth/stencil swizzle sample correctly
2024-01-29 19:39:23 -05:00
Bill Hollings
361b161b8f
Update MoltenVK/MoltenVK/GPUObjects/MVKImage.mm
Minor comment clarification.
2024-01-29 18:54:10 -05:00
Chip Davis
60a429f353 Support the depth bounds test.
This isn't even a regular SPI. It's not even present in the Metal
framework. It's exposed by the driver. Only AMD drivers support the
method we need for now.
2024-01-29 15:42:13 -07:00
Chip Davis
f8b974371b MVKPipeline: Support sample masks in the Metal SPI.
This is yet another "secret" property on the
`MTLRenderPipelineDescriptor`.
2024-01-29 15:39:01 -07:00
Chip Davis
f5d7190554 MVKSampler: Support LoD bias.
Metal actually supports this, but this is a hidden property of the
`MTLSamplerDescriptor`. It's not part of the public API. Guard our use
of it appropriately.
2024-01-29 15:38:52 -07:00
Chip Davis
8d1303a57a MVKPipeline: Support framebuffer logic operations.
This support was always there in Metal. It was just hidden from public
view--but not from prying eyes on the Objective-C metadata.

I had initially thought they were using OpenGL/Vulkan values for the
logic operation. When that didn't work, I then tried D3D11 values. I
guess D3D11 makes sense, because the Intel GPU drivers were the first to
support this in Metal.

Move the definition of `MVK_USE_METAL_PRIVATE_API` into
`"MVKCommonEnvironment.h"` so we can use it from non-C++ code.
2024-01-29 15:37:29 -07:00
Chip Davis
06d493dcc1 Add a configuration parameter to control the use of Metal SPIs.
With the new `MVK_CONFIG_USE_METAL_PRIVATE_API`, the user can prevent their
use at run time without recompiling MoltenVK. This may be useful for
troubleshooting purposes.

The extra member is because the compiler adds tail padding to make the
struct aligned on an 8-byte boundary, so the `static_assert()` fails
without it.
2024-01-29 15:26:23 -07:00
Aitor Camacho
33731ac34c Handle depth/stencil swizzle sample correctly
Fixes CTS tests:
dEQP-VK.pipeline.monolithic.sampler.border_swizzle.d*.opaque_white.*
2024-01-29 16:56:53 +01:00
Bill Hollings
622ab5ad8e
Merge pull request #2144 from billhollings/refactor-single-value-commands
Simplify repetitive copy-paste declarations of single-value Vulkan commands.
2024-01-29 09:45:30 -05:00
Bill Hollings
1c24ec90d9 Simplify repetitive copy-paste declarations of single-value Vulkan commands.
There are many MVKCommand subclasses that simply encode a single value,
resulting in loads of repetitive copy-pasted code.
- Add abstract template superclass MVKSingleValueCommand
  for these concrete command classes.
- Modify MVKCmdSetBlendConstants to hold an MVKColor32 so it can
  subclass from MVKSingleValueCommand, and modify MVKGraphicsPipeline
  and MVKRenderingCommandEncoderState to use MVKColor32.
- Remove trivial comments for simple concrete Vulkan command classes.
2024-01-27 18:19:11 -05:00
Bill Hollings
d4d5dcb8a0
Merge pull request #2141 from billhollings/surface-extent
Don't update currentExtent of headless surface when swapchain attached.
2024-01-26 18:24:30 -05:00
Bill Hollings
3e6b3a7809 Don't update currentExtent of headless surface when swapchain attached. 2024-01-26 18:05:05 -05:00
Bill Hollings
b5ffb474df
Merge pull request #2137 from billhollings/private-widelines
Add optional support for VkPhysicalDeviceFeatures::wideLines.
2024-01-26 09:55:57 -05:00
Bill Hollings
5992dda9ba Add optional support for VkPhysicalDeviceFeatures::wideLines.
- Add MVK_USE_METAL_PRIVATE_API build setting to allow MoltenVK
  to be built with access to Metal private API calls.
- Add support for VkPhysicalDeviceFeatures::wideLines feature
  when MVK_USE_METAL_PRIVATE_API is enabled in a MoltenVK build.
- Set lineWidthRange and lineWidthGranularity to reasonable arbitrary values.
2024-01-25 13:08:10 -05:00
Bill Hollings
3301fdc0f9
Merge pull request #2132 from aitor-lunarg/fix-unresolvable-layered-compute-resolve
Fix unresolvable layered compute resolve
2024-01-25 11:05:10 -05:00
Aitor Camacho
18f06de878 Fix unresolvable layered compute resolve
Implementation did not correctly handle array textures when resolving
unresolvable textures like r8uint formats. Add kernel modules to
correctly resolve through the compute pass.

Fixes CTS failures in test families:
dEQP-VK.api.image_clearing.core.clear_color_attachment.*
dEQP-VK.renderpass.suballocation.multisample_resolve.*
2024-01-25 15:58:15 +01:00
Bill Hollings
680b9d46b8
Merge pull request #2136 from billhollings/add-ios-simulator-dylib
Support libMoltenVK.dylib for iOS Simulator architecture.
2024-01-23 15:33:22 -05:00
Bill Hollings
7f75502440 Support libMoltenVK.dylib for iOS Simulator architecture.
- Xcode now supports building dylib for iOS Simulator
  (but unfortunately not yet tvOS Simulator).
- Restore support for iOS Simulator destination in recent update to
  Cube demo that uses dynamic-linking, by using script build phase
  to overwrite the iOS build of MoltenVK with the iOS Simulator build.
2024-01-23 12:29:38 -05:00
Bill Hollings
133a49cdf4
Merge pull request #2119 from spnda/KHR_shader_integer_dot_product
Add: KHR_shader_integer_dot_product
2024-01-16 18:13:22 -05:00
sean
151e940e13 Add: KHR_shader_integer_dot_product 2024-01-16 20:41:54 +01:00
Bill Hollings
c4f90e84b2
Merge pull request #2126 from aitor-lunarg/fix-va-translate
Fix translation of fully remapped multi vertex attribute bindings
2024-01-16 02:51:10 -05:00
Bill Hollings
b51ae71205
Merge pull request #2128 from billhollings/fix-push-constant-buffer-addresses
Ensure buffers available for buffer addresses in push constants.
2024-01-16 02:48:29 -05:00
Aitor Camacho
a3bb0b802f Fix translation of fully remapped multi vertex attribute bindings
Fix crash on CTS test:
dEQP-VK.robustness.robustness1_vertex_access.out_of_bounds_stride_30_middle_of_buffer

Bindings with multiple vertex attributes would not correctly detect
if the whole binding was remapped to new location/s. This meant
original binding's stride was never set to 0 which would report an
error and in some cases crash.
2024-01-15 19:57:18 +01:00
Bill Hollings
ccf68f4aac Ensure buffers available for buffer addresses in push constants.
Fix issue where push constants contain a buffer address, but no descriptor
resources are encoded, resulting in addressed buffer not resident in GPU.

- Add MVKGPUAddressableBuffersCommandEncoderState to track when the
  GPU-addressable buffer usage needs to be encoded, and only encode
  them once per Metal renderpass.
- Set MVKGPUAddressableBuffersCommandEncoderState dirty whenever
  a buffer is bound for a descriptor or a push constant.

Unrelated changes:
- MVKCommandEncoder::finalizeDrawState() reorder encoding of encoder
  states to encode resource and push-constant encoder states together.
- Move getGraphicsPipeline() and getComputePipeline() to MVKCommandEncoder.
- MVKDevice Remove preallocation on _resources and _gpuAddressableBuffers.
- Align conditions for VkPhysicalDeviceVulkan12Features::bufferDeviceAddress
  to those for VK_KHR_buffer_device_address/VK_EXT_buffer_device_address.
2024-01-13 13:38:06 -05:00
Bill Hollings
41ed2bec36
Merge pull request #2125 from billhollings/fix-img-mem-bind-mapping
Fix potential crash when using multi-planar images.
2024-01-11 15:33:07 -05:00
Bill Hollings
94e86a32bd Fix potential crash when using multi-planar images.
- MVKImage add functions to consolidate mapping plane indexes to memory bindings
  to add safety in situation where one memory binding supports all planes.
- Update MoltenVK version to 1.2.8 (unrelated).
2024-01-11 11:37:50 -05:00
Bill Hollings
66f6ff1e13
Merge pull request #2124 from billhollings/revert-to-default-static-symbols
Revert to disabling MVK_HIDE_VULKAN_SYMBOLS by default.
2024-01-10 17:32:23 -05:00
Bill Hollings
8a675aa3a8 Revert to disabling MVK_HIDE_VULKAN_SYMBOLS by default.
- Statically expose vkGetInstanceProcAddr(), even
  when MVK_HIDE_VULKAN_SYMBOLS is enabled.
- To support Volk, link Cube demo dynamically to libMoltenVK.dylib
  instead of statically to MoltenVK.xcframework.
2024-01-10 17:16:33 -05:00
Bill Hollings
b5774b38fc
Merge pull request #2121 from billhollings/vulkan-sdk-1.3.275
Update dependency libraries to match Vulkan SDK 1.3.275.
2024-01-09 10:43:40 -05:00
Bill Hollings
cb460524d7 Update dependency libraries to match Vulkan SDK 1.3.275.
- Hide static Vulkan API symbols by default
  (build setting MVK_HIDE_VULKAN_SYMBOLS=1 by default).
- Update documentation.
2024-01-09 08:17:16 -05:00
Bill Hollings
e65575c2fb
Merge pull request #2118 from billhollings/upgrade-cube-demo
Upgrade Cube demo to support Volk, as required by demo.
2024-01-07 18:24:55 -05:00
Bill Hollings
43f8888833
Merge pull request #2117 from billhollings/regression-fixes
Various small regression fixes from SDK testing
2024-01-07 02:12:38 -05:00
Bill Hollings
df8e0900fe Upgrade Cube demo to support Volk, as required by demo.
- Add Volk repo to fetchDependencies script and
  ExternalRevisions/Volk_repo_revision file.
- Cube.xcodeproj modify header paths, use of Volk,
  and remove old and unused files.
- Update Demos/README.md to explain that Volk requires MoltenVK
  be built with build setting MVK_HIDE_VULKAN_SYMBOLS enabled.
- MVKInstance support aliasing function name in one extension to a
  function in another extension, to allow MVK_HIDE_VULKAN_SYMBOLS to
  work with extensions promoted to another extension, but not to core,
  and remove additional duplicate functions that were promoted to 1.3,
  but were breaking use of MVK_HIDE_VULKAN_SYMBOLS.
2024-01-06 20:09:20 -05:00