- Redefine enumeration values of MVKPrefillMetalCommandBuffersStyle.
- Add option to defer encoding prefilled MTLCommandBuffer to queue submission.
- Remove option to create an autorelease pool in the MVKCommandEncoder
to span immediate command encodings, because it causes crashes when
multiple command buffers were overlapping prefilling on the same thread.
- Replace MTLCommandEncoder retain/release macros with template member functions.
- Rename MVKCommandPool::newMTLCommandBuffer() to getMTLCommandBuffer()
and do not retain the returned MTLCommandBuffer (unrelated).
- Revert MoltenVK logging to use stderr instead of stdout (unrelated).
- Merge branch from master.
- Add MVKPrefillMetalCommandBuffersStyle enumeration to enable prefilling,
and configure memory recovery options.
- Redefine MVKConfiguration::prefillMetalCommandBuffers as a value from
MVKPrefillMetalCommandBuffersStyle instead of a simple boolean. Set the
values of MVKPrefillMetalCommandBuffersStyle and the default value of
MVKConfiguration::prefillMetalCommandBuffers to be compatible with
legacy use of this setting as a simple enable/disable boolean value.
- MVKCommandEncoder track prefill style, and support option to maintain
a Metal autorelease pool that is created on vkBeginCommandBuffer()
and drained on vkEndCommandBuffer(), when prefiling a command buffer
from a single thread, and an option to wrap each command addition in
a separate @autoreleasepool{} scope to create and drain an autorelease
pool at every command addition to the Vulkan command buffer, when
prefilling a single command buffer from multiple threads.
- MVKCommandEncoder retain Metal encoders when prefilling, because
prefilling may span multiple autorelease pools.
- MVKCommandEncoder clean up memory leak of MTLBlitPassDescriptor
during prefilling.
- MVKCommandEncoder rearrange declarations of MVKCommandUse member
variables to tighten up class memory use (unrelated).
- MVKCommandBuffer remove unnecessary inline declarations (unrelated).
- Change MoltenVK logging to use stdout instead of stderr (unrelated).
- Set MVK_VULKAN_API_VERSION from VK_API_VERSION_1_2.
- Update MoltenVK version to 1.2.0.
- Remove several previously overlooked extension suffixes
in use of promoted Vulkan struct and enum values.
- Update documentation.
when building with MVK_HIDE_VULKAN_SYMBOLS=1.
Alias vkGetBufferDeviceAddressEXT to core function,
and add it as promoted extension function in MVKInstance.
- Support option to use MTLEvents for Vulkan semaphores on NVIDIA and Rosetta2.
- Add public MVKVkSemaphoreSupportStyle enumeration.
- MVKConfiguration replace deprecated legacy booleans semaphoreUseMTLEvent,
and semaphoreUseMTLFence with enumerated semaphoreSupportStyle.
- Alias legacy semaphoreUseMTLEvent to semaphoreSupportStyle and support legacy
use of semaphoreUseMTLFence and semaphoreUseMTLEvent for backwards compatibility.
- MVKConfiguration rename recently renamed semaphoreUseSingleQueue back to
semaphoreUseMTLFence for backwards compatibility.
VK_EXT_descriptor_indexing extension is enabled.
- Change MVKConfiguration::useMetalArgumentBuffers to enum instead of boolean
and default to enabling Metal argument buffers for VK_EXT_descriptor_indexing.
- Leave Metal argument buffers disabled by default until they are improved.
- Enable VkPhysicalDeviceVulkan12Features::descriptorIndexing.
- Add MVKPhysicalDeviceVulkan12FeaturesNoExt to track and enable Vulkan 1.2
features not part of any prior extensions absorbed by Vulkan 1.2.
- Update VK_MVK_MOLTENVK_SPEC_VERSION to version `36`.
- MVKDeviceTrackingMixin remove unnecessary inline declarations.
- MoltenShaderConveter tool support Metal Argument Buffers and MSL 3.0.
- Enable shaderSignedZeroInfNanPreserveFloat16 and
shaderSignedZeroInfNanPreserveFloat32.
Other float control properties are not settable in Metal.
- MVKShaderModule log whether compiling with fast math enabled.
- Update MoltenVK_Runtime_UserGuide.md and Whats_New.md documents.
- runcts script enable MVK_CONFIG_FAST_MATH_ENABLED by default.
When presenting drawables in the future, the MVKPresentableSwapchainImage
and MVKSwapchain were both being retained by the drawable-presented callback,
so that the presentation timing info can be recorded on the swapchain.
Unfortunately, in the case where the presentation timing is set far enough
into the future (I'm looking at you CTS), the swapchain, and even the
CAMetalLayer's view may be destroyed, causing occasional bad access crashes.
- MVKSwapchainImage don't retain() the swapchain, and move clearing the
swapchain from the destructor to destroy(), so the MVKSwapchain is not
necessarily retained by the MVKSwapchainImage, for a drawable being
presented in the future.
- MVKSwapchainImage add a lock around clearing swapchain and accessing
it from callbacks.
- Add lockable releaseLayer() function in both MVKSwapchain and MVKSurface,
which is called from both layer observer and destructor, to handle race
conditions better.
- MVKSwapchain::initCAMetalLayer() call MVKSurface::getCAMetalLayer() only once.
- Update MoltenVK version to 1.1.12.
- Update What's New document.
This fixes an earlier regression, where when only the offset changes in
a buffer descriptor, the binding is not marked dirty if the same Metal
binding index is used by a push constant in between descriptor bindings.
- MVKPushConstantsCommandEncoderState::markDirty() call resource encoder
state markPushConstantBinding() to find and mark dirty descriptor that
uses same Metal index as a push constant binding.
- Add MVKResourcesCommandEncoderState::markMetalBufferIndexDirty() to
find and mark dirty a descriptor buffer binding that uses
- MVKResourcesCommandEncoderState::bind() use range-based-for-loop
for consistency (unrelated).
- MVKDescriptorPool::reset() don't waste time freeing
descriptor sets that were never allocated.
- If descriptor set could not be allocated, set availability bit (unrelated).
- MVKBitArray add _lowestNeverClearedBitIndex to track the lowest bit index
that has not been cleared since last reset.
- MVKBitArray rename _minUnclearedSectionIndex to _clearedSectionCount for clarity.
- MVKBitArray use _clearedSectionCount and _lowestNeverClearedBitIndex to optimize
operation of setting or clearing all bits.
- MVKBitArray::setBit() ensure we don't try to change a bit that is out of range.
- MVKBitArray::resize() no-op if size doesn't actually change.
- MVKQueue don't include object pointer in error log, so CTS log results
are consistent across multiple CTS runs (unrelated).
- Add [CAMetalLayer screenMVK] extension method to retrieve screen.
- If the layer has a delegate view, use it to locate the screen, otherwise
revert to iterating across windows, looking for the CAMetalLayer, to identify
the window the layer is in, from which to retrieve the screen.
- Fix the iteration of the layer hierarchy, to accommodate that Apple may
add superlayers to the CAMetalLayer under the covers.
- Update MoltenVK_Runtime_UserGuide.md to encourage the app to ensure the view
is the delegate of the CAMetalLayer, to more efficiently access the screen.
- DemoView implements NSViewLayerContentScaleDelegate protocol to update
[CAMetalLayer contentsScale] property when moved between screens.
- Log contentsScale value during swapchain creation.
- Remove a few unnecessary inline declarations.
When checking query wait completion, all queries were previously
checked for Available status, and blocked until all became Available.
However, only queries that were encoded to be written should be checked.
It is okay for queries that are not encoded to be written to remain in
Initial state, and not block the wait.
Support by the MTLDevice for Metal Tier 2 argument buffers has an
impact on both descriptor indexing and buffer device address support.
Add MVKPhysicalDeviceMetalFeatures::argumentBuffersTier, to track
the MTLDevice argument buffers support tier, set it from
[MTLDevice argumentBuffersSupport], and subsequently enable support for
VK_KHR_buffer_device_address and VK_EXT_buffer_device_address extensions,
and set descriptor indexing resource counts, based on it.
Update documentation requirements.
Add MVKPhysicalDeviceMetalFeatures::shaderBarycentricCoordinates,
enable it based on [MTLDevice supportsShaderBarycentricCoordinates],
and subsequently enable support for VK_KHR_fragment_shader_barycentric
and VK_NV_fragment_shader_barycentric extensions, based on it.
- Update to latest SPIRV-Cross to support `SPV_KHR_physical_storage_buffer`
for `VK_KHR_buffer_device_address` and `VK_EXT_buffer_device_address`
- Add support for `VK_EXT_buffer_device_address` extension.
- Advertise support for `VK_KHR_buffer_device_address`
and `VK_EXT_buffer_device_address` on macOS 12.5.
- Add appropriate extension reporting and enablement for
`VkPhysicalDeviceBufferDeviceAddressFeatures`,
`VkPhysicalDeviceBufferDeviceAddressFeaturesEXT`, and
`VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR`.
- Support reading `VkMemoryAllocateFlagsInfo` to identify memory allocations that
need to support buffer pointer access (in case needed in future on non-shared memory).
- Update `Whats_New.md` and `MoltenVK_Runtime_UserGuide` documents.
- Update minimum Xcode deployment targets to macOS 10.13, iOS 11, and tvOS 11,
to avoid Xcode build warnings.
- Add support for MTLLanguageVersion3_0 enumeration.
- Build efficiencies:
- Build scripts create_dylib.sh and gen_moltenvk_rev_hdr.sh
only run if build dependencies require it.
- Packaging and copy_to_staging.sh scripts are too complex to define dependencies,
and are fast, so configured to run every time, to avoid build warning.
- Replace use of deprecated sprintf() with snprintf().
- Replace use of deprecated kIOMasterPortDefault with kIOMainPortDefault.
- Support old-style GPU debug capture only if building for earlier minimum
deployment targets, to avoid deprecation warning.
- Update minimum Xcode deployment targets of Cube demo to macOS 10.14, iOS 12,
and tvOS 12, to avoid Xcode build warning regarding MTLSharedEvent in .
- Update README.md document regarding minimum Xcode deployment targets.
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.
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.
- 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.
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.