VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlayCommon.h@ 43138

Last change on this file since 43138 was 39816, checked in by vboxsync, 12 years ago

fix DEBUG_misha builds for linux host

  • Property svn:eol-style set to native
File size: 3.3 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VBoxFrameBuffer Overly classes declarations
5 */
6
7/*
8 * Copyright (C) 2009 Oracle Corporation
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#ifndef __VBoxFBOverlayCommon_h__
19#define __VBoxFBOverlayCommon_h__
20
21#if 0 //defined(DEBUG_misha)
22DECLINLINE(VOID) vboxDbgPrintF(LPCSTR szString, ...)
23{
24 char szBuffer[4096] = {0};
25 va_list pArgList;
26 va_start(pArgList, szString);
27 _vsnprintf(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]), szString, pArgList);
28 va_end(pArgList);
29
30 OutputDebugStringA(szBuffer);
31}
32
33# include "iprt/stream.h"
34# define VBOXQGLLOG(_m) RTPrintf _m
35# define VBOXQGLLOGREL(_m) do { RTPrintf _m ; LogRel( _m ); } while(0)
36# define VBOXQGLDBGPRINT(_m) vboxDbgPrintF _m
37#else
38# define VBOXQGLLOG(_m) do {}while(0)
39# define VBOXQGLLOGREL(_m) LogRel( _m )
40# define VBOXQGLDBGPRINT(_m) do {}while(0)
41#endif
42#define VBOXQGLLOG_ENTER(_m) do {}while(0)
43//do{VBOXQGLLOG(("==>[%s]:", __FUNCTION__)); VBOXQGLLOG(_m);}while(0)
44#define VBOXQGLLOG_EXIT(_m) do {}while(0)
45//do{VBOXQGLLOG(("<==[%s]:", __FUNCTION__)); VBOXQGLLOG(_m);}while(0)
46#ifdef DEBUG
47 #define VBOXQGL_ASSERTNOERR() \
48 do { GLenum err = glGetError(); \
49 if(err != GL_NO_ERROR) VBOXQGLLOG(("gl error occurred (0x%x)\n", err)); \
50 Assert(err == GL_NO_ERROR); \
51 }while(0)
52
53 #define VBOXQGL_CHECKERR(_op) \
54 do { \
55 glGetError(); \
56 _op \
57 VBOXQGL_ASSERTNOERR(); \
58 }while(0)
59#else
60 #define VBOXQGL_ASSERTNOERR() \
61 do {}while(0)
62
63 #define VBOXQGL_CHECKERR(_op) \
64 do { \
65 _op \
66 }while(0)
67#endif
68
69#ifdef DEBUG
70#include <iprt/time.h>
71
72#define VBOXGETTIME() RTTimeNanoTS()
73
74#define VBOXPRINTDIF(_nano, _m) do{\
75 uint64_t cur = VBOXGETTIME(); NOREF(cur); \
76 VBOXQGLLOG(_m); \
77 VBOXQGLLOG(("(%Lu)\n", cur - (_nano))); \
78 }while(0)
79
80class VBoxVHWADbgTimeCounter
81{
82public:
83 VBoxVHWADbgTimeCounter(const char* msg) {mTime = VBOXGETTIME(); mMsg=msg;}
84 ~VBoxVHWADbgTimeCounter() {VBOXPRINTDIF(mTime, (mMsg));}
85private:
86 uint64_t mTime;
87 const char* mMsg;
88};
89
90#define VBOXQGLLOG_METHODTIME(_m) VBoxVHWADbgTimeCounter _dbgTimeCounter(_m)
91
92#define VBOXQG_CHECKCONTEXT() \
93 { \
94 const GLubyte * str; \
95 VBOXQGL_CHECKERR( \
96 str = glGetString(GL_VERSION); \
97 ); \
98 Assert(str); \
99 if(str) \
100 { \
101 Assert(str[0]); \
102 } \
103 }
104#else
105#define VBOXQGLLOG_METHODTIME(_m)
106#define VBOXQG_CHECKCONTEXT() do{}while(0)
107#endif
108
109#define VBOXQGLLOG_QRECT(_p, _pr, _s) do{\
110 VBOXQGLLOG((_p " x(%d), y(%d), w(%d), h(%d)" _s, (_pr)->x(), (_pr)->y(), (_pr)->width(), (_pr)->height()));\
111 }while(0)
112
113#define VBOXQGLLOG_CKEY(_p, _pck, _s) do{\
114 VBOXQGLLOG((_p " l(0x%x), u(0x%x)" _s, (_pck)->lower(), (_pck)->upper()));\
115 }while(0)
116
117#endif /* #ifndef __VBoxFBOverlayCommon_h__ */
118
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use