diff --git a/src/asahi/lib/agx_nir_lower_texture.c b/src/asahi/lib/agx_nir_lower_texture.c index eb580a94b8c..5e2d11b3fc5 100644 --- a/src/asahi/lib/agx_nir_lower_texture.c +++ b/src/asahi/lib/agx_nir_lower_texture.c @@ -484,6 +484,7 @@ image_texel_address(nir_builder *b, nir_intrinsic_instr *intr, } else { return libagx_image_texel_address( b, meta_ptr, coord, nir_u2u32(b, intr->src[2].ssa), blocksize_B, + nir_imm_bool(b, dim == GLSL_SAMPLER_DIM_1D), nir_imm_bool(b, dim == GLSL_SAMPLER_DIM_MS), nir_imm_bool(b, layered), nir_imm_bool(b, return_index)); } diff --git a/src/asahi/lib/shaders/texture.cl b/src/asahi/lib/shaders/texture.cl index 6211c9ca075..135b570f9b4 100644 --- a/src/asahi/lib/shaders/texture.cl +++ b/src/asahi/lib/shaders/texture.cl @@ -137,19 +137,28 @@ calculate_twiddled_coordinates(ushort2 coord, uint16_t tile_w_px, uint64_t libagx_image_texel_address(constant const struct agx_atomic_software_packed *ptr, uint4 coord, uint sample_idx, - uint bytes_per_sample_B, bool is_msaa, + uint bytes_per_sample_B, bool is_1d, bool is_msaa, bool is_layered, bool return_index) { agx_unpack(NULL, ptr, ATOMIC_SOFTWARE, d); /* We do not allow atomics on linear 2D or linear 2D arrays, as there are no - * known use cases. So we're twiddled in this path. + * known use cases. So we're twiddled in this path, unless we're handling a + * 1D image which will be always linear, even if it uses a twiddled layout + * degrading to linear-equivalent 1x1 tiles. (1D uses this path, not the + * buffer path, for 1D arrays.) */ - uint total_px = calculate_twiddled_coordinates( - convert_ushort2(coord.xy), d.tile_width, d.tile_height, d.tiles_per_row); + uint total_px; + if (is_1d) { + total_px = coord.x; + } else { + total_px = + calculate_twiddled_coordinates(convert_ushort2(coord.xy), d.tile_width, + d.tile_height, d.tiles_per_row); + } if (is_layered) - total_px += coord.z * d.layer_stride_pixels; + total_px += coord[is_1d ? 1 : 2] * d.layer_stride_pixels; uint sample_count = is_msaa ? d.sample_count : 1; uint total_sa = (total_px * d.sample_count) + sample_idx;