1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxFrameBuffer Overly classes declarations
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2009 Sun Microsystems, Inc.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 | #ifndef __VBoxFBOverlayCommon_h__
|
---|
23 | #define __VBoxFBOverlayCommon_h__
|
---|
24 |
|
---|
25 | #if defined(DEBUG) && !defined(DEBUG_sandervl)
|
---|
26 | # include "iprt/stream.h"
|
---|
27 | # define VBOXQGLLOG(_m) RTPrintf _m
|
---|
28 | # define VBOXQGLLOGREL(_m) do { RTPrintf _m ; LogRel( _m ); } while(0)
|
---|
29 | #else
|
---|
30 | # define VBOXQGLLOG(_m) do {}while(0)
|
---|
31 | # define VBOXQGLLOGREL(_m) LogRel( _m )
|
---|
32 | #endif
|
---|
33 | #define VBOXQGLLOG_ENTER(_m)
|
---|
34 | //do{VBOXQGLLOG(("==>[%s]:", __FUNCTION__)); VBOXQGLLOG(_m);}while(0)
|
---|
35 | #define VBOXQGLLOG_EXIT(_m)
|
---|
36 | //do{VBOXQGLLOG(("<==[%s]:", __FUNCTION__)); VBOXQGLLOG(_m);}while(0)
|
---|
37 | #ifdef DEBUG
|
---|
38 | #define VBOXQGL_ASSERTNOERR() \
|
---|
39 | do { GLenum err = glGetError(); \
|
---|
40 | if(err != GL_NO_ERROR) VBOXQGLLOG(("gl error ocured (0x%x)\n", err)); \
|
---|
41 | Assert(err == GL_NO_ERROR); \
|
---|
42 | }while(0)
|
---|
43 |
|
---|
44 | #define VBOXQGL_CHECKERR(_op) \
|
---|
45 | do { \
|
---|
46 | glGetError(); \
|
---|
47 | _op \
|
---|
48 | VBOXQGL_ASSERTNOERR(); \
|
---|
49 | }while(0)
|
---|
50 | #else
|
---|
51 | #define VBOXQGL_ASSERTNOERR() \
|
---|
52 | do {}while(0)
|
---|
53 |
|
---|
54 | #define VBOXQGL_CHECKERR(_op) \
|
---|
55 | do { \
|
---|
56 | _op \
|
---|
57 | }while(0)
|
---|
58 | #endif
|
---|
59 |
|
---|
60 | #ifdef DEBUG
|
---|
61 | #include <iprt/time.h>
|
---|
62 |
|
---|
63 | #define VBOXGETTIME() RTTimeNanoTS()
|
---|
64 |
|
---|
65 | #define VBOXPRINTDIF(_nano, _m) do{\
|
---|
66 | uint64_t cur = VBOXGETTIME(); \
|
---|
67 | VBOXQGLLOG(_m); \
|
---|
68 | VBOXQGLLOG(("(%Lu)\n", cur - (_nano))); \
|
---|
69 | }while(0)
|
---|
70 |
|
---|
71 | class VBoxVHWADbgTimeCounter
|
---|
72 | {
|
---|
73 | public:
|
---|
74 | VBoxVHWADbgTimeCounter(const char* msg) {mTime = VBOXGETTIME(); mMsg=msg;}
|
---|
75 | ~VBoxVHWADbgTimeCounter() {VBOXPRINTDIF(mTime, (mMsg));}
|
---|
76 | private:
|
---|
77 | uint64_t mTime;
|
---|
78 | const char* mMsg;
|
---|
79 | };
|
---|
80 |
|
---|
81 | #define VBOXQGLLOG_METHODTIME(_m) VBoxVHWADbgTimeCounter _dbgTimeCounter(_m)
|
---|
82 |
|
---|
83 | #define VBOXQG_CHECKCONTEXT() \
|
---|
84 | { \
|
---|
85 | const GLubyte * str; \
|
---|
86 | VBOXQGL_CHECKERR( \
|
---|
87 | str = glGetString(GL_VERSION); \
|
---|
88 | ); \
|
---|
89 | Assert(str); \
|
---|
90 | if(str) \
|
---|
91 | { \
|
---|
92 | Assert(str[0]); \
|
---|
93 | } \
|
---|
94 | }
|
---|
95 | #else
|
---|
96 | #define VBOXQGLLOG_METHODTIME(_m)
|
---|
97 | #define VBOXQG_CHECKCONTEXT() do{}while(0)
|
---|
98 | #endif
|
---|
99 |
|
---|
100 | #define VBOXQGLLOG_QRECT(_p, _pr, _s) do{\
|
---|
101 | VBOXQGLLOG((_p " x(%d), y(%d), w(%d), h(%d)" _s, (_pr)->x(), (_pr)->y(), (_pr)->width(), (_pr)->height()));\
|
---|
102 | }while(0)
|
---|
103 |
|
---|
104 | #define VBOXQGLLOG_CKEY(_p, _pck, _s) do{\
|
---|
105 | VBOXQGLLOG((_p " l(0x%x), u(0x%x)" _s, (_pck)->lower(), (_pck)->upper()));\
|
---|
106 | }while(0)
|
---|
107 |
|
---|
108 | #endif /* #ifndef __VBoxFBOverlayCommon_h__ */
|
---|