summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_emit.cpp23
3 files changed, 27 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 909e0555ea1..9178485cb5f 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -306,6 +306,8 @@ struct brw_wm_prog_data {
GLuint reg_blocks_16;
GLuint total_scratch;
+ unsigned binding_table_size;
+
GLuint nr_params; /**< number of float params/constants */
GLuint nr_pull_params;
bool dual_src_blend;
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 7feb2b680be..9d240b588ef 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -569,6 +569,8 @@ private:
struct brw_reg offset,
struct brw_reg value);
+ void mark_surface_used(unsigned surf_index);
+
void patch_discard_jumps_to_fb_writes();
struct brw_context *brw;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
index b90cf0fb908..bfb3d331b0a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
@@ -59,6 +59,15 @@ fs_generator::~fs_generator()
}
void
+fs_generator::mark_surface_used(unsigned surf_index)
+{
+ assert(surf_index < BRW_MAX_WM_SURFACES);
+
+ c->prog_data.binding_table_size =
+ MAX2(c->prog_data.binding_table_size, surf_index + 1);
+}
+
+void
fs_generator::patch_discard_jumps_to_fb_writes()
{
if (brw->gen < 6 || this->discard_halt_patches.is_empty())
@@ -175,6 +184,8 @@ fs_generator::generate_fb_write(fs_inst *inst)
0,
eot,
inst->header_present);
+
+ mark_surface_used(SURF_INDEX_DRAW(inst->target));
}
/* Computes the integer pixel x,y values from the origin.
@@ -519,6 +530,8 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src
inst->header_present,
simd_mode,
return_format);
+
+ mark_surface_used(SURF_INDEX_TEXTURE(inst->sampler));
}
@@ -648,6 +661,8 @@ fs_generator::generate_uniform_pull_constant_load(fs_inst *inst,
brw_oword_block_read(p, dst, brw_message_reg(inst->base_mrf),
read_offset, surf_index);
+
+ mark_surface_used(surf_index);
}
void
@@ -688,6 +703,8 @@ fs_generator::generate_uniform_pull_constant_load_gen7(fs_inst *inst,
false, /* no header */
BRW_SAMPLER_SIMD_MODE_SIMD4X2,
0);
+
+ mark_surface_used(surf_index);
}
void
@@ -753,6 +770,8 @@ fs_generator::generate_varying_pull_constant_load(fs_inst *inst,
inst->header_present,
simd_mode,
return_format);
+
+ mark_surface_used(surf_index);
}
void
@@ -795,6 +814,8 @@ fs_generator::generate_varying_pull_constant_load_gen7(fs_inst *inst,
false, /* no header */
simd_mode,
0);
+
+ mark_surface_used(surf_index);
}
/**
@@ -1040,6 +1061,8 @@ fs_generator::generate_shader_time_add(fs_inst *inst,
brw_MOV(p, payload_value, value);
brw_shader_time_add(p, payload, SURF_INDEX_WM_SHADER_TIME);
brw_pop_insn_state(p);
+
+ mark_surface_used(SURF_INDEX_WM_SHADER_TIME);
}
void