3029 Commits

Author SHA1 Message Date
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
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
Bill Hollings
d6cb82e98e MTLPixelFormats constructor retrieve MTLDevice when no physical device.
To consistently modify settings based on MTLDevice,
MTLPixelFormats constructor retrieves or creates
temp MTLDevice once, and passes to support functions.
2024-01-05 21:01:54 -05:00
Bill Hollings
39efdd9c68 Support additional VK_KHR_format_feature_flags2 format feature flags.
- VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT
- VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT
- VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT
2024-01-05 19:28:58 -05:00
Bill Hollings
d481226bf2
Merge pull request #2115 from billhollings/vulkan-sdk-1.3.273
Update dependency libraries to match Vulkan SDK 1.3.273.
2024-01-05 08:20:46 -05:00
Bill Hollings
f7e32e0f33 Update dependency libraries to match Vulkan SDK 1.3.273.
- Update Whats_New.md.
2024-01-05 07:13:54 -05:00
Bill Hollings
bb3913bd84
Merge pull request #2114 from billhollings/update-copyright-dates
Update copyright notices to year 2024.
2024-01-04 17:17:13 -05:00
Bill Hollings
d9f75ed812 Update copyright notices to year 2024. 2024-01-04 14:51:53 -05:00
Bill Hollings
48adb42d37
Merge pull request #2105 from billhollings/fix-mtl-fmt-lookup
Fix Metal vertex format lookup logic and reduce memory used by MVKPixelFormats lookups.
2024-01-04 14:25:11 -05:00
Bill Hollings
a836e18050 Reduce memory used by MVKPixelFormats lookups.
- Add MVKInflectionMap collection to manage lookups based on enums
  that have a large set of consecutive elements, plus additional enum
  values that are more sparsely assigned.
- Recognize every MTLPixelFormat value can be held in uint16_t.
- Reduce inflection-map sizes by calling shrink_to_fit().
- runcts script log completion time (unrelated).
2024-01-04 12:02:28 -05:00
Bill Hollings
0654928a96 Reduce memory used by MVKPixelFormats lookups.
- Add MVKInflectionMap collection to manage lookups based on enums
  that have a large set of consecutive elements, plus additional enum
  values that are more sparsely assigned.
- Recognize every MTLPixelFormat value can be held in uint16_t.
- Reduce inflection-map sizes by calling shrink_to_fit().
- runcts script log completion time (unrelated).
2024-01-03 12:23:38 -05:00
Bill Hollings
d20d13fe27
Merge pull request #2108 from spnda/format_feature_flags2
Add: KHR_format_feature_flags2
2024-01-03 10:58:16 -05:00
Bill Hollings
ae073e737e
Merge pull request #2110 from spnda/KHR_calibrated_timestamp
Add: KHR_calibrated_timestamp
2024-01-03 10:55:41 -05:00
sean
28d512cb51 Upgrade all internal format feature usage to 2 2024-01-03 08:03:33 +01:00
sean
e49a69e617 Add: KHR_format_feature_flags2 2024-01-03 08:03:27 +01:00
sean
6e94ff0bcc Add: KHR_calibrated_timestamp 2024-01-03 07:58:13 +01:00
Bill Hollings
3cabd30719
Merge pull request #2109 from spnda/KHR_vertex_attribute_divisor
Add: KHR_vertex_attribute_divisor
2024-01-02 12:06:11 -05:00
sean
3ea2ab7412 Add: KHR_vertex_attribute_divisor 2024-01-01 03:49:04 +01:00
Bill Hollings
88799cf255 Reduce memory used by MVKPixelFormats lookups.
- Add MVKInflectionMap collection to manage lookups based on enums
  that have a large set of consecutive elements, plus additional enum
  values that are more sparsely assigned.
- Recognize every MTLPixelFormat value can be held in uint16_t.
- Reduce inflection-map sizes by calling shrink_to_fit().
- runcts script log completion time (unrelated).
2023-12-31 11:51:11 -05:00
Bill Hollings
ad8b963e75
Merge pull request #2107 from spnda/apple9
Add: Recognize Apple9
2023-12-28 15:57:15 -05:00
sean
1cbfd0a0a7 Add: Recognize Apple9 2023-12-28 21:27:26 +01:00
Bill Hollings
22427b8424
Merge pull request #1940 from spnda/metal31_formats
Add support for RG11B10 and RGB9E5 vertex formats
2023-12-27 20:31:27 -05:00
sean
86c080d9c8 Add: Support for RG11B10 and RGB9E5 vertex formats 2023-12-28 01:48:37 +01:00
Bill Hollings
fe65485bfb Fix Metal vertex format lookup logic.
- Remove MVKPixelFormats::_mtlFormatDescIndicesByMTLVertexFormats and
  index into _mtlVertexFormatDescriptions using MTLVertexFormat directly.
- Fix assertion to test MTLVertexFormat < _mtlVertexFormatCount.
2023-12-27 18:38:23 -05:00
Bill Hollings
76233bc654
Merge pull request #2095 from billhollings/VK_EXT_layer_settings
Add support for VK_EXT_layer_settings extension
2023-12-19 18:22:02 -05:00