nir: Set IMAGE_DIM and IMAGE_ARRAY on deref intrinsics
The rules here are the same as for texture instructions. The bits on the intrinsic are the ground truth and are allowed to vary from the deref a bit as-needed. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11849>
This commit is contained in:

committed by
Marge Bot

parent
ea7fcd5a97
commit
c0afb60258
@@ -1314,6 +1314,9 @@ nir_visitor::visit(ir_call *ir)
|
||||
|
||||
instr->src[0] = nir_src_for_ssa(&deref->dest.ssa);
|
||||
param = param->get_next();
|
||||
nir_intrinsic_set_image_dim(instr,
|
||||
(glsl_sampler_dim)type->sampler_dimensionality);
|
||||
nir_intrinsic_set_image_array(instr, type->sampler_array);
|
||||
|
||||
/* Set the intrinsic destination. */
|
||||
if (ir->return_deref) {
|
||||
|
@@ -2420,8 +2420,6 @@ nir_rewrite_image_intrinsic(nir_intrinsic_instr *intrin, nir_ssa_def *src,
|
||||
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
||||
nir_variable *var = nir_deref_instr_get_variable(deref);
|
||||
|
||||
nir_intrinsic_set_image_dim(intrin, glsl_get_sampler_dim(deref->type));
|
||||
nir_intrinsic_set_image_array(intrin, glsl_sampler_type_is_array(deref->type));
|
||||
nir_intrinsic_set_access(intrin, access | var->data.access);
|
||||
nir_intrinsic_set_format(intrin, var->data.image.format);
|
||||
if (nir_intrinsic_has_src_type(intrin))
|
||||
|
@@ -562,7 +562,7 @@ atomic3("atomic_counter_comp_swap")
|
||||
# the ARB_shader_image_load_store specification.
|
||||
def image(name, src_comp=[], extra_indices=[], **kwargs):
|
||||
intrinsic("image_deref_" + name, src_comp=[1] + src_comp,
|
||||
indices=[ACCESS] + extra_indices, **kwargs)
|
||||
indices=[IMAGE_DIM, IMAGE_ARRAY, ACCESS] + extra_indices, **kwargs)
|
||||
intrinsic("image_" + name, src_comp=[1] + src_comp,
|
||||
indices=[IMAGE_DIM, IMAGE_ARRAY, FORMAT, ACCESS] + extra_indices, **kwargs)
|
||||
intrinsic("bindless_image_" + name, src_comp=[1] + src_comp,
|
||||
|
@@ -3341,6 +3341,9 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
|
||||
nir_intrinsic_instr *intrin = nir_intrinsic_instr_create(b->shader, op);
|
||||
|
||||
intrin->src[0] = nir_src_for_ssa(&image.image->dest.ssa);
|
||||
nir_intrinsic_set_image_dim(intrin, glsl_get_sampler_dim(image.image->type));
|
||||
nir_intrinsic_set_image_array(intrin,
|
||||
glsl_sampler_type_is_array(image.image->type));
|
||||
|
||||
switch (opcode) {
|
||||
case SpvOpImageQuerySamples:
|
||||
|
Reference in New Issue
Block a user