Brian Paul <bri...@vmware.com> writes: > 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.
Yeah, that's what we did in i965, too: Do a first compile all the way through the backend with a bunch of reasonable guesses, and note when those guesses are wrong under perf_debug(). The value from being able to do shader_db was huge. As a bonus, it reduces stuttering when first starting to draw using your shaders (assuming you guess correctly sometimes, which appears to be pretty easy).
pgpimyQpMgkcr.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev