[Mesa-dev] V2 Rework gl program structures (lots of clean-up)

Timothy Arceri timothy.arceri at collabora.com
Sun Nov 20 13:28:39 UTC 2016


Most of these patches are clean-ups on there own so I'd be grateful for
even partial series reviews.

Series is available in the free_gl_linked_shader8 branch of:

https://github.com/tarceri/Mesa.git

V2:
- some make check fixes
- rebase on master
- previously reviewed patches pushed (Thanks Emil)
- patch 56-58 are new

I started out with a goal of freeing _LinkedShaders after linking as this
would have allowed a bunch of code simplification and also reduced the
possibility of subtle bugs in i965 where a program that is currently
active is relinked but fails and then we recompile a variant of the still
active program but we would have lost things such as per stage atomic
bindings which would be deleted during the failed relink.

In the end this series grew larger than expected so for now this series
aims to switch the pipeline objects CurrentProgram array from using
gl_shader_program to gl_program. Previously the CurrentProgram array
could have contained multiple pointers to the same struct which was
confusing and we would often need to fish out the information we were
really after from the gl_program anyway. Using gl_program makes much
more sense and allows us to optimise some critical paths such as SSO
and sampler validation which are called at draw time.

In patch 53 when we finally change the pointers used in CurrentProgram
you can see some of the confusion caused by the old way of doing things
where use_shader_program() calls 
_mesa_shader_program_init_subroutine_defaults() on each stage in
gl_shader_program but we also call use_shader_program() itself for
each stage in gl_shader_program so unless we are dealing with single
stage SSO programs we will initialise subroutine defaults many
times over. 

On top of all this these changes help make shader cache cleaner
and resolve some of the problems I was having figuring out how to 
get it working for SSO.

I've tried to make the order of the patchs make sense for reviewing
but since almost everything is working towards patches 53-55
reviewers may need to jump to the last few patches at times.

Finally the patches 53-55 will need to be squashed to stop
compilation errors I've just split them up to help make reviewing
easier. I would have liked to have made patch 55 separate but the
patches have some circular dependencies that made it difficult.

I'm really happy with how this series turned out and the improvements
I was able to make along the way. Please review.



More information about the mesa-dev mailing list