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

Unified Diff: client/deps/glbench/src/egl_stuff.cc

Issue 1219003: Store GLXFBConfig and get X visual ID from it. (Closed)
Patch Set: Don't redeclare variables. Created 10 years, 9 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
« no previous file with comments | « no previous file | client/deps/glbench/src/glx_stuff.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/deps/glbench/src/egl_stuff.cc
diff --git a/client/deps/glbench/src/egl_stuff.cc b/client/deps/glbench/src/egl_stuff.cc
index 0887cc0aad2837da84b85f9f5d768ba9dcb974c3..4124072940984fd7ec90d2198711325a0b84bb57 100644
--- a/client/deps/glbench/src/egl_stuff.cc
+++ b/client/deps/glbench/src/egl_stuff.cc
@@ -4,6 +4,7 @@
#include <EGL/egl.h>
+#include "base/logging.h"
#include "main.h"
#include "xlib_window.h"
@@ -29,39 +30,46 @@ bool Init() {
return true;
}
-VisualID GetVisualID() {
- EGLint attribs[] = {
- EGL_RED_SIZE, 1,
- EGL_GREEN_SIZE, 1,
- EGL_BLUE_SIZE, 1,
- EGL_DEPTH_SIZE, 1,
- EGL_STENCIL_SIZE, 1,
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_NONE
- };
-
- EGLNativeDisplayType native_display =
+XVisualInfo* GetXVisual() {
+ if (!egl_config) {
+ EGLint attribs[] = {
+ EGL_RED_SIZE, 1,
+ EGL_GREEN_SIZE, 1,
+ EGL_BLUE_SIZE, 1,
+ EGL_DEPTH_SIZE, 1,
+ EGL_STENCIL_SIZE, 1,
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+ EGL_NONE
+ };
+
+ EGLNativeDisplayType native_display =
static_cast<EGLNativeDisplayType>(g_xlib_display);
- EGLDisplay egl_display = eglGetDisplay(native_display);
- CHECK_EGL();
+ egl_display = eglGetDisplay(native_display);
+ CHECK_EGL();
- eglInitialize(egl_display, NULL, NULL);
- CHECK_EGL();
+ eglInitialize(egl_display, NULL, NULL);
+ CHECK_EGL();
- EGLint num_configs = -1;
- eglGetConfigs(egl_display, NULL, 0, &num_configs);
- CHECK_EGL();
+ EGLint num_configs = -1;
+ eglGetConfigs(egl_display, NULL, 0, &num_configs);
+ CHECK_EGL();
- EGLConfig egl_config;
- eglChooseConfig(egl_display, attribs, &egl_config, 1, &num_configs);
- CHECK_EGL();
+ eglChooseConfig(egl_display, attribs, &egl_config, 1, &num_configs);
+ CHECK_EGL();
+ }
EGLint visual_id;
eglGetConfigAttrib(egl_display, egl_config, EGL_NATIVE_VISUAL_ID, &visual_id);
CHECK_EGL();
- return static_cast<VisualID>(visual_id);
+ XVisualInfo vinfo_template;
+ vinfo_template.visualid = static_cast<VisualID>(visual_id);
+ int nitems = 0;
+ XVisualInfo* ret = XGetVisualInfo(g_xlib_display, VisualIDMask,
+ &vinfo_template, &nitems);
+ CHECK(nitems == 1);
+ return ret;
}
bool InitContext() {
« no previous file with comments | « no previous file | client/deps/glbench/src/glx_stuff.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698