nir_to_tgsi: Add support for declaring image arrays.
Required for virgl. Acked-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
This commit is contained in:
@@ -442,6 +442,8 @@ static void
|
||||
ntt_setup_uniforms(struct ntt_compile *c)
|
||||
{
|
||||
nir_foreach_uniform_variable(var, c->s) {
|
||||
int image_count = glsl_type_get_image_count(var->type);
|
||||
|
||||
if (glsl_type_is_sampler(glsl_without_array(var->type))) {
|
||||
/* Don't use this size for the check for samplers -- arrays of structs
|
||||
* containing samplers should be ignored, and just the separate lowered
|
||||
@@ -459,17 +461,20 @@ ntt_setup_uniforms(struct ntt_compile *c)
|
||||
target, ret_type, ret_type, ret_type, ret_type);
|
||||
ureg_DECL_sampler(c->ureg, var->data.binding + i);
|
||||
}
|
||||
} else if (glsl_type_is_image(var->type)) {
|
||||
} else if (image_count) {
|
||||
const struct glsl_type *itype = glsl_without_array(var->type);
|
||||
enum tgsi_texture_type tex_type =
|
||||
tgsi_texture_type_from_sampler_dim(glsl_get_sampler_dim(var->type),
|
||||
glsl_sampler_type_is_array(var->type), false);
|
||||
tgsi_texture_type_from_sampler_dim(glsl_get_sampler_dim(itype),
|
||||
glsl_sampler_type_is_array(itype), false);
|
||||
|
||||
c->images[var->data.binding] = ureg_DECL_image(c->ureg,
|
||||
var->data.binding,
|
||||
tex_type,
|
||||
var->data.image.format,
|
||||
!(var->data.access & ACCESS_NON_WRITEABLE),
|
||||
false);
|
||||
for (int i = 0; i < image_count; i++) {
|
||||
c->images[var->data.binding] = ureg_DECL_image(c->ureg,
|
||||
var->data.binding + i,
|
||||
tex_type,
|
||||
var->data.image.format,
|
||||
!(var->data.access & ACCESS_NON_WRITEABLE),
|
||||
false);
|
||||
}
|
||||
} else if (glsl_contains_atomic(var->type)) {
|
||||
uint32_t offset = var->data.offset / 4;
|
||||
uint32_t size = glsl_atomic_size(var->type) / 4;
|
||||
|
||||
Reference in New Issue
Block a user