summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-06-21 22:51:36 -0400
committerIlia Mirkin <[email protected]>2016-07-01 00:02:23 -0400
commit71609c99548ab3724e604d59b771ef1c83eac4fe (patch)
treeced2891c5310c45930286cad2c087418c8023e0d
parentc823ff8dfbd22d6c50df8b6a7fd5abc299f90776 (diff)
nv30: fix viewport clipping settings to be based on viewport, not rt
This fixes a ton of "*clip*" dEQP GLES2 tests, as well as triangle-guardband-viewport in piglit. Signed-off-by: Ilia Mirkin <[email protected]>
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_draw.c13
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_state_validate.c15
2 files changed, 11 insertions, 17 deletions
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_draw.c b/src/gallium/drivers/nouveau/nv30/nv30_draw.c
index 7b0d0745766..041c73ca72a 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_draw.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_draw.c
@@ -342,19 +342,6 @@ nv30_render_validate(struct nv30_context *nv30)
for (; i < 16; i++)
r->vtxfmt[i] = NV30_3D_VTXFMT_TYPE_V32_FLOAT;
- BEGIN_NV04(push, NV30_3D(VIEWPORT_TRANSLATE_X), 8);
- PUSH_DATAf(push, 0.0);
- PUSH_DATAf(push, 0.0);
- PUSH_DATAf(push, 0.0);
- PUSH_DATAf(push, 0.0);
- PUSH_DATAf(push, 1.0);
- PUSH_DATAf(push, 1.0);
- PUSH_DATAf(push, 1.0);
- PUSH_DATAf(push, 1.0);
- BEGIN_NV04(push, NV30_3D(DEPTH_RANGE_NEAR), 2);
- PUSH_DATAf(push, 0.0);
- PUSH_DATAf(push, 1.0);
-
BEGIN_NV04(push, NV30_3D(VTXFMT(0)), 16);
PUSH_DATAp(push, r->vtxfmt, 16);
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c b/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c
index 8957634f0fa..6f54ca0fd70 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c
@@ -107,9 +107,6 @@ nv30_validate_fb(struct nv30_context *nv30)
PUSH_DATA (push, w << 16);
PUSH_DATA (push, h << 16);
PUSH_DATA (push, rt_format);
- BEGIN_NV04(push, NV30_3D(VIEWPORT_HORIZ), 2);
- PUSH_DATA (push, w << 16);
- PUSH_DATA (push, h << 16);
BEGIN_NV04(push, NV30_3D(VIEWPORT_TX_ORIGIN), 4);
PUSH_DATA (push, (y << 16) | x);
PUSH_DATA (push, 0);
@@ -250,6 +247,11 @@ nv30_validate_viewport(struct nv30_context *nv30)
struct nouveau_pushbuf *push = nv30->base.pushbuf;
struct pipe_viewport_state *vp = &nv30->viewport;
+ unsigned x = CLAMP(vp->translate[0] - fabsf(vp->scale[0]), 0, 4095);
+ unsigned y = CLAMP(vp->translate[1] - fabsf(vp->scale[1]), 0, 4095);
+ unsigned w = CLAMP(2.0f * fabsf(vp->scale[0]), 0, 4096);
+ unsigned h = CLAMP(2.0f * fabsf(vp->scale[1]), 0, 4096);
+
BEGIN_NV04(push, NV30_3D(VIEWPORT_TRANSLATE_X), 8);
PUSH_DATAf(push, vp->translate[0]);
PUSH_DATAf(push, vp->translate[1]);
@@ -258,10 +260,14 @@ nv30_validate_viewport(struct nv30_context *nv30)
PUSH_DATAf(push, vp->scale[0]);
PUSH_DATAf(push, vp->scale[1]);
PUSH_DATAf(push, vp->scale[2]);
- PUSH_DATAf(push, 1.0f);
+ PUSH_DATAf(push, 0.0f);
BEGIN_NV04(push, NV30_3D(DEPTH_RANGE_NEAR), 2);
PUSH_DATAf(push, vp->translate[2] - fabsf(vp->scale[2]));
PUSH_DATAf(push, vp->translate[2] + fabsf(vp->scale[2]));
+
+ BEGIN_NV04(push, NV30_3D(VIEWPORT_HORIZ), 2);
+ PUSH_DATA (push, (w << 16) | x);
+ PUSH_DATA (push, (h << 16) | y);
}
static void
@@ -419,6 +425,7 @@ static struct state_validate swtnl_validate_list[] = {
{ nv30_validate_stencil_ref, NV30_NEW_STENCIL_REF },
{ nv30_validate_stipple, NV30_NEW_STIPPLE },
{ nv30_validate_scissor, NV30_NEW_SCISSOR | NV30_NEW_RASTERIZER },
+ { nv30_validate_viewport, NV30_NEW_VIEWPORT },
{ nv30_fragprog_validate, NV30_NEW_FRAGPROG | NV30_NEW_FRAGCONST },
{ nv30_validate_fragment, NV30_NEW_FRAMEBUFFER | NV30_NEW_FRAGPROG },
{ nv30_fragtex_validate, NV30_NEW_FRAGTEX },