From: Alyssa Rosenzweig Date: Tue, 4 Feb 2020 14:46:17 +0000 (-0500) Subject: pan/midgard: Implement nir_intrinsic_get_buffer_size X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fcbb3d422e40ab0759c550fb044605364c518e51;p=mesa.git pan/midgard: Implement nir_intrinsic_get_buffer_size We route it as a sysval. Fixes dEQP-GLES31.functional.compute.basic.ssbo_unsized_arr_single_invocation Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index 0b9528a5201..994ebd3ed4a 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -675,9 +675,6 @@ bool mir_is_live_after(compiler_context *ctx, midgard_block *block, midgard_inst void mir_create_pipeline_registers(compiler_context *ctx); void midgard_promote_uniforms(compiler_context *ctx); -void -emit_sysval_read(compiler_context *ctx, nir_instr *instr, signed dest_override, unsigned nr_components); - void midgard_emit_derivatives(compiler_context *ctx, nir_alu_instr *instr); diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 8f1911d22ef..2bab55a9441 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -328,6 +328,7 @@ midgard_nir_sysval_for_intrinsic(nir_intrinsic_instr *instr) case nir_intrinsic_load_num_work_groups: return PAN_SYSVAL_NUM_WORK_GROUPS; case nir_intrinsic_load_ssbo_address: + case nir_intrinsic_get_buffer_size: return midgard_sysval_for_ssbo(instr); case nir_intrinsic_load_sampler_lod_parameters_pan: return midgard_sysval_for_sampler(instr); @@ -1376,9 +1377,9 @@ emit_attr_read( emit_mir_instruction(ctx, ins); } -void +static void emit_sysval_read(compiler_context *ctx, nir_instr *instr, signed dest_override, - unsigned nr_components) + unsigned nr_components, unsigned offset) { unsigned dest = 0; @@ -1394,7 +1395,7 @@ emit_sysval_read(compiler_context *ctx, nir_instr *instr, signed dest_override, /* Emit the read itself -- this is never indirect */ midgard_instruction *ins = - emit_ubo_read(ctx, instr, dest, uniform * 16, NULL, 0, 0); + emit_ubo_read(ctx, instr, dest, (uniform * 16) + offset, NULL, 0, 0); ins->mask = mask_of(nr_components); } @@ -1774,14 +1775,18 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr) break; case nir_intrinsic_load_ssbo_address: - emit_sysval_read(ctx, &instr->instr, ~0, 1); + emit_sysval_read(ctx, &instr->instr, ~0, 1, 0); + break; + + case nir_intrinsic_get_buffer_size: + emit_sysval_read(ctx, &instr->instr, ~0, 1, 8); break; case nir_intrinsic_load_viewport_scale: case nir_intrinsic_load_viewport_offset: case nir_intrinsic_load_num_work_groups: case nir_intrinsic_load_sampler_lod_parameters_pan: - emit_sysval_read(ctx, &instr->instr, ~0, 3); + emit_sysval_read(ctx, &instr->instr, ~0, 3, 0); break; case nir_intrinsic_load_work_group_id: @@ -2086,7 +2091,7 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr) emit_texop_native(ctx, instr, TEXTURE_OP_TEXEL_FETCH); break; case nir_texop_txs: - emit_sysval_read(ctx, &instr->instr, ~0, 4); + emit_sysval_read(ctx, &instr->instr, ~0, 4, 0); break; default: { printf ("Unhandled texture op: %d\n", instr->op);