mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 12:20:10 +01:00
r600: fix cayman address bound tests
This change updates r600_legalize_image_load_store()
to fix these issues.
This change fixes on cayman the tests below which were failing:
spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/.*: fail pass
Fixes: 27f5157777 ("r600/sfn: Add lowering pass to legalize image access")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
This commit is contained in:
parent
188193cbf2
commit
37cd2b2c41
1 changed files with 26 additions and 5 deletions
|
|
@ -22,15 +22,36 @@ r600_legalize_image_load_store_impl(nir_builder *b,
|
|||
b->cursor = nir_before_instr(instr);
|
||||
auto ir = nir_instr_as_intrinsic(instr);
|
||||
|
||||
nir_def *default_value = nir_imm_vec4(b, 0.0, 0.0, 0.0, 0.0);
|
||||
nir_def *default_value, *zero_value;
|
||||
|
||||
nir_def *result = NIR_LOWER_INSTR_PROGRESS_REPLACE;
|
||||
|
||||
bool load_value = ir->intrinsic != nir_intrinsic_image_store;
|
||||
|
||||
if (load_value)
|
||||
default_value =
|
||||
nir_imm_zero(b, ir->def.num_components, ir->def.bit_size);
|
||||
if (load_value) {
|
||||
const enum pipe_format format = nir_intrinsic_format(ir);
|
||||
|
||||
zero_value = nir_imm_zero(b, ir->def.num_components, ir->def.bit_size);
|
||||
|
||||
if (ir->def.num_components == 4 && !util_format_has_alpha(format)) {
|
||||
const nir_alu_type type =
|
||||
nir_alu_type_get_base_type(nir_intrinsic_dest_type(ir));
|
||||
|
||||
switch (type) {
|
||||
case nir_type_int:
|
||||
case nir_type_uint:
|
||||
default_value = nir_imm_ivec4_intN(b, 0, 0, 0, 1, ir->def.bit_size);
|
||||
break;
|
||||
case nir_type_float:
|
||||
default:
|
||||
default_value = nir_imm_vec4(b, 0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
} else {
|
||||
default_value = zero_value;
|
||||
}
|
||||
} else {
|
||||
default_value = zero_value = nir_imm_vec4(b, 0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
auto image_exists =
|
||||
nir_ult_imm(b, ir->src[0].ssa, b->shader->info.num_images);
|
||||
|
|
@ -140,7 +161,7 @@ r600_legalize_image_load_store_impl(nir_builder *b,
|
|||
nir_pop_if(b, else_exists);
|
||||
|
||||
if (load_value)
|
||||
result = nir_if_phi(b, result, default_value);
|
||||
result = nir_if_phi(b, result, zero_value);
|
||||
|
||||
{
|
||||
nir_cf_list cf_list;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue