summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv50
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-03-02 19:02:59 +0100
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-03-02 20:59:53 +0100
commit223d98bb8d49c9e52e498a12980722467ae2bf87 (patch)
tree0356f1915d3418c83133a2ca43153be9545bd861 /src/gallium/drivers/nv50
parentdbdbbce066de9af2856c207f5de8be7f10c74597 (diff)
nv50: fix point sprite state validation
Wasn't updated if the FP didn't change, and coordinate replacement wasn't disabled anymore.
Diffstat (limited to 'src/gallium/drivers/nv50')
-rw-r--r--src/gallium/drivers/nv50/nv50_context.h3
-rw-r--r--src/gallium/drivers/nv50/nv50_shader_state.c47
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c2
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 e6079a621a..46e6c2250a 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 f5685c1cd7..ee50ef8ed1 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 c97927624e..d0b4af6c41 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 },