nvk: Support inline uniform blocks

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand 2023-01-30 20:11:50 -06:00 committed by Marge Bot
parent a45f789083
commit e1c93352d7
2 changed files with 21 additions and 0 deletions

View file

@ -5,6 +5,7 @@
#include "nvk_pipeline_layout.h"
#include "nir_builder.h"
#include "nir_deref.h"
struct lower_descriptors_ctx {
const struct nvk_pipeline_layout *layout;
@ -55,6 +56,22 @@ load_descriptor(nir_builder *b, unsigned num_components, unsigned bit_size,
.align_mul = 16, .align_offset = 0, .range = ~0);
}
case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK: {
nir_ssa_def *base_addr =
nir_iadd_imm(b, load_descriptor_set_addr(b, set, ctx),
binding_layout->offset);
assert(binding_layout->stride == 1);
const uint32_t binding_size = binding_layout->array_size;
/* Convert it to nir_address_format_64bit_bounded_global */
assert(num_components == 4 && bit_size == 32);
return nir_vec4(b, nir_unpack_64_2x32_split_x(b, base_addr),
nir_unpack_64_2x32_split_y(b, base_addr),
nir_imm_int(b, binding_size),
nir_imm_int(b, 0));
}
default: {
assert(binding_layout->stride > 0);
nir_ssa_def *desc_ubo_offset =

View file

@ -56,6 +56,7 @@ nvk_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
VkPhysicalDeviceVulkan13Features core_1_3 = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES,
/* Vulkan 1.3 features */
.inlineUniformBlock = true,
};
vk_foreach_struct(ext, pFeatures->pNext)
@ -140,6 +141,8 @@ nvk_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
VkPhysicalDeviceVulkan13Properties core_1_3 = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES,
/* Vulkan 1.3 properties */
.maxInlineUniformBlockSize = 1 << 16,
.maxPerStageDescriptorInlineUniformBlocks = 32,
};
vk_foreach_struct(ext, pProperties->pNext)
@ -181,6 +184,7 @@ nvk_get_device_extensions(const struct nvk_physical_device *device,
#endif
.KHR_variable_pointers = true,
.EXT_custom_border_color = true,
.EXT_inline_uniform_block = true,
};
}