2 * OpenGL ES 2.0 memory performance estimator
3 * Copyright (C) 2009 Nokia
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 * \author Sami Kyöstilä <sami.kyostila@nokia.com>
21 * CPU texture streaming test
23 #ifndef CPUINTERLEAVINGTEST_H
24 #define CPUINTERLEAVINGTEST_H
30 #include <X11/extensions/XShm.h>
32 enum CPUInterleavingMethod
36 /*CPUI_XSHM_PIXMAP, xshm pixmaps are generally not supported anymore */
37 CPUI_IMG_TEXTURE_STREAMING,
38 CPUI_PIXEL_BUFFER_OBJECT,
39 CPUI_EGL_LOCK_SURFACE,
42 const int CPUI_MAX_BUFFERS = 2;
44 class CPUInterleavingTest: public BlitTest
46 CPUInterleavingMethod m_method;
48 GLuint m_textures[CPUI_MAX_BUFFERS];
50 char* m_textureData[CPUI_MAX_BUFFERS];
52 int m_dataBitsPerPixel;
57 Pixmap m_pixmaps[CPUI_MAX_BUFFERS];
58 EGLSurface m_surfaces[CPUI_MAX_BUFFERS];
61 XShmSegmentInfo m_shminfo[CPUI_MAX_BUFFERS];
62 XImage* m_ximage[CPUI_MAX_BUFFERS];
63 GC m_gc[CPUI_MAX_BUFFERS];
64 int m_completionEvent;
65 std::map<Drawable, int> m_drawableIndex;
66 bool m_writeCompleted[CPUI_MAX_BUFFERS];
69 CPUInterleavingTest(CPUInterleavingMethod method, int buffers,
71 int width, int height,
72 float texW = 1.0f, float texH = 1.0f);
75 void operator()(int frame);
78 std::string name() const;
81 #endif // CPUINTERLEAVINGTEST_H