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 InitializeDebugGLBindingsGLX() {
22 g_driver_glx
.InitializeDebugBindings();
25 void ClearGLBindingsGLX() {
30 g_current_glx_context
= NULL
;
31 g_driver_glx
.ClearBindings();
40 GLXApiBase::GLXApiBase()
44 GLXApiBase::~GLXApiBase() {
47 void GLXApiBase::InitializeBase(DriverGLX
* driver
) {
51 RealGLXApi::RealGLXApi() {
54 RealGLXApi::~RealGLXApi() {
57 void RealGLXApi::Initialize(DriverGLX
* driver
) {
58 InitializeBase(driver
);
61 TraceGLXApi::~TraceGLXApi() {
64 bool GetGLWindowSystemBindingInfoGLX(GLWindowSystemBindingInfo
* info
) {
65 Display
* display
= glXGetCurrentDisplay();
66 const int kDefaultScreen
= 0;
68 glXQueryServerString(display
, kDefaultScreen
, GLX_VENDOR
);
70 glXQueryServerString(display
, kDefaultScreen
, GLX_VERSION
);
71 const char* extensions
=
72 glXQueryServerString(display
, kDefaultScreen
, GLX_EXTENSIONS
);
73 *info
= GLWindowSystemBindingInfo();
75 info
->vendor
= vendor
;
77 info
->version
= version
;
79 info
->extensions
= extensions
;
80 info
->direct_rendering
= !!glXIsDirect(display
, glXGetCurrentContext());