[Mesa-dev] mesa/st: how to force glLinkProgram to create/translate the program?

Brian Paul brianp at vmware.com
Mon Jan 20 07:23:33 PST 2014


On 01/19/2014 12:16 AM, Ilia Mirkin wrote:
> Hi,
>
> My goal is to extend shader-db to be able to be used with nouveau, as
> I'm about to attempt a few compiler optimizations. But I'm having
> trouble with the very first step -- getting the driver to spit out the
> generated code. I've added logic to nouveau to translate the program
> as soon as it's available rather than on first use. However it seems
> that mesa/st has similar delaying logic, which makes it so that none
> of this is called when merely calling glLinkProgram.

Right.  The issue is "shader variants".  It's often the case that misc 
GL state interacts with the VS/FS code.  For example, depending on 
whether we're drawing to the window or an FBO we have to invert the Y 
coordinate of gl_FragCoord in the FS by creating a FS variant.  We 
postpone creating/bind shader variants until draw time, just like other 
state validation.


> I'm having trouble figuring out how to bypass this and make it call
> update_vp/fp/gp which appear like they'll actually call
> pipe->create_fs_state/etc. I see st_link_shader getting called, as
> expected, which creates the TGSI... but what to do from there?

If you were to short-circuit the validation steps above and force the 
VS/FS to get propagated to the driver ASAP, there's a chance the shader 
wouldn't actually do everything that it normally would (ex: invert Y). 
I don't know if that matters to you.

In any case, there's no simple solution to this.  You'll probably have 
to hack something up.  If it turns out simple, maybe we could enable it 
with a debug flag.

-Brian



More information about the mesa-dev mailing list