vulkan: Add nonuniformEXT() where needed

The magical term to know about (because the GLSL compiler or the
validation layers sure as hell don't) is:

  "dynamically uniform expression"

because if you don't have that when indexing a texture or buffer array,
you need to add nonuniformEXT() around the index variable.

Fixes the close icon on AMD having glitches of the previous icon visible
in some pixels.
This commit is contained in:
Benjamin Otte
2023-08-14 06:04:24 +02:00
parent 8862666b5a
commit d665d2fb89

View File

@@ -1,9 +1,11 @@
#extension GL_EXT_nonuniform_qualifier : enable
layout(set = 0, binding = 0) uniform sampler2D textures[50000];
layout(set = 1, binding = 0) readonly buffer FloatBuffers {
float floats[];
} buffers[50000];
#define get_sampler(id) textures[id]
#define get_buffer(id) buffers[id]
#define get_float(id) get_buffer(0).floats[id]
#define get_sampler(id) textures[nonuniformEXT (id)]
#define get_buffer(id) buffers[nonuniformEXT (id)]
#define get_float(id) get_buffer(0).floats[nonuniformEXT (id)]