2011 Commits

Author SHA1 Message Date
Bill Hollings
7f62362db3 Fixes from review for Mac Catalyst on macOS 11.0+.
MVKPixelFormats revert testing for stencil feedback and add Mac Catalyst test.
Revert mvkOSVersionIsAtLeast(mac, ios) to remove test for Mac Catalyst version.
MVKRenderPass revert testing for MTLStorageModeMemoryless for iOS.
2020-12-02 16:22:38 -05:00
Bill Hollings
f8d82620c0 Update Travis CI to use Xcode 12.2 to support macOS 11.0 builds. 2020-12-02 11:34:44 -05:00
Bill Hollings
ab34b8c6d4 Remove spurious debug log message. 2020-12-02 08:07:39 -05:00
Bill Hollings
1ec58c9a92 Support building for Mac Catalyst on macOS 11.0+.
Define MVK_MACCAT build macro and use it to conditionally compile code to align
with build features and capabilities of Mac Catalyst platform on macOS 11.0+.
Treat Mac Catalyst as minor variation of macOS 11.0.
Update documentation.

Currently only support Mac Catalyst on macOS 11.0+, to avoid complexities of
deselecting iOS features and capabilities for Mac Catalyst on previous macOS versions.

Mac Catalyst (and Simulators) require use of XCFrameworks.
Currently unable to generate a dylib for Mac Catalyst.
2020-12-01 19:26:15 -05:00
Bill Hollings
1329f3adee Update build scripts to build for Mac Catalyst. 2020-11-30 18:52:34 -05:00
Bill Hollings
9ec67edc42
Merge pull request #1166 from cdavis5e/mvk-ext-supported-cleanup
MVKExtensions: Clean up mvkIsSupportedOnPlatform().
2020-11-30 18:26:19 -05:00
Chip Davis
1801c5b80b MVKExtensions: Clean up mvkIsSupportedOnPlatform().
There's a lot of redundant pointer comparison and version checking in
that function. Use a macro to reduce the redundancy.

Advertise `VK_KHR_shader_subgroup_extended_types` on iOS. I forgot to do
this in #1159.
2020-11-30 17:01:57 -06:00
Bill Hollings
761004d635
Merge pull request #1165 from cdavis5e/sync-fixes
MVKSync: Miscellaneous fixes.
2020-11-30 17:50:22 -05:00
Chip Davis
898c03d77f MVKSync: Miscellaneous fixes.
Fix reversed condition in `MVKTimelineSemaphoreEmulated`, which probably
caused some test failures.

Don't increment the `MTLEvent` binary semaphore's counter unless a
command buffer is actually present to schedule a wait on.

Defer signal operations when a swapchain image is not yet available.
That way, the correct value will be signaled when the image is ready,
instead of causing GPU lockups and timeouts.

When a drawable is presented, immediately mark it available, instead of
waiting until the command buffer finishes. Otherwise, the wrong
semaphore could be signaled when an image is used twice in a row.

This should fix the problems using `MTLEvent` binary semaphores with
presentation, which was preventing us from enabling them by default when
available.

Special thanks to @apayen, whose
[idea](https://github.com/KhronosGroup/MoltenVK/issues/803) and
[change](a4ac715975)
were the basis for this.
2020-11-28 11:18:20 -06:00
Bill Hollings
242edbdc0b
Merge pull request #1164 from js6i/master
MVKImage: Avoid swizzling storage and/or attachment image views.
2020-11-28 11:43:32 -05:00
Bill Hollings
2b8bc02106
Merge pull request #1162 from cdavis5e/min-sample-shading
MVKGraphicsPipeline: Handle minSampleShading.
2020-11-28 11:40:53 -05:00
Bill Hollings
c2044be561
Merge pull request #1161 from cdavis5e/apple-texture-swizzle
MVKPhysicalDevice: Enable texture swizzle on all Apple GPUs.
2020-11-28 11:37:32 -05:00
Jan Sikorski
597e746012 MVKImage: Avoid swizzling storage and/or attachment image views.
Detect more swizzle patterns that are equivalent to identity, so that Metal
does not disable usage capabilities that we want.
2020-11-27 17:10:46 +01:00
Chip Davis
85416e297e MVKGraphicsPipeline: Handle minSampleShading.
If it is enabled and nonzero, then force sample-rate shading in the
fragment shader.
2020-11-26 14:36:53 -06:00
Chip Davis
346c532648 MVKPhysicalDevice: Enable texture swizzle on all Apple GPUs.
I misread the table when I added this.
2020-11-26 14:34:34 -06:00
Bill Hollings
c5b650f8a6
Merge pull request #1159 from cdavis5e/subgroup-support-fix
MVKPhysicalDevice: Correct subgroup properties.
2020-11-25 15:41:58 -05:00
Chip Davis
8e11c41c40 MVKPhysicalDevice: Correct subgroup properties.
On systems not supporting this, the subgroup size is set to 1.

Make sure the subgroup size is fixed in the shader, at least until we
implement `VK_EXT_subgroup_size_control`.

According to the Metal feature set tables, SIMD-group reduction is only
supported on Mac family 2 GPUs and Apple family 7 GPUs. Previously, we
were exposing these on all Mac GPUs.

Quadgroup permutation is supported on all Apple GPUs starting from
family 4. We use them for regular group non-uniform ops as well, so
these are considered to have a subgroup size of 4. On Mac, it's a bit
more complicated. The 2.1 tables say that all Mac GPUs support this, but
the 3.0 and 4.0 tables say that only family 2 supports quadgroup ops.
I've allowed quad ops on family 1 for now.

Unfortunately, my testing shows that SIMD-group functions don't work in
fragment shaders on Mojave, so no fragment shader support until Metal 3.

Update SPIRV-Cross to pull in changes needed for all this.
2020-11-25 12:02:37 -06:00
Chip Davis
ce85a96d80
Merge pull request #1157 from Michael-Lfx/master
Fix macOS 10.15.5 with Xcode 12.1 compilation error.
2020-11-19 11:43:44 -06:00
michael(jf.lai)
fee3e5da3a Fix macOS 10.15.5 with Xcode 12.1 compilation error. 2020-11-20 00:39:42 +08:00
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