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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium OS 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.
4
5 #include "base/logging.h"
6
7 #include "main.h"
8 #include "xlib_window.h"
9 #include "glx_stuff.h"
10 #include "teartest.h"
11
12
13 PFNGLXBINDTEXIMAGEEXTPROC glXBindTexImageEXT = NULL;
14 PFNGLXRELEASETEXIMAGEEXTPROC glXReleaseTexImageEXT = NULL;
15
16 static GLXPixmap glxpixmap = 0;
17
18
19 void InitNative(Pixmap pixmap) {
20 glXBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(
21 glXGetProcAddress(
22 reinterpret_cast<const GLubyte *>("glXBindTexImageEXT")));
23 glXReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(
24 glXGetProcAddress(
25 reinterpret_cast<const GLubyte *>("glXReleaseTexImageEXT")));
26
27 if (!glXBindTexImageEXT)
28 return;
29
30 int rgba, rgb;
31 glXGetFBConfigAttrib(g_xlib_display, g_glx_fbconfig,
32 GLX_BIND_TO_TEXTURE_RGBA_EXT, &rgba);
33 glXGetFBConfigAttrib(g_xlib_display, g_glx_fbconfig,
34 GLX_BIND_TO_TEXTURE_RGB_EXT, &rgb);
35 CHECK(rgba || rgb);
36 const int pixmapAttribs[] = {
37 GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
38 GLX_TEXTURE_FORMAT_EXT,
39 rgba ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT,
40 None
41 };
42
43 glxpixmap = glXCreatePixmap(g_xlib_display, g_glx_fbconfig,
44 pixmap, pixmapAttribs);
45 }
46
47 bool UpdateBindTexImage(TestState state, int shift) {
48 if (!glXBindTexImageEXT) {
49 printf("# Could not load glXBindTexImageEXT\n");
50 return false;
51 }
52
53 switch (state) {
54 case TestStart:
55 printf("# Update pixmap bound to texture.\n");
56 InitializePixmap();
57 CopyPixmapToTexture();
58 glXBindTexImageEXT(g_xlib_display, glxpixmap, GLX_FRONT_LEFT_EXT, NULL);
59 break;
60
61 case TestLoop:
62 glXReleaseTexImageEXT(g_xlib_display, glxpixmap, GLX_FRONT_LEFT_EXT);
63 UpdatePixmap(shift);
64 glXBindTexImageEXT(g_xlib_display, glxpixmap, GLX_FRONT_LEFT_EXT, NULL);
65 break;
66
67 case TestStop:
68 glXReleaseTexImageEXT(g_xlib_display, glxpixmap, GLX_FRONT_LEFT_EXT);
69 break;
70 }
71 return true;
72 }
OLDNEW
« 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