VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/include/cr_dump.h@ 46395

Last change on this file since 46395 was 46395, checked in by vboxsync, 11 years ago

crOpenGL: more debugging

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/* $Id: cr_dump.h 46395 2013-06-05 15:20:56Z vboxsync $ */
2
3/** @file
4 * Debugging: Dump API
5 */
6/*
7 * Copyright (C) 2013 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#ifndef ___cr_dump_h__
18#define ___cr_dump_h__
19
20/* dump stuff */
21//#define VBOX_WITH_CRDUMPER
22#ifdef VBOX_WITH_CRDUMPER
23
24#include <iprt/cdefs.h>
25#include <iprt/string.h>
26#include <cr_spu.h>
27#include <cr_glstate.h>
28#include <cr_blitter.h>
29
30# define VBOXDUMPDECL(_type) DECLEXPORT(_type)
31
32RT_C_DECLS_BEGIN
33
34DECLEXPORT(void) crDmpDumpImgDmlBreak(struct CR_DUMPER * pDumper, CR_BLITTER_IMG *pImg, const char*pszEntryDesc);
35
36DECLEXPORT(void) crDmpDumpStrDbgPrint(struct CR_DUMPER * pDumper, const char*pszStr);
37
38struct CR_DUMPER;
39
40typedef DECLCALLBACKPTR(void, PFNCRDUMPIMG)(struct CR_DUMPER * pDumper, CR_BLITTER_IMG *pImg, const char*pszEntryDesc);
41typedef DECLCALLBACKPTR(void, PFNCRDUMPSTR)(struct CR_DUMPER * pDumper, const char*pszStr);
42
43typedef struct CR_DUMPER
44{
45 PFNCRDUMPIMG pfnDumpImg;
46 PFNCRDUMPSTR pfnDumpStr;
47} CR_DUMPER;
48
49#define crDmpImg(_pDumper, _pImg, _pDesc) do { \
50 (_pDumper)->pfnDumpImg((_pDumper), (_pImg), (_pDesc)); \
51 } while (0)
52
53#define crDmpStr(_pDumper, _pDesc) do { \
54 (_pDumper)->pfnDumpStr((_pDumper), (_pDesc)); \
55 } while (0)
56
57DECLINLINE(void) crDmpStrV(CR_DUMPER *pDumper, const char *pszStr, va_list pArgList)
58{
59 char szBuffer[4096] = {0};
60 vsprintf_s(szBuffer, sizeof (szBuffer), pszStr, pArgList);
61 crDmpStr(pDumper, szBuffer);
62}
63
64DECLINLINE(void) crDmpStrF(CR_DUMPER *pDumper, const char *pszStr, ...)
65{
66 va_list pArgList;
67 va_start(pArgList, pszStr);
68 crDmpStrV(pDumper, pszStr, pArgList);
69 va_end(pArgList);
70}
71
72DECLINLINE(void) crDmpImgV(CR_DUMPER *pDumper, CR_BLITTER_IMG *pImg, const char *pszStr, va_list pArgList)
73{
74 char szBuffer[4096] = {0};
75 vsprintf_s(szBuffer, sizeof (szBuffer), pszStr, pArgList);
76 crDmpImg(pDumper, pImg, szBuffer);
77}
78
79DECLINLINE(void) crDmpImgF(CR_DUMPER *pDumper, CR_BLITTER_IMG *pImg, const char *pszStr, ...)
80{
81 va_list pArgList;
82 va_start(pArgList, pszStr);
83 crDmpImgV(pDumper, pImg, pszStr, pArgList);
84 va_end(pArgList);
85}
86
87VBOXDUMPDECL(size_t) crDmpFormatArrayf(char *pString, size_t cbString, const float *pVal, uint32_t cVal);
88VBOXDUMPDECL(size_t) crDmpFormatRawArrayf(char *pString, size_t cbString, const float *pVal, uint32_t cVal);
89VBOXDUMPDECL(size_t) crDmpFormatMatrixArrayf(char *pString, size_t cbString, const float *pVal, uint32_t cX, uint32_t cY);
90
91typedef struct CR_DBGPRINT_DUMPER
92{
93 CR_DUMPER Base;
94} CR_DBGPRINT_DUMPER;
95
96typedef struct CR_HTML_DUMPER
97{
98 CR_DUMPER Base;
99 const char* pszFile;
100 const char* pszDir;
101 FILE *pFile;
102 uint32_t cImg;
103} CR_HTML_DUMPER;
104
105DECLEXPORT(int) crDmpHtmlInit(struct CR_HTML_DUMPER * pDumper, const char *pszDir, const char *pszFile);
106
107DECLINLINE(void) crDmpDbgPrintInit(CR_DBGPRINT_DUMPER *pDumper)
108{
109 pDumper->Base.pfnDumpImg = crDmpDumpImgDmlBreak;
110 pDumper->Base.pfnDumpStr = crDmpDumpStrDbgPrint;
111}
112
113typedef struct CR_RECORDER
114{
115 CR_BLITTER *pBlitter;
116 SPUDispatchTable *pDispatch;
117 CR_DUMPER *pDumper;
118} CR_RECORDER;
119
120DECLINLINE(void) crRecInit(CR_RECORDER *pRec, CR_BLITTER *pBlitter, SPUDispatchTable *pDispatch, CR_DUMPER *pDumper)
121{
122 pRec->pBlitter = pBlitter;
123 pRec->pDispatch = pDispatch;
124 pRec->pDumper = pDumper;
125}
126
127VBOXDUMPDECL(void) crRecDumpBuffer(CR_RECORDER *pRec, CRContext *ctx, CR_BLITTER_CONTEXT *pCurCtx, CR_BLITTER_WINDOW *pCurWin, GLint idRedirFBO, VBOXVR_TEXTURE *pRedirTex);
128VBOXDUMPDECL(void) crRecDumpTextures(CR_RECORDER *pRec, CRContext *ctx, CR_BLITTER_CONTEXT *pCurCtx, CR_BLITTER_WINDOW *pCurWin);
129VBOXDUMPDECL(void) crRecDumpShader(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
130VBOXDUMPDECL(void) crRecDumpProgram(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
131VBOXDUMPDECL(void) crRecDumpCurrentProgram(CR_RECORDER *pRec, CRContext *ctx);
132VBOXDUMPDECL(void) crRecDumpProgramUniforms(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
133VBOXDUMPDECL(void) crRecDumpCurrentProgramUniforms(CR_RECORDER *pRec, CRContext *ctx);
134VBOXDUMPDECL(void) crRecDumpGlGetState(CR_RECORDER *pRec, CRContext *ctx);
135VBOXDUMPDECL(void) crRecDumpGlEnableState(CR_RECORDER *pRec, CRContext *ctx);
136
137typedef DECLCALLBACKPTR(GLuint, PFNCRDUMPGETHWID)(void *pvObj);
138void* crDmpHashtableSearchByHwid(CRHashTable *pHash, GLuint hwid, PFNCRDUMPGETHWID pfnGetHwid, unsigned long *pKey);
139
140RT_C_DECLS_END
141
142#endif /* VBOX_WITH_CRDUMPER */
143/* */
144
145#endif /* #ifndef ___cr_dump_h__ */
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