summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2013-08-14 20:25:40 -0700
committerKenneth Graunke <kenneth@whitecape.org>2013-08-19 13:17:00 -0700
commit7e9559c9ba4dd82aca83b08d039103e38a3f94be (patch)
treebe8c9972a7c13d46d83699f236fe8d5dfac60320 /src/mesa/drivers/dri/i965/brw_vs_surface_state.c
parentc642bd3dcc1a6f1039732c614ab8a56dd3779427 (diff)
downloadexternal_mesa3d-7e9559c9ba4dd82aca83b08d039103e38a3f94be.zip
external_mesa3d-7e9559c9ba4dd82aca83b08d039103e38a3f94be.tar.gz
external_mesa3d-7e9559c9ba4dd82aca83b08d039103e38a3f94be.tar.bz2
i965/vs: Rework binding table size calculation.
Unlike the FS, the VS backend already computed the binding table size. However, it did so poorly: after compilation, it looked to see if any pull constants/textures/UBOs were in use, and set num_surfaces to the maximum surface index for that category. If the VS only used a single texture or UBO, this overcounted by quite a bit. The shader time surface was also noted at state upload time (during drawing), not at compile time, which is inefficient. I believe it also had an off by one error. This patch computes it accurately, while also simplifying the code. It also renames num_surfaces to binding_table_size, since num_surfaces wasn't actually the number of surfaces used. For example, a VS that used one UBO and no other surfaces would have set num_surfaces to SURF_INDEX_VS_UBO(1) == 18, rather than 1. A bit of a misnomer there. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Paul Berry <stereotype441@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vs_surface_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_surface_state.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index eaeff95..2c2d713 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -140,16 +140,12 @@ brw_vs_upload_binding_table(struct brw_context *brw)
if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
gen7_create_shader_time_surface(brw, &brw->vs.surf_offset[SURF_INDEX_VS_SHADER_TIME]);
-
- assert(brw->vs.prog_data->base.num_surfaces
- <= SURF_INDEX_VS_SHADER_TIME);
- brw->vs.prog_data->base.num_surfaces = SURF_INDEX_VS_SHADER_TIME;
}
/* CACHE_NEW_VS_PROG: Skip making a binding table if we don't use textures or
* pull constants.
*/
- if (brw->vs.prog_data->base.num_surfaces == 0) {
+ if (brw->vs.prog_data->base.binding_table_size == 0) {
if (brw->vs.bind_bo_offset != 0) {
brw->state.dirty.brw |= BRW_NEW_VS_BINDING_TABLE;
brw->vs.bind_bo_offset = 0;