Design choices - JayFoxRox/xqemu-jfr GitHub Wiki

CGL/WGL/GLX/EGL differences (unresolved)

There are a couple of issues with how we load OpenGL extensions:

  • WGL uses GLEW to make all functions available
  • GLX uses GLEW to make all functions available
  • EGL is not supported by GLEW yet(?) and hence glo_get_extension_proc() was added
  • CGL provides all extensions by default and doesn't provie a GetProcAddress function. This results in problems with extensions which are not implemented in the driver but in the environment.

Problem 1: In the case of xqemu these are the GL debugging functions. As CGL does not provide these natively we can't assume to have them at compile time, yet we can't query them at runtime either. Solution 1: We could probably provide a wrapper function using NSLookupAndBindSymbol around the required OGL extensions [in gloffscreen_cgl.c]

Problem: As EGL is not able to work with GLEW yet we can't just assume the framework provides everything and we have to manually import functions using glo_get_extension_proc(), however, we are not able to use the original function names for pointers because those names are already reserved with gloffscreen_cgl. Solution 2: use something like gl.OpenGLExtensionFuntion() which is resolved at startup [probably in nv2a.c]

Solution 3: Provide wrappers for debugging functions within gloffscreen and disable those on apple/CGL unless we figure out if apitrace even adds those functions to the framework somehow

Surfaceless OpenGL (unresolved)

  • GLX seems to support this for no appearent reason even though it shouldn't
  • WGL requires a surface to get the context with the same format (We use a 16x16 PBuffer for that purpose)
  • EGL supports a surfaceless context using the EGL_KHR_surfaceless_context extension
  • CGL supports a surfaceless context natively

However, apitrace doesn't support a surfaceless context so we still create one in EGL and possibly GLX (#if 1 in gloffscreen_egl). WGL has the context anyway, wether apitrace works fine with CGL has not been tested yet. Once apitrace and most drivers are fixed we should attempt to switch to a surfaceless context as default.