2610 Commits

Author SHA1 Message Date
Bill Hollings
0de4cafb72 Fixes from PR code review.
Inline MVKRenderSubpass::hasDepthStencilAttachment() and fix minor comment typo.
2021-07-26 16:51:58 -04:00
Bill Hollings
6372ba4792 Fixes from PR code review.
Remove dead code and make GPU counter creation error message generic.
2021-07-26 16:40:34 -04:00
Bill Hollings
293c049a16 Properly ignore non-null pipeline creation pointers that should be ignored.
See for reference spec description of VkGraphicsPipelineCreateInfo, and CTS test
dEQP-VK.api.pipeline.pipeline_invalid_pointers_unused_structs.graphics
2021-07-24 20:33:21 -04:00
Bill Hollings
2adb24bde2 Merge master branch into timestamp-using-metal-gpu-counters branch. 2021-07-23 12:42:27 -04:00
Bill Hollings
9bf9030236
Merge pull request #1406 from billhollings/update-spirv-cross
Update to latest SPIRV-Cross version.
2021-07-23 12:36:59 -04:00
Bill Hollings
386bde9c78 Update to latest SPIRV-Cross version.
MSL: Adjust gl_SampleMaskIn for sample-shading and/or fixed sample mask.
MSL: Fix setting SPIRVCrossDecorationInterpolantComponentExpr decoration.
MSL: Simplify spvSubgroupBallot().
2021-07-22 11:03:52 -04:00
Bill Hollings
a582924bcf Update Metal GPU counters to support macOS 10.15 and build under Xcode 11.7. 2021-07-21 19:18:29 -04:00
Bill Hollings
6ae1745a9c Vulkan timestamp query pools use Metal GPU counters when available.
Add MVKPhysicalDeviceMetalFeatures::counterSamplingPoints
to track platform availability of GPU counters.
MVKPhysicalDevice creates and manages MTLCounterSets and checks for and enables
flags within MVKPhysicalDeviceMetalFeatures::counterSamplingPoints.
Add abstract MVKGPUCounterQueryPool class as parent of MVKTimestampQueryPool
and MVKPipelineStatisticsQueryPool concrete classes and refactor access to host
and command copy tracking data to allow extraction from MTLCounterSampleBuffer.
MVKTimestampQueryPool uses MTLCounterSampleBuffer if supported, otherwise reverts
to using host data for timestamps.
MVKCommandEncoder encodes Vulkan timestamp commands either as Metal staged or
command timestamps, depending on whether the GPU is tile-based or immediate-mode.
For Metal stage counters, we use a light-weight dummy BLIT encoder to mark
timestamp commands executed in the previous Metal encoding pass.
Add MVKDevice::getDummyBlitMTLBuffer() to supply a dummy single-byte buffer that
can be used by a stand-alone MTLBlitCommandEncoder as dummy work to mark timestamps.
2021-07-20 22:13:04 -04:00
Bill Hollings
feb8d41444
Merge pull request #1401 from billhollings/alpha-to-coverage-no-color-attachment
Support alpha-to-coverage without a color attachment.
2021-07-10 21:18:57 -04:00
Bill Hollings
b1a8b59f66 Support alpha-to-coverage without a color attachment.
If alpha-to-coverage is enabled, we must enable the fragment shader first color output,
even without a color attachment present or in use, so that coverage can be calculated.
2021-07-10 15:38:02 -04:00
Bill Hollings
a7ffaad975
Merge pull request #1399 from billhollings/e5b9g9r9-disable-blending
Disable blending for VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 on macOS Apple Silicon.
2021-07-08 22:18:00 -04:00
Bill Hollings
ccc81c45d3
Merge pull request #1400 from billhollings/packed-swizzle-fixes
Fix occasional crash when swizzling used but shader swizzling not enabled.
2021-07-08 22:17:46 -04:00
Bill Hollings
c2f27e40c1 Fix occasional crash when swizzling used but shader swizzling not enabled.
MVKImageViewPlane distinguish tracking of native and shader swizzling.
Only provide packed swizzle value if shader swizzling is used.
2021-07-08 16:43:22 -04:00
Bill Hollings
b3cf74401f Disable VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT for
VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 on macOS Apple Silicon.

On Apple Silicon (iOS/tvOs/macOS M1), format VK_FORMAT_E5B9G9R9_UFLOAT_PACK32
is fully supported as a color attachment except that format components cannot
be individually write-enabled. All components must either be write-enabled or
write-disabled together. This is causing several hundred Vulkan CTS blending
tests to fail on M1. The least intrusive behavioural change to allow the CTS
tests to report Not Supported instead, is to disable blending for this format.
2021-07-08 15:52:34 -04:00
Bill Hollings
bde3a86180
Merge pull request #1397 from billhollings/depth-stencil-swizzle-fixes
Fix swizzle of depth and stencil values into RGBA (float4) variable in shaders.
2021-07-08 10:31:55 -04:00
Bill Hollings
e482ac95df Use unswizzled MTLTexture for attachments.
Depth/stencil attachments that are also sampled might have an artificially forced
swizzled texture view. The original unswizzled texture must be used for attachments.
Add MVKImageViewPlane::getUnswizzledMTLTexture().
2021-07-07 13:09:40 -04:00
Bill Hollings
53a2223abd Fix swizzle of depth and stencil values into RGBA (float4) variable in shaders.
MVKImageViewPlane track Vulkan component swizzle instead of just packed
swizzle, and modify swizzle when using depth or stencil sampling or reading.
2021-07-06 17:57:47 -04:00
Bill Hollings
1748686d0d Refactor MVKImageView::validateSwizzledMTLPixelFormat().
Move MVKImageView::validateSwizzledMTLPixelFormat() to
MVKImageViewPlane::initSwizzledMTLPixelFormat(), make it non-static, and use
instance member content instead of passing all the data as function arguments.
2021-07-06 14:19:26 -04:00
Bill Hollings
9534c3b9ef
Merge pull request #1395 from billhollings/apple-silicon-clear-color-adjustment
Fix incorrect translation of clear color values on Apple Silicon.
2021-07-05 14:04:53 -04:00
Bill Hollings
97ab675915 Set MVKPhysicalDeviceMetalFeatures::clearColorFloatRounding based on GPU vendorID. 2021-07-05 13:10:39 -04:00
Bill Hollings
bbcdc8dcf6
Merge pull request #1394 from VZout/patch-3
Fix execution order of `encodeBindings` for `bufferBindings`
2021-07-04 17:46:27 -04:00
Bill Hollings
2d30c0ae13 Fix incorrect translation of clear color values on Apple Silicon.
The same set of CTS tests either fails or passes on different GPUs
based on whether or not we adjust float clear colors by one ULP.
Add MVKFloatRounding enum.
Add MVKPhysicalDeviceMetalFeatures::clearColorFloatRounding.
Disable ULP adjustment for clear colors on Apple Silicon.
For consistency and to simplify bookkeepping, calculate
clear color ULP adjustment from bit width of format component.
Update MoltenVK version to 1.1.5.
Update VK_MVK_MOLTENVK_SPEC_VERSION to 32.
2021-07-04 11:41:39 -04:00
Viktor Zoutman
d7b4775bba
Fix order of binding encoding 2021-07-01 09:28:10 +02:00
Bill Hollings
4f7f0dc209
Merge pull request #1392 from billhollings/sdk-1.2.182
Update dependency libraries to match Vulkan SDK 1.2.182.
2021-06-28 08:11:38 -04:00
Bill Hollings
30e7b5b0fc
Merge pull request #1393 from billhollings/retain-queue-during-submit
Retain MVKQueue in MVKQueueSubmission to avoid possible race condition.
2021-06-28 08:10:49 -04:00
Bill Hollings
e3cf071ace
Merge pull request #1387 from billhollings/occlusion-query-fixes-for-M1
Occlusion query fixes for M1
2021-06-28 08:10:17 -04:00
Bill Hollings
382da23410 Retain MVKQueue in MVKQueueSubmission to avoid possible race condition. 2021-06-25 17:16:42 -04:00
Bill Hollings
55c5cee233 Update dependency libraries to match Vulkan SDK 1.2.182. 2021-06-25 15:32:34 -04:00
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