i965: Clean up context constant initialization code.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 12 Nov 2015 21:46:16 +0000 (13:46 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 17 Nov 2015 00:24:44 +0000 (16:24 -0800)
commit5ee5dfddeafde2e2b89f86d2a59769a61ce5d6b2
tree6a487a0f42ad3453aa8a8d486c92b62684eb4318
parent44d6c0c805d2911cc5dfe853e5bc5a505f87775f
i965: Clean up context constant initialization code.

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.

v2: Drop stray compute shader hunk.  Mark stage_exists as const.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/mesa/drivers/dri/i965/brw_context.c