2396 Commits

Author SHA1 Message Date
Bill Hollings
5ff912031b
Merge pull request #1436 from billhollings/gpu-ctr-fixes
Improved checks for timestamp GPU counter support on older devices + Ensure timestamp sync.
2021-09-13 19:06:32 -04:00
Bill Hollings
4ad5930263 Improved checks for timestamp GPU counter support on older devices.
Check that appropriate GPU counter set is supported on
the device before creating GPU counter sample buffer.
Don't attempt to timestamp using GPU counters unless
a GPU sample counter buffer has been created.
2021-09-13 17:20:00 -04:00
Bill Hollings
0cf396a70f Add MTLFence between Metal encoders and timestamp stage counter BLIT encoder
to ensure previous work is finished before being timestamped.
2021-09-13 16:08:16 -04:00
Bill Hollings
8132cec62e
Merge pull request #1435 from billhollings/pt-size+spvx-update
Several updates for CTS test fixes.
2021-09-10 13:03:57 -04:00
Bill Hollings
e36b9e60d5 Set maximum point primitive size based on GPU vendor ID. 2021-09-09 14:33:30 -04:00
Bill Hollings
333084f739 Several updates for CTS test fixes.
Support maximum point primitive size of 511.
Update to latest SPIRV-Cross version to add support
for OpSpecConstantOp ops OpQuantizeToF16 and OpSRem.
Update MoltenVK version to 1.1.6.
2021-09-08 12:05:08 -04:00
Bill Hollings
b10b970707
Merge pull request #1432 from starbucksDave/starbucksDave-SetWorkGroupSize-FunctionType
Add SetWorkGroupSize function type to vk_mvk_moltenvk.h
2021-09-01 11:37:25 -04:00
StarbucksDave
b4d98aa77e
Add SetWorkGroupSize function type 2021-09-01 17:23:40 +02:00
Bill Hollings
c1d03328b2
Merge pull request #1431 from billhollings/SDK-1.2.189
Update library dependencies to match Vulkan SDK 1.2.189.
2021-08-30 16:03:00 -04:00
Bill Hollings
bb7af644ee Remove use of the MTLMaxBlitPassSampleBuffers Metal API definition.
MTLMaxBlitPassSampleBuffers was available in Xcode 12 and had a value of 4.
According to Apple, the definition will be removed from the API in Xcode 13.
For now, assume a value of 1, until we can accurately determine the
appropriate value per platform.
2021-08-30 15:37:49 -04:00
Bill Hollings
a5ee3ead35 Update library dependencies to match Vulkan SDK 1.2.189.
Update What's New document.
2021-08-30 13:54:37 -04:00
Bill Hollings
f5dd310c55
Merge pull request #1426 from billhollings/partial-clear-stencil
Several renderpass clearing and input fixes from CTS
2021-08-23 19:42:13 -04:00
Bill Hollings
653978cae1
Merge pull request #1427 from billhollings/spvx-update
Update to latest version of SPIRV-Cross.
2021-08-23 19:15:45 -04:00
Bill Hollings
2412b97998 Fix from PR code review.
Remove unused MVKCommandUse::kMVKCommandUseBeginMultiViewPass.
2021-08-23 18:43:59 -04:00
Bill Hollings
43a133ff10 Update to latest version of SPIRV-Cross.
MSL: Support row-major transpose when storing matrix from constant RHS matrix.
MSL: Fix casting in constant expressions with different sizes.
MSL: Fix duplicate gl_Position outputs when gl_Position defined but unused.
2021-08-23 18:31:45 -04:00
Bill Hollings
8a7e20d348 Fix GPU race condition when clearing a renderpass input attachment on Apple GPUs.
Apple GPUs do not support rendering/writing to an attachment and then reading
from that attachment within a single Metal renderpass. On Apple Silicon, restart
the Metal renderpass if an input attachment is cleared inside renderpass.

Don't clear render area when restarting Metal renderpass, as it should not occur,
and itself causes a recursive loop restarting the renderpass as a result.

Add MVKCommandUse::kMVKCommandUseRestartSubpass.
MVKCommandEncoder::beginMetalRenderPass() pass MVKCommandUse to help determine
Metal renderpass attachment load and clearing options.
2021-08-23 14:28:20 -04:00
Bill Hollings
ff7ea713f6 Fix depth/stencil clearing broken during recent fix.
A recent change for resolving color formats mistakenly
broke clearing depth and stencil formats.
Remove optionality of all function arguments in
MVKRenderPassAttachment::populateMTLRenderPassAttachmentDescriptor()
to avoid bad calls being masked by optional function arguments.
Add appropriate canResolveFormat values for all calls to that function.
2021-08-20 13:58:32 -04:00
Bill Hollings
ce583f4f3d Support stencil-only partial attachment clearing.
Rename MVKRenderPassAttachment::shouldUseClearAttachment() to
shouldClearAttachment(), pass whether testing for stencil clearing,
and check stencil clearing distinct from depth clearing.
Refactor MVKRenderSubpass::populateClearAttachments() to work with this.
Remove MVKRenderPassAttachment::getAttachmentStencilLoadOp() as obsolete.
2021-08-19 17:22:29 -04:00
Bill Hollings
77c31cd0da
Merge pull request #1418 from billhollings/vulkan-semaphores-via-mtlevents
Prefer MTLEvent for VkSemaphore, except on NVIDIA, prefer emulation.
2021-08-10 13:51:47 -04:00
Bill Hollings
8c7db31cd7 Prefer MTLEvent for VkSemaphore, except on NVIDIA, prefer emulation.
Disable MVK_ALLOW_METAL_FENCES by default.
Disable use of MTLEvent on NVIDIA.
By default, use MTLEvent for VkSemaphore everywhere except NVIDIA.
By default, use CPU synchronization on NVIDIA.

These changes fix a large number of CTS synchronization test failures.
2021-08-10 11:32:21 -04:00
Bill Hollings
8e6731fd8e Revert to prefer MTLEvent over MTLFence for VkSemaphore, except on NVIDIA.
Prefer MTLEvent over MTLFence for VkSemaphore, because MTLEvent handles
sync across MTLCommandBuffers and MTLCommandQueues, except on NVIDIA GPUs,
which have demonstrated trouble with MTLEvents, prefer MTLFence.
Add MVKDevice::VkSemaphoreStyle enum.
2021-08-10 10:29:09 -04:00
Bill Hollings
1032c43b61
Merge pull request #1417 from billhollings/mtlcmdbuff-labels
Add queue and queue family indices to MTLCommandBuffer label.
2021-08-09 18:06:09 -04:00
Bill Hollings
0c9c3b3fee Add queue and queue family indices to MTLCommandBuffer label.
For better identification in GPUCapture, particularly when tracking sync issues.
Resulting labels are also cached for performance.
2021-08-09 14:18:33 -04:00
Bill Hollings
f9696449ea
Merge pull request #1416 from billhollings/resolve-unresolvable
Support resolving attachments with formats that Metal does not natively resolve.
2021-08-04 14:32:52 -04:00
Bill Hollings
edcaa08923 One more MVKArrayRef reference-to-value change. 2021-08-04 13:28:46 -04:00
Bill Hollings
8b1435ca88 Pass MVKArrayRef by reference to functions.
Per cdavis5e observation:
Since an MVKArrayRef<T> is just a pointer and a size, passing it around by
reference doesn't buy much. It might actually hurt performance, since cache
lines might be evicted to make room for the MVKArrayRef in memory.
For this reason, LLVM passes its ArrayRefs by value.

Unrelatedly, update runcts to log errors by default.
2021-08-04 13:16:25 -04:00
Bill Hollings
12f0089d0c Support resolving attachments with formats that Metal does not natively resolve.
Metal does not support resolving all formats that support MSAA, whereas Vulkan
assumes any MSAA format can be resolved. We fix that by running an optional
post-renderpass compute shader that resolves such textures by simply taking the
first sample as the resolved sample. This works to fix all failing CTS tests,
because such formats are all integer formats, and Vulkan allows an arbitrary
single sample value to be selected.

If we need to resolve, but the Metal format doesn't support it,
cause the Metal renderpass to store the MSAA attachment results.

MVKRenderSubpass don't establish Metal resolve attachment textures if format
is not natively resolvable, and encode Metal renderpass store actions accordingly.
MVKCommandEncodingPool add MTLComputePipelineStates to run simple resolve
compute shaders on attachments that cannot be resolved in Metal renderpass.
Add MVKRenderSubpass::resolveUnresolvableAttachments() and call from
MVKCommandEncoder::endMetalRenderEncoding(), before subpass index is updated.
Rename MVKCommandEncodingPool::getClearStateIndex() to
getRenderpassLoadStoreStateIndex() and remove MVK_MACOS restriction on
clearing shaders to allow compatibility with resolve shader handling.
MVKRenderPassAttachment remove validation of whether a format can be resolved.
MVKPixelFormats::getMTLTextureUsage() add read and write usage as appropriate
to allow compute shader to run to resolve formats not natively resolvable.
MVKPixelFormats remove obsolete unit test code.
MVKImageView clean up access functions and obsolete constructor
use of MVKConfiguration.
2021-08-03 18:47:13 -04:00
Bill Hollings
36aa71db65
Merge pull request #1415 from billhollings/renderpass-testing-fixes
Fix pipeline barriers not working inside self-dependent subpasses on Apple GPUs.
2021-07-30 17:38:45 -04:00
Bill Hollings
c243db9267 Remove unreachable code when setting barrier features on Apple Silicon.
MVKPhysicalDeviceMetalFeatures::memoryBarriers and ::textureBarriers
are never enabled on Apple Silicon. Remove it as an possibility.
2021-07-30 16:15:57 -04:00
Bill Hollings
086c680436 Fix pipeline barriers not working inside self-dependent subpasses on Apple GPUs.
On Apple GPUs, MVKCmdPipelineBarrier restarts Metal renderpass when encountered
inside self-dependent Vulkan subpass where the same attachment acts as both
input attachment and render attachment.
2021-07-30 15:25:59 -04:00
Bill Hollings
d5e04421dc
Merge pull request #1411 from billhollings/blit-from-compressed
Fix issue with vkCmdBlitImage() from compressed textures.
2021-07-27 19:41:47 -04:00
Bill Hollings
665dbfd632 Fix issue with vkCmdBlitImage() from compressed textures. 2021-07-27 18:08:50 -04:00
Bill Hollings
1d118b3b11
Merge pull request #1410 from billhollings/swapchain-image-acquisition-order
Fix issue where swapchain images were acquired out of order under heavy load.
2021-07-27 15:52:48 -04:00
Bill Hollings
b40dba904d Fix issue where swapchain images were acquired out of order under heavy load.
Move update of MVKSwapchainImageAvailability::acquisitionID to the acquisition
time instead of the become available again time, so other images will be preferred
if either all images are available or no images are available.
2021-07-27 15:42:43 -04:00
Bill Hollings
3236796839
Merge pull request #1408 from billhollings/handle-bad-api-pointers
Properly ignore non-null pipeline creation pointers that should be ignored.
2021-07-26 18:15:48 -04:00
Bill Hollings
7a2def4604
Merge pull request #1404 from billhollings/timestamp-using-metal-gpu-counters
Vulkan timestamp query pools use Metal GPU counters when available.
2021-07-26 18:15:25 -04:00
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