aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-11-21 14:30:55 -0800
committerEric Anholt <[email protected]>2012-12-28 10:53:50 -0800
commit7e28d6c1ab101894c3a3c90bef929c34e9da6148 (patch)
treeed6f943471ca58c0363df4e08d0b0b0c319dcf55 /src/mesa/drivers/dri/i965
parentaa6e35e80dddfe1011e845da6325d276263e2242 (diff)
i965: Consistently use nr_pull_params instead of NumParameters.
NumParameters used to be an upper bound on the number of vec4s to be uploaded, which was basically safe (unless your buffer was bound near the top of address space *and* you array indexed outside the buffer, in which case I think you might GPU hang). As I migrate the driver away from ParameterValues[], this is no longer true. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_surface_state.c5
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c2
2 files changed, 3 insertions, 4 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 3985b4811fa..4da7eaa51b9 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -48,7 +48,6 @@ brw_upload_vs_pull_constants(struct brw_context *brw)
/* BRW_NEW_VERTEX_PROGRAM */
struct brw_vertex_program *vp =
(struct brw_vertex_program *) brw->vertex_program;
- const struct gl_program_parameter_list *params = vp->program.Base.Parameters;
int i;
/* Updates the ParamaterValues[i] pointers for all parameters of the
@@ -81,7 +80,7 @@ brw_upload_vs_pull_constants(struct brw_context *brw)
}
if (0) {
- for (i = 0; i < params->NumParameters; i++) {
+ for (i = 0; i < ALIGN(brw->vs.prog_data->nr_pull_params, 4) / 4; i++) {
float *row = (float *)brw->vs.const_bo->virtual + i * 4;
printf("vs const surface %3d: %4.3f %4.3f %4.3f %4.3f\n",
i, row[0], row[1], row[2], row[3]);
@@ -92,7 +91,7 @@ brw_upload_vs_pull_constants(struct brw_context *brw)
const int surf = SURF_INDEX_VERT_CONST_BUFFER;
intel->vtbl.create_constant_surface(brw, brw->vs.const_bo, 0,
- params->NumParameters,
+ ALIGN(brw->vs.prog_data->nr_pull_params, 4) / 4,
&brw->vs.surf_offset[surf]);
brw->state.dirty.brw |= BRW_NEW_VS_CONSTBUF;
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 94c01cb3a9d..a2a875fa8b8 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1026,7 +1026,7 @@ brw_upload_wm_pull_constants(struct brw_context *brw)
drm_intel_gem_bo_unmap_gtt(brw->wm.const_bo);
intel->vtbl.create_constant_surface(brw, brw->wm.const_bo, 0,
- params->NumParameters,
+ ALIGN(brw->wm.prog_data->nr_pull_params, 4) / 4,
&brw->wm.surf_offset[surf_index]);
brw->state.dirty.brw |= BRW_NEW_SURFACES;