2961 Commits

Author SHA1 Message Date
Bill Hollings
608342b528 Update documentation for prefilling Metal command buffers options. 2022-10-18 12:41:13 -04:00
Bill Hollings
00b2184c23 Fix crash and memory leaks when configured for prefilling Metal command buffers.
- Redefine enumeration values of MVKPrefillMetalCommandBuffersStyle.
- Add option to defer encoding prefilled MTLCommandBuffer to queue submission.
- Remove option to create an autorelease pool in the MVKCommandEncoder
  to span immediate command encodings, because it causes crashes when
  multiple command buffers were overlapping prefilling on the same thread.
- Replace MTLCommandEncoder retain/release macros with template member functions.
- Rename MVKCommandPool::newMTLCommandBuffer() to getMTLCommandBuffer()
  and do not retain the returned MTLCommandBuffer (unrelated).
- Revert MoltenVK logging to use stderr instead of stdout (unrelated).
- Merge branch from master.
2022-10-18 03:28:12 -04:00
Bill Hollings
7662501280
Merge pull request #1745 from billhollings/sdk-1.3.231
Update dependency libraries to match Vulkan SDK 1.3.231.
2022-10-17 16:59:19 -04:00
Bill Hollings
e061e5ebf8 Update dependency libraries to match Vulkan SDK 1.3.231. 2022-10-17 16:05:43 -04:00
Bill Hollings
b751c07eb3 Fix memory leaks when configured for prefilling Metal command buffers.
- Add MVKPrefillMetalCommandBuffersStyle enumeration to enable prefilling,
  and configure memory recovery options.
- Redefine MVKConfiguration::prefillMetalCommandBuffers as a value from
  MVKPrefillMetalCommandBuffersStyle instead of a simple boolean. Set the
  values of MVKPrefillMetalCommandBuffersStyle and the default value of
  MVKConfiguration::prefillMetalCommandBuffers to be compatible with
  legacy use of this setting as a simple enable/disable boolean value.
- MVKCommandEncoder track prefill style, and support option to maintain
  a Metal autorelease pool that is created on vkBeginCommandBuffer()
  and drained on vkEndCommandBuffer(), when prefiling a command buffer
  from a single thread, and an option to wrap each command addition in
  a separate @autoreleasepool{} scope to create and drain an autorelease
  pool at every command addition to the Vulkan command buffer, when
  prefilling a single command buffer from multiple threads.
- MVKCommandEncoder retain Metal encoders when prefilling, because
  prefilling may span multiple autorelease pools.
- MVKCommandEncoder clean up memory leak of MTLBlitPassDescriptor
  during prefilling.
- MVKCommandEncoder rearrange declarations of MVKCommandUse member
  variables to tighten up class memory use (unrelated).
- MVKCommandBuffer remove unnecessary inline declarations (unrelated).
- Change MoltenVK logging to use stdout instead of stderr (unrelated).
2022-10-16 17:03:55 -04:00
Bill Hollings
707da6e043
Merge pull request #1738 from billhollings/fix-vulkan-sem4-fallback
Vulkan semaphore fallback to using single queue if `MTLEvents` unusable.
2022-10-10 09:05:50 -05:00
Bill Hollings
ceb298965e Vulkan semaphore fallback to using single queue if MTLEvents unusable.
- If MTLEvents are unusable, fallback to single queue.
- Adjust values of MVKVkSemaphoreSupportStyle enumeration.
- For legacy compatibility, if legacy semaphoreUseMTLEvent and
  semaphoreUseMTLFence are both disabled, use CPU callback emulation.
- Update and expand related documentation in vk_mvk_moltenvk.h.
2022-10-09 21:17:18 -04:00
Bill Hollings
45e339a283
Merge pull request #1737 from billhollings/fix-hide-vulkan-symbols
Fix support for `MVK_HIDE_VULKAN_SYMBOLS` build setting.
2022-10-09 16:37:15 -05:00
Bill Hollings
0cc6e1d3a4 Fix support for MVK_HIDE_VULKAN_SYMBOLS build setting.
- Remove separate extension entry points for 1.3 promoted
  vkCmdBeginRenderingKHR() and vkCmdEndRenderingKHR() functions,
  which caused build breaks when MVK_HIDE_VULKAN_SYMBOLS=1.
- For consistency, hide vkGetMoltenVKConfigurationMVK(),
  vkSetMoltenVKConfigurationMVK(), and vkGetVersionStringsMVK()
  when MVK_HIDE_VULKAN_SYMBOLS=1, which was an oversight in original
  implementation of hiding Vulkan functions.
- Update build `README.md` for generic command line build settings
  and MVK_HIDE_VULKAN_SYMBOLS in particular.
2022-10-09 16:32:26 -04:00
Bill Hollings
5f52f38f2e
Merge pull request #1730 from rasky/fix_macros
Makefile: fix environment variable definitions
2022-10-09 15:16:19 -05:00
Giovanni Bajo
d32c60a901
Makefile: fix environment variable definitions 2022-10-04 22:58:55 +02:00
Bill Hollings
c2e9f1d876
Merge pull request #1726 from billhollings/vulkan-1_2
Add support for Vulkan 1.2.
2022-09-28 11:01:52 -04:00
sean
e8b32dec92 Final 1.2 fixes 2022-09-26 12:38:03 -04:00
Bill Hollings
ac39eb24e1 Add support for Vulkan 1.2.
- Set MVK_VULKAN_API_VERSION from VK_API_VERSION_1_2.
- Update MoltenVK version to 1.2.0.
- Remove several previously overlooked extension suffixes
  in use of promoted Vulkan struct and enum values.
- Update documentation.
2022-09-26 11:25:49 -04:00
Bill Hollings
77b3cc03f4
Merge pull request #1722 from spnda/provide_1_3_stubs
Add Vulkan 1.3 command stubs
2022-09-24 18:31:14 -04:00
sean
6eaa0351fa
Add Vulkan 1.3 command stubs 2022-09-24 23:54:41 +02:00
Bill Hollings
daea6b3e6a
Merge pull request #1724 from billhollings/VK_KHR_spirv_1_4
Advertise support for extension VK_KHR_spirv_1_4.
2022-09-24 12:53:54 -04:00
Bill Hollings
293e005ac5 GitHub CI use macos-11 to build using Xcode 11.7.
GitHub CI has deprecated and removed support for the macos-10.15 runner image.
2022-09-23 13:22:53 -04:00
Bill Hollings
31a77834f1 Advertise support for extension VK_KHR_spirv_1_4.
- Advertise support for extension VK_KHR_spirv_1_4.
- MoltenVKShaderConverter automatically map bindings when converting GLSL.
- MoltenVKShaderConverter improvements to diagnostic logging.
- Update Whats_New.md document.
2022-09-23 11:43:32 -04:00
Bill Hollings
73a3faa13b
Merge pull request #1723 from rasky/make_vars
Makefile: forward to xcode any variable declared on the command line
2022-09-23 11:13:09 -04:00
Giovanni Bajo
b0e433ad11
Makefile: forward to xcode any variable declared on the command line
Makefile currently special-case MVK_HIDE_VULKAN_SYMBOLS as the only
variable that can be customised on the command line. There are many
others that are useful though, such as MVK_LOG_*. This commit
makes the Makefile more generic and allows to forward to xcode whatever
variable was declared on the command line.
2022-09-23 11:31:14 +02:00
Bill Hollings
44bf22592b
Merge pull request #1720 from rasky/update_spirv
Update SPIRV-Cross to latest version.
2022-09-22 12:08:05 -04:00
Giovanni Bajo
d38cb86e9e
Update SPIRV-Cross to latest version.
MSL: Handle descriptor aliasing of raw buffer descriptors.
MSL: Do not attempt to alias push constants.
MSL: Report unsupported 64-bit atomics.
MSL: Add more keywords to reserved set.
2022-09-22 14:58:25 +02:00
Bill Hollings
b2409824dc
Merge pull request #1719 from billhollings/fix-hidden-symbol-leak
Fix undefined reference to vkGetBufferDeviceAddressEXT when building with MVK_HIDE_VULKAN_SYMBOLS=1.
2022-09-19 16:41:40 -04:00
Bill Hollings
63be111958 Fix undefined reference to vkGetBufferDeviceAddressEXT
when building with MVK_HIDE_VULKAN_SYMBOLS=1.

Alias vkGetBufferDeviceAddressEXT to core function,
and add it as promoted extension function in MVKInstance.
2022-09-19 15:29:40 -04:00
Bill Hollings
250e1f988a
Merge pull request #1715 from cdavis5e/tess-unwritten-builtin-read
MVKPipeline: Add builtins that are read but not written to tessellation pipelines.
2022-09-14 10:25:05 -04:00
Chip Davis
fafcc4b844 MVKPipeline: Add builtins that are read but not written to tessellation pipelines.
It is always legal in Vulkan to read a builtin, particularly
`BuiltInPosition`, even if it weren't written by the previous stage. The
CTS tests that this scenario works in the driver.

Update SPIRV-Cross to pull in a change required for this.

Fixes 8 CTS tests under `dEQP-VK.pipeline.*.no_position`. (Eight other
tests worked solely by accident without this change.)
2022-09-13 13:18:41 -07:00
Bill Hollings
5bae97a4ae
Merge pull request #1709 from KhronosGroup/SingleQueueSemaphore
Merge SingleQueueSemaphore branch into master
2022-09-02 11:51:53 -04:00
Bill Hollings
d7b5a36ddc
Merge pull request #1707 from billhollings/SingleQueueSemaphore
Vulkan semaphore functional improvements.
2022-09-01 17:03:05 -04:00
Bill Hollings
14de07b6f4 Vulkan semaphore functional improvements.
- Support option to use MTLEvents for Vulkan semaphores on NVIDIA and Rosetta2.
- Add public MVKVkSemaphoreSupportStyle enumeration.
- MVKConfiguration replace deprecated legacy booleans semaphoreUseMTLEvent,
  and semaphoreUseMTLFence with enumerated semaphoreSupportStyle.
- Alias legacy semaphoreUseMTLEvent to semaphoreSupportStyle and support legacy
  use of semaphoreUseMTLFence and semaphoreUseMTLEvent for backwards compatibility.
- MVKConfiguration rename recently renamed semaphoreUseSingleQueue back to
  semaphoreUseMTLFence for backwards compatibility.
2022-09-01 12:10:23 -04:00
Bill Hollings
c652ebc745
Merge pull request #1693 from tellowkrinkle/SingleQueueSemaphore
Replace MTLFence semaphores with forcing a single queue
2022-08-30 15:04:58 -04:00
Bill Hollings
37f1988e34
Merge branch 'master' into SingleQueueSemaphore 2022-08-30 14:10:56 -04:00
Bill Hollings
8692a9df52
Merge pull request #1704 from billhollings/desc-idx-auto-mtl-arg-buffs
Support automatically enable Metal argument buffers when VK_EXT_descriptor_indexing extension is enabled.
2022-08-30 13:50:25 -04:00
Bill Hollings
14f99101d7 Set MVKPhysicalDeviceVulkan12FeaturesNoExt parameters based on support.
- shaderOutputViewportIndex requires multi-viewport
- shaderOutputLayer requires layered rendering
- subgroupBroadcastDynamicId requires SIMD support
2022-08-29 14:54:14 -04:00
Bill Hollings
4effb9a5fd Support automatically enable Metal argument buffers when
VK_EXT_descriptor_indexing extension is enabled.

- Change MVKConfiguration::useMetalArgumentBuffers to enum instead of boolean
  and default to enabling Metal argument buffers for VK_EXT_descriptor_indexing.
- Leave Metal argument buffers disabled by default until they are improved.
- Enable VkPhysicalDeviceVulkan12Features::descriptorIndexing.
- Add MVKPhysicalDeviceVulkan12FeaturesNoExt to track and enable Vulkan 1.2
  features not part of any prior extensions absorbed by Vulkan 1.2.
- Update VK_MVK_MOLTENVK_SPEC_VERSION to version `36`.
- MVKDeviceTrackingMixin remove unnecessary inline declarations.
- MoltenShaderConveter tool support Metal Argument Buffers and MSL 3.0.
2022-08-26 14:48:13 -04:00
Bill Hollings
013a192466
Merge pull request #1697 from billhollings/optional-vk12-extn-hooks
Add hooks for optional but currently unsupported Vulkan 1.2 extensions.
2022-08-23 16:24:21 -04:00
Bill Hollings
67cfe53d93 Add hooks for optional but currently unsupported Vulkan 1.2 extensions.
Vulkan 1.2 includes several optional extensions that are not currently
supported by Metal. These include:

- VK_KHR_draw_indirect_count (and VK_AMD_draw_indirect_count)
- VK_KHR_shader_atomic_int64
- VK_KHR_vulkan_memory_model
- VK_EXT_sampler_filter_minmax

Capability flags for these extensions are included in
VkPhysicalDeviceVulkan12Features and VkPhysicalDeviceVulkan12Properties,
and in parallell extension-specific structures.

This addition provides no new user functionality. For consistency with
VkPhysicalDeviceVulkan12Features and VkPhysicalDeviceVulkan12Properties,
the changes here flush out the extension/Vulkan 1.2 parallel functionality,
with a view to prepare to include the functionality consistently in both
an extension and Vulkan 1.2, should the functionality become available
in a future version of Metal.

This change also explicitly includes the optional extensions in
MVKExtensions.def, but disables them from user visibility.
2022-08-23 14:21:40 -04:00
TellowKrinkle
a233e0b5ac Add single-queue handling of VkSemaphore 2022-08-21 23:45:59 -05:00
TellowKrinkle
21a4947e98 Remove MTLFence semaphores
They did nothing.  Might as well call them YOLO semaphores.
2022-08-20 20:41:40 -05:00
Bill Hollings
ea5a53d13c
Merge pull request #1691 from billhollings/VK_KHR_shader_float_controls
Add support for the VK_KHR_shader_float_controls.
2022-08-18 18:55:29 -04:00
Bill Hollings
11679be153
Merge pull request #1690 from bangnoise/pr/localizedName-crash-macOS_10_14
Fix crash in vkCreateSwapchainKHR() on macOS 10.14 and earlier
2022-08-18 17:54:36 -04:00
Tom Butterworth
47d2c74bd1
Style fix
Co-authored-by: Bill Hollings <bill.hollings@brenwill.com>
2022-08-18 21:55:17 +01:00
Bill Hollings
e0a50c8f2d Add support for the VK_KHR_shader_float_controls extension.
- Enable shaderSignedZeroInfNanPreserveFloat16 and
  shaderSignedZeroInfNanPreserveFloat32.
  Other float control properties are not settable in Metal.
- MVKShaderModule log whether compiling with fast math enabled.
- Update MoltenVK_Runtime_UserGuide.md and Whats_New.md documents.
- runcts script enable MVK_CONFIG_FAST_MATH_ENABLED by default.
2022-08-18 13:35:35 -04:00
Tom Butterworth
07ac3c8603 Fix crash in vkCreateSwapchainKHR() on macOS 10.14 and earlier 2022-08-18 16:54:20 +01:00
Bill Hollings
d447ea7940
Merge pull request #1686 from billhollings/fix-1.2-promotion-typo
Remove KHR suffix typo from vkGetDeviceMemoryOpaqueCaptureAddress promotion to Vulkan 1.2.
2022-08-17 13:01:30 -04:00
Bill Hollings
3ceb786440 Remove KHR suffix typo from vkGetDeviceMemoryOpaqueCaptureAddress promotion to Vulkan 1.2. 2022-08-17 12:42:20 -04:00
Bill Hollings
93a171a6e1
Merge pull request #1683 from billhollings/fix-swapchain-retention
Fix retention of MVKSwapchain for future drawable presentations.
2022-08-16 16:53:49 -04:00
Bill Hollings
666d7ed951
Merge pull request #1682 from spnda/vulkan_1_2_commands
Add Vulkan 1.2 core commands
2022-08-16 16:52:19 -04:00
sean
89b3b5f922
Add aliases for draw_indirect_count 2022-08-16 22:06:19 +02:00
Bill Hollings
33ca59ef13 Fix retention of MVKSwapchain for future drawable presentations.
When presenting drawables in the future, the MVKPresentableSwapchainImage
and MVKSwapchain were both being retained by the drawable-presented callback,
so that the presentation timing info can be recorded on the swapchain.
Unfortunately, in the case where the presentation timing is set far enough
into the future (I'm looking at you CTS), the swapchain, and even the
CAMetalLayer's view may be destroyed, causing occasional bad access crashes.

- MVKSwapchainImage don't retain() the swapchain, and move clearing the
  swapchain from the destructor to destroy(), so the MVKSwapchain is not
  necessarily retained by the MVKSwapchainImage, for a drawable being
  presented in the future.
- MVKSwapchainImage add a lock around clearing swapchain and accessing
  it from callbacks.
- Add lockable releaseLayer() function in both MVKSwapchain and MVKSurface,
  which is called from both layer observer and destructor, to handle race
  conditions better.
- MVKSwapchain::initCAMetalLayer() call MVKSurface::getCAMetalLayer() only once.
- Update MoltenVK version to 1.1.12.
- Update What's New document.
2022-08-16 15:27:20 -04:00