diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/nv50/nv50_context.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/nv50_shader_state.c | 47 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/nv50_state_validate.c | 2 |
3 files changed, 38 insertions, 14 deletions
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index e6079a621a9..46e6c2250af 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -79,8 +79,10 @@ struct nv50_context { struct { uint32_t instance_elts; /* bitmask of per-instance elements */ uint32_t instance_base; + uint32_t interpolant_ctrl; int32_t index_bias; boolean prim_restart; + boolean point_sprite; uint8_t num_vtxbufs; uint8_t num_vtxelts; uint8_t num_textures[3]; @@ -181,6 +183,7 @@ void nv50_fragprog_validate(struct nv50_context *); void nv50_fp_linkage_validate(struct nv50_context *); void nv50_gp_linkage_validate(struct nv50_context *); void nv50_constbufs_validate(struct nv50_context *); +void nv50_sprite_coords_validate(struct nv50_context *); /* nv50_state.c */ extern void nv50_init_state_functions(struct nv50_context *); diff --git a/src/gallium/drivers/nv50/nv50_shader_state.c b/src/gallium/drivers/nv50/nv50_shader_state.c index f5685c1cd7d..ee50ef8ed16 100644 --- a/src/gallium/drivers/nv50/nv50_shader_state.c +++ b/src/gallium/drivers/nv50/nv50_shader_state.c @@ -223,13 +223,29 @@ nv50_gmtyprog_validate(struct nv50_context *nv50) OUT_RING (chan, gp->code_base); } -static void -nv50_pntc_replace(struct nv50_context *nv50, uint32_t pntc[8], unsigned m) +void +nv50_sprite_coords_validate(struct nv50_context *nv50) { + struct nouveau_channel *chan = nv50->screen->base.channel; + uint32_t pntc[8], mode; struct nv50_program *fp = nv50->fragprog; unsigned i, c; + unsigned m = (nv50->state.interpolant_ctrl >> 8) & 0xff; + + if (!nv50->rast->pipe.point_quad_rasterization) { + if (nv50->state.point_sprite) { + BEGIN_RING(chan, RING_3D(POINT_COORD_REPLACE_MAP(0)), 1); + for (i = 0; i < 8; ++i) + OUT_RING(chan, 0); + + nv50->state.point_sprite = FALSE; + } + return; + } else { + nv50->state.point_sprite = TRUE; + } - memset(pntc, 0, 8 * sizeof(uint32_t)); + memset(pntc, 0, sizeof(pntc)); for (i = 0; i < fp->in_nr; i++) { unsigned n = util_bitcount(fp->in[i].mask); @@ -250,6 +266,17 @@ nv50_pntc_replace(struct nv50_context *nv50, uint32_t pntc[8], unsigned m) } } } + + if (nv50->rast->pipe.sprite_coord_mode == PIPE_SPRITE_COORD_LOWER_LEFT) + mode = 0x00; + else + mode = 0x10; + + BEGIN_RING(chan, RING_3D(POINT_SPRITE_CTRL), 1); + OUT_RING (chan, mode); + + BEGIN_RING(chan, RING_3D(POINT_COORD_REPLACE_MAP(0)), 1); + OUT_RINGp (chan, pntc, 8); } static int @@ -291,7 +318,7 @@ nv50_fp_linkage_validate(struct nv50_context *nv50) uint32_t psiz = 0x000; uint32_t interp = fp->fp.interp; uint32_t colors = fp->fp.colors; - uint32_t lin[4], pntc[8]; + uint32_t lin[4]; uint8_t map[64]; memset(lin, 0x00, sizeof(lin)); @@ -372,19 +399,11 @@ nv50_fp_linkage_validate(struct nv50_context *nv50) BEGIN_RING(chan, RING_3D(FP_INTERPOLANT_CTRL), 1); OUT_RING (chan, interp); + nv50->state.interpolant_ctrl = interp; + BEGIN_RING(chan, RING_3D(NOPERSPECTIVE_BITMAP(0)), 4); OUT_RINGp (chan, lin, 4); - if (nv50->rast->pipe.point_quad_rasterization) { - nv50_pntc_replace(nv50, pntc, (interp >> 8) & 0xff); - - BEGIN_RING(chan, RING_3D(POINT_SPRITE_CTRL), 1); - OUT_RING (chan, (nv50->rast->pipe.sprite_coord_mode == - PIPE_SPRITE_COORD_LOWER_LEFT) ? 0 : 0x10); - BEGIN_RING(chan, RING_3D(POINT_COORD_REPLACE_MAP(0)), 8); - OUT_RINGp (chan, pntc, 8); - } - BEGIN_RING(chan, RING_3D(GP_ENABLE), 1); OUT_RING (chan, nv50->gmtyprog ? 1 : 0); } diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index c97927624e4..d0b4af6c41b 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -269,6 +269,8 @@ static struct state_validate { { nv50_fp_linkage_validate, NV50_NEW_FRAGPROG | NV50_NEW_VERTPROG | NV50_NEW_GMTYPROG }, { nv50_gp_linkage_validate, NV50_NEW_GMTYPROG | NV50_NEW_VERTPROG }, + { nv50_sprite_coords_validate, NV50_NEW_FRAGPROG | NV50_NEW_RASTERIZER | + NV50_NEW_VERTPROG | NV50_NEW_GMTYPROG }, { nv50_constbufs_validate, NV50_NEW_CONSTBUF }, { nv50_validate_textures, NV50_NEW_TEXTURES }, { nv50_validate_samplers, NV50_NEW_SAMPLERS }, |