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

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

Issue 1315007: Added tearing tests for plain texture updates and bind pixmap to texture. (Closed)
Patch Set: 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 | « client/deps/glbench/src/teartest_egl.cc ('k') | client/deps/glbench/src/xlib_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/deps/glbench/src/teartest_glx.cc
diff --git a/client/deps/glbench/src/teartest_glx.cc b/client/deps/glbench/src/teartest_glx.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b00e50edf781bf4e828df56157c9e5e00a950d0e
--- /dev/null
+++ b/client/deps/glbench/src/teartest_glx.cc
@@ -0,0 +1,72 @@
+// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/logging.h"
+
+#include "main.h"
+#include "xlib_window.h"
+#include "glx_stuff.h"
+#include "teartest.h"
+
+
+PFNGLXBINDTEXIMAGEEXTPROC glXBindTexImageEXT = NULL;
+PFNGLXRELEASETEXIMAGEEXTPROC glXReleaseTexImageEXT = NULL;
+
+static GLXPixmap glxpixmap = 0;
+
+
+void InitNative(Pixmap pixmap) {
+ glXBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(
+ glXGetProcAddress(
+ reinterpret_cast<const GLubyte *>("glXBindTexImageEXT")));
+ glXReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(
+ glXGetProcAddress(
+ reinterpret_cast<const GLubyte *>("glXReleaseTexImageEXT")));
+
+ if (!glXBindTexImageEXT)
+ return;
+
+ int rgba, rgb;
+ glXGetFBConfigAttrib(g_xlib_display, g_glx_fbconfig,
+ GLX_BIND_TO_TEXTURE_RGBA_EXT, &rgba);
+ glXGetFBConfigAttrib(g_xlib_display, g_glx_fbconfig,
+ GLX_BIND_TO_TEXTURE_RGB_EXT, &rgb);
+ CHECK(rgba || rgb);
+ const int pixmapAttribs[] = {
+ GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
+ GLX_TEXTURE_FORMAT_EXT,
+ rgba ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT,
+ None
+ };
+
+ glxpixmap = glXCreatePixmap(g_xlib_display, g_glx_fbconfig,
+ pixmap, pixmapAttribs);
+}
+
+bool UpdateBindTexImage(TestState state, int shift) {
+ if (!glXBindTexImageEXT) {
+ printf("# Could not load glXBindTexImageEXT\n");
+ return false;
+ }
+
+ switch (state) {
+ case TestStart:
+ printf("# Update pixmap bound to texture.\n");
+ InitializePixmap();
+ CopyPixmapToTexture();
+ glXBindTexImageEXT(g_xlib_display, glxpixmap, GLX_FRONT_LEFT_EXT, NULL);
+ break;
+
+ case TestLoop:
+ glXReleaseTexImageEXT(g_xlib_display, glxpixmap, GLX_FRONT_LEFT_EXT);
+ UpdatePixmap(shift);
+ glXBindTexImageEXT(g_xlib_display, glxpixmap, GLX_FRONT_LEFT_EXT, NULL);
+ break;
+
+ case TestStop:
+ glXReleaseTexImageEXT(g_xlib_display, glxpixmap, GLX_FRONT_LEFT_EXT);
+ break;
+ }
+ return true;
+}
« no previous file with comments | « client/deps/glbench/src/teartest_egl.cc ('k') | client/deps/glbench/src/xlib_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698