aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
diff options
context:
space:
mode:
authorTobias Klausmann <[email protected]>2016-05-08 22:44:11 +0200
committerIlia Mirkin <[email protected]>2016-05-15 10:48:39 -0400
commit8c0293979457dab49f0055075d1ca4daa3fb8033 (patch)
tree677ce1a79386b8b72ebdf51d6ac3120da6f2e6ba /src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
parent2ad970ecf49ecf79cb1b2c38cedc69e527eb3c28 (diff)
nv50,nvc0: add support for cull distances
Cull distances are just a special case of clip distances as far as the hardware is concerned. Make sure that the relevant "planes" are enabled, and flip the clip mode to cull for those. Signed-off-by: Tobias Klausmann <[email protected]> [imirkin: add enables on nvc0, add nv50 support] Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Tobias Klausmann <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/nv50/nv50_state_validate.c')
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_state_validate.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
index 51204930031..65f7338f43e 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
@@ -340,7 +340,7 @@ nv50_validate_clip(struct nv50_context *nv50)
{
struct nouveau_pushbuf *push = nv50->base.pushbuf;
struct nv50_program *vp;
- uint8_t clip_enable;
+ uint8_t clip_enable = nv50->rast->pipe.clip_plane_enable;
if (nv50->dirty_3d & NV50_NEW_3D_CLIP) {
BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
@@ -353,13 +353,20 @@ nv50_validate_clip(struct nv50_context *nv50)
if (likely(!vp))
vp = nv50->vertprog;
- clip_enable = nv50->rast->pipe.clip_plane_enable;
+ if (clip_enable)
+ nv50_check_program_ucps(nv50, vp, clip_enable);
+
+ clip_enable &= vp->vp.clip_enable;
+ clip_enable |= vp->vp.cull_enable;
BEGIN_NV04(push, NV50_3D(CLIP_DISTANCE_ENABLE), 1);
PUSH_DATA (push, clip_enable);
- if (clip_enable)
- nv50_check_program_ucps(nv50, vp, clip_enable);
+ if (nv50->state.clip_mode != vp->vp.clip_mode) {
+ nv50->state.clip_mode = vp->vp.clip_mode;
+ BEGIN_NV04(push, NV50_3D(CLIP_DISTANCE_MODE), 1);
+ PUSH_DATA (push, vp->vp.clip_mode);
+ }
}
static void