summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc5/vc5_program.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2017-12-27 15:12:37 -0800
committerEric Anholt <[email protected]>2018-01-03 14:25:23 -0800
commit2056e4a777bd0eed88ff2762977955b2f2bf2f1c (patch)
tree619d3ce2823d1880e9cd787be8bf9488b8c593d2 /src/gallium/drivers/vc5/vc5_program.c
parent476469955225e15f454e01dc80047dd5fa5c9f97 (diff)
broadcom/vc5: Emit proper flatshading code for glShadeModel(GL_FLAT).
In updating the simulator, behavior changed slightly so that our old code wasn't getting glxgears's flatshading interpolated right. Emit flat shading code just like we would for a normal flat-shaded varying, by passing a flag in the shader key for glShadeModel(GL_FLAT) state and customizing the color inputs based on that.
Diffstat (limited to 'src/gallium/drivers/vc5/vc5_program.c')
-rw-r--r--src/gallium/drivers/vc5/vc5_program.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/gallium/drivers/vc5/vc5_program.c b/src/gallium/drivers/vc5/vc5_program.c
index 4232d6aeb83..2fbd83982cd 100644
--- a/src/gallium/drivers/vc5/vc5_program.c
+++ b/src/gallium/drivers/vc5/vc5_program.c
@@ -390,6 +390,7 @@ vc5_update_compiled_fs(struct vc5_context *vc5, uint8_t prim_mode)
}
key->light_twoside = vc5->rasterizer->base.light_twoside;
+ key->shade_model_flat = vc5->rasterizer->base.flatshade;
struct vc5_compiled_shader *old_fs = vc5->prog.fs;
vc5->prog.fs = vc5_get_compiled_shader(vc5, &key->base);
@@ -399,11 +400,8 @@ vc5_update_compiled_fs(struct vc5_context *vc5, uint8_t prim_mode)
vc5->dirty |= VC5_DIRTY_COMPILED_FS;
if (old_fs &&
- (vc5->prog.fs->prog_data.fs->flat_shade_flags !=
- old_fs->prog_data.fs->flat_shade_flags ||
- (vc5->rasterizer->base.flatshade &&
- vc5->prog.fs->prog_data.fs->shade_model_flags !=
- old_fs->prog_data.fs->shade_model_flags))) {
+ vc5->prog.fs->prog_data.fs->flat_shade_flags !=
+ old_fs->prog_data.fs->flat_shade_flags) {
vc5->dirty |= VC5_DIRTY_FLAT_SHADE_FLAGS;
}