VirtualBox

source: vbox/trunk/src/VBox/Main/src-helper-apps/OpenGLTest/VBoxFBOverlayCommon.h@ 91575

Last change on this file since 91575 was 84793, checked in by vboxsync, 4 years ago

Main/Helpers: Build fix for r138593.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: VBoxFBOverlayCommon.h 84793 2020-06-11 13:31:10Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - VBoxFrameBuffer Overlay classes declarations.
4 */
5
6/*
7 * Copyright (C) 2009-2020 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef MAIN_INCLUDED_SRC_src_helper_apps_OpenGLTest_VBoxFBOverlayCommon_h
19#define MAIN_INCLUDED_SRC_src_helper_apps_OpenGLTest_VBoxFBOverlayCommon_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#if 0 //defined(DEBUG_misha)
25DECLINLINE(VOID) vboxDbgPrintF(LPCSTR szString, ...)
26{
27 char szBuffer[4096] = {0};
28 va_list pArgList;
29 va_start(pArgList, szString);
30 _vsnprintf(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]), szString, pArgList);
31 va_end(pArgList);
32
33 OutputDebugStringA(szBuffer);
34}
35
36# include "iprt/stream.h"
37# define VBOXQGLLOG(_m) RTPrintf _m
38# define VBOXQGLLOGREL(_m) do { RTPrintf _m ; LogRel( _m ); } while(0)
39# define VBOXQGLDBGPRINT(_m) vboxDbgPrintF _m
40#else
41# define VBOXQGLLOG(_m) do {}while(0)
42# define VBOXQGLLOGREL(_m) LogRel( _m )
43# define VBOXQGLDBGPRINT(_m) do {}while(0)
44#endif
45#define VBOXQGLLOG_ENTER(_m) do {}while(0)
46//do{VBOXQGLLOG(("==>[%s]:", __FUNCTION__)); VBOXQGLLOG(_m);}while(0)
47#define VBOXQGLLOG_EXIT(_m) do {}while(0)
48//do{VBOXQGLLOG(("<==[%s]:", __FUNCTION__)); VBOXQGLLOG(_m);}while(0)
49#ifdef DEBUG
50 #define VBOXQGL_ASSERTNOERR() \
51 do { GLenum err = glGetError(); \
52 if(err != GL_NO_ERROR) VBOXQGLLOG(("gl error occurred (0x%x)\n", err)); \
53 Assert(err == GL_NO_ERROR); \
54 }while(0)
55
56 #define VBOXQGL_CHECKERR(_op) \
57 do { \
58 glGetError(); \
59 _op \
60 VBOXQGL_ASSERTNOERR(); \
61 }while(0)
62#else
63 #define VBOXQGL_ASSERTNOERR() \
64 do {}while(0)
65
66 #define VBOXQGL_CHECKERR(_op) \
67 do { \
68 _op \
69 }while(0)
70#endif
71
72#ifdef DEBUG
73#include <iprt/time.h>
74
75#define VBOXGETTIME() RTTimeNanoTS()
76
77#define VBOXPRINTDIF(_nano, _m) do{\
78 uint64_t cur = VBOXGETTIME(); NOREF(cur); \
79 VBOXQGLLOG(_m); \
80 VBOXQGLLOG(("(%Lu)\n", cur - (_nano))); \
81 }while(0)
82
83class VBoxVHWADbgTimeCounter
84{
85public:
86 VBoxVHWADbgTimeCounter(const char* msg) {mTime = VBOXGETTIME(); mMsg=msg;}
87 ~VBoxVHWADbgTimeCounter() {VBOXPRINTDIF(mTime, (mMsg));}
88private:
89 uint64_t mTime;
90 const char* mMsg;
91};
92
93#define VBOXQGLLOG_METHODTIME(_m) VBoxVHWADbgTimeCounter _dbgTimeCounter(_m)
94
95#define VBOXQG_CHECKCONTEXT() \
96 { \
97 const GLubyte * str; \
98 VBOXQGL_CHECKERR( \
99 str = glGetString(GL_VERSION); \
100 ); \
101 Assert(str); \
102 if(str) \
103 { \
104 Assert(str[0]); \
105 } \
106 }
107#else
108#define VBOXQGLLOG_METHODTIME(_m)
109#define VBOXQG_CHECKCONTEXT() do{}while(0)
110#endif
111
112#define VBOXQGLLOG_QRECT(_p, _pr, _s) do{\
113 VBOXQGLLOG((_p " x(%d), y(%d), w(%d), h(%d)" _s, (_pr)->x(), (_pr)->y(), (_pr)->width(), (_pr)->height()));\
114 }while(0)
115
116#define VBOXQGLLOG_CKEY(_p, _pck, _s) do{\
117 VBOXQGLLOG((_p " l(0x%x), u(0x%x)" _s, (_pck)->lower(), (_pck)->upper()));\
118 }while(0)
119
120#endif /* !MAIN_INCLUDED_SRC_src_helper_apps_OpenGLTest_VBoxFBOverlayCommon_h */
121
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette