On Sun, Sep 27, 2015 at 10:41 PM, Ilia Mirkin <[email protected]> wrote: > On Sun, Sep 27, 2015 at 2:25 PM, Marek Olšák <[email protected]> wrote: >> On Sun, Sep 27, 2015 at 8:21 PM, Ilia Mirkin <[email protected]> wrote: >>> On Sun, Sep 27, 2015 at 2:14 PM, Marek Olšák <[email protected]> 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. >> >> Who needs to debug it. If there's a regression, it's bisectable. After >> that, you know your shaders aren't shareable and you need to take a >> closer look at your code. > > OK, well, in that case I'm just going to set such a cap to 0 until a > test appears -- I'm not sufficiently confident in how it all works to > say that it's definitely fine on nouveau. There are enough bugs that > failures from such an issue may not be easily bisected, or it may not > even be clear that old versions worked.
Yeah, I'll probably add some test for simple sharing, i.e. one context compiles it and another one uses it. Marek _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
