2704 Commits

Author SHA1 Message Date
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
Bill Hollings
f5f6515dce Update dependency libraries to match Vulkan SDK 1.3.236.
Update Whats New document.
2022-12-08 14:10:58 -05:00
Bill Hollings
c0c00d78f0
Merge pull request #1793 from billhollings/fix-fastmath-regression
Fix app performance regression triggered by the previous introduction of VK_KHR_shader_float_controls.
2022-12-08 11:34:25 -05:00
Bill Hollings
985ec99832 Fix app performance regression triggered by the previous introduction
of VK_KHR_shader_float_controls.

The introduction of shaderSignedZeroInfNanPreserveFloat32 was causing Metal
fast math to be aggressively disabled by the use of SignedZeroInfNanPreserve
in shaders in some apps, causing a regression in shader performance in those apps.

- Change MVKConfiguration::fastMathEnabled from bool to enumeration to distinguish
  between always using fast math or allowing shaders to selectively disable it.
- Default value to fast math always.
2022-12-07 12:40:50 -05:00
Bill Hollings
de285efba3
Merge pull request #1790 from billhollings/fix-buff-bind-overrides
Fix Metal buffer index binding overrides for push constants and attachment clearing.
2022-11-30 05:32:24 -05:00
Bill Hollings
8e45217fbd Fix Metal buffer index binding overrides for push constants and attachment clearing.
Push constants and attachment clearing can temporarily override Metal buffer
bindings for descriptor sets and vertex attributes. Mark the overridden buffer
bindings and ensure they are reinstated when the pipeline is updated.

- Add MVKMTLBufferBinding::isOverridden to track if buffer binding is
  temporarily overridden.
- Rename MVKResourcesCommandEncoderState::markIndexDirty()
  to markBufferIndexOverridden() to mark buffer bindings as overridden.
- Rename MVKGraphicsResourcesCommandEncoderState::markBufferIndexDirty()
  to markBufferIndexOverridden().
- Rename MVKComputeResourcesCommandEncoderState::markBufferIndexDirty()
  to markBufferIndexOverridden().
- Add MVKResourcesCommandEncoderState::markOverriddenBufferIndexesDirty()
  to mark overridden buffer bindings as dirty.
- Add MVKGraphicsResourcesCommandEncoderState::markOverriddenBufferIndexesDirty()
  and call when render pipeline change is encoded
- Add MVKComputeResourcesCommandEncoderState::markOverriddenBufferIndexesDirty()
  and call when compute pipeline change is encoded.
2022-11-30 00:01:07 -05:00
Bill Hollings
13535d0f35
Merge pull request #1783 from cdavis5e/discarded-frag-checks
MVKPipeline: Force extra checks for stores after fragment discard.
2022-11-23 13:32:52 -05:00
Chip Davis
03ce25da20 MVKPipeline: Force extra checks for stores after fragment discard.
Update SPIRV-Cross to pull in multiple CTS fixes. Handle the new
`check_discarded_frag_stores` and `manual_helper_invocation_updates`
options.
2022-11-21 11:04:29 -08:00
Bill Hollings
417d27da72
Merge pull request #1780 from billhollings/fix-ycbcr-format-support
Fix mistaken YCBCR format support indication.
2022-11-19 09:13:55 -05:00
Bill Hollings
bd497fe713 Fix mistaken YCBCR format support indication.
MVKVkFormatDesc::chromaSubsamplingPlaneCount must be > 1 to be considered supported.
2022-11-18 23:35:46 -05:00
Bill Hollings
0dd329398a
Merge pull request #1769 from MennoVink/#1764_emulated_semaphores_freeze_fix
Only wait on emulated semaphores once...
2022-11-17 18:13:27 -05:00
Bill Hollings
0fe5ffecc5
Merge pull request #1773 from billhollings/misc-small-fixes
Misc small fixes - Document Xcode 13 linkage, and Intel Iris Plus Graphics driver workaround
2022-11-16 15:12:29 -05:00
Bill Hollings
b2acfb61cb Upgrade GitHub CI to use Xcode 14.1 on macOS 12. 2022-11-16 13:58:52 -05:00
Bill Hollings
7c0143c37b Support Xcode 14.1 build settings. 2022-11-15 20:49:17 -05:00
Bill Hollings
4d003bf256 Document new linkage model used by Xcode 14 and later, and how to link
MoltenVK to an app or game using Xcode 13 or earlier.
2022-11-15 18:48:36 -05:00
Bill Hollings
6d7f4330c7 Work around MTLCounterSet crash on additional Intel Iris Plus Graphics devices.
Add 0x8a5a and 0x8a5c to list of Intel Iris Plus Graphics
device IDs requiring workaround.
2022-11-15 17:44:55 -05:00
Bill Hollings
c8f581088f
Merge pull request #1767 from cdavis5e/optimal-tiling-atomics
MVKImage: Always use a texel buffer for atomic storage images.
2022-11-13 17:01:53 -05:00
Chip Davis
b871d8f603 MVKDevice: Fix backwards attribution of storage/uniform texel buffer alignments.
A drive-by fix for something I noticed while investigating a problem
with linear-for-atomics textures.
2022-11-12 14:27:39 -08:00
Chip Davis
94b1ea3c95 MVKImage: Always use a texel buffer for atomic storage images.
Do this even if `OPTIMAL` tiling were requested. Vulkan mandates support
for image atomics on `OPTIMAL`-tiled `R32_UINT` and `R32_SINT` images.
In a way, this is "optimal"; image atomics won't work without this.

Advertise support for atomics on `OPTIMAL` tiled images now.

Fixes at least two CTS tests under
`dEQP-VK.compute.basic.image_atomic_op_*`.
2022-11-12 14:27:32 -08:00
Bill Hollings
9cdf4ed881
Merge pull request #1770 from spnda/fix_cmd_blit
Fix: Invalid blit offsets
2022-11-11 13:47:16 -05:00
sean
0b62f647d5
Fix: Invalid blit offsets 2022-11-11 18:33:54 +01:00
Menno Vink
05c757c8b7 Only wait on emulated semaphores once to prevent freezing when using prefilled command buffers. 2022-11-11 14:18:32 +01:00
Bill Hollings
5ebeac741d
Merge pull request #1755 from cdavis5e/raw-buffer-tese-input
MVKPipeline: Stop using vertex-style input for tessellation evaluatio…
2022-11-10 20:46:24 -05:00
Chip Davis
2cb33c09b6 MVKPipeline: Stop using vertex-style input for tessellation evaluation shaders.
This has caused us nothing but trouble. The code to build up the vertex
descriptor is fragile; we can rip that out now.

Also, make sure to positively identify per-patch blocks as per-patch.
For those, the individual members have the `Patch` decoration.

Update SPIRV-Cross to pull in the changes needed for this.

Fixes 66 tests in the CTS.
2022-11-10 14:12:02 -08:00
Bill Hollings
b283868aea
Merge pull request #1763 from spnda/bda_requirements
Fix: Proper requirements for enabling BDA extensions
2022-11-09 15:28:02 -05:00
sean
237e538bd0
Fix: Proper requirements for enabling BDA extensions 2022-11-09 20:41:42 +01:00
Bill Hollings
7740554a9c
Merge pull request #1759 from spnda/KHR_copy_commands2
Add: KHR_copy_commands2
2022-11-09 13:49:14 -05:00
sean
8a7979d3d0
Cleanup MVKCmdBufferImageCopy::setContent 2022-11-09 16:33:08 +01:00
sean
331d8e1d0b
Deduplicate code 2022-11-09 16:11:02 +01:00
sean
270a0198e0
Add: KHR_copy_commands2 2022-11-06 00:58:19 +01:00
Bill Hollings
9fa413d54c
Merge pull request #1754 from billhollings/fix-desc-update-bounds-crash
Fix crash on descriptor update with out-of-bounds descriptor count data.
2022-10-31 17:07:57 -04:00
Bill Hollings
0287a3242c Fix crash on descriptor update with out-of-bounds descriptor count data.
Update MoltenVK version to 1.2.1.
2022-10-31 14:41:08 -04:00
Bill Hollings
67d59ae3ee
Merge pull request #1747 from KhronosGroup/rw_lunarg_fixjson
fix for wrong version number in icd json
2022-10-25 12:46:23 -04:00
Richard S. Wright Jr
9987bca0d2 fix for wrong version number in icd json 2022-10-20 15:29:24 -04:00
Bill Hollings
260bad42e1
Merge pull request #1744 from billhollings/fix-prefilling-mem-leaks
Fix memory leaks when configured for prefilling Metal command buffers.
2022-10-18 12:51:17 -04:00
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