summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-01-23 16:00:29 -0800
committerEric Anholt <[email protected]>2013-02-11 13:14:51 -0800
commite07457d0aec96970a39a2dd1cb4e46da6107eb77 (patch)
tree26f64172b82ef4dfbb32a6a75844ad72bba19260 /src/mesa/drivers
parent11766b1bbb730d2f22a23d8293c67b138b364fce (diff)
i965: Simplify VS push constant upload code since removal of old path.
We used to have clip planes optionally included in the push constants, resulting in a variable amount of data uploaded, but no more. This also means less wasted space in the batch for our push constants. v2: Update _NEW_TRANSFORM state bit information. Reviewed-by: Kenneth Graunke <[email protected]> (v1)
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/gen6_vs_state.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c
index d293482ed8e..fb05354ddd1 100644
--- a/src/mesa/drivers/dri/i965/gen6_vs_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c
@@ -41,7 +41,6 @@ gen6_upload_vs_push_constants(struct brw_context *brw)
/* _BRW_NEW_VERTEX_PROGRAM */
const struct brw_vertex_program *vp =
brw_vertex_program_const(brw->vertex_program);
- unsigned int nr_params = brw->vs.prog_data->nr_params / 4;
/* Updates the ParamaterValues[i] pointers for all parameters of the
* basic type of PROGRAM_STATE_VAR.
@@ -49,23 +48,28 @@ gen6_upload_vs_push_constants(struct brw_context *brw)
/* XXX: Should this happen somewhere before to get our state flag set? */
_mesa_load_state_parameters(ctx, vp->program.Base.Parameters);
- /* CACHE_NEW_VS_PROG | _NEW_TRANSFORM */
- if (brw->vs.prog_data->nr_params == 0 && !ctx->Transform.ClipPlanesEnabled) {
+ /* CACHE_NEW_VS_PROG */
+ if (brw->vs.prog_data->nr_params == 0) {
brw->vs.push_const_size = 0;
} else {
- int params_uploaded = 0;
+ int params_uploaded;
float *param;
int i;
param = brw_state_batch(brw, AUB_TRACE_VS_CONSTANTS,
- (MAX_CLIP_PLANES + nr_params) *
- 4 * sizeof(float),
+ brw->vs.prog_data->nr_params * sizeof(float),
32, &brw->vs.push_const_offset);
+ /* _NEW_PROGRAM_CONSTANTS
+ *
+ * Also _NEW_TRANSFORM -- we may reference clip planes other than as a
+ * side effect of dereferencing uniforms, so _NEW_PROGRAM_CONSTANTS
+ * wouldn't be set for them.
+ */
for (i = 0; i < brw->vs.prog_data->nr_params; i++) {
param[i] = *brw->vs.prog_data->param[i];
}
- params_uploaded += brw->vs.prog_data->nr_params / 4;
+ params_uploaded = brw->vs.prog_data->nr_params / 4;
if (0) {
printf("VS constant buffer:\n");