[Mesa-dev] GSoC : OpenCL over Gallium3D

Christoph Bumiller e0425955 at student.tuwien.ac.at
Sat Mar 26 15:41:25 PDT 2011

On 26.03.2011 21:52, Denis Steckelmacher wrote:
> Hello,
> 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 
Gallium has pipe_resource.
You'd create them for device memory allocations and hand them (or their
addresses) to the compute program (not a shader) which would write to /
load from a global memory location lying within such a resource (or you
might say write to the resource).
Then you just map it to read stuff out if you need to.

> 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 
> instruction.
> 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.
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

More information about the mesa-dev mailing list