xref: /aosp_15_r20/external/mesa3d/docs/osmesa.rst (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1*61046927SAndroid Build Coastguard WorkerOff-screen Rendering
2*61046927SAndroid Build Coastguard Worker====================
3*61046927SAndroid Build Coastguard Worker
4*61046927SAndroid Build Coastguard WorkerMesa's off-screen interface is used for rendering into user-allocated
5*61046927SAndroid Build Coastguard Workermemory without any sort of window system or operating system
6*61046927SAndroid Build Coastguard Workerdependencies. That is, the GL_FRONT colorbuffer is actually a buffer in
7*61046927SAndroid Build Coastguard Workermain memory, rather than a window on your display.
8*61046927SAndroid Build Coastguard Worker
9*61046927SAndroid Build Coastguard WorkerThe OSMesa API provides three basic functions for making off-screen
10*61046927SAndroid Build Coastguard Workerrenderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and
11*61046927SAndroid Build Coastguard WorkerOSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for more
12*61046927SAndroid Build Coastguard Workerinformation about the API functions.
13*61046927SAndroid Build Coastguard Worker
14*61046927SAndroid Build Coastguard WorkerThe OSMesa interface may be used with the gallium software renderers:
15*61046927SAndroid Build Coastguard Worker
16*61046927SAndroid Build Coastguard Worker#. LLVMpipe - this is the high-performance Gallium LLVM driver
17*61046927SAndroid Build Coastguard Worker#. Softpipe - this is the reference Gallium software driver
18*61046927SAndroid Build Coastguard Worker
19*61046927SAndroid Build Coastguard WorkerThere are several examples of OSMesa in the mesa/demos repository.
20*61046927SAndroid Build Coastguard Worker
21*61046927SAndroid Build Coastguard WorkerBuilding OSMesa
22*61046927SAndroid Build Coastguard Worker---------------
23*61046927SAndroid Build Coastguard Worker
24*61046927SAndroid Build Coastguard WorkerConfigure and build Mesa with something like:
25*61046927SAndroid Build Coastguard Worker
26*61046927SAndroid Build Coastguard Worker.. code-block:: sh
27*61046927SAndroid Build Coastguard Worker
28*61046927SAndroid Build Coastguard Worker   meson setup builddir -Dosmesa=true -Dgallium-drivers=swrast -Dvulkan-drivers=[] -Dprefix=$PWD/builddir/install
29*61046927SAndroid Build Coastguard Worker   meson install -C builddir
30*61046927SAndroid Build Coastguard Worker
31*61046927SAndroid Build Coastguard WorkerMake sure you have LLVM installed first if you want to use the LLVMpipe
32*61046927SAndroid Build Coastguard Workerdriver.
33*61046927SAndroid Build Coastguard Worker
34*61046927SAndroid Build Coastguard WorkerWhen the build is complete you should find:
35*61046927SAndroid Build Coastguard Worker
36*61046927SAndroid Build Coastguard Worker::
37*61046927SAndroid Build Coastguard Worker
38*61046927SAndroid Build Coastguard Worker   $PWD/builddir/install/lib/libOSMesa.so
39*61046927SAndroid Build Coastguard Worker
40*61046927SAndroid Build Coastguard WorkerSet your LD_LIBRARY_PATH to point to $PWD/builddir/install to use the
41*61046927SAndroid Build Coastguard Workerlibraries
42*61046927SAndroid Build Coastguard Worker
43*61046927SAndroid Build Coastguard WorkerWhen you link your application, link with -lOSMesa
44