summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2014-03-06 15:39:50 -0800
committerKenneth Graunke <kenneth@whitecape.org>2014-03-10 13:05:12 -0700
commitdb26253a482a721d8ae93cc306e3c6ce070c06cf (patch)
tree80ff4b56ef7b7ace06a8b62f07e4b03980c9fe3e /src
parent8c136b53b79e90b9e8f30f891b8bef112fee375d (diff)
downloadexternal_mesa3d-db26253a482a721d8ae93cc306e3c6ce070c06cf.zip
external_mesa3d-db26253a482a721d8ae93cc306e3c6ce070c06cf.tar.gz
external_mesa3d-db26253a482a721d8ae93cc306e3c6ce070c06cf.tar.bz2
i965: Reorganize the code in brw_upload_binding_tables.
This makes both the empty and non-empty binding table paths exit through the bottom of the function, which gives us a place to share code. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_binding_tables.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c b/src/mesa/drivers/dri/i965/brw_binding_tables.c
index b39bd10..0de5d1a 100644
--- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
+++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
@@ -58,27 +58,28 @@ brw_upload_binding_table(struct brw_context *brw,
/* CACHE_NEW_*_PROG */
struct brw_stage_prog_data *prog_data = stage_state->prog_data;
- /* If there are no surfaces, skip making the binding table altogether. */
if (prog_data->binding_table.size_bytes == 0) {
- if (stage_state->bind_bo_offset != 0) {
- brw->state.dirty.brw |= brw_new_binding_table;
- stage_state->bind_bo_offset = 0;
+ /* There are no surfaces; skip making the binding table altogether. */
+ if (stage_state->bind_bo_offset == 0)
+ return;
+
+ stage_state->bind_bo_offset = 0;
+ } else {
+ /* Upload a new binding table. */
+ if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
+ brw->vtbl.create_raw_surface(
+ brw, brw->shader_time.bo, 0, brw->shader_time.bo->size,
+ &stage_state->surf_offset[prog_data->binding_table.shader_time_start], true);
}
- return;
- }
- if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
- brw->vtbl.create_raw_surface(
- brw, brw->shader_time.bo, 0, brw->shader_time.bo->size,
- &stage_state->surf_offset[prog_data->binding_table.shader_time_start], true);
- }
+ uint32_t *bind = brw_state_batch(brw, AUB_TRACE_BINDING_TABLE,
+ prog_data->binding_table.size_bytes, 32,
+ &stage_state->bind_bo_offset);
- uint32_t *bind = brw_state_batch(brw, AUB_TRACE_BINDING_TABLE,
- prog_data->binding_table.size_bytes, 32,
- &stage_state->bind_bo_offset);
-
- /* BRW_NEW_SURFACES and BRW_NEW_*_CONSTBUF */
- memcpy(bind, stage_state->surf_offset, prog_data->binding_table.size_bytes);
+ /* BRW_NEW_SURFACES and BRW_NEW_*_CONSTBUF */
+ memcpy(bind, stage_state->surf_offset,
+ prog_data->binding_table.size_bytes);
+ }
brw->state.dirty.brw |= brw_new_binding_table;
}