diff options
author | Jason Ekstrand <[email protected]> | 2018-08-14 14:03:05 -0500 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-08-29 14:04:02 -0500 |
commit | 15d39f474b89093507a80813d149c40461b8f355 (patch) | |
tree | 0898b5f25a31037c16983d8f09e30ce425ef98d2 /src/compiler/glsl | |
parent | 7cdf8f9339017ea5ee3c7f3a585c6bd5a815b99b (diff) |
nir: Make image load/store intrinsics variable-width
Instead of requiring 4 components, this allows them to potentially use
fewer. Both the SPIR-V and GLSL paths still generate vec4 intrinsics so
drivers which assume 4 components should be safe. However, we want to
be able to shrink them for i965.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/glsl_to_nir.cpp | 9 |
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 efbb2317ac6..22419abc571 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -904,12 +904,17 @@ nir_visitor::visit(ir_call *ir) /* Set the intrinsic destination. */ if (ir->return_deref) { unsigned num_components = ir->return_deref->type->vector_elements; - if (instr->intrinsic == nir_intrinsic_image_deref_size) - instr->num_components = num_components; nir_ssa_dest_init(&instr->instr, &instr->dest, num_components, 32, NULL); } + if (op == nir_intrinsic_image_deref_size) { + instr->num_components = instr->dest.ssa.num_components; + } else if (op == nir_intrinsic_image_deref_load || + op == nir_intrinsic_image_deref_store) { + instr->num_components = 4; + } + if (op == nir_intrinsic_image_deref_size || op == nir_intrinsic_image_deref_samples) { nir_builder_instr_insert(&b, &instr->instr); |