From: Marek O. <ma...@gm...> - 2010-04-04 05:30:08
|
On Sun, Apr 4, 2010 at 6:14 AM, Tom Stellard <tst...@gm...> wrote: > On Sun, Apr 04, 2010 at 01:09:51AM +0200, Marek Olšák wrote: > > > > Since Nicolai has already implemented the branch emulation and some other > > optimizations, it would be nice to take over his work. I tried to use the > > branch emulation on vertex shaders and it did not work correctly, I guess > it > > needs little fixing. See this branch in his repo: > > http://cgit.freedesktop.org/~nh/mesa/log/?h=r300g-glsl<http://cgit.freedesktop.org/%7Enh/mesa/log/?h=r300g-glsl> > <http://cgit.freedesktop.org/%7Enh/mesa/log/?h=r300g-glsl> > > Especially this commit implements exactly what you propose (see comments > in > > the code): > > > http://cgit.freedesktop.org/~nh/mesa/commit/?h=r300g-glsl&id=71c8d4c745da23b0d4f3974353b19fad89818d7f<http://cgit.freedesktop.org/%7Enh/mesa/commit/?h=r300g-glsl&id=71c8d4c745da23b0d4f3974353b19fad89818d7f> > < > http://cgit.freedesktop.org/%7Enh/mesa/commit/?h=r300g-glsl&id=71c8d4c745da23b0d4f3974353b19fad89818d7f > > > > > > Reusing this code for Gallium seems more reasonable to me than > reinventing > > the wheel and doing basically the same thing elsewhere. I recommend > > implementing a TGSI backend in the r300 compiler, which will make > possible > > using it with TGSI shaders. So basically a TGSI shader would be converted > to > > the RC representation the way it's done in r300g right now, and code for > > converting RC -> hw code would get replaced by conversion RC -> TGSI. > Both > > RC and TGSI are very similar so it'll be pretty straightforward. With a > TGSI > > backend, another step would be to make a nice hw-independent and > > configurable interface on top of it which should go to util. So far it's > > simple, now comes some real work: fixing the branch emulation and > continuing > > from (2) in your list. > > I am not sure if I follow you here, so let me know if I am understanding > this correctly. What you are suggesting is to take Nicolai's branch, > which right now does TGSI -> RC -> Branch Emulation in RC -> hw code and > instead of converting from RC to hw code convert from RC back into TGSI. > That's right. > Then, pull the TGSI -> RC -> Branch Emulation in RC -> TGSI path out of > the r300 compiler and place it in gallium/auxillary/util so it can be used > by other Gallium drivers that want to emulate branches. Is this correct? > Sorry I should have been more clear. The whole RC may stay in src/mesa/drivers/dri/r300/compiler as it is now. I think these are parts that should go to util: - TGSI -> RC conversion - RC -> TGSI conversion - Hw-independent interface to the compiler, i.e. one function (or more) which takes a TGSI shader and returns a TGSI shader. It should do both conversions above and use r300/compiler directly. In the long-term, the compiler should probably be moved to src/compiler or something like that (since both classic and gallium drivers may use it), but you don't need to care about that if you don't want to. -Marek |