diff options
author | Tobias Klausmann <[email protected]> | 2016-05-08 22:44:11 +0200 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2016-05-15 10:48:39 -0400 |
commit | 8c0293979457dab49f0055075d1ca4daa3fb8033 (patch) | |
tree | 677ce1a79386b8b72ebdf51d6ac3120da6f2e6ba /src/gallium/drivers/nouveau/nv50/nv50_program.c | |
parent | 2ad970ecf49ecf79cb1b2c38cedc69e527eb3c28 (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_program.c')
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_program.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c index 89db67f0524..648cb7314bf 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_program.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c @@ -319,7 +319,7 @@ nv50_program_translate(struct nv50_program *prog, uint16_t chipset, struct pipe_debug_callback *debug) { struct nv50_ir_prog_info *info; - int ret; + int i, ret; const uint8_t map_undef = (prog->type == PIPE_SHADER_VERTEX) ? 0x40 : 0x80; info = CALLOC_STRUCT(nv50_ir_prog_info); @@ -378,6 +378,13 @@ nv50_program_translate(struct nv50_program *prog, uint16_t chipset, prog->vp.need_vertex_id = info->io.vertexId < PIPE_MAX_SHADER_INPUTS; + prog->vp.clip_enable = (1 << info->io.clipDistances) - 1; + prog->vp.cull_enable = + ((1 << info->io.cullDistances) - 1) << info->io.clipDistances; + prog->vp.clip_mode = 0; + for (i = 0; i < info->io.cullDistances; ++i) + prog->vp.clip_mode |= 1 << ((info->io.clipDistances + i) * 4); + if (prog->type == PIPE_SHADER_FRAGMENT) { if (info->prop.fp.writesDepth) { prog->fp.flags[0] |= NV50_3D_FP_CONTROL_EXPORTS_Z; |