This patch fixes a regression caused by 1b6b8bc9 when the implicit buffers
were moved to top of Metal buffer index range.
Fix vertex buffer binding counts when binding indexes are not consecutive,
or when additional synthetic buffer bindings are required to accommodate
vertex attributes that are outside the vertex buffer stride values.
Take into consideration that the app may bind more vertex attribute buffers
than a pipeline may consume, and don't allow these to overwrite any implicit
buffers sent to the shader.
MVKResourcesCommandEncoderState::encodeBinding() clear binding dirty flag
before calling lambda function to allow function operation to possibly
override and leave binding marked dirty.
Set tessellation vertex buffer indexes based on platform maximum vertex stage
buffer count, instead of hardcoding them, to preemptively avoid conflict with
implicit buffers should the platform counts ever change.
So far it always returned a 60 Hz refresh on macOS. Now we query the
actual refresh interval for the NSScreen on which our swapChain is likely
displaying.
Tested on a MacBookPro dual-display setup with builtin 60 Hz Retina panel
and external 100 Hz monitor, showing proper reporting depending on which
monitor the window was displaying on. Tested on macOS 10.15.7 only.
renderpass was writing timestamp before renderpass activity was complete.
MVKCommandBuffer tracks whether it contains a stage-based timestamp command,
and MVKCommandEncoder updates the timestamp command fence when ending any
Metal command encoder on such a MVKCommandBuffer.
MVKCommandEncoder reorder member variables to avoid layout gaps (unrelated).
MVKCommandBuffer update _commandCount even for single-use immediate command
encoding (unrelated).
Add VK_KHR_separate_depth_stencil_layouts and enable its features.
Metal generally ignores image layouts, so nothing further needed.
Update Whats_New.md and MoltenVK_Runtime_UserGuide.md documents
with recently-added extensions.
Passes almost all supported separate_layouts CTS tests, with the
few remaining tests failing due to issues with unrelated capabilities.
Unrelated cleanup:
- MVKDevice enable extensions before features.
- MVKDevice reorder ivar declarations to reduce
memory layout gaps, and define default values.
- Rename VkSemaphoreStyle to MVKSemaphoreStyle to
remove potential conflicts with Vulkan Vk name space.
- MVKRenderPass set rendering flags from outside instead of via constructor.
- MVKCommandEncodingContext tracks and manages lifespan of renderpass and
framebuffer, potentially across multiple MVKCommandEncoders.
- When resuming a suspended dynamic renderpass, reuse the renderpass and
framebuffer cached in MVKCommandEncodingContext, otherwise create them.
- MVKCommandBuffer::begin() creates local copy of dynamic rendering color formats.
- MVKDevice track enabling VK_KHR_dynamic_rendering extension features.
- Add MVKCmdBeginRendering and MVKCmdEndRendering command objects
and associated command pools.
- Add MVKCommandEncoder::beginRendering() which dynamically instantiates
temporary MVKRenderpass and (imageless) MVKFramebuffer objects to handle
equivalent renderpass operations.
- MVKCommandEncoder retain and release subpass and framebuffer objects
to allow transient dynamic instances to be created and destroyed.
- Add support functions to create MVKRenderpass and (imageless)
MVKFramebuffer objects from VkRenderingInfo.
- MVKRenderpass track VkRenderingFlags.
- MVKRenderSubpass create and track an internal VkPipelineRenderingCreateInfo.
- MVKRenderPassAttachment support LoadOp and StoreOp behavior for
dynamic rendering suspend and resume.
- Refactor viewMask processing to permit operations on viewMask outside of
MVKGraphicsPipeline without requiring the presence of an MVKSubpass.
- MVKGraphicsPipeline extract VkPipelineRenderingCreateInfo from MVKRenderSubpass
if available, or VkGraphicsPipelineCreateInfo::pNext if not.
- MVKCommandBuffer track VkCommandBufferInheritanceRenderingInfo (currently unused).
- (unrelated) vulkan.mm move location of VK_EXT_sample_locations functions
for layout readability consistency.
buffer binding used by a subsequent pipeline that does not use push constants.
This error was previously introduced in 2a17f75, where a push constants
binding could override the Metal buffer binding 0 of a subsequent pipeline
that does not use push constants.
When pipeline binding is encoded, track which stages use push constants
and only encode push constants if the pipeline and stage uses them.
(unrelated) Make use of MVKResourcesCommandEncoderState::getPipeline() consistent.
Update README.md and MoltenVK_Runtime_UserGuide.md to document the impact
of the VK_KHR_portability_enumeration extension during runtime loading on macOS.
Update MoltenVK version to 1.1.10.
Supports only setting custom sample locations in subpasses via
vkBeginRenderpass. Does not support setting custom sample locations via
vkCmdBindPipeline or vkCmdSetSampleLocationsEXT, although collects that
info for possible future enhancements.
- MVKPhysicalDevice track platform support and respond to property queries.
- MVKCmdBeginRenderPassBase collect subpass custom sample locations.
- MVKPipeline support dynamic state values beyond 31.
- MVKPipeline collect custom sample locations.
- Add MVKCmdSetSampleLocations to support vkCmdSetSampleLocations
to collect dynamic custom sample locations.
- MVKCommandEncoder support collecting custom sample positions from subpass
and dynamic, and set into MTLRenderPassDescriptor for each Metal render pass.
- MVKArrayRef add assignment operator.
- Add MVKPhysicalDeviceMetalFeatures::programmableSamplePositions.
- Update VK_MVK_MOLTENVK_SPEC_VERSION to version 34.
- MVKCommandBuffer.h remove obsolete comment documentation.
- Update Whats_New.md.
A small leak occurs if no existing IOSurface is provided to vkUseIOSurfaceMVK() because CoreFoundation objects returned from functions with Create in their name must be released with CFRelease()
In the interests of Single Source of Truth, OS version support is now populated
in MVKExtensions.def, and that info is used to validate each Vulkan extension
against OS version support for the functionality required by the extension, with
the default being unsupported, unless otherwise indicated in MVKExtensions.def.
- Add OS version info for each extension in MVKExtensions.def.
- mvkIsSupportedOnPlatform() checks every extension for OS version support,
not just a separately-populated list of OS version limitations (that defaulted
to supported, instead of unsupported).
- Visually clean up MVKExtensions.def for easier reading.
std::iterator is deprecated in C++17, which triggers multiple compilation warnings.
Update MVKSmallVector::iterator to explicitly specify iterator traits,
instead of subclassing from std::iterator.
Qualify use of std::remove() in mvkRemoveAllOccurances(),
to eliminate resolution ambiguity.
To better support pipeline layout compatibility between pipelines with differing
quantities of descriptor sets, move the buffer indexes used by implicit buffers to
the top end of the Metal buffer index range, below vertex and tessellation buffers.
MVKPipeline calculates implicit buffer indexes based on vertex and tessellation
buffers required by pipeline, instead of based on descriptors in MVKPipelineLayout.
MVKPipeline track buffer index counts consumed by MVKPipelineLayout, to validate
room for implicit buffers.
For pipeline layout compatibility, consume the Metal resource indexes in this order:
- Consume a fixed number of Metal buffer indexes for Metal argument buffers,
but only consume them if Metal argument buffers are not being used.
- Consume push constants Metal buffer index before descriptor set resources,
but only consume it if the stage uses push constants.
- Consume descriptor set bindings.
In MVKPipelineLayout, separate tracking resource counts from push constants
indexes, and move push constant indexes ahead of descriptor bindings.
In MVKPipeline, track which stages use push constants.
Remove unused and obsolete function declaration in MVKDescriptorSet.h.
For a resource object that can be retained by descriptors beyond its lifetime,
release memory resources when the object is destroyed by the app. This includes
objects of type MVKBuffer, MVKBufferView, MVKImageView, and MVKSampler.
When the app destroys an MVKBuffer, also detach from the MVKDeviceMemory,
to fix a potential race condition when the app updates the descriptor on
one thread while also freeing the MVKDeviceMemory on another thread.
MVKImageView guard against detached planes while in descriptor.
Add comment to clarify how destroy() is called from release().
For GPUs that round float clear colors down, a half-ULP adjustment is performed
on normalized formats. But this adjustment should not be performed on SRGB formats,
which Vulkan requires to be treated as linear, with the value managed by the app.