[Mesa-dev] [PATCH 10/16] i965/gen7.5: Update surface state entries in update_texture_surfaces
Abdiel Janulgue
abdiel.janulgue at linux.intel.com
Tue Oct 8 14:41:47 PDT 2013
Update the on-chip binding table for every generated texture surface_state
entries. Instead of generating binding tables manually, we update individual
slots of surface state entries using the new EDIT commands for gen7.5
Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 46 +++++++++++++++-------
1 file changed, 31 insertions(+), 15 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 6e91857..d82a7cf 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -715,8 +715,10 @@ const struct brw_tracked_state gen6_renderbuffer_surfaces = {
static void
update_stage_texture_surfaces(struct brw_context *brw,
const struct gl_program *prog,
- uint32_t *surf_offset,
- bool for_gather)
+ uint32_t *surf_base,
+ int base_index,
+ bool for_gather,
+ enum stage_shader_edit_type stage)
{
if (!prog)
return;
@@ -725,6 +727,7 @@ update_stage_texture_surfaces(struct brw_context *brw,
unsigned num_samplers = _mesa_fls(prog->SamplersUsed);
+ uint32_t* surf_offset = surf_base + base_index;
for (unsigned s = 0; s < num_samplers; s++) {
surf_offset[s] = 0;
@@ -733,7 +736,14 @@ update_stage_texture_surfaces(struct brw_context *brw,
/* _NEW_TEXTURE */
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
- brw->vtbl.update_texture_surface(ctx, unit, surf_offset + s, for_gather);
+ uint32_t *surf_entry = surf_offset + s;
+ brw->vtbl.update_texture_surface(ctx, unit, surf_entry, for_gather);
+
+ if (brw->has_resource_streamer) {
+ gen7_update_binding_table(brw, stage,
+ base_index + s,
+ *surf_entry);
+ }
}
}
}
@@ -757,36 +767,42 @@ brw_update_texture_surfaces(struct brw_context *brw)
/* _NEW_TEXTURE */
update_stage_texture_surfaces(brw, vs,
- brw->vs.base.surf_offset +
+ brw->vs.base.surf_offset,
SURF_INDEX_VEC4_TEXTURE(0),
- false);
+ false,
+ STAGE_VERTEX_SHADER);
update_stage_texture_surfaces(brw, gs,
- brw->gs.base.surf_offset +
+ brw->gs.base.surf_offset,
SURF_INDEX_VEC4_TEXTURE(0),
- false);
+ false,
+ STAGE_GEOMETRY_SHADER);
update_stage_texture_surfaces(brw, fs,
- brw->wm.base.surf_offset +
+ brw->wm.base.surf_offset,
SURF_INDEX_TEXTURE(0),
- false);
+ false,
+ STAGE_FRAGMENT_SHADER);
/* emit alternate set of surface state for gather. this
* allows the surface format to be overriden for only the
* gather4 messages. */
if (vs && vs->UsesGather)
update_stage_texture_surfaces(brw, vs,
- brw->vs.base.surf_offset +
+ brw->vs.base.surf_offset,
SURF_INDEX_VEC4_GATHER_TEXTURE(0),
- true);
+ true,
+ STAGE_VERTEX_SHADER);
if (gs && gs->UsesGather)
update_stage_texture_surfaces(brw, gs,
- brw->gs.base.surf_offset +
+ brw->gs.base.surf_offset,
SURF_INDEX_VEC4_GATHER_TEXTURE(0),
- true);
+ true,
+ STAGE_GEOMETRY_SHADER);
if (fs && fs->UsesGather)
update_stage_texture_surfaces(brw, fs,
- brw->wm.base.surf_offset +
+ brw->wm.base.surf_offset,
SURF_INDEX_GATHER_TEXTURE(0),
- true);
+ true,
+ STAGE_FRAGMENT_SHADER);
brw->state.dirty.brw |= BRW_NEW_SURFACES;
}
--
1.7.9.5
More information about the mesa-dev
mailing list