Merge pull request #1836 from goki/main

WIP: enable availability of EXT_shader_atomic_float
This commit is contained in:
Bill Hollings 2023-03-08 18:13:07 -05:00 committed by GitHub
commit 6d2ccd4505
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 2 deletions

View File

@ -22,6 +22,7 @@ Table of Contents
- [Installing **MoltenVK** in Your *Vulkan* Application](#install)
- [Install *MoltenVK* as a Universal `XCFramework`](#install_xcfwk)
- [Install *MoltenVK* as a Dynamic Library](#install_dylib)
- [Install *MoltenVK* replacing the Vulkan SDK .dylib](#install_vksdk)
- [Build and Runtime Requirements](#requirements)
- [Interacting with the **MoltenVK** Runtime](#interaction)
- [MoltenVK `VK_MVK_moltenvk` Extension](#moltenvk_extension)
@ -219,6 +220,39 @@ To link **MoltenVK** to your application as a dynamic library (`.dylib`), follow
- `MoltenVK/dylib/tvOS/libMoltenVK.dylib` *(tvOS)*
<a name="install_vksdk"></a>
### Install *MoltenVK* replacing the Vulkan SDK .dylib
There are a few potential issues when building **MoltenVK** to replace the version installed via
the *[Vulkan SDK](https://vulkan.lunarg.com/sdk/home)* standard install process, which lives in
`/usr/local/lib/libMoltenVK.dylib`.
1. You must *remove* the existing `.dylib` file before copying the new one, because of the way
that the gatekeeper system works to prevent malicious overwriting of files in standard locations
such as `/usr/local`:
```bash
$ sudo rm /usr/local/lib/libMoltenVK.dylib
$ sudo cp Package/Release/MoltenVK/dylib/macOS/libMoltenVK.dylib /usr/local/lib
```
If you do not do the remove first, your application will terminate immediately with a
singularly unhelpful `Killed: 9` message. Alternatively, moving the existing `.dylib` to a
backup name and making a symbolic link to the Package location above is particularly useful
for repeated building and testing.
2. Do *not* copy the `MoltenVK_icd.json` file from the newly-built package to
`/usr/local/share/vulkan/icd.d` -- it will not work and will result in errors about not being
able to initialize the instance. The one installed by Vulkan SDK uses a relative path to
specify the location of the `.dylib`, whereas the one in the package specifies it in the same
directory.
3. The default config for command-line build has verbose logging info turned on -- if you want
it to be like the original, use this command for building:
```bash
$ make macos MVK_CONFIG_LOG_LEVEL=1
```
<a name="requirements"></a>
### Build and Runtime Requirements
@ -303,6 +337,7 @@ In addition to core *Vulkan* functionality, **MoltenVK** also supports the foll
- `VK_KHR_sampler_mirror_clamp_to_edge` *(requires a Mac GPU or Apple family 7 GPU)*
- `VK_KHR_sampler_ycbcr_conversion`
- `VK_KHR_separate_depth_stencil_layouts`
- `VK_EXT_shader_atomic_float` *(requires Metal 3.0)*
- `VK_KHR_shader_draw_parameters`
- `VK_KHR_shader_float_controls`
- `VK_KHR_shader_float16_int8`

View File

@ -1 +1 @@
4e2fdb25671c742a9fbe93a6034eb1542244c7e1
3550a54ae01b295c40ce972d951b420b388b9401

View File

@ -1 +1 @@
ca8d07d0bc1c6390b83915700439fa7719de6a2a
6d41bb9c557c5a0eec61ffba1f775dc5f717a8f7

View File

@ -411,6 +411,16 @@ void MVKPhysicalDevice::getFeatures(VkPhysicalDeviceFeatures2* features) {
shaderIntFuncsFeatures->shaderIntegerFunctions2 = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT: {
auto* atomicFloatFeatures = (VkPhysicalDeviceShaderAtomicFloatFeaturesEXT*)next;
mvkClear(atomicFloatFeatures);
bool atomicFloatEnabled = _metalFeatures.mslVersion >= 030000;
atomicFloatFeatures->shaderBufferFloat32Atomics = atomicFloatEnabled;
atomicFloatFeatures->shaderBufferFloat32AtomicAdd = atomicFloatEnabled;
atomicFloatFeatures->shaderSharedFloat32Atomics = atomicFloatEnabled;
atomicFloatFeatures->shaderSharedFloat32AtomicAdd = atomicFloatEnabled;
break;
}
default:
break;
}

View File

@ -112,6 +112,7 @@ MVK_EXTENSION(EXT_sample_locations, EXT_SAMPLE_LOCATIONS,
MVK_EXTENSION(EXT_sampler_filter_minmax, EXT_SAMPLER_FILTER_MINMAX, DEVICE, MVK_NA, MVK_NA)
MVK_EXTENSION(EXT_scalar_block_layout, EXT_SCALAR_BLOCK_LAYOUT, DEVICE, 10.11, 8.0)
MVK_EXTENSION(EXT_separate_stencil_usage, EXT_SEPARATE_STENCIL_USAGE, DEVICE, 10.11, 8.0)
MVK_EXTENSION(EXT_shader_atomic_float, EXT_SHADER_ATOMIC_FLOAT, DEVICE, 13.0, 16.0)
MVK_EXTENSION(EXT_shader_stencil_export, EXT_SHADER_STENCIL_EXPORT, DEVICE, 10.14, 12.0)
MVK_EXTENSION(EXT_shader_viewport_index_layer, EXT_SHADER_VIEWPORT_INDEX_LAYER, DEVICE, 10.11, 8.0)
MVK_EXTENSION(EXT_subgroup_size_control, EXT_SUBGROUP_SIZE_CONTROL, DEVICE, 10.14, 13.0)