gtk/gsk/vulkan/resources/common.frag.glsl
Benjamin Otte 17698bfd2e vulkan: Use 3 descriptor sets, not 3 bindings
It turns out variable length is only supported for the last binding in
a set, not for every binding.
So we need to create one set for each of our arrays.

[ VUID-VkDescriptorSetLayoutBindingFlagsCreateInfo-pBindingFlags-03004 ] Object 0: handle = 0x33a9f10, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xd3f353a | vkCreateDescriptorSetLayout(): pBindings[0] has VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT but 0 is the largest value of all the bindings. The Vulkan spec states: If an element of pBindingFlags includes VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT, then all other elements of VkDescriptorSetLayoutCreateInfo::pBindings must have a smaller value of binding (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkDescriptorSetLayoutBindingFlagsCreateInfo-pBindingFlags-03004)
2023-06-20 20:15:12 +02:00

11 lines
372 B
GLSL

layout(set = 0, binding = 0) uniform texture2D textures[50000];
layout(set = 1, binding = 0) uniform sampler samplers[50000];
layout(set = 2, binding = 0) readonly buffer FloatBuffers {
float floats[];
} buffers[50000];
#define get_sampler(id) sampler2D(textures[id.x], samplers[id.y])
#define get_buffer(id) buffers[id]
#define get_float(id) get_buffer(0).floats[id]