1799 Commits

Author SHA1 Message Date
Chip Davis
9f675b2e9d MVKCmdClearImage: Support clears of 3D images.
For these, we must use the `depthPlane` property to set the layer to
clear, and we must iterate over the image's depth, since the layer count
will be 1 in this case.
2020-09-16 01:07:20 -05:00
Bill Hollings
67d4b335be
Merge pull request #1036 from cdavis5e/ignore-sampler-address-w
MVKSampler: Ignore addressModeW with unnormalized coordinates.
2020-09-15 16:35:58 -04:00
Bill Hollings
afa536c8ea
Merge pull request #1035 from cdavis5e/3d-blits
MVKCmdBlitImage: Support blits with non-2D images.
2020-09-15 16:23:31 -04:00
Bill Hollings
5a9b8c8936
Merge pull request #1031 from cdavis5e/retain-descriptor-sets
MVKCmdBindDescriptorSets: Retain given objects.
2020-09-15 16:18:48 -04:00
Chip Davis
9c28064760 MVKSampler: Ignore addressModeW with unnormalized coordinates.
Some tests intentionally pass an invalid address mode here when
unnormalized coordinates are in use, ostensibly to test that it is
ignored. Metal's validation layer, however, complains if you set
`rAddressMode` to an invalid value, even if `normalizedCoordinates` is
`false`. To avoid this, don't set the `rAddressMode`, since it can't be
used with unnormalized coordinates anyway.
2020-09-15 13:13:32 -05:00
Chip Davis
3e1e029569 MVKCmdBlitImage: Support blits with non-2D images.
This is needed to get us past the 3D blit tests that were recently added
to the CTS. It *almost* passes all these new tests; the 3D format tests
fail for some reason.
2020-09-15 13:10:09 -05:00
Chip Davis
30113fc123 Retain pipeline layouts in bind/push descriptor commands.
Fixes a use-after-free bug when the pipeline layout is destroyed after
recording--e.g. in the
`dEQP-VK.api.pipeline_layout.lifetime.destroy_after_end` test.
2020-09-15 13:07:16 -05:00
Bill Hollings
a2734c3166
Merge pull request #1034 from cdavis5e/sampler-desc-autorelease
MVKSampler: Wrap MTLSamplerState creation in an autorelease pool.
2020-09-15 13:36:48 -04:00
Bill Hollings
7abb9f552a
Merge pull request #1033 from cdavis5e/3d-2d-copies
MVKCmdCopyImage: Support copies between 3D and 2D images.
2020-09-15 13:35:44 -04:00
Bill Hollings
0a20bb0cfb
Merge pull request #1032 from cdavis5e/free-failed-objects
Destroy/free objects when configuration fails.
2020-09-15 13:33:31 -04:00
Chip Davis
ef55ef6927 MVKSampler: Wrap MTLSamplerState creation in an autorelease pool.
Or the `MTLSamplerDescriptor` could be leaked.
2020-09-14 19:30:33 -05:00
Chip Davis
fa862c46a3 MVKCmdCopyImage: Support copies between 3D and 2D images.
This can be done by copying between each slice of the 2D image and each
plane of the 3D image individually.

This was actually quite simple to implement. I don't know why I punted
on this.
2020-09-14 19:28:09 -05:00
Chip Davis
86a1fbdb8f Destroy/free objects when configuration fails.
Prior to this, we were leaking objects after failing to configure them.
The sole exception was `VkDescriptorSet`; failed descriptor sets are
automatically returned to the pool. Now all objects are destroyed or
freed when creation fails.
2020-09-14 19:25:54 -05:00
Bill Hollings
061f4ee6c5
Merge pull request #1030 from cdavis5e/clear-linear-images-mac
MVKCmdClearColorImage: Clear linear images on Mac with a shader.
2020-09-14 14:39:33 -04:00
Chip Davis
544a4a88ef MVKCmdClearColorImage: Clear linear images on Mac with a shader.
Linear textures on Mac family GPUs aren't renderable, so we cannot use
a `Clear`/`Store` `MTLRenderPass` to clear them. Instead, use a compute
shader to clear them.

I haven't expanded this to all color images, because the
`MTLTextureUsageShaderWrite` usage disables lossless compression on
Apple GPUs, but `RenderTarget` usage does not. Also, multisample
textures do not yet support writing.
2020-09-14 12:37:17 -05:00
Bill Hollings
2cb385b04c
Merge pull request #1029 from cdavis5e/resolve-subregion-fix
MVKCmdResolveImage: Fix resolving sub-regions.
2020-09-14 13:31:16 -04:00
Bill Hollings
36803088cd
Merge pull request #1028 from billhollings/xcode12
Support fat platform libraries in XCFrameworks and dylibs.
2020-09-14 12:54:04 -04:00
Chip Davis
a299ee6601 MVKCmdResolveImage: Fix resolving sub-regions.
When doing multisample resolution in Metal, the dimensions of the MSAA
RT and the resolve destination must be the same. Therefore, if the
resolve region does not cover the entire destination, we must use a
temporary transfer image. This fixes a validation error in the differing
image size tests from the CTS
(`dEQP-VK.api.copy_and_blit.*.resolve_image.diff_image_size.*`).

Because the temporary transfer image has the same dimensions as the
destination and is intended to be resolved to it, copies from the source
should use the destination's parameters for the temp image. That way,
the regions show up in the correct place in the destination. This fixes
the remaining resolve tests.

Don't do expansion blits if the resolve region covers the entire
destination. This should reduce the amount of needless work we do in
that case.
2020-09-14 11:28:18 -05:00
Bill Hollings
a47bcdf2c5 Support fat platform libraries in XCFrameworks and dylibs.
Remove EXCLUDED_ARCHS from all Xcode projects to allow fat platform libraries to be built.
Script copy_lib_to_staging.sh no longer breaks fat libraries into single-architecture
libraries, and simply copies fat file to XCFramework staging area.
This permits support for arm64 on macOS, and arm64e on iOS and tvOS.
Creating a Simulator dylib containing both x86_64 and arm64 (Apple Silicon)
architectures is not currently supported by Xcode, so Simulator dylibs are skipped.
2020-09-14 12:01:13 -04:00
Bill Hollings
cf109ce4da
Merge pull request #1026 from billhollings/xcode12
Sync xcode12 with master.
2020-09-12 00:50:41 -04:00
Bill Hollings
f00de1b5c6 Cleanup master xcode12 merge issues in Demos. 2020-09-11 16:05:29 -04:00
Bill Hollings
9406fce556 Fix syntax crash in create_xcframework_func.sh. 2020-09-11 15:01:03 -04:00
Bill Hollings
51777ca49c Merge branch 'master' of https://github.com/billhollings/MoltenVK into xcode12 2020-09-11 14:03:03 -04:00
Bill Hollings
d135363277
Merge pull request #1024 from billhollings/master
Cleanup Vulkan 1.1 info & Support Xcode 11.7.
2020-09-11 12:15:32 -04:00
Bill Hollings
b7b1435d8b Support Xcode 11.7. 2020-09-11 11:35:44 -04:00
Bill Hollings
e9c4b4813b Cleanup Vulkan 1.1 info.
Update remaining documents to reference Vulkan 1.1 instead of 1.0.
Per Vulkan 1.1 spec, remove now-obsolete MVKInstance code
that emits error if app requests higher Vulkan version.
Upgrade MoltenVK version to 1.1.0.
2020-09-11 11:16:34 -04:00
Bill Hollings
c6af90ca5a
Merge pull request #1021 from cdavis5e/create-renderpass2
Support the VK_KHR_create_renderpass2 extension.
2020-09-11 10:42:06 -04:00
Bill Hollings
4181445688
Merge pull request #1022 from cdavis5e/arm64-alias-fix
Fix aliases on ARM64.
2020-09-11 10:34:00 -04:00
Chip Davis
2c40e39699 Fix aliases on ARM64.
The semicolon is the comment character in ARM64 assembly. Just put the
alias symbol definition on another line.
2020-09-10 20:21:02 -05:00
Chip Davis
260f9393d7 Support the VK_KHR_create_renderpass2 extension.
This will be needed for two other Vulkan 1.2 extensions,
`VK_KHR_depth_stencil_resolve` and
`VK_KHR_separate_depth_stencil_layouts`.

Most of this is just changing MVKRenderPass to store everything
internally in `RenderPass2` format. I also added some basic handling for
a few things I left out from earlier changes, input attachment aspect
masks and dependency view offsets. The former won't become important
until Metal supports depth/stencil framebuffer fetch. The latter won't
be needed until we start using untracked resources, and therefore need
to insert explicit fences and/or barriers between subpasses. We don't
need either right now, but I've handled them regardless.
2020-09-10 19:09:05 -05:00
Bill Hollings
19ebc7778b
Merge pull request #1020 from billhollings/master
Fix Metal validation error when occlusion query and renderpass are in separate Vulkan command buffers.
2020-09-10 18:22:12 -04:00
Bill Hollings
3fccd4bcbf Fix Metal validation error when occlusion query and
renderpass are in separate Vulkan command buffers.
2020-09-10 16:41:03 -04:00
Bill Hollings
f3fd6986b6
Merge pull request #1019 from js6i/master
MVKCmdCopyImage: adjust destination extent when it's compressed
2020-09-10 10:05:16 -04:00
Jan Sikorski
8eeae75dc6 MVKCmdCopyImage: adjust destination extent when it's compressed 2020-09-10 14:48:39 +02:00
Bill Hollings
f7a592850b
Merge pull request #1014 from js6i/master
Store action validation warnings
2020-09-09 12:48:20 -04:00
Bill Hollings
5de79dccee
Merge pull request #1018 from cdavis5e/store-override-fix
MVKCommandEncoder: Set store override actions before finalizing draw state.
2020-09-09 11:16:19 -04:00
Jan Sikorski
6cbfba085d Prevent accidental setColorStoreAction for non-color attachments 2020-09-09 10:16:36 +02:00
Chip Davis
93ee0300a9 MVKCommandEncoder: Set store override actions before finalizing draw state.
Otherwise, they could be left unset when we switch to compute in order
to set up the state for the draw call.
2020-09-08 18:52:38 -05:00
Bill Hollings
8260f44762
Merge pull request #1017 from cdavis5e/merge-pipeline-cache-owner-fix
MVKShaderLibraryCache: Fix owner of merged MVKShaderLibraries.
2020-09-08 16:54:13 -04:00
Bill Hollings
79a15b1776
Merge pull request #1016 from cdavis5e/free-descriptor-sets
MVKDescriptorPool: Only free descriptor sets it knows about.
2020-09-08 16:37:45 -04:00
Bill Hollings
346843928e
Merge pull request #1015 from cdavis5e/vulkan1.1
Support Vulkan 1.1.
2020-09-08 16:08:31 -04:00
Chip Davis
28b5f8c37e MVKShaderLibraryCache: Fix owner of merged MVKShaderLibraries.
When a pipeline cache were merged into another pipeline cache, we would
create new `MVKShaderLibrary` objects for each one contained in the
source. The objects would be exact copies of the originals... including
their owner, which could be destroyed after the pipeline caches were
merged. Fix the owner in the new objects to prevent a dangling
reference.
2020-09-08 13:35:02 -05:00
Chip Davis
8a30aeadbe MVKDescriptorPool: Only free descriptor sets it knows about.
Fixes a crash in `dEQP-VK.api.null_handle.free_descriptor_sets`.
2020-09-08 13:33:46 -05:00
Chip Davis
0cf2bfd1d2 Implement the vkEnumerateInstanceVersion() function.
We're Vulkan 1.1 now!
2020-09-08 13:22:17 -05:00
Chip Davis
a775263888 Implement the vkGetDeviceQueue2() function.
This function was introduced with protected memory. Since we don't
support that, right now it does nothing that `vkGetDeviceQueue()` did
not already do. Despite that, I've added a method to `MVKDevice`,
because this is an extensible function analogous to e.g.
`vkGetPhysicalDeviceFeatures2()`.
2020-09-08 13:22:17 -05:00
Chip Davis
78963db6cc Export core names of Vulkan 1.1 calls promoted from extensions.
The functions are now defined under their core names. To avoid code
bloat, I've defined the suffixed names as aliases of the core names.
Both symbols will be globally defined with the same value, and in the
dylib both will be exported.

Fix the default API version when none is given. Zero is the same as
`VK_API_VERSION_1_0`. Prior to this, we were overwriting it with zero if
no app info were given, or if it were zero in the app info. It wasn't
important before, but now that we gate API availability on maximum
Vulkan version, we need to make sure it's a valid version.
2020-09-08 13:22:17 -05:00
Chip Davis
16db5bfe63 MVKDevice: Fill in protected memory info structs.
We can't support this feature on top of Metal with the API available to
us, but we have to fill in the structures for Vulkan 1.1.
2020-09-08 13:22:17 -05:00
Chip Davis
742a2f2951 MVKDevice: Fill in feature struct for VK_KHR_shader_draw_parameters.
It's actually from Vulkan 1.1, but we'll soon support that.
2020-09-08 13:22:17 -05:00
Bill Hollings
b8b44f9d88
Merge pull request #1011 from cdavis5e/external-semaphore
Add basic support for VK_KHR_external_semaphore{,_capabilities}.
2020-09-08 13:32:17 -04:00
Chip Davis
09bcd534d9 Add basic support for VK_KHR_external_semaphore{,_capabilities}.
Also a non-functional base for future extensions. We can't implement it
anyway until all remaining bugs in `MTLEvent`-based semaphores are
fixed.

This is the last of the extensions that was promoted to core for Vulkan
1.1. We're almost there!
2020-09-05 21:05:54 -05:00