summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50/nv50_shader_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_shader_state.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_shader_state.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/gallium/drivers/nv50/nv50_shader_state.c b/src/gallium/drivers/nv50/nv50_shader_state.c
index bea9c095bb3..82c346cb5ea 100644
--- a/src/gallium/drivers/nv50/nv50_shader_state.c
+++ b/src/gallium/drivers/nv50/nv50_shader_state.c
@@ -226,7 +226,7 @@ nv50_gmtyprog_validate(struct nv50_context *nv50)
OUT_RING (chan, gp->code_base);
}
-void
+static void
nv50_sprite_coords_validate(struct nv50_context *nv50)
{
struct nouveau_channel *chan = nv50->screen->base.channel;
@@ -282,6 +282,39 @@ nv50_sprite_coords_validate(struct nv50_context *nv50)
OUT_RINGp (chan, pntc, 8);
}
+/* Validate state derived from shaders and the rasterizer cso. */
+void
+nv50_validate_derived_rs(struct nv50_context *nv50)
+{
+ struct nouveau_channel *chan = nv50->screen->base.channel;
+ uint32_t color, psize;
+
+ nv50_sprite_coords_validate(nv50);
+
+ if (nv50->dirty & NV50_NEW_FRAGPROG)
+ return;
+ psize = nv50->state.semantic_psize & ~NV50_3D_MAP_SEMANTIC_3_PTSZ_EN__MASK;
+ color = nv50->state.semantic_color & ~NV50_3D_MAP_SEMANTIC_0_CLMP_EN;
+
+ if (nv50->rast->pipe.clamp_vertex_color)
+ color |= NV50_3D_MAP_SEMANTIC_0_CLMP_EN;
+
+ if (color != nv50->state.semantic_color) {
+ nv50->state.semantic_color = color;
+ BEGIN_RING(chan, RING_3D(MAP_SEMANTIC_0), 1);
+ OUT_RING (chan, color);
+ }
+
+ if (nv50->rast->pipe.point_size_per_vertex)
+ psize |= NV50_3D_MAP_SEMANTIC_3_PTSZ_EN__MASK;
+
+ if (psize != nv50->state.semantic_psize) {
+ nv50->state.semantic_psize = psize;
+ BEGIN_RING(chan, RING_3D(MAP_SEMANTIC_3), 1);
+ OUT_RING (chan, psize);
+ }
+}
+
static int
nv50_vec4_map(uint8_t *map, int mid, uint32_t lin[4],
struct nv50_varying *in, struct nv50_varying *out)
@@ -372,6 +405,9 @@ nv50_fp_linkage_validate(struct nv50_context *nv50)
map[m++] = vp->vp.psiz;
}
+ if (nv50->rast->pipe.clamp_vertex_color)
+ colors |= NV50_3D_MAP_SEMANTIC_0_CLMP_EN;
+
n = (m + 3) / 4;
assert(m <= 64);
@@ -404,6 +440,9 @@ nv50_fp_linkage_validate(struct nv50_context *nv50)
nv50->state.interpolant_ctrl = interp;
+ nv50->state.semantic_color = colors;
+ nv50->state.semantic_psize = psiz;
+
BEGIN_RING(chan, RING_3D(NOPERSPECTIVE_BITMAP(0)), 4);
OUT_RINGp (chan, lin, 4);