[Mesa-dev] [PATCH 08/21] intel/fs: Mark texture surfaces used in brw_fs_nir
Jason Ekstrand
jason at jlekstrand.net
Sat Nov 17 02:47:36 UTC 2018
Previously, we were marking constant surface used in the generator and
non-constant ones in brw_fs_nir. We should pick one and go with it.
---
src/intel/compiler/brw_fs_generator.cpp | 2 --
src/intel/compiler/brw_fs_nir.cpp | 16 ++++++++--------
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/intel/compiler/brw_fs_generator.cpp b/src/intel/compiler/brw_fs_generator.cpp
index 1a6e57ae1a7..d729cd065a1 100644
--- a/src/intel/compiler/brw_fs_generator.cpp
+++ b/src/intel/compiler/brw_fs_generator.cpp
@@ -1185,8 +1185,6 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src
inst->header_size != 0,
simd_mode,
return_format);
-
- brw_mark_surface_used(prog_data, surface + base_binding_table_index);
} else {
/* Non-const sampler index */
diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp
index 84d0c6be6c3..81e16cb9f63 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -4728,6 +4728,7 @@ void
fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)
{
unsigned texture = instr->texture_index;
+ unsigned max_texture = texture;
unsigned sampler = instr->sampler_index;
fs_reg srcs[TEX_LOGICAL_NUM_SRCS];
@@ -4814,14 +4815,7 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)
case nir_tex_src_texture_offset: {
/* Figure out the highest possible texture index and mark it as used */
- uint32_t max_used = texture + instr->texture_array_size - 1;
- if (instr->op == nir_texop_tg4 && devinfo->gen < 8) {
- max_used += stage_prog_data->binding_table.gather_texture_start;
- } else {
- max_used += stage_prog_data->binding_table.texture_start;
- }
- brw_mark_surface_used(prog_data, max_used);
-
+ max_texture = texture + instr->texture_array_size - 1;
/* Emit code to evaluate the actual indexing expression */
fs_reg tmp = vgrf(glsl_type::uint_type);
bld.ADD(tmp, src, brw_imm_ud(texture));
@@ -4850,6 +4844,7 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)
stage_prog_data->binding_table.texture_start;
srcs[TEX_LOGICAL_SRC_SURFACE] = brw_imm_ud(texture_index);
+ max_texture = texture_index;
break;
}
@@ -4858,6 +4853,11 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)
}
}
+ unsigned bt_start = instr->op == nir_texop_tg4 && devinfo->gen < 8 ?
+ stage_prog_data->binding_table.gather_texture_start :
+ stage_prog_data->binding_table.texture_start;
+ brw_mark_surface_used(prog_data, bt_start + max_texture);
+
if (srcs[TEX_LOGICAL_SRC_MCS].file == BAD_FILE &&
(instr->op == nir_texop_txf_ms ||
instr->op == nir_texop_samples_identical)) {
--
2.19.1
More information about the mesa-dev
mailing list