[Mesa-dev] [PATCH 2/2] i965: Clean up context constant initialization code.

Kenneth Graunke kenneth at whitecape.org
Fri Nov 13 12:47:42 PST 2015


On Friday, November 13, 2015 10:10:28 AM Pohjolainen, Topi wrote:
> On Thu, Nov 12, 2015 at 03:38:52PM -0800, Kenneth Graunke wrote:
> > This was getting pretty out of hand, and with compute partially in place
> > and tessellation on the way, it was only going to get worse.
> > 
> > This patch makes a "stage exists?" predicate and a "number of stages"
> > count and uses them to clean up a lot of calculations.  We can just
> > loop over shader stages and set things for the ones that exist.  For
> > combined counts, we can just multiply by the number of stages.
> > 
> > It also tries to organize a little bit.
> > 
> > We should probably use _mesa_has_geometry_shaders/tessellation/compute
> > here, but we can't because ctx->Version isn't initialized yet.  Perhaps
> > that could be fixed in the future.
> > 
> > No change in "glxinfo -l" on Broadwell.
> > 
> > Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> > ---
> >  src/mesa/drivers/dri/i965/brw_context.c | 138 ++++++++++++++------------------
> >  1 file changed, 58 insertions(+), 80 deletions(-)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
> > index 2db99c7..89533ae 100644
> > --- a/src/mesa/drivers/dri/i965/brw_context.c
> > +++ b/src/mesa/drivers/dri/i965/brw_context.c
> > @@ -322,64 +322,85 @@ static void
> >  brw_initialize_context_constants(struct brw_context *brw)
> >  {
> >     struct gl_context *ctx = &brw->ctx;
> > +   const struct brw_compiler *compiler = brw->intelScreen->compiler;
> > +
> > +   bool stage_exists[MESA_SHADER_STAGES] = {
> 
> This could be const.

Right...changed in v2.  Thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151113/91745a86/attachment.sig>


More information about the mesa-dev mailing list