Samstag, Juli 25, 2009

r300: Refactoring the program compiler for Gallium

One of the tasks of a 3D graphics driver is translating shader programs into something that the hardware can understand. The classic Mesa driver has, over the last years, seen a constant improvement in the compiler that does this, which is no small feat considering that the instruction set implemented by the hardware is sometimes rather quirky.

The Gallium driver, on the other hand, is far from the same level of support. So instead of reinventing the wheel, why not use the same code that we know already works?

Working towards this goal is precisely what I've done in my spare time over the last week or so. The compiler in the classic Mesa driver contains a lot of assumptions about the inner workings of Mesa - these assumptions are not necessarily true in a Gallium environment. So I have been refactoring the compiler to remove such assumptions and to make it ready for consumption in Gallium, while at the same time being extra careful to avoid introducing bugs or regressions.

Right now, the compiler proper has already been moved out of the driver into its own directory and object archive. I'm going to hook it up into Gallium over the next week or so. In the meantime, you can take a look at the current work in progress in my Git repository.

Edit: The world is changing quickly. The above link to my repository is correct in principle, but it refers to a branch that is no longer there, because that branch is already merged to Mesa master.

Keine Kommentare: