1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/gl/gl_glx_api_implementation.h"
6 #include "ui/gl/gl_implementation.h"
10 RealGLXApi
* g_real_glx
;
12 void InitializeStaticGLBindingsGLX() {
13 g_driver_glx
.InitializeStaticBindings();
15 g_real_glx
= new RealGLXApi();
17 g_real_glx
->Initialize(&g_driver_glx
);
18 g_current_glx_context
= g_real_glx
;
21 void InitializeDynamicGLBindingsGLX(GLContext
* context
) {
22 g_driver_glx
.InitializeDynamicBindings(context
);
25 void InitializeDebugGLBindingsGLX() {
26 g_driver_glx
.InitializeDebugBindings();
29 void ClearGLBindingsGLX() {
34 g_current_glx_context
= NULL
;
35 g_driver_glx
.ClearBindings();
44 GLXApiBase::GLXApiBase()
48 GLXApiBase::~GLXApiBase() {
51 void GLXApiBase::InitializeBase(DriverGLX
* driver
) {
55 RealGLXApi::RealGLXApi() {
58 RealGLXApi::~RealGLXApi() {
61 void RealGLXApi::Initialize(DriverGLX
* driver
) {
62 InitializeBase(driver
);
65 TraceGLXApi::~TraceGLXApi() {
68 bool GetGLWindowSystemBindingInfoGLX(GLWindowSystemBindingInfo
* info
) {
69 Display
* display
= glXGetCurrentDisplay();
70 const int kDefaultScreen
= 0;
72 glXQueryServerString(display
, kDefaultScreen
, GLX_VENDOR
);
74 glXQueryServerString(display
, kDefaultScreen
, GLX_VERSION
);
75 const char* extensions
=
76 glXQueryServerString(display
, kDefaultScreen
, GLX_EXTENSIONS
);
77 *info
= GLWindowSystemBindingInfo();
79 info
->vendor
= vendor
;
81 info
->version
= version
;
83 info
->extensions
= extensions
;
84 info
->direct_rendering
= !!glXIsDirect(display
, glXGetCurrentContext());