freedreno: Fix constant-index assumptions in IBO loads.

The encoder already sets up our IBO accesses as potentially nonuniform, so
we just need to be careful to not try to force the IBO index into an
immediate.

Fixes assertion failures in piglit arb_shader_image_load_store-invalid
(intermittent due to
https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/597), which
had some interesting actual failures hidden behind it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13601>
This commit is contained in:
Emma Anholt 2021-10-29 13:41:16 -07:00 committed by Marge Bot
parent 9e04f97d8e
commit 549924d53e
4 changed files with 24 additions and 21 deletions

View File

@ -77,11 +77,6 @@ shaders@point-vertex-id gl_vertexid divisor,Crash
shaders@point-vertex-id gl_vertexid gl_instanceid,Crash
shaders@point-vertex-id gl_vertexid gl_instanceid divisor,Crash
# "nir_src_comp_as_uint: Assertion `nir_src_is_const(src)' failed." looking up image
spec@arb_arrays_of_arrays@execution@image_store@basic-imagestore-mixed-const-non-const-uniform-index2,Crash
spec@arb_arrays_of_arrays@execution@image_store@basic-imagestore-mixed-const-non-const-uniform-index,Crash
spec@arb_arrays_of_arrays@execution@image_store@basic-imagestore-non-const-uniform-index,Crash
spec@arb_compute_shader@execution@border-color,Fail
spec@arb_depth_buffer_float@fbo-clear-formats stencil,Fail
spec@arb_depth_buffer_float@fbo-clear-formats stencil@GL_DEPTH32F_STENCIL8,Fail
@ -145,9 +140,6 @@ spec@arb_sample_shading@samplemask 4,Fail
spec@arb_sample_shading@samplemask 4@noms mask_in_one,Fail
spec@arb_sample_shading@samplemask 4@sample mask_in_one,Fail
# "nir_src_comp_as_uint: Assertion `nir_src_is_const(src)' failed." looking up image
spec@arb_shader_image_load_store@indexing,Crash
spec@arb_shader_storage_buffer_object@array-ssbo-auto-binding,Fail
spec@arb_shader_storage_buffer_object@linker@instance-matching-shader-storage-blocks-member-array-size-mismatch,Fail
spec@arb_tessellation_shader@execution@gs-primitiveid-instanced,Fail

View File

@ -142,10 +142,6 @@ glx@glx-visuals-stencil
# [ 375.034086] adreno 5000000.gpu: [drm:a6xx_irq] *ERROR* gpu fault ring 0 fence aefe8 status 00E51005 rb 0602/06d2 ib1 000000010023D000/0000 ib2 0000000100246170/0000
glx@glx-tfp
# async shader compiler asserts in get_image_samp_tex_src()'s nir_src_comp_as_uint().
# https://gitlab.freedesktop.org/mesa/mesa/-/issues/4474
spec@arb_shader_image_load_store@invalid
# Flaky since around 2021-03-20. First appeared on the autotune branch.
spec@arb_draw_indirect@arb_draw_indirect-transform-feedback

View File

@ -1301,6 +1301,16 @@ emit_intrinsic_load_image(struct ir3_context *ctx, nir_intrinsic_instr *intr,
return;
}
/* The sparse set of texture descriptors for non-coherent load_images means we can't do indirection, so
* fall back to coherent load.
*/
if (ctx->compiler->gen >= 5 &&
!ir3_bindless_resource(intr->src[0]) &&
!nir_src_is_const(intr->src[0])) {
ctx->funcs->emit_intrinsic_load_image(ctx, intr, dst);
return;
}
struct ir3_block *b = ctx->block;
struct tex_src_info info = get_image_samp_tex_src(ctx, intr);
struct ir3_instruction *sam;

View File

@ -41,14 +41,9 @@ ir3_ibo_mapping_init(struct ir3_ibo_mapping *mapping, unsigned num_textures)
struct ir3_instruction *
ir3_ssbo_to_ibo(struct ir3_context *ctx, nir_src src)
{
if (ir3_bindless_resource(src)) {
if (ir3_bindless_resource(src))
ctx->so->bindless_ibo = true;
return ir3_get_src(ctx, &src)[0];
} else {
/* can this be non-const buffer_index? how do we handle that? */
int ssbo_idx = nir_src_as_uint(src);
return create_immed(ctx->block, ssbo_idx);
}
return ir3_get_src(ctx, &src)[0];
}
unsigned
@ -68,10 +63,20 @@ ir3_image_to_ibo(struct ir3_context *ctx, nir_src src)
if (ir3_bindless_resource(src)) {
ctx->so->bindless_ibo = true;
return ir3_get_src(ctx, &src)[0];
} else {
/* can this be non-const buffer_index? how do we handle that? */
}
if (nir_src_is_const(src)) {
int image_idx = nir_src_as_uint(src);
return create_immed(ctx->block, ctx->s->info.num_ssbos + image_idx);
} else {
struct ir3_instruction *image_idx = ir3_get_src(ctx, &src)[0];
if (ctx->s->info.num_ssbos) {
return ir3_ADD_U(ctx->block,
image_idx, 0,
create_immed(ctx->block, ctx->s->info.num_ssbos), 0);
} else {
return image_idx;
}
}
}