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

Ilia Mirkin imirkin at alum.mit.edu
Sun Sep 27 11:21:22 PDT 2015


On Sun, Sep 27, 2015 at 2:14 PM, Marek Olšák <maraeo at gmail.com> wrote:
> 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?

FWIW I believe this should work for at least nv50 and nvc0, as they
have a screen-shared code segment that all shaders get uploaded to.
However I believe that it would be crucial to have a piglit test that
exercises this functionality, as debugging this stuff esp in an actual
game is extremely difficult.

>
> Marek
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list