mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
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 <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
This commit is contained in:
parent
169b6c1955
commit
afd605f346
5 changed files with 12 additions and 12 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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++) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue