[Mesa-dev] Question: st/mesa and context-shareable shaders

Marek Olšák maraeo at gmail.com
Sun Sep 27 11:14:10 PDT 2015


Hi,

For some reason, st/mesa assumes that shaders can't be shared by
multiple contexts and therefore has a context pointer in shader keys.
I'd like to get rid of this dependency, because there is no reason why
shaders would need to be tied to a context. In fact, shaders don't
even need a device, they just need a compiler.

This is becoming a bigger issue with latest games that might prefer
compiling shaders in another thread using a different GL context.

As far as I know, shaders should be context-shareable on all hardware
drivers. I see only 2 options out of this:

1) Removing the context pointer from the shader keys. If drivers need
this, they should handle it by themselves. This will simplify st/mesa,
because TCS, TES, GS won't need the variant-tracking machinery.

2) Adding PIPE_CAP_SHAREABLE_SHADERS and if the cap is 1, set the
context pointer to NULL in all keys.

What do you think?

Marek


More information about the mesa-dev mailing list