diff options
author | Kenneth Graunke <[email protected]> | 2014-12-01 01:01:02 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2014-12-02 17:00:26 -0800 |
commit | afd605f3461462ba1b9f522b079ff5a03e7ab55c (patch) | |
tree | ac5782d37e551f50c51d956d17b1584ffc9c1e4f /src | |
parent | 169b6c1955deee7333d61f9ff149b7124bdea7d1 (diff) |
i965: Make vertex color clamp handling code VS specific.
Vertex color clamping only applies to gl_[Secondary]{Front,Back}Color,
which are compatibility-only built-in varyings. We only support GS in
core profile, so they can't exist in geometry shaders.
We can drop several dirty bits from the GS program key - they're
unnecessary for a core profile implementation.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_gs.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_program.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4.cpp | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.c | 5 |
5 files changed, 12 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index b2ecf8fd0c5..a9649516bf7 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -333,9 +333,6 @@ brw_upload_gs_prog(struct brw_context *brw) brw_setup_vec4_key_clip_info(brw, &key.base, gp->program.Base.UsesClipDistanceOut); - /* _NEW_LIGHT | _NEW_BUFFERS */ - key.base.clamp_vertex_color = ctx->Light._ClampVertexColor; - /* _NEW_TEXTURE */ brw_populate_sampler_prog_key_data(ctx, prog, stage_state->sampler_count, &key.base.tex); @@ -364,9 +361,7 @@ brw_upload_gs_prog(struct brw_context *brw) const struct brw_tracked_state brw_gs_prog = { .dirty = { - .mesa = _NEW_BUFFERS | - _NEW_LIGHT | - _NEW_TEXTURE, + .mesa = _NEW_TEXTURE, .brw = BRW_NEW_GEOMETRY_PROGRAM | BRW_NEW_TRANSFORM_FEEDBACK | BRW_NEW_VUE_MAP_VS, diff --git a/src/mesa/drivers/dri/i965/brw_program.h b/src/mesa/drivers/dri/i965/brw_program.h index 57de2728265..808fe80f406 100644 --- a/src/mesa/drivers/dri/i965/brw_program.h +++ b/src/mesa/drivers/dri/i965/brw_program.h @@ -93,8 +93,6 @@ struct brw_vec4_prog_key { */ unsigned nr_userclip_plane_consts:4; - bool clamp_vertex_color:1; - struct brw_sampler_prog_key_data tex; }; @@ -109,6 +107,8 @@ struct brw_vs_prog_key { bool copy_edgeflag:1; + bool clamp_vertex_color:1; + /** * For pre-Gen6 hardware, a bitfield indicating which texture coordinates * are going to be replaced with point coordinates (as a consequence of a diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 4d893e15dca..18a336922a1 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -1813,7 +1813,6 @@ brw_vec4_setup_prog_key_for_precompile(struct gl_context *ctx, GLuint id, struct gl_program *prog) { key->program_string_id = id; - key->clamp_vertex_color = ctx->API == API_OPENGL_COMPAT; unsigned sampler_count = _mesa_fls(prog->SamplersUsed); for (unsigned i = 0; i < sampler_count; i++) { diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index 96816b6fbd0..61af3258cec 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -3104,8 +3104,13 @@ vec4_visitor::emit_urb_slot(dst_reg reg, int varying) case VARYING_SLOT_COL1: case VARYING_SLOT_BFC0: case VARYING_SLOT_BFC1: { + /* These built-in varyings are only supported in compatibility mode, + * and we only support GS in core profile. So, this must be a vertex + * shader. + */ + assert(stage == MESA_SHADER_VERTEX); vec4_instruction *inst = emit_generic_urb_slot(reg, varying); - if (key->clamp_vertex_color) + if (((struct brw_vs_prog_key *) key)->clamp_vertex_color) inst->saturate = true; break; } diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 798d975b1e7..e5de3c20d2f 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -380,7 +380,7 @@ brw_vs_debug_recompile(struct brw_context *brw, found |= key_debug(brw, "PointCoord replace", old_key->point_coord_replace, key->point_coord_replace); found |= key_debug(brw, "vertex color clamping", - old_key->base.clamp_vertex_color, key->base.clamp_vertex_color); + old_key->clamp_vertex_color, key->clamp_vertex_color); found |= brw_debug_recompile_sampler_key(brw, &old_key->base.tex, &key->base.tex); @@ -432,7 +432,7 @@ static void brw_upload_vs_prog(struct brw_context *brw) } /* _NEW_LIGHT | _NEW_BUFFERS */ - key.base.clamp_vertex_color = ctx->Light._ClampVertexColor; + key.clamp_vertex_color = ctx->Light._ClampVertexColor; /* _NEW_POINT */ if (brw->gen < 6 && ctx->Point.PointSprite) { @@ -541,6 +541,7 @@ brw_vs_precompile(struct gl_context *ctx, memset(&key, 0, sizeof(key)); brw_vec4_setup_prog_key_for_precompile(ctx, &key.base, bvp->id, &vp->Base); + key.clamp_vertex_color = ctx->API == API_OPENGL_COMPAT; success = do_vs_prog(brw, shader_prog, bvp, &key); |