On 06/16/2011 10:34 AM, Bryan Cain wrote:
On Thu, Jun 16, 2011 at 9:08 AM, Brian Paul <bri...@vmware.com
<mailto:bri...@vmware.com>> wrote:


    Looks like nice work, Bryan.

    Just a few minor questions/comments for now:

    1. The st_fragment/vertex/geometry_program structs now have a
    glsl_to_tgsi field.  I did a grep, but I couldn't find where that
    field is assigned.  Can you clue me in?

It's assigned at the end of the get_mesa_program function in
st_glsl_to_tgsi.cpp.

Thanks.  I was using grep glsl_to_tgsi *.[ch]   Duh.


    2. The above mentioned program structs contains an old Mesa
    instruction program AND/OR(?) a GLSL IR.  Do both types of
    representations co-exist sometimes?  Perhaps you could update the
    comments on those structs to explain that.

They used to co-exist, because after my first commit, st_glsl_to_tgsi
still generated Mesa IR in addition to TGSI.  But I removed the Mesa
IR generation in "st/mesa: stop generating Mesa IR in
st_glsl_to_tgsi", so now it has either one or the other -
glsl_to_tgsi_visitor for GLSL shaders, Mesa IR programs for everything
else.

OK, can you update the comments with this info?


    3. Kind of a follow-on: for glDrawPixels and glBitmap we take the
    original program code (in Mesa form) and prepend extra
    instructions for fetching the fragment color or doing the fragment
    kill.  Do we always have the Mesa instructions for this?  It seems
    we don't normally want to generate Mesa instructions all the time
    but we still need them sometimes.

No, I didn't realize Mesa did that, and we don't have the Mesa
instructions for GLSL programs anymore.  I'm not sure what the
right way to handle that is.

How hard would it be to edit the IR to insert the extra operations?

For glBitmaps it's basically sample a texture and then do a conditional fragment kill. For glDrawPixels we need to sample the texture representing the image, then apply the pixel transfer ops (scale/bias, table lookup, etc). We generate the code for that in st_atom_pixeltransfer.c. That program is then concatenated with the current fragment program with _mesa_combine_program().

If we ever propogate GLSL IR through the gallium interface there's lots of places where we'll need to do other kinds of IR editing.

-Brian
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to