nvc0: move sprite coord replace state into cso
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 11 Mar 2011 09:00:32 +0000 (10:00 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sun, 13 Mar 2011 12:23:54 +0000 (13:23 +0100)
It's not dependent on any other state anymore now.

src/gallium/drivers/nvc0/nvc0_state.c
src/gallium/drivers/nvc0/nvc0_state_validate.c

index f230292316f48806176f7614ee4596c854d8168f..bbcac3938f5dd2394df7411fa7f4dff8acf844cf 100644 (file)
@@ -166,6 +166,7 @@ nvc0_rasterizer_state_create(struct pipe_context *pipe,
                              const struct pipe_rasterizer_state *cso)
 {
     struct nvc0_rasterizer_stateobj *so;
+    uint32_t reg;
 
     so = CALLOC_STRUCT(nvc0_rasterizer_stateobj);
     if (!so)
@@ -202,6 +203,13 @@ nvc0_rasterizer_state_create(struct pipe_context *pipe,
        SB_BEGIN_3D(so, POINT_SIZE, 1);
        SB_DATA    (so, fui(cso->point_size));
     }
+
+    reg = (cso->sprite_coord_mode == PIPE_SPRITE_COORD_UPPER_LEFT) ?
+       NVC0_3D_POINT_COORD_REPLACE_COORD_ORIGIN_UPPER_LEFT :
+       NVC0_3D_POINT_COORD_REPLACE_COORD_ORIGIN_LOWER_LEFT;
+
+    SB_BEGIN_3D(so, POINT_COORD_REPLACE, 1);
+    SB_DATA    (so, ((cso->sprite_coord_enable & 0xff) << 3) | reg);
     SB_IMMED_3D(so, POINT_SPRITE_ENABLE, cso->point_quad_rasterization);
     SB_IMMED_3D(so, POINT_SMOOTH_ENABLE, cso->point_smooth);
 
index 6fd880829e4f7168cfe07747ea02485f70c16129..c37a070bc68d5c8b94c4234221b0417e2bd37431 100644 (file)
@@ -293,32 +293,6 @@ nvc0_validate_rasterizer(struct nvc0_context *nvc0)
    OUT_RINGp(chan, nvc0->rast->state, nvc0->rast->size);
 }
 
-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;
-
-      while (en) {
-         int i = ffs(en) - 1;
-         en &= ~(1 << i);
-         if (i >= 0 && i < 8)
-            reg |= 8 << i;
-      }
-   }
-
-   BEGIN_RING(chan, RING_3D(POINT_COORD_REPLACE), 1);
-   OUT_RING  (chan, reg);
-}
-
 static void
 nvc0_constbufs_validate(struct nvc0_context *nvc0)
 {
@@ -432,7 +406,6 @@ 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 },