Revert to Xcode 12.4 in GitHub Actions CI, as 12.5 not deployed yet for the
macos-latest virtual environment, which is currently macOS 10.15, and a
macOS 11.0 virtual environment is available only in private preview.
This build error seems to have been exposed in Xcode 12.5.
Add mvkSupportsBCTextureCompression() to manage use of
[MTLDevice supportsBCTextureCompression] to query for
MTLDevice support for BC compression across all platforms.
Citing section 33.8 "Display Timing Queries", the description of
VK_GOOGLE_display_timing's vkGetPastPresentationTimingGOOGLE()
the spec states that "The results for a given swapchain and presentID are
only returned once from vkGetPastPresentationTimingGOOGLE."
In other words, every VkPastPresentationTimingGOOGLE timing record
stored in the internal queue must get removed from the internal queue,
once it was returned to the calling client application via a successfull
call to vkGetPastPresentationTimingGOOGLE().
The current implementation does not remove delivered entries from the
queue. Instead it keeps the last kMaxPresentationHistory (== 60) records,
so the internal queue grows to its maximum fill level and never empties.
Successive calls to vkGetPastPresentationTimingGOOGLE() deliver the same
records repeatedly, confusing applications which are written according to
spec.
This commit changes the queueing behavior to properly remove items from
the queue, so that it operates in a FIFO fashion and only retains items which
have not been fetched yet, up to kMaxPresentationHistory, after which the
oldest items get discarded.
Tested on macOS 10.15.7 with AMD for different intervals between calling
vkGetPastPresentationTimingGOOGLE() and different input values for
pPresentationTimingCount, to make sure it behaves properly for cases like
1 item in queue at query time, queue half full at query time, queue completely
full, queue "overflowing" - ie. items are properly discarded in FIFO order, and
for fetching 1 item at a time, multiple items (partially emptying the queue in
each iteration) or all items (emptying the queue in one go).
On return, *pPresentationTimingCount was not assigned the actual number
of timing records written, as the spec requires. Fix this.
If pPresentationTimingCount was smaller than the number of available
records, the function still returned VK_SUCCESS instead of VK_INCOMPLETE,
as the spec requires. Fix this.
Those functions are also usable from standard C, no need for the caller
to be compiled as Objective-C. Move their definition outside the __OBJC__
guards.
Use `[MTLDevice maxArgumentBufferSamplerCount]` to determine maximum sampler counts.
When checking `[MTLDevice argumentBuffersSupport]` tiers, compare
using `>=` to automatically handle evolution of this value in future.
Remove suspect use of early breaks in
MVKDescriptorSetLayoutBinding::initMetalResourceIndexOffsets().
Revert to using void* when padding for buffers in shader desc set structs.
Fix several typos.
by introduction of Metal argument buffer support.
Add copy assignment operator to MVKMTLFunction, plus other objects that have
notable copy constructors: MVKBitArray, MVKShaderLibrary, MVKVulkanAPIObject.
There are still some classes that have destructors without copy and
copy assign overrides, but these are higher level classes that should
not be subject to copy or assignment by value.
Note to self: Respect the Rule of Three!
pipelines and only encode bindings that are in use for each stage.
Add SPIRVToMSLConversionConfiguration::isResourceUsed() and
remove SPIRVToMSLConversionResults::isDescriptorSetUsed().
MVKBitArray add copy constructor and allow queries beyond range.
MVKDescriptorSetLayoutBinding no longer uses MTLTextureType to create
MTLArgumentEncoder, which is not needed for descriptor set argument encoding.
Remove obsolete MSLResourceBinding::outMTLTextureType and
SPIRVToMSLConversionConfiguration::getMTLTextureType().
or one MTLArgumentEncoder per combination of pipeline-stage/descriptor set.
Add MVKPhysicalDeviceMetalFeatures::descriptorSetArgumentBuffers,
and MVKDeviceTrackingMixin::isUsingDescriptorSetMetalArgumentBuffers()
and isUsingPipelineStageMetalArgumentBuffers() to track this.
Create a separate MTLArgumentEncoder for each shader stage from
MTLFunction instead of MTLDevice, and track per-stage in MVKPipeline.
Add MVKMTLArgumentEncoder to track MTLArgumentEncoders in pipelines and desc set layouts.
Add SPIRVToMSLConversionResults::activeDescriptorSets to get desc sets used by a shader.
In SPIRV-Cross make padded Metal argument buffer descriptors
for buffers a pointer to float instead of pointer to void.
Update to latest version of SPIRV-Cross to use arg buffer padding feature.
Enable argument buffer support only when one MTLArgumentEncoder per
descriptor set can be used (macOS 10.16 and later or Intel GPU's).
to allow VkDevice to resume after non-fatal VK_ERROR_DEVICE_LOST error.
When running CTS, when one test triggers a VK_ERROR_DEVICE_LOST error condition,
CTS does not create a new VkDevice for subsequent tests, which causes all subsequent
tests to fail. This creates an incredible amount of results noise, and makes it
difficult to determine accurate test failure numbers. This is particularly problematic
because VK_ERROR_DEVICE_LOST may be triggered sporadically by internal Metal issues,
often making it not traceable to a consistent failure of a particular CTS test.
If descriptor count is zero, don't add MTLArgumentDescriptor to
MTLArgumentEncoder, and don't populate resources into shader converter.
Don't update command encoder resource usage if resource is nil.
Move dynamic offsets from the Metal argument buffer to an implicit shader buffer.
Add SPIRVToMSLConversionConfiguration::dynamicBufferDescriptors to track dynamic
buffer descriptors, and add SPIRVToMSLConversionResults::needsDynamicOffsetBuffer
to indicate shader needs an implicit buffer to track these dynamic offsets.
Add MVKShaderStageResourceBinding::dynamicOffsetBufferIndex to track a
descriptor's index into the implicit dynamic offsets buffer.
MVKPipelineLayout change how per-descriptor set offsets are calculated and tracked
when using Metal argument buffers, so that resource indexes do not accumulate
across descriptor sets, but dynamic offset buffer indexes do accumulate.
MVKPipelineLayout rearrange order of implicit buffer indexes to give more commonly used
implicit buffers lower indexes to help reduce risk of exhausting discrete buffer bindings.
if storage image has no underlying MTLBuffer.
MVKResourcesCommandEncoderState::encodeMetalArgumentBuffer()
if runtime array retrieve descriptor count from descriptor set.
usage not tracked accurately across shader stages.
Remove tracking of descriptor usage in MVKPipeline.
Don't bind argument buffer to command encoder if descriptor set unused by shader stage.
MVKDescriptor::encodeToMetalArgumentBuffer() remove unused shader stage argument.
Remove SPIRVToMSLConversionConfiguration::isResourceUsed().
MVKPipelineLayout don't track descriptor set resource index offsets when
using Metal argument buffers.
Fix alignment calc of space available for next descriptor set.
Bind Metal argument buffer to command encoder when its content is updated
during command encoding, and only if shader uses that descriptor set.
Use MTLResourceStorageModeManaged for Metal argument buffer if available.
Support SPIRV-Cross CompilerMSL::Options::pad_argument_buffer_resources and
MSLResourceBinding::base_type.
Consolidate mvkPopulateShaderConverterContext() and set
MSLResourceBinding::base_type from VkDescriptorType.
Add MVKDescriptorSetLayout::initForMetalArgumentBufferUse() to measure size of Metal
argument buffer needed for descriptor set by creating a ephemeral MTLArgumentEncoder
from the descriptor bindings and measuring its length.
MVKDescriptorPool::initMetalArgumentBuffer() measure size of a single MTLBuffer
to use for all descriptor sets in the pool.
MVKDescriptorPool use VkDescriptorPoolInlineUniformBlockCreateInfoEXT to determine
descriptor count for VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT.
Set max size of temporary inline block buffer allocations from
MVKDevice::_pMetalFeatures->dynamicMTLBufferSize.
Set MTLSamplerDescriptor::supportArgumentBuffers property when appropriate.
Use specific resource indices of MVKShaderStageResourceBinding
when assigning indices to argument buffer elements.
MVKShaderStageResourceBinding expand elements to uint32_t
to support larger numbers of resource arguments.
Fix calculation of descriptor set Metal argument buffer size requirements.
Streamline MVKResourcesCommandEncoderState::encodeToMetalArgumentBuffer(),
and add fix for GPU capturing of Metal arg buffers for Xcode 12.
Update MSLResourceBinding::outMTLTextureType and outIsUsedByShader from shader
only if resource binding is for the correct shader stage, to allow outIsUsedByShader
to be carried across multiple-stage shader compilations.
Remove MVKDescriptorSet::populateMetalArgumentBufferBinding().
Remove MVKSamplerDescriptorMixin::getMetalArgumentBufferSamplerIndexOffset().
Add MVKCommandEncoderState::getDevice().
shader cache lookup hits in MVKShaderLibraryCache.
Rename MSLResourceBinding::mtlTextureType, MSLResourceBinding::isUsedByShader, and
MSLShaderInput::isUsedByShader to add a prefix out*, to clarify that those variables
are output from the conversion process, instead of input to the conversion process.
Don't use MSLResourceBinding::outMTLTextureType when looking up cached shaders.
MVKPipeline track descriptors used by shaders.
Update resources as dirty at start of Metal render pass or compute encoder.
Add MVKCommandEncoder::beginMetalComputeEncoding() to mark a new Metal compute encoder.
MVKResourcesCommandEncoderState track resource usage that needs to be encoded.
Add MVKResourcesCommandEncoderState::encodeArgumentBufferResourceUsage().
Add MVKCommandEncoderState::beginMetalComputeEncoding() to mark compute
state dirty when a MTLComputeEncoder is created.
Add SPIRVToMSLConversionConfiguration::isResourceUsed().
MVKBitArray add ability to retain contents when resizing, and clear bit during getBit().
Add MVKBitArray getBit() option to clear bit.
Pass VkPipelineBindPoint during descriptor set binding, and hold bound
descriptor sets and dynamic offsets in MVKResourcesCommandEncoderState.
Add MVKDescriptor::encodeToMetalArgumentBuffer() to write descriptor to arg buffer.
MVKInlineUniformBlockDescriptor use temp MTLBuffer, available through
MVKDescriptorPool, so it can be written to arg buffer.
Write to arg buffer during MVKResourcesCommandEncoderState encoding, for update-after-bind.
Add MVKBitArray::enumerateEnabledBits() to perform operations on enabled bits.
During beta period, disable MVKConfiguration::useMetalArgumentBuffers/
MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS by default.