aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50/nv50_state_validate.c
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2009-07-29 01:21:41 +0200
committerBen Skeggs <[email protected]>2009-07-29 09:40:34 +1000
commitd1b9183e64e819d389688074c3db338bd0d2d80e (patch)
treef69443f0a9e93d65c9af8416a952081d1c5159f1 /src/gallium/drivers/nv50/nv50_state_validate.c
parentb0341f994feb3ea724bdbbfde5d79ec2c88c34a1 (diff)
nv50: fix viewport transform
The translation also needs to be inverted, and in bypass mode the state tracker incorrectly assumes that Y = 0 = TOP, so we need inversion there to; NDC clipping has to be deactivated explicitly.
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_state_validate.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index 03aed81fed7..ce8e44fb006 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -258,6 +258,7 @@ scissor_uptodate:
if (nv50->dirty & (NV50_NEW_VIEWPORT | NV50_NEW_RASTERIZER)) {
unsigned bypass;
+ float y_translate = (float)nv50->framebuffer.height;
if (!nv50->rasterizer->pipe.bypass_vs_clip_and_viewport)
bypass = 0;
@@ -271,25 +272,33 @@ scissor_uptodate:
nv50->state.viewport_bypass = bypass;
so = so_new(12, 0);
+ so_method(so, tesla, NV50TCL_VIEW_VOLUME_CLIP_CTRL, 1);
if (!bypass) {
- so_method(so, tesla, NV50TCL_VIEWPORT_UNK1(0), 3);
+ so_data(so, 0x0000);
+ y_translate -= nv50->viewport.translate[1];
+ so_method(so, tesla, NV50TCL_VIEWPORT_TRANSLATE(0), 3);
so_data (so, fui(nv50->viewport.translate[0]));
- so_data (so, fui(nv50->viewport.translate[1]));
+ so_data (so, fui(y_translate));
so_data (so, fui(nv50->viewport.translate[2]));
- so_method(so, tesla, NV50TCL_VIEWPORT_UNK0(0), 3);
+ so_method(so, tesla, NV50TCL_VIEWPORT_SCALE(0), 3);
so_data (so, fui(nv50->viewport.scale[0]));
so_data (so, fui(-nv50->viewport.scale[1]));
so_data (so, fui(nv50->viewport.scale[2]));
- so_method(so, tesla, 0x192c, 1);
- so_data (so, 1);
- so_method(so, tesla, 0x0f90, 1);
- so_data (so, 0);
} else {
- so_method(so, tesla, 0x192c, 1);
- so_data (so, 0);
- so_method(so, tesla, 0x0f90, 1);
- so_data (so, 1);
+ /* don't do xy-clipping in NDC space */
+ so_data(so, 0x0800);
+ /* in bypass mode, y = 0 would be bottom */
+ so_method(so, tesla, NV50TCL_VIEWPORT_TRANSLATE(0), 3);
+ so_data (so, fui(0.0f));
+ so_data (so, fui(y_translate));
+ so_data (so, fui(0.0f));
+ so_method(so, tesla, NV50TCL_VIEWPORT_SCALE(0), 3);
+ so_data (so, fui(1.0f));
+ so_data (so, fui(-1.0f));
+ so_data (so, fui(1.0f));
}
+ so_method(so, tesla, NV50TCL_VIEWPORT_TRANSFORM_EN, 1);
+ so_data (so, 1);
so_ref(so, &nv50->state.viewport);
so_ref(NULL, &so);