summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nvc0
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/nvc0
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/nvc0')
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_program.c5
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_program.h1
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_screen.c2
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c1
4 files changed, 6 insertions, 3 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
index 9db45c0759a..b573ac0b8bc 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
@@ -251,8 +251,9 @@ nvc0_vtgp_gen_header(struct nvc0_program *vp, struct nv50_ir_prog_info *info)
}
}
- vp->vp.clip_enable =
- (1 << (info->io.clipDistances + info->io.cullDistances)) - 1;
+ vp->vp.clip_enable = (1 << info->io.clipDistances) - 1;
+ vp->vp.cull_enable =
+ ((1 << info->io.cullDistances) - 1) << info->io.clipDistances;
for (i = 0; i < info->io.cullDistances; ++i)
vp->vp.clip_mode |= 1 << ((info->io.clipDistances + i) * 4);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.h b/src/gallium/drivers/nouveau/nvc0/nvc0_program.h
index 08af3c823b8..328088e4cc4 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.h
@@ -39,6 +39,7 @@ struct nvc0_program {
struct {
uint32_t clip_mode; /* clip/cull selection */
uint8_t clip_enable; /* mask of defined clip planes */
+ uint8_t cull_enable; /* mask of defined cull distances */
uint8_t num_ucps; /* also set to max if ClipDistance is used */
uint8_t edgeflag; /* attribute index of edgeflag input */
bool need_vertex_id;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index eaf9c78d24b..3178588819c 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -227,6 +227,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_INVALIDATE_BUFFER:
case PIPE_CAP_STRING_MARKER:
case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
+ case PIPE_CAP_CULL_DISTANCE:
return 1;
case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
return (class_3d >= NVE4_3D_CLASS) ? 1 : 0;
@@ -259,7 +260,6 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_PCI_DEVICE:
case PIPE_CAP_PCI_FUNCTION:
case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
- case PIPE_CAP_CULL_DISTANCE:
return 0;
case PIPE_CAP_VENDOR_ID:
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
index 4280db44bb6..7a9abe58754 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
@@ -389,6 +389,7 @@ nvc0_validate_clip(struct nvc0_context *nvc0)
nvc0_upload_uclip_planes(nvc0, stage);
clip_enable &= vp->vp.clip_enable;
+ clip_enable |= vp->vp.cull_enable;
if (nvc0->state.clip_enable != clip_enable) {
nvc0->state.clip_enable = clip_enable;