2485 Commits

Author SHA1 Message Date
Bill Hollings
fada8e08c7
Merge pull request #1547 from billhollings/pipeline-layout-compatibility-fixes
Fixes to pipeline layout compatibility
2022-03-16 14:05:22 -04:00
Bill Hollings
1b6b8bc992 Move implicit buffers to top of Metal buffer index range.
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.
2022-03-15 11:52:15 -04:00
Bill Hollings
2a17f757e1 Fixes to pipeline layout compatibility.
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.
2022-03-14 16:29:22 -04:00
Bill Hollings
9cfc946a7c
Merge pull request #1546 from billhollings/retained-resource-object-fixes
Fixes to optimize resource objects retained by descriptors beyond their lifetimes.
2022-03-13 17:05:30 -04:00
Bill Hollings
9f4243ff91 Fixes to optimize resource objects retained by descriptors beyond their lifetimes.
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().
2022-03-13 14:54:54 -04:00
Bill Hollings
eba6a04a91
Merge pull request #1545 from billhollings/avoid-adjusting-sRGB-clear-colors
Avoid adjusting SRGB clear color values by half-ULP.
2022-03-11 12:51:46 -05:00
Bill Hollings
cf3b5968ef Avoid adjusting SRGB clear color values by half-ULP.
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.
2022-03-11 11:24:05 -05:00
Bill Hollings
cd2146c229
Merge pull request #1544 from billhollings/fix-maxSamplerAllocationCount
Remove limit on VkPhysicalDeviceLimits::maxSamplerAllocationCount when not using Metal argument buffers.
2022-03-10 21:44:01 -05:00
Bill Hollings
a91a3d000a Remove limit on VkPhysicalDeviceLimits::maxSamplerAllocationCount
when not using Metal argument buffers.
2022-03-10 18:12:54 -05:00
Bill Hollings
d3b5d113f7
Merge pull request #1543 from billhollings/fix-gpu-counter-mtlfence-deletion
Fix deletion of GPU counter MTLFence while it is being used by MTLCommandBuffer.
2022-03-10 13:51:34 -05:00
Bill Hollings
2aadca70ce Fix deletion of GPU counter MTLFence while it is being used by MTLCommandBuffer.
Move release of GPU counter MTLFence from MVKCommandEncoder destructor
to MTLCommandBuffer completion handler.
2022-03-10 13:25:09 -05:00
Bill Hollings
da0f15c7b0
Merge pull request #1541 from billhollings/shaderconverter-tool-default-msl-version
MoltenVKShaderConverter tool defaults to the highest MSL version supported on runtime OS.
2022-03-09 13:54:15 -05:00
Bill Hollings
728182cf75 MoltenVKShaderConverter tool defaults to the
highest MSL version supported on runtime OS.

Update to latest SPIRV-Cross.
Update Docs/Whats_New.md document.
2022-03-08 21:22:25 -05:00
Bill Hollings
c5ce77fff3
Merge pull request #1540 from billhollings/reinstate-gpu-memory-barriers
Reinstate memory barriers on non-Apple GPUs.
2022-03-08 20:58:26 -05:00
Bill Hollings
3114e16457 Fix build for Xcode 11.7. 2022-03-08 17:52:50 -05:00
Bill Hollings
6327b767e0 Reinstate memory barriers on non-Apple GPUs.
Ensure non-Apple GPU's enable memory barriers.
A previous commit inadvertently disabled GPU memory barriers.

Change tests for memory barriers to runtime test for Apple GPU, instead of
build-time test for Apple Silicon, to accommodate running on Rosetta2, and
refactor tests for Apple Silicon and OS version on some macOS GPU feature settings.
2022-03-08 17:01:50 -05:00
Bill Hollings
5d7b7eaba6
Merge pull request #1539 from redstrate/master
Enable base vertex instance support in shader conversion
2022-03-08 16:50:57 -05:00
Joshua Goins
b6c392541c
Check if metal device supports base vertex instance drawing
Co-authored-by: Bill Hollings <bill.hollings@brenwill.com>
2022-03-08 14:17:55 -05:00
Joshua Goins
d05537dbe5 Enable base vertex instance support in shader conversion 2022-03-06 17:07:54 -05:00
Bill Hollings
c09bcd0972
Merge pull request #1531 from billhollings/stencil-only-depth-store-action
Don't attempt to store the depth component of a stencil-only renderpass attachment.
2022-02-24 14:37:08 -05:00
Bill Hollings
e42b33e593 Don't attempt to store the depth component of a stencil-only renderpass attachment.
For a combined depth-stencil format in a MVKImageView attachment with
VK_IMAGE_ASPECT_STENCIL_BIT, the attachment format may have been swizzled
to a stencil-only format. In this case, we want to guard against an attempt
to store the non-existent depth component.

Pass MVKImageView attachment to MVKRenderPassAttachment::encodeStoreAction()
and MVKRenderPassAttachment::populateMTLRenderPassAttachmentDescriptor() to
check attachment depth format component.

Consolidate calls to MVKImageView::populateMTLRenderPassAttachmentDescriptor() by calling
it from within MVKRenderPassAttachment::populateMTLRenderPassAttachmentDescriptor().
2022-02-24 11:42:12 -05:00
Bill Hollings
a6f5841b91
Merge pull request #1530 from billhollings/align-shader-io-nested-structs
Align flattened shader inputs to previous stage output structs.
2022-02-22 17:29:41 -05:00
Bill Hollings
e28a16d76b Update MoltenVK version number to 1.1.9.
Adjust Whats_New.md to accommodate earlier
trivial 1.1.8 patch release for SDK 1.3.204.1.
2022-02-22 14:18:55 -05:00
Bill Hollings
afd997ab31 Align flattened shader inputs to previous stage output structs.
When flattening shader inputs for stage_in, which are to be read from a buffer
that was populated as nested structs during an earlier stage, the structs will
be aligned according to C++ rules, which can affect the alignment of the first
member of the flattened input struct.

Add SPIRVShaderOutput::firstStructMemberAlignment to track the alignment
requirements of the first member of a nested structure, and recursively
determine the alignment of the first member of each nested output structure.

Move sizeOfOutput() from MVKPipeline.mm to SPIRVReflection.h,
rename to getShaderOutputSize(), and add getShaderOutputAlignment()
to extract member alignment.
2022-02-22 12:17:15 -05:00
Bill Hollings
24f802a5dd
Merge pull request #1527 from billhollings/update-glslang
Update glslang version, to use python3 in glslang scripts, to replace missing python on macOS 12.3.
2022-02-16 14:48:24 -05:00
Bill Hollings
f7ca132844 Update glslang version, to use python3 in glslang scripts,
to replace missing python on macOS 12.3.
2022-02-16 14:02:01 -05:00
Bill Hollings
2fa625f962
Merge pull request #1523 from billhollings/rmv-api-warn
Remove logged warning if MoltenVK does not support VkApplicationInfo::apiVersion value.
2022-02-09 13:53:44 -05:00
Bill Hollings
16408fd6ae Remove logged warning if MoltenVK does not support VkApplicationInfo::apiVersion value.
Update MoltenVK version to 1.1.8.
Minor spelling fixes in comments.
2022-02-09 13:36:08 -05:00
Bill Hollings
8218606f44
Merge pull request #1522 from billhollings/sdk-1.3.204
Update dependency libraries to match Vulkan SDK 1.3.204.
2022-02-06 20:46:12 -05:00
Bill Hollings
24ff2106d9 Update dependency libraries to match Vulkan SDK 1.3.204.
Update What's New document.
2022-02-06 19:55:44 -05:00
Bill Hollings
24c2315072
Merge pull request #1520 from billhollings/simulator-gpu-counter-sets
Fix use of GPU counter sets on older versions of iOS running on the simulator.
2022-02-05 13:23:26 -05:00
Bill Hollings
13a0f6abee Fix use of GPU counter sets on older versions of iOS running on the simulator.
Replace test for MVK_APPLE_SILICON with test for MVK_MACOS plus Apple1 GPU.
2022-02-05 12:23:05 -05:00
Bill Hollings
101ea9eec1
Merge pull request #1519 from cfnptr/master
Update license year
2022-02-04 11:27:57 -05:00
Nikita Fediuchin
be51560ba9 Update license year 2 2022-02-04 17:36:53 +02:00
Nikita Fediuchin
4efb90b3c1 Update license year 2022-02-04 13:33:27 +02:00
Bill Hollings
9366457b86
Merge pull request #1509 from billhollings/shaderconverter-updates
MoltenVKShaderConverter updates
2022-01-19 17:06:15 -05:00
Bill Hollings
d4daba6687 MoltenVKShaderConverter updates.
mvk::getShaderOutputs() in SPRIVReflection.h support flattening nested structures.
MoltenVKShaderConverter tool support loading tessellation shader files.
MoltenVKShaderConverter tool update to MSL 2.4 by default.
Remove use of deprecated MTLCreateSystemDefaultDevice().
Update to latest version of SPIRV-Cross.
2022-01-19 15:55:44 -05:00
Bill Hollings
a8149aa45e
Merge pull request #1502 from mbechard/master
fix for #1501
2022-01-05 20:53:34 -05:00
Malcolm Bechard
f3f02c327c fix for #1501
Maintain the incrementing location throughout the structure traversal.
2022-01-05 15:25:16 -05:00
Bill Hollings
9986e92f35
Merge pull request #1497 from billhollings/apple-silicon-deviceID
On Apple Silicon, set VkPhysicalDeviceProperties::deviceID from GPU capabilities.
2021-12-28 22:08:44 -05:00
Bill Hollings
54cdb4706e
Merge pull request #1500 from billhollings/normalize-gpu-counters
Improve accuracy of VkPhysicalDeviceLimits::timestampPeriod.
2021-12-28 22:08:25 -05:00
Bill Hollings
7740d4f43a
Change scale of OSMin value in deviceID to 100.
Co-authored-by: Chip Davis <cdavis@codeweavers.com>
2021-12-28 19:58:10 -05:00
Bill Hollings
cd7c7fdfae Support MTLTimestamp on Xcode 11.7. 2021-12-28 18:12:25 -05:00
Bill Hollings
9633f4843d Improve accuracy of VkPhysicalDeviceLimits::timestampPeriod.
If using GPU counters, on all Apple GPUs lock timestampPeriod to 1.0,
since Apple GPUs use nanoseconds, and on non-Apple GPUs, dynamically
adapt value of timestampPeriod by correlating GPU ticks with GPU ticks.

If using CPU sync, set timestampPeriod to OS CPU timestamp tick period.
2021-12-28 17:19:11 -05:00
Bill Hollings
a1e5ed97a1
Merge pull request #1498 from billhollings/xcode-13.2-build-settings
Support Xcode 13.2 build settings.
2021-12-27 21:16:02 -05:00
Bill Hollings
3a8975c21d Support Xcode 13.2 build settings. 2021-12-27 17:50:29 -05:00
Bill Hollings
df043487e4 On Apple Silicon, set VkPhysicalDeviceProperties::deviceID from GPU capabilities.
Previously, on Apple Silicon (iOS, tvOS & macOS M1), we tried to guess
deviceID from GPU parameters, but this is becoming harder as the types
of Apple Silicon is growing, and the actual device SoC itself is less
relevant that the GPU capabilities. So we now set deviceID from the
combination of OS version and GPU type.

Rename MVKDevice::getHighestMTLFeatureSet() to getHighestGPUCapability().
2021-12-27 16:45:12 -05:00
Bill Hollings
939d51da71
Merge pull request #1494 from billhollings/fix-subpass-mtltex-mem-leak
Fix memory leak of dummy MTLTexture in render subpasses that use no attachments.
2021-12-27 13:00:34 -05:00
Bill Hollings
5810772644 Fix merge conflicts and syntax build error in iOS build. 2021-12-26 18:30:31 -05:00
Bill Hollings
66a171a25d
Merge pull request #1490 from billhollings/strip-promoted-static-vulkan-symbols
Optionally hide additional static Vulkan linkage symbols.
2021-12-26 17:24:19 -05:00