[Mesa-dev] GSoC : OpenCL over Gallium3D

Denis Steckelmacher steckdenis at yahoo.fr
Sat Mar 26 13:52:22 PDT 2011


After some messages on this list, I reconsidered my GSoC proposal and decided 
to give a try at an OpenCL state tracker. I will base my work on the Clover 
branch of Mesa.

I read its code, which is very well-done and clean, but I saw one big 
difficulty : I don't know how to translate LLVM IR to TGSI. The big problem is 
that TGSI is made mostly with OpenGL in mind. We can use it to decode video 
frames using vertex and fragment shader stages, but using it to run on the GPU 
the complex output given by LLVM, and without using any part of the OpenGL 
pipeline (OpenCL can be used to do mathematics, and that doesn't draw anything 
on the screen), is tricky.

The problem is how OpenCL can upload data on the GPU and then download the 
computed results. One solution may be to create one or more textures 
containing the input data (maybe one texture by input data type), and then use 
a fragment shader to compute the resulting values and to put them in a render 
buffer that will never be drawn on screen but instead downloaded from the GPU 
and sent back to the application.

I don't know if it would be possible to do things like that, especially 
considering that precise results across all graphics cards may be difficult to 
get with OpenGL. An other problem of this LLVM to TGSI conversion is that the 
TGSI instruction set is not completely implemented on all the pipe drivers, 
and that unimplemented instructions may be needed by a specific LLVM IR 

I'm open to any suggestion regarding this OpenCL state tracker. If you say it 
will be very difficult to do that during the summer, I think I will apply to 
work on the OpenGL 3+ support in Mesa (without doing a new state tracker) and 
the GLSL compiler.

Best regards,
Denis Steckelmacher.

More information about the mesa-dev mailing list