Skip to content

Commit

Permalink
fix condition to use nonuniform decoration
Browse files Browse the repository at this point in the history
  • Loading branch information
rjodinchr committed Jul 3, 2023
1 parent 52edb12 commit efa1fe9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ void cvk_device::init_features(VkInstance instance) {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES;
m_features_buffer_device_address.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR;
m_features_descriptor_indexing.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES;

std::vector<std::tuple<uint32_t, const char*, VkBaseOutStructure*>>
coreversion_extension_features = {
Expand Down Expand Up @@ -314,6 +316,9 @@ void cvk_device::init_features(VkInstance instance) {
VER_EXT_FEAT(VK_MAKE_VERSION(1, 2, 0),
VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME,
m_features_buffer_device_address),
VER_EXT_FEAT(VK_MAKE_VERSION(1, 2, 0),
VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME,
m_features_descriptor_indexing),

#undef VER_EXT_FEAT
};
Expand Down
12 changes: 9 additions & 3 deletions src/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,14 @@ struct cvk_device : public _cl_device_id,
bool supports_subgroups() const { return m_has_subgroups_support; }

bool supports_non_uniform_decoration() const {
return m_properties.apiVersion >= VK_MAKE_VERSION(1, 2, 0) ||
is_vulkan_extension_enabled(
VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME);
return m_features_descriptor_indexing
.shaderSampledImageArrayNonUniformIndexing &&
m_features_descriptor_indexing
.shaderStorageImageArrayNonUniformIndexing &&
m_features_descriptor_indexing
.shaderUniformBufferArrayNonUniformIndexing &&
m_features_descriptor_indexing
.shaderStorageBufferArrayNonUniformIndexing;
}
bool supports_atomic_order_acq_rel() const {
return m_features_vulkan_memory_model.vulkanMemoryModel;
Expand Down Expand Up @@ -585,6 +590,7 @@ struct cvk_device : public _cl_device_id,
m_features_vulkan_memory_model{};
VkPhysicalDeviceBufferDeviceAddressFeaturesKHR
m_features_buffer_device_address{};
VkPhysicalDeviceDescriptorIndexingFeatures m_features_descriptor_indexing{};

VkDevice m_dev;
std::vector<const char*> m_vulkan_device_extensions;
Expand Down

0 comments on commit efa1fe9

Please sign in to comment.