Files
Sungun Park 1e77947758 Add glFramebufferTextureMultisampleMultiviewOVR for multiview MSAA (#8755)
This commit adds the `glFramebufferTextureMultisampleMultiviewOVR`
function, enabling MSAA to work in conjunction with the multiview
extension.

The function's declaration is present in the latest main branch of the
Khronos GLES2 API headers. While directly pulling these updated headers
is the ideal approach, it would necessitate a significant reorganization
of Filament's current header file structure and incorporate more files
than currently needed.

To minimize immediate changes and limit scope, this change adopts
only the necessary function declaration by copying it directly.

BUGS=[417311684]
2025-05-16 23:50:12 +00:00
..
2018-08-03 10:38:22 -07:00

BlueGL Mechanics

So you want to call glClear()?

Step 0: Run bluegl-gen.py

This step is only required if updating or modifying BlueGL. These artifacts should already be checked into the Filament repository.

From the libs/bluegl folder, run:

./bluegl-gen.py

The bluegl-gen.py script generates a set of files:

  • assembly (proxy) files: BlueGLCore*.S
  • header files: include/BlueGLDefines.h and include/bluegl/BlueGL.h
  • a private header:include/private_BlueGL.h

Step 1: Include the BlueGL defines header:

#include <bluegl/BlueGLDefines.h>

This headers adds a bunch of defines:

...
#define glClear bluegl_glClear
...

Step 2: Include the BlueGL header after the defines header:

#include <bluegl/BlueGLDefines.h>
#include <bluegl/BlueGL.h>

This also includes the GL headers, like <GL/glcorearb.h> for you.

Step 3: Call bluegl::bind()

Internally, the BlueGL library maintains a list of function pointers:

void* __blue_glCore_glClear;

During bluegl::bind(), each function gets assigned to the appropriate symbol loaded from the OS-specific GL shared library via dlopen, dlsym, and equivalents.

Step 4: Call glClear()

Because of the prior #define, you'll actually be calling bluegl_glClear(). This is a trampoline function, defined in the BlueGLCore*.S assembly file (the exact implementation varies slightly on each platform):

.private_extern _bluegl_glClear
_bluegl_glClear:
    mov ___blue_glCore_glClear@GOTPCREL(%rip), %r11
    jmp *(%r11)

The invokes the __blue_glCore_glClear function, which was previously assigned to the actual GL function.