diff options
author | Christoph Bumiller <[email protected]> | 2010-12-10 20:16:10 +0100 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2010-12-10 20:20:37 +0100 |
commit | dea9d604005e9aaed2bd6807f1913ac668479443 (patch) | |
tree | 80d938959678a29927b7053b8385cf8007c9ae7c /src/gallium/drivers/nvc0 | |
parent | 51f22689a419a8a13ca105e8ffc905b5fadea0db (diff) |
nvc0: fix FACE state and and handle FACE sysval/varying offset
Diffstat (limited to 'src/gallium/drivers/nvc0')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_program.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_state.c | 34 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c | 2 |
3 files changed, 23 insertions, 19 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_program.c b/src/gallium/drivers/nvc0/nvc0_program.c index aeb92130371..7aa6ef02bcd 100644 --- a/src/gallium/drivers/nvc0/nvc0_program.c +++ b/src/gallium/drivers/nvc0/nvc0_program.c @@ -23,6 +23,8 @@ #include "pipe/p_shader_tokens.h" #include "pipe/p_defines.h" +#define NOUVEAU_DEBUG + #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_util.h" #include "tgsi/tgsi_dump.h" @@ -147,6 +149,8 @@ nvc0_system_value_location(unsigned sn, unsigned si) */ case TGSI_SEMANTIC_INSTANCEID: return 0x2f8; + case TGSI_SEMANTIC_FACE: + return 0x3fc; default: assert(0); return 0x000; @@ -178,6 +182,8 @@ nvc0_varying_location(unsigned sn, unsigned si) return 0x360; case TGSI_SEMANTIC_PRIMID: return 0x40; + case TGSI_SEMANTIC_FACE: + return 0x3fc; /* case TGSI_SEMANTIC_CLIP_DISTANCE: return 0x2c0 + (si * 4); diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c index afba7ce6a0d..c7a8c4b747f 100644 --- a/src/gallium/drivers/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nvc0/nvc0_state.c @@ -210,25 +210,21 @@ nvc0_rasterizer_state_create(struct pipe_context *pipe, SB_DATA (so, nvgl_polygon_mode(cso->fill_back)); SB_OUT_3D (so, POLYGON_SMOOTH_ENABLE, cso->poly_smooth); - if (cso->cull_face != PIPE_FACE_NONE) { - SB_BEGIN_3D(so, CULL_FACE_ENABLE, 3); - SB_DATA (so, 1); - SB_DATA (so, cso->front_ccw ? NVC0_3D_FRONT_FACE_CCW : - NVC0_3D_FRONT_FACE_CW); - switch (cso->cull_face) { - case PIPE_FACE_FRONT_AND_BACK: - SB_DATA(so, NVC0_3D_CULL_FACE_FRONT_AND_BACK); - break; - case PIPE_FACE_FRONT: - SB_DATA(so, NVC0_3D_CULL_FACE_FRONT); - break; - case PIPE_FACE_BACK: - default: - SB_DATA(so, NVC0_3D_CULL_FACE_BACK); - break; - } - } else { - SB_OUT_3D(so, CULL_FACE_ENABLE, 0); + SB_BEGIN_3D(so, CULL_FACE_ENABLE, 3); + SB_DATA (so, cso->cull_face != PIPE_FACE_NONE); + SB_DATA (so, cso->front_ccw ? NVC0_3D_FRONT_FACE_CCW : + NVC0_3D_FRONT_FACE_CW); + switch (cso->cull_face) { + case PIPE_FACE_FRONT_AND_BACK: + SB_DATA(so, NVC0_3D_CULL_FACE_FRONT_AND_BACK); + break; + case PIPE_FACE_FRONT: + SB_DATA(so, NVC0_3D_CULL_FACE_FRONT); + break; + case PIPE_FACE_BACK: + default: + SB_DATA(so, NVC0_3D_CULL_FACE_BACK); + break; } SB_OUT_3D (so, POLYGON_STIPPLE_ENABLE, cso->poly_stipple_enable); diff --git a/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c b/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c index 26f9e735fb2..8a20983a7e2 100644 --- a/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c +++ b/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c @@ -963,8 +963,10 @@ bld_interp(struct bld_context *bld, unsigned mode, struct nv_value *val) if (val->reg.address == 0x3fc) { /* gl_FrontFacing: 0/~0 to -1.0/+1.0 */ val = bld_insn_1(bld, NV_OP_LINTERP, val); + val->insn->flat = 1; val = bld_insn_2(bld, NV_OP_SHL, val, bld_imm_u32(bld, 31)); val = bld_insn_2(bld, NV_OP_XOR, val, bld_imm_f32(bld, -1.0f)); + return val; } else if (mode == NVC0_INTERP_PERSPECTIVE) { val = bld_insn_2(bld, NV_OP_PINTERP, val, bld->frag_coord[3]); |