2845 Commits

Author SHA1 Message Date
Filip Lundgren
d8b5a7df55 Merge branch 'main' of https://github.com/KhronosGroup/MoltenVK into visionOS 2023-06-23 10:29:57 -04:00
Filip Lundgren
16990efeb1 Support building for visionOS
Note: Internal naming is xrOS, but publicly it should be referred to as visionOS
2023-06-23 10:25:05 -04:00
Bill Hollings
3e1fb4fe52
Merge pull request #1954 from AntarticCoder/khr-deferred-operation
Implemented Deferred Host Operations
2023-06-22 10:35:50 -04:00
Antarctic Coder
e5bfc2d66e C-Style Arrays instead of MVKSmallVector
This commit changes the MVKSmallVector to a C-Style array because the parameters array will not have to resize, and it seems that a C-Style array is just as capable of doing the job.
2023-06-21 11:00:15 -04:00
Antarctic Coder
fa19fcc962 Push to Compile MVKSmallVector with void*
Pushing to Github to compile with Github Actions to see if MVKVectors with void* can work
2023-06-20 13:11:54 -04:00
Antarctic Coder
c0705c8f7d Made some fixes for Deferred Operations
The changes are as follows:

* Moved the code around to fit with the ordering system
* Added a function to get available cpu cores
* Renamed variables with _ in front of them
* Added mutexes and lock guards for the getters and setters of the max concurrency and result variables
* Made max concurrency dynamic by returning 0 when the operation is finished
2023-06-20 10:19:29 -04:00
Antarctic Coder
ab7087165a
Fixed comments for deferred operations
Co-authored-by: Chip Davis <cdavis5x@gmail.com>
2023-06-20 08:28:59 -04:00
Antarctic Coder
33cd6f24c4 Implemented Deferred Host Operations
Implemented deferred host operations in this commit. It was pretty simple with nothing Metal specific. I am a bit concerned on the return types of MVKDeferredOperation::join and about how to store the operation to be executed for later.
2023-06-19 15:18:15 -04:00
Bill Hollings
9356c89bd5
Merge pull request #1949 from billhollings/swap-system-GPU-fix
Don't call MTLCreateSystemDefaultDevice() on every swapchain creation.
2023-06-16 09:00:02 -04:00
Bill Hollings
78f3e1ee28
Merge pull request #1951 from billhollings/log-shdr-conv-err-info
Log more info about SPIR-V to MSL conversion errors.
2023-06-15 20:33:18 -04:00
Bill Hollings
e69c249348 Log more info about SPIR-V to MSL conversion errors.
Remove unhelpful "Shader module does not contain
an entry point named 'main0'" error message.
2023-06-15 19:56:36 -04:00
Bill Hollings
425505da47 Don't call MTLCreateSystemDefaultDevice() on every swapchain creation.
- When forcing the window system to use the same high-power GPU as the app,
  move the call to MTLCreateSystemDefaultDevice() to MVKDevice constructor,
  instead of MVKDevice::createSwapchain(), and test whether the
  VK_KHR_swapchain extension is enabled to determine the need to swap GPUs.

- After calling MTLCreateSystemDefaultDevice() the GPU will already be
  the same high-power GPU, so remove attempting to replace the MTLDevice.

- Remove MVKPhysicalDevice::replaceMTLDevice() as no longer used.

- Remove many unnecessary inline declarations in MVKDevice.h (unrelated).
2023-06-15 17:24:50 -04:00
Bill Hollings
4a9bf78e03
Merge pull request #1946 from billhollings/no-rendpass-no-dyn-rend-info
Allow both renderPass and VkPipelineRenderingCreateInfo to be missing.
2023-06-15 10:34:57 -04:00
Bill Hollings
b94553dbb3 Allow both renderPass and VkPipelineRenderingCreateInfo to be missing.
This avoids crashes in CTS when creating a graphics pipeline.
2023-06-14 18:49:40 -04:00
Bill Hollings
bdbf9abf0a
Merge pull request #1944 from RaafatAkkad/main
Allows maximizing the concurrent executing compilation tasks.
2023-06-14 17:58:40 -04:00
Raafat Akkad
e7243572d7 Allows maximizing the concurrent executing compilation tasks.
https://developer.apple.com/videos/play/wwdc2023/10127/?time=540
On an M1 Pro Macbook Pro 16" maximumConcurrentCompilationTaskCount goes from 2 to 8
2023-06-14 20:17:53 +01:00
Bill Hollings
4949c34b4d
Merge pull request #1936 from billhollings/present-imm-mode-unless-present-time
Support VK_PRESENT_MODE_IMMEDIATE_KHR if VkPresentTimeGOOGLE::desiredPresentTime is zero.
2023-06-07 18:41:57 -04:00
Bill Hollings
49748602dd
Merge pull request #1935 from cdavis5e/shader-demote-to-helper
Advertise the VK_EXT_shader_demote_to_helper_invocation extension.
2023-06-07 16:10:27 -04:00
Chip Davis
750adcaae2 Advertise the VK_EXT_shader_demote_to_helper_invocation extension.
As of macOS Big Sur and iOS/tvOS 14, the `discard_fragment()` function
in MSL is defined to have demote semantics; that is, fragment shader
output is discarded, but the fragment shader thread continues to run as
a helper invocation. This is very useful for Direct3D emulation, since
this is the semantic that HLSL `discard` has.

Signed-off-by: Chip Davis <chip@holochip.com>
2023-06-07 12:48:02 -07:00
Bill Hollings
3690a52a0e
Merge pull request #1942 from rcombs/spirv-cross-fix
Update SPIRV-Cross revision to include function constant fix
2023-06-07 11:35:08 -04:00
rcombs
3fbde1615d update SPIRV-Cross revision to include function constant fix; closes #1941 2023-06-06 14:26:29 -05:00
Bill Hollings
6fb53471b1 Support VK_PRESENT_MODE_IMMEDIATE_KHR if VkPresentTimeGOOGLE::desiredPresentTime is zero.
- [MTLDrawable presentAtTime:] syncs to display vsync. To support
  VK_PRESENT_MODE_IMMEDIATE_KHR while using VkPresentTimeGOOGLE::presentID,
  only call presentAtTime: if VkPresentTimeGOOGLE::desiredPresentTime has
  been explicitly set to a non-zero value.
- Clarify initially clearing MVKImagePresentInfo to all zeros.
2023-06-05 19:17:10 -04:00
Bill Hollings
0332055cff
Merge pull request #1927 from billhollings/demo-support-immediate-present-mode
Add support for VK_PRESENT_MODE_IMMEDIATE_KHR to macOS Cube demo.
2023-05-30 21:56:17 -04:00
Bill Hollings
107be116b7 Add support for VK_PRESENT_MODE_IMMEDIATE_KHR to macOS Cube demo.
- Only log performance stats on FPS logging if logging style is explicitly
  set to MVK_CONFIG_ACTIVITY_PERFORMANCE_LOGGING_STYLE_FRAME_COUNT (unrelated).
2023-05-30 21:11:02 -04:00
Bill Hollings
2a4e415665
Merge pull request #1922 from billhollings/fix-comp-enc-state
Ensure compute encoding state is marked dirty for non-dispatch commands.
2023-05-26 08:21:05 -04:00
Bill Hollings
83a1811230 Ensure compute encoding state is marked dirty for non-dispatch commands.
The same compute encoder is used across dispatches and other commands,
which may override compute state, and end up breaking subsequent dispatches.

- Mark compute encoding state dirty when following commands,
  which use Metal compute encoders, are issued:
  - vkCmdCopyBuffer()
  - vkCmdClearColorImage()
  - vkCmdClearDepthStencilImage()
  - vkCmdFillBuffer()
  - vkCmdCopyQueryPoolResults()

- MVKCommandEncoder move marking compute state dirty from
  endCurrentMetalEncoding() to getMTLComputeEncoder().
- For efficiency, don't prematurely force end of query copy compute encoder
  used on renderpass end, in case compute dispatches follow.

- Update MoltenVK to 1.2.5 (unrelated).
2023-05-26 00:06:40 -04:00
Bill Hollings
4c6bfbebd1
Merge pull request #1920 from billhollings/always-advertise-VK_KHR_depth_stencil_resolve
Advertise VK_KHR_depth_stencil_resolve extension on all devices.
2023-05-23 20:14:26 -04:00
Bill Hollings
b26ce32a60 Advertise VK_KHR_depth_stencil_resolve extension on all devices.
Advertise VK_KHR_depth_stencil_resolve extension on early iOS devices,
since VK_RESOLVE_MODE_SAMPLE_ZERO_BIT is supported on all devices,
even if other resolve modes are not, and makes it consistent with
Vulkan 1.2 mandatory support for VK_RESOLVE_MODE_SAMPLE_ZERO_BIT.
2023-05-23 19:01:31 -04:00
Bill Hollings
3d7f996f6a
Merge pull request #1918 from billhollings/accumulate-render-stages
Accumulate render stages when a resource is used by multiple descriptor bindings.
2023-05-23 16:55:51 -04:00
Bill Hollings
b863ecef4d Accumulate render stages when a resource is used by multiple descriptor bindings. 2023-05-23 13:13:19 -04:00
Bill Hollings
a832e3805a
Merge pull request #1916 from billhollings/sdk-1.3.250
Update dependency libraries to match Vulkan SDK 1.3.250.
2023-05-23 11:06:02 -04:00
Bill Hollings
c231c90dd4 Update dependency libraries to match Vulkan SDK 1.3.250.
- Update Whats New document.
2023-05-22 20:00:14 -04:00
Bill Hollings
1a386e0493
Merge pull request #1913 from italomandara/update-spirv-cross-revision
Update SPIRV-Cross revision to fix explicit LOD workaround regression
2023-05-21 07:19:58 -04:00
Italo Mandara
0125e5b739 Revert "Allow to disable Explicit LOD Workaround"
This reverts commit 6f3a2b709fbfcfdf7dc077b80b12f02463cc07b1.
2023-05-21 00:27:16 +01:00
Italo Mandara
6c633a7a18 update SPIRV-Cross revision to include explicit LOD workaround regression fix 2023-05-21 00:26:44 +01:00
Bill Hollings
b3ae0f48d0
Merge pull request #1911 from etang-cw/NoAbortOnCompilationFailure
Check if shader compiled before adding it to a pipeline
2023-05-18 11:47:46 -04:00
Evan Tang
75b4d26fbc Check if shader compiled before adding it to a pipeline
Prevents Metal from aborting when you try to set a null function on the descriptor
2023-05-17 15:47:47 -05:00
Bill Hollings
ae0ee6a012
Merge pull request #1908 from billhollings/fix-deviceUUID
Populate deviceUUID from MTLDevice location and peer group info.
2023-05-17 15:09:46 -04:00
Bill Hollings
665ef6df13 Improve support for deviceUUID and deviceLUID.
- MTLDevice registryID is not constant across OS reboots,
  which is not conformant with deviceUUID requirements.
- Replace with combination of MTLDevice location, locationNumber,
  peerGroupID, and peerIndex, which should define uniqueness,
  and should be constant across OS reboots.
- Populate deviceLUID from MTLDevice registryID.
2023-05-17 14:50:48 -04:00
Bill Hollings
6111aabc8f
Merge pull request #1910 from billhollings/fix-ts-qp
Do not fail on request for timestamp query pool that is too large.
2023-05-17 10:50:23 -04:00
Bill Hollings
d29092ab78 Do not fail on request for timestamp query pool that is too large.
- Report error, but do not fail on request for timestamp query pool
  that is too large for MTLCounterSampleBuffer.
- Change reported error to VK_ERROR_OUT_OF_DEVICE_MEMORY and clarify
  text of error reported when timestamp query pool is too large.
- Clarify error reported for occlusion query pool errors (unrelated).
2023-05-16 17:26:26 -04:00
Bill Hollings
44c3063439
Merge pull request #1906 from billhollings/ensure-present-time
Ensure swapchain image presented time is always populated when requested.
2023-05-15 19:09:40 -04:00
Bill Hollings
65ce195a6f Ensure swapchain image presented time is always populated when requested.
If Metal reports zero presentedTime, and desired presentation
time has not been set by app, use the current time.
2023-05-15 18:47:22 -04:00
Bill Hollings
9c55ef3116
Merge pull request #1905 from billhollings/id-unsupp-dvc-feat-flags
Identify each unsupported device feature flag that the app attempts to enable.
2023-05-15 15:49:45 -04:00
Bill Hollings
4893f78b29 Identify each unsupported device feature flag that the app attempts to be enable.
- Make MVKDevice::enableFeatures() functions into templates to pass struct type.
- Add mvkGetAddressOfFirstMember() to retrieve the address of the first member of
  a struct, taking into consideration whether the struct has a Vulkan pNext member.
- Add mvk::getTypeName() and mvk::getOrdinalSuffix() string functions.
2023-05-15 15:14:30 -04:00
Bill Hollings
7d4f5745f7
Merge pull request #1903 from ChibiDenDen/simulator_feature_discovery_fix
Fix simulator feature discovery
2023-05-13 12:28:07 -04:00
Bill Hollings
9bdc29a5ec
Merge pull request #1902 from etang-cw/FixReorderCtor
Fix reorder-ctor warning
2023-05-13 12:05:40 -04:00
ChibiDenDen
0139b95849 Fix simulator feature discovery
Fix depth clamp and texture swizzle feature discovery on simulator builds

Both of these features are not supported by the iphone simulator
and leads to crashes when used
2023-05-12 23:41:46 +03:00
Evan Tang
47ce47ad4c Fix reorder-ctor warning 2023-05-12 14:10:14 -05:00
Bill Hollings
734a185170
Merge pull request #1898 from etang-cw/PushBindPoint
Respect the bind point supplied to vkCmdBindDescriptorSets / vkCmdPushDescriptorSets
2023-05-12 14:42:26 -04:00