summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/gen6_vs_state.c
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2011-09-23 21:33:50 -0700
committerPaul Berry <stereotype441@gmail.com>2011-09-28 11:38:03 -0700
commite7da40afe84349a640fe15e3af408a0dfe880e85 (patch)
tree9cf7f8a407bb4c4cb77f5c42fe58ad421d6dba06 /src/mesa/drivers/dri/i965/gen6_vs_state.c
parent7e2b23ba85a89282565d9375b0a885cc48e66c82 (diff)
downloadexternal_mesa3d-e7da40afe84349a640fe15e3af408a0dfe880e85.zip
external_mesa3d-e7da40afe84349a640fe15e3af408a0dfe880e85.tar.gz
external_mesa3d-e7da40afe84349a640fe15e3af408a0dfe880e85.tar.bz2
i965 new VS: don't share clip plane constants in pre-GEN6
In pre-GEN6, when using clip planes, both the vertex shader and the clipper need access to the client-supplied clip planes, since the vertex shader needs them to set the clip flags, and the clipper needs them to determine where to insert new vertices. With the old VS backend, we used a clever optimization to avoid placing duplicate copies of these planes in the CURBE: we used the same block of memory for both the clipper and vertex shader constants, with the clip planes at the front of it, and then we instructed the clipper to read just the initial part of this block containing the clip planes. This optimization was tricky, of dubious value, and not completely working in the new VS backend, so I've removed it. Now, when using the new VS backend, separate parts of the CURBE are used for the clipper and the vertex shader. Note that this doesn't affect the number of push constants available to the vertex shader, it simply causes the CURBE to occupy a few more bytes of URB memory. The old VS backend is unaffected. GEN6+, which does clipping entirely in hardware, is also unaffected. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen6_vs_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/gen6_vs_state.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c
index afb4ace..0f6f6a7 100644
--- a/src/mesa/drivers/dri/i965/gen6_vs_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c
@@ -66,24 +66,6 @@ gen6_prepare_vs_push_constants(struct brw_context *brw)
4 * sizeof(float),
32, &brw->vs.push_const_offset);
- /* This should be loaded like any other param, but it's ad-hoc
- * until we redo the VS backend.
- */
- if (!uses_clip_distance) {
- for (i = 0; i < MAX_CLIP_PLANES; i++) {
- if (ctx->Transform.ClipPlanesEnabled & (1 << i)) {
- memcpy(param, ctx->Transform._ClipUserPlane[i], 4 * sizeof(float));
- param += 4;
- params_uploaded++;
- }
- }
- }
- /* Align to a reg for convenience for brw_vs_emit.c */
- if (params_uploaded & 1) {
- param += 4;
- params_uploaded++;
- }
-
if (brw->vs.prog_data->uses_new_param_layout) {
for (i = 0; i < brw->vs.prog_data->nr_params; i++) {
*param = *brw->vs.prog_data->param[i];
@@ -91,6 +73,25 @@ gen6_prepare_vs_push_constants(struct brw_context *brw)
}
params_uploaded += brw->vs.prog_data->nr_params / 4;
} else {
+ /* This should be loaded like any other param, but it's ad-hoc
+ * until we redo the VS backend.
+ */
+ if (!uses_clip_distance) {
+ for (i = 0; i < MAX_CLIP_PLANES; i++) {
+ if (ctx->Transform.ClipPlanesEnabled & (1 << i)) {
+ memcpy(param, ctx->Transform._ClipUserPlane[i], 4 * sizeof(float));
+ param += 4;
+ params_uploaded++;
+ }
+ }
+ }
+
+ /* Align to a reg for convenience for brw_vs_emit.c */
+ if (params_uploaded & 1) {
+ param += 4;
+ params_uploaded++;
+ }
+
for (i = 0; i < vp->program.Base.Parameters->NumParameters; i++) {
if (brw->vs.constant_map[i] != -1) {
memcpy(param + brw->vs.constant_map[i] * 4,