From 6105d1d0a02c7eea83b327965713be3bada306f7 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Fri, 30 Oct 2015 10:24:12 +0100 Subject: [PATCH] i965/vec4: Do not mark used direct surfaces in VS_OPCODE_PULL_CONSTANT_LOAD Right now the generator marks direct surfaces as used but leaves marking of indirect surfaces to the caller. Just make the callers handle marking in both cases for consistency. v2: Use const, do not add unnecessary temporary (Curro) Reviewed-by: Francisco Jerez --- src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 9 --------- src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 6 ++++-- src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 6 ++++-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp index f0ad903c572..d9252ef4c89 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp @@ -929,8 +929,6 @@ generate_pull_constant_load(struct brw_codegen *p, 2, /* mlen */ true, /* header_present */ 1 /* rlen */); - - brw_mark_surface_used(&prog_data->base, surf_index); } static void @@ -985,9 +983,6 @@ generate_pull_constant_load_gen7(struct brw_codegen *p, inst->header_size != 0, BRW_SAMPLER_SIMD_MODE_SIMD4X2, 0); - - brw_mark_surface_used(&prog_data->base, surf_index.dw1.ud); - } else { struct brw_reg addr = vec1(retype(brw_address_reg(0), BRW_REGISTER_TYPE_UD)); @@ -1017,10 +1012,6 @@ generate_pull_constant_load_gen7(struct brw_codegen *p, inst->header_size != 0, BRW_SAMPLER_SIMD_MODE_SIMD4X2, 0); - - /* visitor knows more than we do about the surface limit required, - * so has already done marking. - */ } } diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp index b848810ebc7..e6c018e52ae 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp @@ -749,8 +749,10 @@ vec4_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr) /* The block index is a constant, so just emit the binding table entry * as an immediate. */ - surf_index = src_reg(prog_data->base.binding_table.ubo_start + - const_block_index->u[0]); + const unsigned index = prog_data->base.binding_table.ubo_start + + const_block_index->u[0]; + surf_index = src_reg(index); + brw_mark_surface_used(&prog_data->base, index); } else { /* The block index is not a constant. Evaluate the index expression * per-channel and add the base UBO index; we have to select a value diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index 7d949896bcc..94759afd166 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -1745,14 +1745,16 @@ vec4_visitor::emit_pull_constant_load(bblock_t *block, vec4_instruction *inst, int base_offset) { int reg_offset = base_offset + orig_src.reg_offset; - src_reg index = src_reg(prog_data->base.binding_table.pull_constants_start); + const unsigned index = prog_data->base.binding_table.pull_constants_start; src_reg offset = get_pull_constant_offset(block, inst, orig_src.reladdr, reg_offset); emit_pull_constant_load_reg(temp, - index, + src_reg(index), offset, block, inst); + + brw_mark_surface_used(&prog_data->base, index); } /** -- 2.30.2