VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/VBoxOGL.h@ 3389

Last change on this file since 3389 was 3339, checked in by vboxsync, 17 years ago

Export to OSE

File size: 5.7 KB
Line 
1/** @file
2 *
3 * VirtualBox Windows NT/2000/XP guest OpenGL ICD
4 *
5 * Copyright (C) 2006-2007 innotek GmbH
6 *
7 * This file is part of VirtualBox Open Source Edition (OSE), as
8 * available from http://www.virtualbox.org. This file is free software;
9 * you can redistribute it and/or modify it under the terms of the GNU
10 * General Public License as published by the Free Software Foundation,
11 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
12 * distribution. VirtualBox OSE is distributed in the hope that it will
13 * be useful, but WITHOUT ANY WARRANTY of any kind.
14 *
15 * If you received this file as part of a commercial VirtualBox
16 * distribution, then only the terms of your commercial VirtualBox
17 * license agreement apply instead of the previous paragraph.
18 *
19 */
20#ifndef __VBOXOGL_H__
21#define __VBOXOGL_H__
22
23#include <windows.h>
24/* get rid of the inconsistent dll linkage warnings */
25#undef WINGDIAPI
26#define WINGDIAPI
27#include "GL/gl.h"
28
29#include <iprt/cdefs.h>
30#include <iprt/assert.h>
31
32#include <VBox/HostServices/VBoxOpenGLSvc.h>
33#include <VBox/HostServices/VBoxOGLOp.h>
34
35typedef struct _icdTable
36{
37 DWORD size;
38 PROC table[336];
39} ICDTABLE, *PICDTABLE;
40
41
42typedef struct
43{
44 HANDLE hGuestDrv;
45
46} VBOX_OGL_CTX, *PVBOX_OGL_CTX;
47
48typedef struct
49{
50 uint32_t u32ClientID;
51
52 GLenum glLastError;
53 uint32_t cCommands;
54 uint8_t *pCmdBuffer;
55 uint8_t *pCmdBufferEnd;
56 uint8_t *pCurrentCmd;
57} VBOX_OGL_THREAD_CTX, *PVBOX_OGL_THREAD_CTX;
58
59
60extern HINSTANCE hDllVBoxOGL;
61
62void APIENTRY glSetError(GLenum glNewError);
63
64#ifdef DEBUG
65#define glLogError(a) \
66 { \
67 /** @todo log error */ \
68 glSetError(a); \
69 }
70#define DbgPrintf(a) VBoxDbgLog a
71#else
72#define glLogError(a) glSetError(a)
73#define DbgPrintf(a)
74#endif
75
76
77/**
78 * Initialize the OpenGL guest-host communication channel
79 *
80 * @return success or failure (boolean)
81 * @param hDllInst Dll instance handle
82 */
83BOOL VBoxOGLInit(HINSTANCE hDllInst);
84
85/**
86 * Destroy the OpenGL guest-host communication channel
87 *
88 * @return success or failure (boolean)
89 */
90BOOL VBoxOGLExit();
91
92/**
93 * Initialize new thread
94 *
95 * @return success or failure (boolean)
96 */
97BOOL VBoxOGLThreadAttach();
98
99/**
100 * Clean up for terminating thread
101 *
102 * @return success or failure (boolean)
103 */
104BOOL VBoxOGLThreadDetach();
105
106/**
107 * Set the thread local OpenGL context
108 *
109 * @param pCtx thread local OpenGL context ptr
110 */
111void VBoxOGLSetThreadCtx(PVBOX_OGL_THREAD_CTX pCtx);
112
113/**
114 * Return the thread local OpenGL context
115 *
116 * @return thread local OpenGL context ptr or NULL if failure
117 */
118PVBOX_OGL_THREAD_CTX VBoxOGLGetThreadCtx();
119
120
121/**
122 * Queue a new OpenGL command
123 *
124 * @param enmOp OpenGL command op
125 * @param cParam Number of parameters
126 * @param cbParams Memory needed for parameters
127 */
128void VBoxCmdStart(uint32_t enmOp, uint32_t cParam, uint32_t cbParams);
129
130/**
131 * Add a parameter to the currently queued OpenGL command
132 *
133 * @param pParam Parameter ptr
134 * @param cbParam Parameter value size
135 */
136void VBoxCmdSaveParameter(uint8_t *pParam, uint32_t cbParam);
137
138/**
139 * Add a parameter (variable size) to the currently queued OpenGL command
140 *
141 * @param pParam Parameter ptr
142 * @param cbParam Parameter value size
143 */
144void VBoxCmdSaveMemParameter(uint8_t *pParam, uint32_t cbParam);
145
146/**
147 * Finish the queued command
148 *
149 * @param enmOp OpenGL command op
150 */
151void VBoxCmdStop(uint32_t enmOp);
152
153
154/**
155 * Send an HGCM request
156 *
157 * @return VBox status code
158 * @param hDriver Driver handle
159 * @param pvData Data pointer
160 * @param cbData Data size
161 */
162int vboxHGCMCall(HANDLE hDriver, void *pvData, unsigned cbData);
163
164#ifdef DEBUG
165/**
166 * Log to the debug output device
167 *
168 * @param pszFormat Format string
169 * @param ... Variable parameters
170 */
171void VBoxDbgLog(char *pszFormat, ...);
172#endif
173
174/**
175 * Flush the OpenGL command queue and return the return val of the last command
176 *
177 * @returns return val of last command
178 */
179uint64_t VBoxOGLFlush();
180
181/**
182 * Flush the OpenGL command queue and return the return val of the last command
183 * The last command's final parameter is a pointer where its result is stored
184 *
185 * @returns return val of last command
186 * @param pLastParam Last parameter's address
187 * @param cbParam Last parameter's size
188 */
189uint64_t VBoxOGLFlushPtr(void *pLastParam, uint32_t cbParam);
190
191/**
192 * Query the specified cached parameter
193 *
194 * @returns requested cached value
195 * @param type Parameter type (Note: minimal checks only!)
196 */
197GLint glInternalGetIntegerv(GLenum type);
198
199/**
200 * Query the specified cached texture level parameter
201 *
202 * @returns requested cached value
203 * @param type Parameter type (Note: minimal checks only!)
204 */
205GLint glInternalGetTexLevelParameteriv(GLenum type);
206
207/**
208 * Query the number of bytes required for a pixel in the specified format
209 *
210 * @returns requested pixel size
211 * @param type Parameter type
212 */
213GLint glInternalGetPixelFormatElements(GLenum format);
214
215/**
216 * Query the size of the specified data type
217 *
218 * @returns type size or 0 if unknown type
219 * @param type data type
220 */
221GLint glVBoxGetDataTypeSize(GLenum type);
222
223uint32_t glInternalLightvElem(GLenum pname);
224uint32_t glInternalMaterialvElem(GLenum pname);
225uint32_t glInternalTexEnvvElem(GLenum pname);
226uint32_t glInternalTexGenvElem(GLenum pname);
227uint32_t glInternalTexParametervElem(GLenum pname);
228
229
230#endif /* __VBOXOGL_H__ */
231
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