summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nvc0/nvc0_state_validate.c
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-01-23 21:29:30 +0100
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-01-23 21:35:27 +0100
commita287a758c6567405a7ea10df21e586d1e2ff08ec (patch)
treea06f473b7558331d6c54c18ad208cd4f86f5a8b8 /src/gallium/drivers/nvc0/nvc0_state_validate.c
parentf154cd231552d16c66b87ca1e32be5451f6bdae4 (diff)
nvc0: implement point coord replacement
But we have to cheat and peek at the GENERIC semantic indices the state tracker uses for TEXn. Only outputs from 0x300 to 0x37c can be replaced, and so we have to know on shader compilation which ones to put there in order to keep doing separate shader objects properly. At some point I'll probably create a patch that makes gallium not force us to discard the information about what is a TexCoord.
Diffstat (limited to 'src/gallium/drivers/nvc0/nvc0_state_validate.c')
-rw-r--r--src/gallium/drivers/nvc0/nvc0_state_validate.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nvc0/nvc0_state_validate.c
index b41ca056b6..6419011132 100644
--- a/src/gallium/drivers/nvc0/nvc0_state_validate.c
+++ b/src/gallium/drivers/nvc0/nvc0_state_validate.c
@@ -286,6 +286,34 @@ nvc0_validate_rasterizer(struct nvc0_context *nvc0)
}
static void
+nvc0_validate_sprite_coords(struct nvc0_context *nvc0)
+{
+ struct nouveau_channel *chan = nvc0->screen->base.channel;
+ uint32_t reg;
+
+ if (nvc0->rast->pipe.sprite_coord_mode == PIPE_SPRITE_COORD_UPPER_LEFT)
+ reg = NVC0_3D_POINT_COORD_REPLACE_COORD_ORIGIN_UPPER_LEFT;
+ else
+ reg = NVC0_3D_POINT_COORD_REPLACE_COORD_ORIGIN_LOWER_LEFT;
+
+ if (nvc0->rast->pipe.point_quad_rasterization) {
+ uint32_t en = nvc0->rast->pipe.sprite_coord_enable;
+ int i;
+ struct nvc0_program *prog = nvc0->fragprog;
+
+ while (en) {
+ i = ffs(en) - 1;
+ en &= ~(1 << i);
+ if (prog->fp.in_pos[i] >= 0xc0 && prog->fp.in_pos[i] < 0xe0)
+ reg |= 8 << ((prog->fp.in_pos[i] - 0xc0) / 4);
+ }
+ }
+
+ BEGIN_RING(chan, RING_3D(POINT_COORD_REPLACE), 1);
+ OUT_RING (chan, reg);
+}
+
+static void
nvc0_constbufs_validate(struct nvc0_context *nvc0)
{
struct nouveau_channel *chan = nvc0->screen->base.channel;
@@ -404,6 +432,7 @@ static struct state_validate {
{ nvc0_tevlprog_validate, NVC0_NEW_TEVLPROG },
{ nvc0_gmtyprog_validate, NVC0_NEW_GMTYPROG },
{ nvc0_fragprog_validate, NVC0_NEW_FRAGPROG },
+ { nvc0_validate_sprite_coords, NVC0_NEW_RASTERIZER | NVC0_NEW_FRAGPROG },
{ nvc0_constbufs_validate, NVC0_NEW_CONSTBUF },
{ nvc0_validate_textures, NVC0_NEW_TEXTURES },
{ nvc0_validate_samplers, NVC0_NEW_SAMPLERS },