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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Adjust VkPhysicalDeviceLimits values:
- minMemoryMapAlignment raised to MIN of 64 per Vulkan spec.
- pointSizeRange upper limit to 511 per Metal.
- lineWidthGranularity to 0 per Vulkan spec when wideLines disabled.
- maxSamplerLodBias set to 4 to cover setting in shader.
to each other to find cached shader, only consider current shader stage resources.
Rename more references to ShaderConverterContext to ShaderConversionConfig.
Rename kMVKShaderStageMax to kMVKShaderStageCount
to clarify it's common use in array sizing and for loops.
Change mvkConfig() to return reference instead of pointer
to improve syntactic sugar to use . instead of ->.
Update MoltenVK version to 1.1.4.
Update What's New document.
Enable MVKConfiguration::preallocateDescriptors and
MVK_CONFIG_PREALLOCATE_DESCRIPTORS by default.
Rename MVKDescriptorTypePreallocation to MVKDescriptorTypePool.
For memoryless attachments, setting renderpass load and store
actions to "load" and "store" triggers Metal validation errors.
Refactor determination of renderpass MTLLoadAction and MTLStoreAction.
For memoryless attachments, replace load with don't care,
and store with resolve or don't care.
Don't assume the incoming CAMetalLayer has default (no-op) values for colorspace and
wantsExtendedDynamicRangeContent properties, since they could have been set externally.
Ensure the Vulkan app has control over both of these properties.
vkCreateSwapchainKHR() returns VK_ERROR_FORMAT_NOT_SUPPORTED for unsupported colorspaces.
Restore support for VK_COLOR_SPACE_HDR10_HLG_EXT and VK_COLOR_SPACE_HDR10_ST2084_EXT
under Xcode12 that was removed due to App Store conflicts using older enum values.
Introduce MVKConfigAdvertiseExtensionBits enum to specify multiple API config values in
a Vulkan-friendly manner, while automatically documenting the same values for env vars.
External libraries in particular make liberal use of assert() calls, which bypass
error catching, sometimes causing crashes rather than catch errors and moving on.
LunarG is planning to retire the LunarG/VulkanSamples repository.
Remove dependency to it, and remove the affected Hologram and API-Samples demo apps.
Update documents, including directing developers to the
KhronosGroup/Vulkan-Samples repository for official demo apps.