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.
This commit is contained in:
Eric Anholt
2017-12-27 15:12:37 -08:00
parent 4764699552
commit 2056e4a777
6 changed files with 17 additions and 37 deletions

View File

@@ -317,6 +317,7 @@ struct v3d_fs_key {
bool sample_alpha_to_coverage;
bool sample_alpha_to_one;
bool clamp_color;
bool shade_model_flat;
uint8_t nr_cbufs;
uint8_t swap_color_rb;
/* Mask of which render targets need to be written as 32-bit floats */
@@ -417,17 +418,11 @@ struct v3d_compile {
uint32_t uniforms_array_size;
/* Booleans for whether the corresponding QFILE_VARY[i] is
* flat-shaded. This doesn't count gl_FragColor flat-shading, which is
* controlled by shader->color_inputs and rasterizer->flatshade in the
* gallium driver.
* flat-shaded. This includes gl_FragColor flat-shading, which is
* customized based on the shademodel_flat shader key.
*/
BITSET_WORD flat_shade_flags[BITSET_WORDS(V3D_MAX_FS_INPUTS)];
/* Booleans for whether the corresponding QFILE_VARY[i] uses the
* default glShadeModel() behavior.
*/
BITSET_WORD shade_model_flags[BITSET_WORDS(V3D_MAX_FS_INPUTS)];
struct v3d_ubo_range *ubo_ranges;
bool *ubo_range_used;
uint32_t ubo_ranges_array_size;
@@ -574,14 +569,9 @@ struct v3d_fs_prog_data {
struct v3d_varying_slot input_slots[V3D_MAX_FS_INPUTS];
/* Bitmask for whether the corresponding input is flat-shaded,
* independent of rasterizer (gl_FragColor) flat-shading.
/* Bitmask for whether the corresponding input is flat-shaded.
*/
BITSET_WORD flat_shade_flags[BITSET_WORDS(V3D_MAX_FS_INPUTS)];
/* Bitmask for whether the corresponding input uses the default
* glShadeModel() behavior.
*/
BITSET_WORD shade_model_flags[BITSET_WORDS(V3D_MAX_FS_INPUTS)];
bool writes_z;
bool discard;