2432 Commits

Author SHA1 Message Date
Bill Hollings
45ffcc9564 Occlusion query fixes from PR review.
MVKOcclusionQueryCommandEncoderState::beginOcclusionQuery() check for visibility
buffer exhaustion, and if needed, log an error and disable further visibility
tracking for the remainder of the current MTLCommandBuffer.
Create visibility buffer if needed during MVKCommandEncoder::beginMetalRenderPass.
Simplify MVKCommandEncodingContext to PODS.
2021-06-25 08:46:52 -04:00
Bill Hollings
1421c1e9a4
Merge pull request #1391 from danginsburg/stencil_clear_fix
Fixes #1390 - when MVKRenderSubpass::populateClearAttachments determi…
2021-06-24 15:49:55 -04:00
danginsburg
5d8a76f927 Address code review feedback. 2021-06-24 15:03:59 -04:00
Bill Hollings
84e8e9ed73
Merge pull request #1389 from billhollings/add-cts-script
Add Scripts/runcts script as a convenience for running Vulkan CTS tests.
2021-06-24 13:14:16 -04:00
danginsburg
2c7db45aa1 Fixes #1390 - when MVKRenderSubpass::populateClearAttachments determines whether to clear stencil, it was using the loadOp for the depth. It needs to look at the loadOp for the stencil which is set independently. 2021-06-24 12:08:15 -04:00
Bill Hollings
51e3ae0d23 Additional documentation clarification in Scripts/runcts script. 2021-06-24 08:32:06 -04:00
Bill Hollings
b65d8f8677 Fixes to Scripts/runcts script from PR review.
Consolidate portability command line options selection.
Document magic numbers used to limit portability option
to Vulkan 1.0 and limited extensions.
2021-06-24 08:27:28 -04:00
Bill Hollings
368044b8b4
Merge pull request #1388 from billhollings/fix-block-observer-leak
Fix small memory leak during swapchain creation.
2021-06-22 19:53:35 -04:00
Bill Hollings
25d1349579 Add Scripts/runcts script as a convenience for running Vulkan CTS tests.
Update .gitignore to ignore CTS artifacts in Scripts directory.
2021-06-22 19:45:24 -04:00
Bill Hollings
664296abd0 Fix small memory leak during swapchain creation.
Add ability to profile Cube demo on macOS.
2021-06-22 11:50:58 -04:00
Bill Hollings
53dde5718a Syntactically simplify tracking of outstanding occlusion queries.
Add MVKOcclusionQueryCommandEncoderState::OcclusionQueryLocation to
more directly track occlusion query locations in temp visibility buffer.
2021-06-21 12:37:46 -04:00
Bill Hollings
e72cd614e1 Fix issue where M1 GPU does not support reusing Metal visibility buffer offsets
across separate render encoders within a single Metal command buffer (Vulkan submit).

Add MVKCommandEncodingContext to track information across multiple
MVKCommandEncoders, and use it to track temporary visibility buffer and offset.
Add support for more than one temporary visibility buffer per MTLCommandBuffer
when current temporary visibility buffer is exhausted.
2021-06-21 11:17:40 -04:00
Bill Hollings
450feb0d30 Fix issue where M1 GPU does not support reusing Metal visibility buffer
offsets across separate render encoders within a single Vulkan command buffer.

Monotonically increase the offset into the temporary visibility buffer
after each query in a MVKCommandEncoder (ie- Vulkan command buffer).
2021-06-18 17:59:30 -04:00
Bill Hollings
adc43456bd
Merge pull request #1384 from billhollings/build-updates
Various build updates
2021-06-15 08:16:54 -04:00
Bill Hollings
d5b4ef1b19
Merge pull request #1381 from js6i/volatile_buffer_locking
MVKMTLBufferAllocator: Make sure temporary buffers stay mlocked() until they're encoded.
2021-06-15 08:15:08 -04:00
Bill Hollings
71b71be33c Add Xcode destinations in Makefile to avoid Xcode 13 warnings. 2021-06-14 19:59:33 -04:00
Bill Hollings
6b502bcb60 Upgrade projects to Xcode 13 SDK APIs.
Add MVK_XCODE_13 code macro.
Support MTLLanguageVersion2_4 enum value.
MoltenVKPackaging project add DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING
build setting to suppress build warnings about using manual build orders.
2021-06-14 16:24:32 -04:00
Bill Hollings
a7a8a88904 Upgrade projects to Xcode 13 build settings. 2021-06-14 11:35:43 -04:00
Bill Hollings
269fca63ba Upgrade project builds to use C++17. 2021-06-14 10:39:42 -04:00
Jan Sikorski
c9d425a37b MVKMTLBufferAllocator: Make sure temporary buffer data is not discarded while in use.
e1ac50c0 marks temporary buffers as volatile, but it only mlocks() them for the duration
of memcpy() of initial data, leaving Metal runtime a window to snatch it before the buffer
is no longer in use. Simply putting the munlock() in a completion handler raises questions
about possible edge cases where multiple, non page-aligned allocations are live.
This patch fixes it by keeping the whole buffer non-volatile while is supports any active
allocations.

Fixes rendering issues in Sekiro: Shadows Die Twice menus.
2021-06-11 16:31:28 +02:00
Bill Hollings
ef34fb7f37 Set project build optimizations to -O2 for all Release mode builds. 2021-06-10 18:32:38 -04:00
Bill Hollings
c2ded942e2
Merge pull request #1382 from billhollings/coherent-texture-flushing
Reorganize coherent texture flushing on memory map and unmap.
2021-06-10 18:22:11 -04:00
Bill Hollings
bb7b46be0f MoltenVKShaderConverter build fixes.
Remove #include "SPIRVReflection.h" from SPIRVToMSLConverter.h.
Remove MoltenVKShaderConverter/Common and move contained files to
MoltenVKShaderConverter/MoltenVKShaderConverter.
2021-06-10 15:56:58 -04:00
Bill Hollings
a2d8cf1710 Reorganize coherent texture flushing on memory map and unmap.
MVKDeviceMemory track original Vulkan memory coherency request, not just Metal
coherency status.

MVKDeviceMemory map() and unmap() only triggers host flush if coherent Vulkan memory
was requested, not just when Metal memory is coherent, because this can be changed
for dedicated image resources.

Redesign MVKDeviceMemory flushToDevice() and pullFromDevice()
to be consistent operation with each other.

Don't trigger automatic texture flush during vkCmdCopyImage(), as it can
cause an unexpected update from mapped memory, resulting in a race condition.
2021-06-09 10:53:10 -04:00
Bill Hollings
b74040a93d
Merge pull request #1375 from billhollings/begin-renderpass-fixes
Begin renderpass fixes
2021-06-01 23:04:53 -04:00
Bill Hollings
db056e36f7 Pass attachments to MVKBeginRenderPass::setContents() as an MVKArrayRef.
MVKBeginRenderPass::setContents() use MVKSmallVector::assign()
to add attachments and clear colors.
MVKFramebuffer add getAttachments() and remove getAttachment()
and getAttachmentCount().
2021-06-01 12:40:26 -04:00
Bill Hollings
8eaf065aa0 Derive MVKCmdBeginRenderPass attachment count and imageless status once. 2021-05-31 22:30:54 -04:00
Bill Hollings
a73f10a35d Consolidate vkCmdBeginRenderPass() and vkCmdBeginRenderPass2KHR() handling.
Add mvkCmdBeginRenderPass() and call from both
vkCmdBeginRenderPass() and vkCmdBeginRenderPass2KHR().
MVKCmdBeginRenderPassBase and MVKCmdBeginRenderPassBase
constructors pass VkSubpassBeginInfo.
Remove overloaded MVKCmdBeginRenderPassBase::setContent().
2021-05-31 22:08:11 -04:00
Bill Hollings
51188ace2c Clear attachments in MVKCmdBeginRenderPass between invocations.
Fixes crash due to incorrect number of attachments.
Update What's New document with VK_KHR_imageless_framebuffer extension.
2021-05-31 21:31:30 -04:00
Bill Hollings
1f29e4e599
Merge pull request #1373 from billhollings/memoryless-fixes
Fix crash using memoryless storage for input attachments on Apple Silicon.
2021-05-31 20:23:42 -04:00
Bill Hollings
776719106c Fix crash using memoryless storage for input attachments on Apple Silicon.
Don't allow memoryless storage for VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT.
Memoryless storage for VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT descriptors
requires support for, and use of, shader framebuffer fetch.

Remove compile-time checking for MVK_APPLE_SILICON before disabling memoryless storage
for buffers and images, since the requirement exists for all platforms, and memoryless
storage will already otherwise be disabled on other platforms anyway.
2021-05-31 17:20:35 -04:00
Bill Hollings
e06eb3a892
Merge pull request #1370 from f32by/imageless_framebuffer
Support the VK_KHR_imageless_framebuffer extension.
2021-05-31 13:20:24 -04:00
UnsafeBy
6fe4cc5e13 Add MVKCmdBeginRenderPass template specializations for 2 framebuffer attachments. 2021-05-31 14:11:13 +08:00
UnsafeBy
d402a3265f Implement iterator-based assign() in pointer verion of MVKSmallVectorImpl. 2021-05-30 11:06:17 +08:00
Bill Hollings
0973096add
Merge pull request #1368 from ahelpingchip/fix-docs-typos
Fix minor typos in docs
2021-05-29 16:21:55 -04:00
Bill Hollings
3a2a92763d
Merge pull request #1369 from billhollings/mtlcmdbuff-labels
Add label strings to MTLCommandBuffers, based on use type, for GPU Capture debugging.
2021-05-29 16:21:16 -04:00
UnsafeBy
703cdcf332 Update: support the VK_KHR_imageless_framebuffer extension.
Remove framebuffer reference in MVKCommandEncoder. Instead,
1) non-imageless: copy the attachment vector from
   VkFramebufferCreateInfo if it does not contain the
   VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT_KHR flag.
or
2) imageless: copy the attachment vector from
   VkRenderPassAttachmentBeginInfo when calling
   vkBeginRenderPass/vkBeginRenderPass2.
2021-05-29 11:59:42 +08:00
UnsafeBy
c49ad89ffa
Update MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm
Co-authored-by: Chip Davis <cdavis@codeweavers.com>
2021-05-29 10:00:27 +08:00
UnsafeBy
797b92e606
Update MoltenVK/MoltenVK/Commands/MVKCommandBuffer.h
Co-authored-by: Chip Davis <cdavis@codeweavers.com>
2021-05-29 10:00:19 +08:00
UnsafeBy
a723dc1f21 Support the VK_KHR_imageless_framebuffer extension.
I'm not sure this is the elegant way but it works in my own
project:)
2021-05-28 23:28:20 +08:00
Bill Hollings
5f4c4b257f Add label strings to MTLCommandBuffers, based on use type, for GPU Capture debugging.
Extend MVKCommandUse enum to identify additional command buffer uses.
MVKQueueCommandBufferSubmission track use type.
MVKQueue pass use type in functions that result in creation of a MTLCommandBuffer.
Add mvkMTLCommandBufferLabel() to map use types to label strings.
2021-05-27 18:15:27 -04:00
Philip Cheang
c70790bf0f
Fix minor typos in What's New 2021-05-28 02:18:48 +08:00
Philip Cheang
76abba6199
Fix minor typos in User Guide. 2021-05-28 02:02:15 +08:00
Bill Hollings
102037491a
Merge pull request #1367 from billhollings/device-loss-fixes
Device loss fixes
2021-05-25 23:35:27 -04:00
Bill Hollings
729dd5f7d4
Minor comment typo fix.
Co-authored-by: Chip Davis <cdavis@codeweavers.com>
2021-05-25 23:14:18 -04:00
Bill Hollings
9e5ff3a614 Changes to MVKConfiguration::resumeLostDevice behavior.
On command buffer submission failure, if MVKConfiguration::resumeLostDevice enabled,
do not release waits on VkDevice, and do not return VK_ERROR_DEVICE_LOST, unless
VkPhysicalDevice is also lost.
2021-05-25 12:14:14 -04:00
Bill Hollings
f4fbc1ec23 Fix race condition on MVKQueueCommandBufferSubmission fence during device loss.
MVKQueueCommandBufferSubmission retain() and release() fence and signal semaphores
to ensure they live long enough for the submission to finish using them.
2021-05-24 18:23:12 -04:00
Bill Hollings
cafb188d6f
Merge pull request #1365 from billhollings/linear-attach-decision-fix
Fix inconsistent handling of linear attachment decisions on Apple Silicon.
2021-05-20 22:11:12 -04:00
Bill Hollings
d806530d7b
Fix syntactic typo in comment.
Co-authored-by: Chip Davis <cdavis@codeweavers.com>
2021-05-20 21:51:03 -04:00
Bill Hollings
4d2448db3f Fix inconsistent handling of linear attachment decisions on Apple Silicon. 2021-05-20 16:07:34 -04:00