diff options
author | Roland Scheidegger <[email protected]> | 2014-12-10 20:07:25 +0100 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2014-12-10 22:11:16 +0100 |
commit | 2b23149206c933aed473d289d79dd2f398f88389 (patch) | |
tree | de9e9769131167630fb20536f31285bb3e975f39 /src/gallium/auxiliary/draw/draw_pipe_clip.c | |
parent | fb61f75bf633e60c0f81fe8ae59d03bfa68d755b (diff) |
draw: fix flatshade stage for constant interpolated values
This stage only worked for traditional old-school flatshading, it did ignore
constant interpolated values and only handled colors, the code probably
predates using of constant interpolated values in gallium. So fix this - the
clip stage apparently did this a long time ago already.
Unfortunately this also means the stage needs to be invoked when flatshading
isn't enabled but some other prim changing stages are - for instance with
fill mode line each of the 3 lines in a tri should get the same attribute
value from the leading vertex in the original tri if interpolation is constant,
which did not happen before
Due to that, the stage is now run in more cases, even unnecessary ones. Could
in theory skip it completely if there aren't any constant interpolated
attributes (and rast->flatshade isn't set), but not sure it's worth bothering,
as it looks kinda complicated getting this information in advance.
No piglit change (doesn't really cover this directly).
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pipe_clip.c')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_clip.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c index 2fbd655e07f..e1e7dcc6f63 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c @@ -741,9 +741,10 @@ static void clip_init_state( struct draw_stage *stage ) { struct clip_stage *clipper = clip_stage( stage ); - const struct draw_fragment_shader *fs = stage->draw->fs.fragment_shader; + const struct draw_context *draw = stage->draw; + const struct draw_fragment_shader *fs = draw->fs.fragment_shader; + const struct tgsi_shader_info *info = draw_get_shader_info(draw); uint i, j; - const struct tgsi_shader_info *info = draw_get_shader_info(stage->draw); /* We need to know for each attribute what kind of interpolation is * done on it (flat, smooth or noperspective). But the information @@ -765,7 +766,7 @@ clip_init_state( struct draw_stage *stage ) * gl_Color/gl_SecondaryColor, with the correct default. */ int indexed_interp[2]; - indexed_interp[0] = indexed_interp[1] = stage->draw->rasterizer->flatshade ? + indexed_interp[0] = indexed_interp[1] = draw->rasterizer->flatshade ? TGSI_INTERPOLATE_CONSTANT : TGSI_INTERPOLATE_PERSPECTIVE; if (fs) { @@ -802,11 +803,11 @@ clip_init_state( struct draw_stage *stage ) clipper->noperspective_attribs[i] = interp == TGSI_INTERPOLATE_LINEAR; } /* Search the extra vertex attributes */ - for (j = 0; j < stage->draw->extra_shader_outputs.num; j++) { + for (j = 0; j < draw->extra_shader_outputs.num; j++) { /* Find the interpolation mode for a specific attribute */ int interp = find_interp(fs, indexed_interp, - stage->draw->extra_shader_outputs.semantic_name[j], - stage->draw->extra_shader_outputs.semantic_index[j]); + draw->extra_shader_outputs.semantic_name[j], + draw->extra_shader_outputs.semantic_index[j]); /* If it's flat, add it to the flat vector. Otherwise update * the noperspective mask. */ |