summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQiang Yu <yuq825@gmail.com>2021-12-28 13:52:36 +0800
committerQiang Yu <yuq825@gmail.com>2022-01-18 16:10:35 +0800
commitf4a972b74837a9f7992b93a808115541bf20589b (patch)
treee8850c91ef482e3ab82fafc9587cfc51207bbe80
parentf62bbe44c973fad90544db22dc82c1a2a0d1df81 (diff)
glsl/nir: convert sparse ir_texture to nir
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362>
-rw-r--r--src/compiler/glsl/glsl_to_nir.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index b00887c8929..990b9803262 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -2411,7 +2411,12 @@ nir_visitor::visit(ir_texture *ir)
instr->is_shadow = ir->sampler->type->sampler_shadow;
if (instr->is_shadow)
instr->is_new_style_shadow = (ir->type->vector_elements == 1);
- instr->dest_type = nir_get_nir_type_for_glsl_type(ir->type);
+
+ const glsl_type *dest_type
+ = ir->is_sparse ? ir->type->field_type("texel") : ir->type;
+ assert(dest_type != glsl_type::error_type);
+ instr->dest_type = nir_get_nir_type_for_glsl_type(dest_type);
+ instr->is_sparse = ir->is_sparse;
nir_deref_instr *sampler_deref = evaluate_deref(ir->sampler);
@@ -2523,7 +2528,7 @@ nir_visitor::visit(ir_texture *ir)
assert(src_number == num_srcs);
- unsigned bit_size = glsl_get_bit_size(ir->type);
+ unsigned bit_size = glsl_get_bit_size(dest_type);
add_instr(&instr->instr, nir_tex_instr_dest_size(instr), bit_size);
}