Re: [Mesa-dev] [PATCH] i965: Only set key->flat_shade if COL0/COL1 are written.
On Wednesday, August 23, 2017 12:04:40 PM PDT Ilia Mirkin wrote: > You might consider also including whether the interpolation method was > forced or not. i.e. if you have > > flat varying vec4 gl_Color; > > then it doesn't matter whether shade model is flat or not, it'll be > interpolated as flat. (Same with the other qualifiers made available > in GL 3.0.) > > So you only have to do funny stuff if either COL0 / COL1 don't have > explicit interpolation qualifiers. > > That might be over-optimizing it though. Your call. Just something > that occurred to me. > > -ilia Yeah, we definitely could do that. I think I'd have to go loop over the input variables, though, instead of checking a bitfield...which is a bit of a pain. Given that 'flat' was introduced with GLSL 1.30, which also deprecated gl_Color, I doubt it's too common of a case. --Ken signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Only set key->flat_shade if COL0/COL1 are written.
You might consider also including whether the interpolation method was forced or not. i.e. if you have flat varying vec4 gl_Color; then it doesn't matter whether shade model is flat or not, it'll be interpolated as flat. (Same with the other qualifiers made available in GL 3.0.) So you only have to do funny stuff if either COL0 / COL1 don't have explicit interpolation qualifiers. That might be over-optimizing it though. Your call. Just something that occurred to me. -ilia On Tue, Aug 22, 2017 at 10:19 PM, Kenneth Graunkewrote: > This may reduce some recompiles. > --- > src/mesa/drivers/dri/i965/brw_wm.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_wm.c > b/src/mesa/drivers/dri/i965/brw_wm.c > index c9c45045902..e1555d60c56 100644 > --- a/src/mesa/drivers/dri/i965/brw_wm.c > +++ b/src/mesa/drivers/dri/i965/brw_wm.c > @@ -531,7 +531,9 @@ brw_wm_populate_key(struct brw_context *brw, struct > brw_wm_prog_key *key) >key->stats_wm = brw->stats_wm; > > /* _NEW_LIGHT */ > - key->flat_shade = (ctx->Light.ShadeModel == GL_FLAT); > + key->flat_shade = > + (prog->info.inputs_read & (VARYING_BIT_COL0 | VARYING_BIT_COL1)) && > + (ctx->Light.ShadeModel == GL_FLAT); > > /* _NEW_FRAG_CLAMP | _NEW_BUFFERS */ > key->clamp_fragment_color = ctx->Color._ClampFragmentColor; > -- > 2.14.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Only set key->flat_shade if COL0/COL1 are written.
Seems reasonable: Reviewed-by: Timothy ArceriOn 23/08/17 12:19, Kenneth Graunke wrote: This may reduce some recompiles. --- src/mesa/drivers/dri/i965/brw_wm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index c9c45045902..e1555d60c56 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -531,7 +531,9 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key) key->stats_wm = brw->stats_wm; /* _NEW_LIGHT */ - key->flat_shade = (ctx->Light.ShadeModel == GL_FLAT); + key->flat_shade = + (prog->info.inputs_read & (VARYING_BIT_COL0 | VARYING_BIT_COL1)) && + (ctx->Light.ShadeModel == GL_FLAT); /* _NEW_FRAG_CLAMP | _NEW_BUFFERS */ key->clamp_fragment_color = ctx->Color._ClampFragmentColor; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965: Only set key->flat_shade if COL0/COL1 are written.
This may reduce some recompiles. --- src/mesa/drivers/dri/i965/brw_wm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index c9c45045902..e1555d60c56 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -531,7 +531,9 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key) key->stats_wm = brw->stats_wm; /* _NEW_LIGHT */ - key->flat_shade = (ctx->Light.ShadeModel == GL_FLAT); + key->flat_shade = + (prog->info.inputs_read & (VARYING_BIT_COL0 | VARYING_BIT_COL1)) && + (ctx->Light.ShadeModel == GL_FLAT); /* _NEW_FRAG_CLAMP | _NEW_BUFFERS */ key->clamp_fragment_color = ctx->Color._ClampFragmentColor; -- 2.14.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev