2242 Commits

Author SHA1 Message Date
Bill Hollings
883b96f611
Merge pull request #1153 from js6i/master
MVKBufferView: Avoid triggering bytesPerRow validation warning.
2020-11-17 09:38:02 -05:00
Bill Hollings
6087e0a266
Merge pull request #1152 from cdavis5e/ios-min-lod-clamp
MVKPhysicalDevice: Enable shaderResourceMinLod on iOS.
2020-11-17 09:33:57 -05:00
Jan Sikorski
8173a9717d MVKBufferView: Avoid triggering bytesPerRow validation warning. 2020-11-17 14:26:38 +01:00
Chip Davis
3b33c9ce05 MVKPhysicalDevice: Enable shaderResourceMinLod on iOS.
This was actually added in iOS 13, but it wasn't present in the betas.
Since the betas also didn't support family 6, this leads me to suspect
that `min_lod_clamp()` requires family 6. So to be safe, only enable the
feature on family 6.

Update SPIRV-Cross to pull in the changes needed for this.
2020-11-16 20:47:31 -06:00
Bill Hollings
4e0abab7db
Merge pull request #1151 from cdavis5e/ios-family-7
Enable some family 7 features on iOS.
2020-11-16 21:41:22 -05:00
Bill Hollings
3b71eb0b2a
Merge pull request #1149 from cdavis5e/ios-3d-compressed
MVKPhysicalDevice: Enable 3D compressed textures on iOS/tvOS.
2020-11-16 21:29:59 -05:00
Chip Davis
4f8613c650 Enable some family 7 features on iOS.
Apple family 7 GPUs (A14) on iOS support multisample layered rendering,
as well as sampler border colors and the mirror clamp to edge sampler
address mode.
2020-11-16 14:46:07 -06:00
Bill Hollings
76c78eb922
Merge pull request #1150 from cdavis5e/max-threadgroup-size-pipeline
MVKComputePipeline: Override max threads per threadgroup.
2020-11-16 14:03:25 -05:00
Chip Davis
c826d58946 MVKComputePipeline: Override max threads per threadgroup.
We know the actual threadgroup size, because it is declared in the
shader. Therefore, we know the total count of threads per threadgroup,
which is simply the product of the threadgroup size in all three
dimensions. This is necessary if Metal picks a size lower than the app
is expecting. At least one game (NieR: Automata) needs this to work
correctly.
2020-11-15 20:03:53 -06:00
Chip Davis
0dc92be38f MVKPhysicalDevice: Enable 3D compressed textures on iOS/tvOS.
Forbid ETC2 and EAC 3D textures on all platforms. Apple GPUs do not
support 3D for those.
2020-11-15 13:56:15 -06:00
Bill Hollings
1772790f46
Merge pull request #1147 from cdavis5e/mac-apple-family-7
MVKPhysicalDevice: Enable Apple family 7 features on macOS.
2020-11-15 14:35:42 -05:00
Chip Davis
a63861c732
Merge pull request #1146 from TheSpydog/dont-cull-clears
Disable culling for the duration of vkCmdClearAttachments
2020-11-14 18:17:41 -06:00
Caleb Cornett
2c33c69e22 Set viewport and scissor rect to the framebuffer extents before clearing. And minor style fixes. 2020-11-14 16:27:39 -05:00
Caleb Cornett
85c6e453b2 Set fill mode, depth bias, viewport, and scissor states before clearing attachments 2020-11-14 15:32:37 -05:00
Chip Davis
6a00362b7b MVKPhysicalDevice: Enable Apple family 7 features on macOS.
The M1 chip supports up to GPU family 7. The enum for this was added to
the SDK in the final version of Xcode 12.2; now we can use it.
2020-11-13 18:10:02 -06:00
Bill Hollings
f37c9ad146
Merge pull request #1144 from cdavis5e/mixed-2d-3d-layered-render
MVKCommandEncoder: Don't set renderTargetArrayLength for mixed 2D/3D renders.
2020-11-13 10:43:04 -05:00
Caleb Cornett
d8bded2637 Disable culling for the duration of the vkCmdClearAttachments call 2020-11-11 15:27:11 -05:00
Chip Davis
3e699e4650 MVKCommandEncoder: Don't set renderTargetArrayLength for mixed 2D/3D renders.
Metal's validation layer doesn't like it when we render to both a 2D and
a 3D texture with layered rendering. Work around this by not setting the
`renderTargetArrayLength` if it would be one and we are rendering to
mixed 2D and 3D textures.

If the pipeline sets `[[render_target_array_index]]`, we're hosed either
way. Perhaps this is why Vulkan has a special flag,
`VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT`, intended for rendering to 3D
textures.
2020-11-09 11:14:00 -06:00
Bill Hollings
d208f94788
Merge pull request #1143 from cdavis5e/msl-interpolation-functions
MVKPhysicalDevice: Expose support for interpolation functions.
2020-11-08 17:13:32 -05:00
Chip Davis
e6d1f3cc67 MVKPhysicalDevice: Expose support for interpolation functions.
This is now supported in MSL 2.3. Support varies by device; devices that
support this return `YES` from `supportsPullModelInterpolation`. Based
on my testing, AMD devices do not yet support this, and Intel devices
do. Apple GPUs probably also support this, in order to support OpenGL on
top.

Update SPIRV-Cross to pull in the changes needed for this.
2020-11-07 12:05:12 -06:00
Bill Hollings
c593983ae0
Merge pull request #1142 from MarnixKuijs/master
Device fallback and fixed typo
2020-11-06 15:11:27 -05:00
Bill Hollings
bf65caa7e4
Merge pull request #1141 from billhollings/desc-set-cleanups
Descriptor code cleanups
2020-11-06 11:30:49 -05:00
MarnixKuijs
ac968db0b5 Device fallback and fixed typo 2020-11-05 23:39:29 +01:00
Bill Hollings
3308075107
Merge pull request #1140 from cdavis5e/apple-gpu-linear-blit-clear
Allow linear images on Apple GPUs in Blit and Clear commands.
2020-11-05 15:30:04 -05:00
Bill Hollings
163e8e5b20 Merge branch 'master' of https://github.com/billhollings/MoltenVK into desc-set-cleanups 2020-11-05 15:14:02 -05:00
Chip Davis
415ad30bea Allow linear images on Apple GPUs in Blit and Clear commands.
They can now be used as blit destinations and be cleared with a render
pass.

This also fixes a bug where we were incorrectly validating that the
format supported shader writes if the image were linear, even on
iOS/tvOS.
2020-11-05 13:45:53 -06:00
Bill Hollings
3261d69be8
Merge pull request #1139 from billhollings/tvos-build-fixes
Fix tvOS builds and fix supportsGPUFamily: typo.
2020-11-05 14:28:16 -05:00
Bill Hollings
51ad6b3019
Merge pull request #1138 from cdavis5e/max-occlusion-queries
MVKPhysicalDevice: Set max visibility buffer size to 256 kiB where supported.
2020-11-05 14:03:08 -05:00
Bill Hollings
223a1f4d30 Fix build warnings.
Replace use of MTLDevice::supportsGPUFamily: with supportsFamily:.
Wrap unused variable of tvOS with conditional compile macro.
2020-11-05 13:58:30 -05:00
Bill Hollings
779ae2aa45 Fix tvOS builds.
Add macros to set MTLPixelFormatASTC_*_HDR to MTLPixelFormatInvalid on tvOS.
Use MTLRenderPipelineDescriptor::inputPrimitiveTopologyMVK instead of native method.
2020-11-05 13:41:55 -05:00
Chip Davis
8cb48464b4 MVKPhysicalDevice: Set max visibility buffer size to 256 kiB where supported.
Starting in macOS 10.15, all desktop GPUs support 256 kiB offsets. Apple
GPUs, however, do not support this until family 7. It isn't clear which
one is the supported limit on Apple Silicon Macs with family 5 or 6
GPUs, so I have left the Apple Silicon limit at 64 kiB for now.
2020-11-05 12:04:09 -06:00
Bill Hollings
426b699703
Merge pull request #1137 from cdavis5e/layered-blits
MVKCmdBlitImage: Use layered draws when possible.
2020-11-05 12:30:37 -05:00
Bill Hollings
46661417d4
Merge pull request #1136 from cdavis5e/tex-compress-astc-hdr
Support the VK_EXT_texture_compression_astc_hdr extension.
2020-11-05 12:28:05 -05:00
Bill Hollings
6defcea596 Simplify MVKDescriptor subclass implementations.
Don't pass descriptor type to MVKDescriptor functions, which already know their
descriptor type, and remove redundant switch tests in each subclass.
Move sanity tests for correct descriptor type to callers.
2020-11-05 11:31:50 -05:00
Chip Davis
b1e304bf91 MVKCmdBlitImage: Use layered draws when possible.
I wanted to do this in the last release, but I ran out of time.

It doesn't seem to provide much speed up.
2020-11-05 10:28:00 -06:00
Chip Davis
75129b849b Support the VK_EXT_texture_compression_astc_hdr extension.
Requires Apple family 6.

This adds one too many `MTLPixelFormats`, so I bumped the
`_mtlPixelFormatCount`.

Fixes #738.
2020-11-05 10:17:42 -06:00
Bill Hollings
a941ace5de
Merge pull request #1135 from cdavis5e/tsan-pipeline-layout-config
MVKPipelineLayout: Only set configuration result if validating.
2020-11-05 09:36:34 -05:00
Bill Hollings
cee558f484
Merge pull request #1134 from cdavis5e/apple-gpu-extensions
Enable extensions supported by Apple GPUs on Mac
2020-11-05 09:32:56 -05:00
Bill Hollings
cdd5b458da Fix Metal validation error when unused elements in
an array of sampler are not populated by descriptors.

Populate a default MTLSampler in unused sampler descriptors.
2020-11-04 22:16:04 -05:00
Chip Davis
23f113f1cd MVKPipelineLayout: Only set configuration result if validating.
Fixes a race condition picked up by `tsan`.
2020-11-04 16:25:39 -06:00
Bill Hollings
8cff884624 MVKDescriptorSetLayout sort and hold bindings by binding number.
MVKBufferDescriptor increment dynamic offset index as consumed during binding.
Remove need to track dynamic offset indexes in MVKDescriptorSetLayoutBinding.
2020-11-04 17:25:24 -05:00
Chip Davis
8bb9db2dce Enable VK_EXT_post_depth_coverage for Apple Silicon on Mac. 2020-11-04 16:23:33 -06:00
Chip Davis
51afe4745e Enable VK_AMD_shader_image_load_store_lod for Apple Silicon on Mac. 2020-11-04 16:23:33 -06:00
Bill Hollings
53fd0b3640 Fix crash in vkUpdateDescriptorSets() when copying inline block descriptors.
Use temporary buffer to hold inline block data between
read and write stages while copying between descriptor sets.
2020-11-04 14:01:08 -05:00
Bill Hollings
5be7b2d8d5
Merge pull request #1131 from billhollings/VK_EXT_descriptor_indexing
Initial support for the VK_EXT_descriptor_indexing extension
2020-11-04 13:17:41 -05:00
Bill Hollings
e23ead807e Fix typo. 2020-11-04 13:00:49 -05:00
Bill Hollings
6e5984832f Sync VK_EXT_descriptor_indexing branch with master. 2020-11-04 11:07:27 -05:00
Bill Hollings
ae20a01c17
Merge pull request #1133 from cdavis5e/dylib-ubsan
Scripts: Support ubsan when building the dylib.
2020-11-04 10:59:32 -05:00
Bill Hollings
77dc97631e
Merge pull request #1132 from cdavis5e/tvos-supported-extensions
MVKExtensions: Add missing tvOS case for unsupported extensions.
2020-11-04 10:58:41 -05:00
Bill Hollings
3288a3f445
Merge pull request #1130 from cdavis5e/apple-gpu-pixel-formats-mac
Support Apple GPU pixel formats with Apple Silicon on Mac.
2020-11-04 10:57:43 -05:00