Skip to content

Commit

Permalink
igl | vulkan | Make VK_EXT_descriptor_indexing optional
Browse files Browse the repository at this point in the history
Summary:
Make the Vulkan extension `VK_EXT_descriptor_indexing` optional.

Enabled via `VulkanContextConfig::enableDescriptorIndexing`.

Reviewed By: EricGriffith

Differential Revision: D49102607

fbshipit-source-id: c4d3767e4f519221a8fe31f9958e5eb3933d147c
  • Loading branch information
corporateshark authored and facebook-github-bot committed Oct 2, 2023
1 parent 48c425f commit 1eda30e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ There are a lot of good options for abstracting GPU API's; each making different
* OpenGL 2.x (requires [GL_ARB_framebuffer_object](https://registry.khronos.org/OpenGL/extensions/ARB/ARB_framebuffer_object.txt))
* OpenGL 3.1+
* OpenGL ES 2.0+
* Vulkan 1.1 (requires [VK_EXT_descriptor_indexing](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_descriptor_indexing.html))
* Vulkan 1.1
* WebGL 2.0

## Supported platforms
Expand All @@ -39,13 +39,13 @@ There are a lot of good options for abstracting GPU API's; each making different

## API Support

| | Windows | Linux | macOS | iOS | Android |
| ------------------------ | -------------------------- | -------------------------- | ----------------------------- | ----------------------------- | -------------------------------- |
| | Windows | Linux | macOS | iOS | Android |
| ------------------------ | -------------------------- | -------------------------- | ----------------------------- | ----------------------------- | ---------------------------------- |
| Vulkan 1.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: (MoltenVK) | :heavy_multiplication_x: | :heavy_check_mark: (Quest 2/3/Pro) |
| OpenGL ES 2.0 - 3.0 | :heavy_check_mark: (Angle) | :heavy_check_mark: (Angle) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| OpenGL ES 3.1 - 3.2 | :heavy_check_mark: (Angle) | :heavy_check_mark: (Angle) | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_check_mark: |
| OpenGL 3.1 - 4.6 | :heavy_check_mark: | :heavy_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |
| Metal 2 | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_multiplication_x: |
| OpenGL ES 2.0 - 3.0 | :heavy_check_mark: (Angle) | :heavy_check_mark: (Angle) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| OpenGL ES 3.1 - 3.2 | :heavy_check_mark: (Angle) | :heavy_check_mark: (Angle) | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_check_mark: |
| OpenGL 3.1 - 4.6 | :heavy_check_mark: | :heavy_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |
| Metal 2 | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_multiplication_x: |

## Build

Expand Down
4 changes: 3 additions & 1 deletion src/igl/vulkan/VulkanContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,11 @@ class DescriptorPoolsArena final {
VkDescriptorSet dset = VK_NULL_HANDLE;
const VkResult result =
ivkAllocateDescriptorSet(&vf_, device_, pool_, dsl_->getVkDescriptorSetLayout(), &dset);
// if the allocation fails due to no more space in the descriptor pool, and not because of
// If the allocation fails due to no more space in the descriptor pool, and not because of
// system or device memory exhaustion, then VK_ERROR_OUT_OF_POOL_MEMORY must be returned.
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkAllocateDescriptorSets.html
// P.S. This is guaranteed only on Vulkan 1.1. If we want Vulkan 1.0, we have to track
// allocations ourselves.
if (result == VK_ERROR_OUT_OF_POOL_MEMORY) {
switchToNewDescriptorPool(ic);
VK_ASSERT(
Expand Down
14 changes: 7 additions & 7 deletions src/igl/vulkan/VulkanHelpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,18 +334,18 @@ VkResult ivkCreateDevice(const struct VulkanFunctionTable* vt,
};
const VkPhysicalDeviceDescriptorIndexingFeaturesEXT descriptorIndexingFeature = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT,
.shaderSampledImageArrayNonUniformIndexing = enableDescriptorIndexing ? VK_TRUE : VK_FALSE,
.shaderSampledImageArrayNonUniformIndexing = VK_TRUE,
.descriptorBindingUniformBufferUpdateAfterBind = VK_TRUE,
.descriptorBindingSampledImageUpdateAfterBind = VK_TRUE,
.descriptorBindingStorageImageUpdateAfterBind = VK_TRUE,
.descriptorBindingStorageBufferUpdateAfterBind = VK_TRUE,
.descriptorBindingUpdateUnusedWhilePending = enableDescriptorIndexing ? VK_TRUE : VK_FALSE,
.descriptorBindingPartiallyBound = enableDescriptorIndexing ? VK_TRUE : VK_FALSE,
.runtimeDescriptorArray = enableDescriptorIndexing ? VK_TRUE : VK_FALSE,
.descriptorBindingUpdateUnusedWhilePending = VK_TRUE,
.descriptorBindingPartiallyBound = VK_TRUE,
.runtimeDescriptorArray = VK_TRUE,
};
// TODO: make it completely optional
// @fb-only
ivkAddNext(&ci, &descriptorIndexingFeature);
if (enableDescriptorIndexing) {
ivkAddNext(&ci, &descriptorIndexingFeature);
}

const VkPhysicalDevice16BitStorageFeatures float16StorageBuffersFeature = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES,
Expand Down

0 comments on commit 1eda30e

Please sign in to comment.