Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Unified Diff: ui/gl/gl_bindings_autogen_glx.cc

Issue 871763002: Make GL bindings conditional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gl/gl_bindings_autogen_glx.cc
diff --git a/ui/gl/gl_bindings_autogen_glx.cc b/ui/gl/gl_bindings_autogen_glx.cc
index 617ff5fc6b4df5518ec8ee97b83e9f76410aa33e..59960f50a3b95a192042e87ed32871ccccd64dd7 100644
--- a/ui/gl/gl_bindings_autogen_glx.cc
+++ b/ui/gl/gl_bindings_autogen_glx.cc
@@ -23,22 +23,84 @@ namespace gfx {
static bool g_debugBindingsInitialized;
DriverGLX g_driver_glx;
+void glXBindTexImageEXTNotBound(Display* dpy,
+ GLXDrawable drawable,
+ int buffer,
+ int* attribList) {
+ NOTREACHED();
+}
+void glXCopySubBufferMESANotBound(Display* dpy,
+ GLXDrawable drawable,
+ int x,
+ int y,
+ int width,
+ int height) {
+ NOTREACHED();
+}
+GLXContext glXCreateContextAttribsARBNotBound(Display* dpy,
+ GLXFBConfig config,
+ GLXContext share_context,
+ int direct,
+ const int* attrib_list) {
+ NOTREACHED();
+ return 0;
+}
+GLXFBConfig glXGetFBConfigFromVisualSGIXNotBound(Display* dpy,
+ XVisualInfo* visualInfo) {
+ NOTREACHED();
+ return 0;
+}
+bool glXGetMscRateOMLNotBound(Display* dpy,
+ GLXDrawable drawable,
+ int32* numerator,
+ int32* denominator) {
+ NOTREACHED();
+ return 0;
+}
+bool glXGetSyncValuesOMLNotBound(Display* dpy,
+ GLXDrawable drawable,
+ int64* ust,
+ int64* msc,
+ int64* sbc) {
+ NOTREACHED();
+ return 0;
+}
+void glXReleaseTexImageEXTNotBound(Display* dpy,
+ GLXDrawable drawable,
+ int buffer) {
+ NOTREACHED();
+}
+void glXSwapIntervalEXTNotBound(Display* dpy,
+ GLXDrawable drawable,
+ int interval) {
+ NOTREACHED();
+}
+void glXSwapIntervalMESANotBound(unsigned int interval) {
+ NOTREACHED();
+}
+int glXWaitVideoSyncSGINotBound(int divisor,
+ int remainder,
+ unsigned int* count) {
+ NOTREACHED();
+ return 0;
+}
+
void DriverGLX::InitializeStaticBindings() {
- fn.glXBindTexImageEXTFn = reinterpret_cast<glXBindTexImageEXTProc>(
- GetGLProcAddress("glXBindTexImageEXT"));
+ fn.glXBindTexImageEXTFn =
+ reinterpret_cast<glXBindTexImageEXTProc>(glXBindTexImageEXTNotBound);
fn.glXChooseFBConfigFn = reinterpret_cast<glXChooseFBConfigProc>(
GetGLProcAddress("glXChooseFBConfig"));
fn.glXChooseVisualFn = reinterpret_cast<glXChooseVisualProc>(
GetGLProcAddress("glXChooseVisual"));
fn.glXCopyContextFn =
reinterpret_cast<glXCopyContextProc>(GetGLProcAddress("glXCopyContext"));
- fn.glXCopySubBufferMESAFn = reinterpret_cast<glXCopySubBufferMESAProc>(
- GetGLProcAddress("glXCopySubBufferMESA"));
+ fn.glXCopySubBufferMESAFn =
+ reinterpret_cast<glXCopySubBufferMESAProc>(glXCopySubBufferMESANotBound);
fn.glXCreateContextFn = reinterpret_cast<glXCreateContextProc>(
GetGLProcAddress("glXCreateContext"));
fn.glXCreateContextAttribsARBFn =
reinterpret_cast<glXCreateContextAttribsARBProc>(
- GetGLProcAddress("glXCreateContextAttribsARB"));
+ glXCreateContextAttribsARBNotBound);
fn.glXCreateGLXPixmapFn = reinterpret_cast<glXCreateGLXPixmapProc>(
GetGLProcAddress("glXCreateGLXPixmap"));
fn.glXCreateNewContextFn = reinterpret_cast<glXCreateNewContextProc>(
@@ -76,15 +138,15 @@ void DriverGLX::InitializeStaticBindings() {
GetGLProcAddress("glXGetFBConfigAttrib"));
fn.glXGetFBConfigFromVisualSGIXFn =
reinterpret_cast<glXGetFBConfigFromVisualSGIXProc>(
- GetGLProcAddress("glXGetFBConfigFromVisualSGIX"));
+ glXGetFBConfigFromVisualSGIXNotBound);
fn.glXGetFBConfigsFn = reinterpret_cast<glXGetFBConfigsProc>(
GetGLProcAddress("glXGetFBConfigs"));
- fn.glXGetMscRateOMLFn = reinterpret_cast<glXGetMscRateOMLProc>(
- GetGLProcAddress("glXGetMscRateOML"));
+ fn.glXGetMscRateOMLFn =
+ reinterpret_cast<glXGetMscRateOMLProc>(glXGetMscRateOMLNotBound);
fn.glXGetSelectedEventFn = reinterpret_cast<glXGetSelectedEventProc>(
GetGLProcAddress("glXGetSelectedEvent"));
- fn.glXGetSyncValuesOMLFn = reinterpret_cast<glXGetSyncValuesOMLProc>(
- GetGLProcAddress("glXGetSyncValuesOML"));
+ fn.glXGetSyncValuesOMLFn =
+ reinterpret_cast<glXGetSyncValuesOMLProc>(glXGetSyncValuesOMLNotBound);
fn.glXGetVisualFromFBConfigFn =
reinterpret_cast<glXGetVisualFromFBConfigProc>(
GetGLProcAddress("glXGetVisualFromFBConfig"));
@@ -108,29 +170,24 @@ void DriverGLX::InitializeStaticBindings() {
fn.glXQueryVersionFn = reinterpret_cast<glXQueryVersionProc>(
GetGLProcAddress("glXQueryVersion"));
fn.glXReleaseTexImageEXTFn = reinterpret_cast<glXReleaseTexImageEXTProc>(
- GetGLProcAddress("glXReleaseTexImageEXT"));
+ glXReleaseTexImageEXTNotBound);
fn.glXSelectEventFn =
reinterpret_cast<glXSelectEventProc>(GetGLProcAddress("glXSelectEvent"));
fn.glXSwapBuffersFn =
reinterpret_cast<glXSwapBuffersProc>(GetGLProcAddress("glXSwapBuffers"));
- fn.glXSwapIntervalEXTFn = reinterpret_cast<glXSwapIntervalEXTProc>(
- GetGLProcAddress("glXSwapIntervalEXT"));
- fn.glXSwapIntervalMESAFn = reinterpret_cast<glXSwapIntervalMESAProc>(
- GetGLProcAddress("glXSwapIntervalMESA"));
+ fn.glXSwapIntervalEXTFn =
+ reinterpret_cast<glXSwapIntervalEXTProc>(glXSwapIntervalEXTNotBound);
+ fn.glXSwapIntervalMESAFn =
+ reinterpret_cast<glXSwapIntervalMESAProc>(glXSwapIntervalMESANotBound);
fn.glXUseXFontFn =
reinterpret_cast<glXUseXFontProc>(GetGLProcAddress("glXUseXFont"));
fn.glXWaitGLFn =
reinterpret_cast<glXWaitGLProc>(GetGLProcAddress("glXWaitGL"));
- fn.glXWaitVideoSyncSGIFn = reinterpret_cast<glXWaitVideoSyncSGIProc>(
- GetGLProcAddress("glXWaitVideoSyncSGI"));
+ fn.glXWaitVideoSyncSGIFn =
+ reinterpret_cast<glXWaitVideoSyncSGIProc>(glXWaitVideoSyncSGINotBound);
fn.glXWaitXFn = reinterpret_cast<glXWaitXProc>(GetGLProcAddress("glXWaitX"));
-}
-
-void DriverGLX::InitializeDynamicBindings(GLContext* context) {
- DCHECK(context && context->IsCurrent(NULL));
- const GLVersionInfo* ver = context->GetVersionInfo();
- ALLOW_UNUSED_LOCAL(ver);
- std::string extensions = context->GetExtensions() + " ";
+ std::string extensions(GetPlatformExtensions());
+ extensions += " ";
ALLOW_UNUSED_LOCAL(extensions);
ext.b_GLX_ARB_create_context =
@@ -150,6 +207,120 @@ void DriverGLX::InitializeDynamicBindings(GLContext* context) {
ext.b_GLX_SGI_video_sync =
extensions.find("GLX_SGI_video_sync ") != std::string::npos;
+ fn.glXBindTexImageEXTFn = 0;
+ debug_fn.glXBindTexImageEXTFn = 0;
+ if (ext.b_GLX_EXT_texture_from_pixmap) {
+ fn.glXBindTexImageEXTFn = reinterpret_cast<glXBindTexImageEXTProc>(
+ GetGLProcAddress("glXBindTexImageEXT"));
+ } else {
+ fn.glXBindTexImageEXTFn =
+ reinterpret_cast<glXBindTexImageEXTProc>(glXBindTexImageEXTNotBound);
+ }
+ DCHECK(fn.glXBindTexImageEXTFn);
+
+ fn.glXCopySubBufferMESAFn = 0;
+ debug_fn.glXCopySubBufferMESAFn = 0;
+ if (ext.b_GLX_MESA_copy_sub_buffer) {
+ fn.glXCopySubBufferMESAFn = reinterpret_cast<glXCopySubBufferMESAProc>(
+ GetGLProcAddress("glXCopySubBufferMESA"));
+ } else {
+ fn.glXCopySubBufferMESAFn = reinterpret_cast<glXCopySubBufferMESAProc>(
+ glXCopySubBufferMESANotBound);
+ }
+ DCHECK(fn.glXCopySubBufferMESAFn);
+
+ fn.glXCreateContextAttribsARBFn = 0;
+ debug_fn.glXCreateContextAttribsARBFn = 0;
+ if (ext.b_GLX_ARB_create_context) {
+ fn.glXCreateContextAttribsARBFn =
+ reinterpret_cast<glXCreateContextAttribsARBProc>(
+ GetGLProcAddress("glXCreateContextAttribsARB"));
+ } else {
+ fn.glXCreateContextAttribsARBFn =
+ reinterpret_cast<glXCreateContextAttribsARBProc>(
+ glXCreateContextAttribsARBNotBound);
+ }
+ DCHECK(fn.glXCreateContextAttribsARBFn);
+
+ fn.glXGetFBConfigFromVisualSGIXFn = 0;
+ debug_fn.glXGetFBConfigFromVisualSGIXFn = 0;
+ if (ext.b_GLX_SGIX_fbconfig) {
+ fn.glXGetFBConfigFromVisualSGIXFn =
+ reinterpret_cast<glXGetFBConfigFromVisualSGIXProc>(
+ GetGLProcAddress("glXGetFBConfigFromVisualSGIX"));
+ } else {
+ fn.glXGetFBConfigFromVisualSGIXFn =
+ reinterpret_cast<glXGetFBConfigFromVisualSGIXProc>(
+ glXGetFBConfigFromVisualSGIXNotBound);
+ }
+ DCHECK(fn.glXGetFBConfigFromVisualSGIXFn);
+
+ fn.glXGetMscRateOMLFn = 0;
+ debug_fn.glXGetMscRateOMLFn = 0;
+ if (ext.b_GLX_OML_sync_control) {
+ fn.glXGetMscRateOMLFn = reinterpret_cast<glXGetMscRateOMLProc>(
+ GetGLProcAddress("glXGetMscRateOML"));
+ } else {
+ fn.glXGetMscRateOMLFn =
+ reinterpret_cast<glXGetMscRateOMLProc>(glXGetMscRateOMLNotBound);
+ }
+ DCHECK(fn.glXGetMscRateOMLFn);
+
+ fn.glXGetSyncValuesOMLFn = 0;
+ debug_fn.glXGetSyncValuesOMLFn = 0;
+ if (ext.b_GLX_OML_sync_control) {
+ fn.glXGetSyncValuesOMLFn = reinterpret_cast<glXGetSyncValuesOMLProc>(
+ GetGLProcAddress("glXGetSyncValuesOML"));
+ } else {
+ fn.glXGetSyncValuesOMLFn =
+ reinterpret_cast<glXGetSyncValuesOMLProc>(glXGetSyncValuesOMLNotBound);
+ }
+ DCHECK(fn.glXGetSyncValuesOMLFn);
+
+ fn.glXReleaseTexImageEXTFn = 0;
+ debug_fn.glXReleaseTexImageEXTFn = 0;
+ if (ext.b_GLX_EXT_texture_from_pixmap) {
+ fn.glXReleaseTexImageEXTFn = reinterpret_cast<glXReleaseTexImageEXTProc>(
+ GetGLProcAddress("glXReleaseTexImageEXT"));
+ } else {
+ fn.glXReleaseTexImageEXTFn = reinterpret_cast<glXReleaseTexImageEXTProc>(
+ glXReleaseTexImageEXTNotBound);
+ }
+ DCHECK(fn.glXReleaseTexImageEXTFn);
+
+ fn.glXSwapIntervalEXTFn = 0;
+ debug_fn.glXSwapIntervalEXTFn = 0;
+ if (ext.b_GLX_EXT_swap_control) {
+ fn.glXSwapIntervalEXTFn = reinterpret_cast<glXSwapIntervalEXTProc>(
+ GetGLProcAddress("glXSwapIntervalEXT"));
+ } else {
+ fn.glXSwapIntervalEXTFn =
+ reinterpret_cast<glXSwapIntervalEXTProc>(glXSwapIntervalEXTNotBound);
+ }
+ DCHECK(fn.glXSwapIntervalEXTFn);
+
+ fn.glXSwapIntervalMESAFn = 0;
+ debug_fn.glXSwapIntervalMESAFn = 0;
+ if (ext.b_GLX_MESA_swap_control) {
+ fn.glXSwapIntervalMESAFn = reinterpret_cast<glXSwapIntervalMESAProc>(
+ GetGLProcAddress("glXSwapIntervalMESA"));
+ } else {
+ fn.glXSwapIntervalMESAFn =
+ reinterpret_cast<glXSwapIntervalMESAProc>(glXSwapIntervalMESANotBound);
+ }
+ DCHECK(fn.glXSwapIntervalMESAFn);
+
+ fn.glXWaitVideoSyncSGIFn = 0;
+ debug_fn.glXWaitVideoSyncSGIFn = 0;
+ if (ext.b_GLX_SGI_video_sync) {
+ fn.glXWaitVideoSyncSGIFn = reinterpret_cast<glXWaitVideoSyncSGIProc>(
+ GetGLProcAddress("glXWaitVideoSyncSGI"));
+ } else {
+ fn.glXWaitVideoSyncSGIFn =
+ reinterpret_cast<glXWaitVideoSyncSGIProc>(glXWaitVideoSyncSGINotBound);
+ }
+ DCHECK(fn.glXWaitVideoSyncSGIFn);
+
if (g_debugBindingsInitialized)
InitializeDebugBindings();
}

Powered by Google App Engine
This is Rietveld 408576698