summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2011-11-01 16:19:39 -0700
committerKenneth Graunke <kenneth@whitecape.org>2011-11-10 22:51:19 -0800
commita7d0fa209b444e3c7ad9358f1d31e3f638c20e40 (patch)
tree851d5584eb04b88ee3b9dbf469b2663301defd7a /src/mesa/drivers/dri/i965/brw_wm_surface_state.c
parentf3e9ccb3bcd174a0b55cae6f9c56835145558e89 (diff)
downloadexternal_mesa3d-a7d0fa209b444e3c7ad9358f1d31e3f638c20e40.zip
external_mesa3d-a7d0fa209b444e3c7ad9358f1d31e3f638c20e40.tar.gz
external_mesa3d-a7d0fa209b444e3c7ad9358f1d31e3f638c20e40.tar.bz2
i965: Combine the two WM pull constant tracked state atoms.
These were only split for historical reasons: brw_wm_constants used to be the "prepare" step, while brw_wm_constant_surface was "emit". Now that both happen at emit time, it makes sense to combine them. Call the newly combined state atom "brw_wm_pull_constants" to indicate help distinguish it from the Gen6+ atoms that handle push constants. Finally, remove the BRW_NEW_WM_CONSTBUF dirty bit entirely now that it's never flagged nor used. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Paul Berry <stereotype441@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_wm_surface_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c60
1 files changed, 12 insertions, 48 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 cca1d48..1bce06c 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -362,18 +362,21 @@ brw_upload_wm_pull_constants(struct brw_context *brw)
/* BRW_NEW_FRAGMENT_PROGRAM */
struct brw_fragment_program *fp =
(struct brw_fragment_program *) brw->fragment_program;
+ struct gl_program_parameter_list *params = fp->program.Base.Parameters;
const int size = brw->wm.prog_data->nr_pull_params * sizeof(float);
+ const int surf_index = SURF_INDEX_FRAG_CONST_BUFFER;
float *constants;
unsigned int i;
- _mesa_load_state_parameters(ctx, fp->program.Base.Parameters);
+ _mesa_load_state_parameters(ctx, params);
/* CACHE_NEW_WM_PROG */
if (brw->wm.prog_data->nr_pull_params == 0) {
if (brw->wm.const_bo) {
drm_intel_bo_unreference(brw->wm.const_bo);
brw->wm.const_bo = NULL;
- brw->state.dirty.brw |= BRW_NEW_WM_CONSTBUF;
+ brw->wm.surf_offset[surf_index] = 0;
+ brw->state.dirty.brw |= BRW_NEW_WM_SURFACES;
}
return;
}
@@ -391,61 +394,22 @@ brw_upload_wm_pull_constants(struct brw_context *brw)
}
drm_intel_gem_bo_unmap_gtt(brw->wm.const_bo);
- brw->state.dirty.brw |= BRW_NEW_WM_CONSTBUF;
+ intel->vtbl.create_constant_surface(brw, brw->wm.const_bo,
+ params->NumParameters,
+ &brw->wm.surf_offset[surf_index]);
+
+ brw->state.dirty.brw |= BRW_NEW_WM_SURFACES;
}
-const struct brw_tracked_state brw_wm_constants = {
+const struct brw_tracked_state brw_wm_pull_constants = {
.dirty = {
.mesa = (_NEW_PROGRAM_CONSTANTS),
- .brw = (BRW_NEW_FRAGMENT_PROGRAM),
+ .brw = (BRW_NEW_BATCH | BRW_NEW_FRAGMENT_PROGRAM),
.cache = CACHE_NEW_WM_PROG,
},
.emit = brw_upload_wm_pull_constants,
};
-/**
- * Updates surface / buffer for fragment shader constant buffer, if
- * one is required.
- *
- * This consumes the state updates for the constant buffer, and produces
- * BRW_NEW_WM_SURFACES to get picked up by brw_prepare_wm_surfaces for
- * inclusion in the binding table.
- */
-static void upload_wm_constant_surface(struct brw_context *brw )
-{
- GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER;
- struct brw_fragment_program *fp =
- (struct brw_fragment_program *) brw->fragment_program;
- const struct gl_program_parameter_list *params =
- fp->program.Base.Parameters;
-
- /* If there's no constant buffer, then no surface BO is needed to point at
- * it.
- */
- if (brw->wm.const_bo == 0) {
- if (brw->wm.surf_offset[surf]) {
- brw->state.dirty.brw |= BRW_NEW_WM_SURFACES;
- brw->wm.surf_offset[surf] = 0;
- }
- return;
- }
-
- brw->intel.vtbl.create_constant_surface(brw, brw->wm.const_bo,
- params->NumParameters,
- &brw->wm.surf_offset[surf]);
- brw->state.dirty.brw |= BRW_NEW_WM_SURFACES;
-}
-
-const struct brw_tracked_state brw_wm_constant_surface = {
- .dirty = {
- .mesa = 0,
- .brw = (BRW_NEW_WM_CONSTBUF |
- BRW_NEW_BATCH),
- .cache = 0
- },
- .emit = upload_wm_constant_surface,
-};
-
static void
brw_update_null_renderbuffer_surface(struct brw_context *brw, unsigned int unit)
{