1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
/* $Id: server_texture.c $ */
/** @file
* VBox crOpenGL: teximage functions.
*/
/*
* Copyright (C) 2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "chromium.h"
#include "cr_error.h"
#include "server_dispatch.h"
#include "server.h"
#define CR_NOTHING()
#define CR_CHECKPTR(name) \
if (!realptr) \
{ \
crWarning(#name " with NULL ptr, ignored!"); \
return; \
}
#if !defined(CR_STATE_NO_TEXTURE_IMAGE_STORE)
# define CR_FIXPTR() (uintptr_t) realptr += (uintptr_t) cr_server.head_spu->dispatch_table.MapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_READ_ONLY_ARB)
#else
# define CR_FIXPTR()
#endif
#if defined(CR_ARB_pixel_buffer_object)
# define CR_CHECKBUFFER(name, checkptr) \
if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB)) \
{ \
CR_FIXPTR(); \
} \
else \
{ \
checkptr \
}
#else
# define CR_CHECKBUFFER(name, checkptr) checkptr
#endif
#if defined(CR_ARB_pixel_buffer_object) && !defined(CR_STATE_NO_TEXTURE_IMAGE_STORE)
# define CR_FINISHBUFFER() \
if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB)) \
{ \
if (!cr_server.head_spu->dispatch_table.UnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB)) \
{ \
crWarning("UnmapBufferARB failed"); \
} \
}
#else
#define CR_FINISHBUFFER()
#endif
#define CR_FUNC_SUBIMAGE(name, def, call, ptrname) \
void SERVER_DISPATCH_APIENTRY \
crServerDispatch##name def \
{ \
const GLvoid *realptr = ptrname; \
CR_CHECKBUFFER(name, CR_CHECKPTR(name)) \
crState##name call; \
CR_FINISHBUFFER() \
realptr = ptrname; \
cr_server.head_spu->dispatch_table.name call; \
}
#define CR_FUNC_IMAGE(name, def, call, ptrname) \
void SERVER_DISPATCH_APIENTRY \
crServerDispatch##name def \
{ \
const GLvoid *realptr = ptrname; \
CR_CHECKBUFFER(name, CR_NOTHING()) \
crState##name call; \
CR_FINISHBUFFER() \
realptr = ptrname; \
cr_server.head_spu->dispatch_table.name call; \
}
#if defined(CR_ARB_texture_compression)
CR_FUNC_SUBIMAGE(CompressedTexSubImage1DARB,
(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imagesize, const GLvoid * data),
(target, level, xoffset, width, format, imagesize, realptr), data)
CR_FUNC_SUBIMAGE(CompressedTexSubImage2DARB,
(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imagesize, const GLvoid * data),
(target, level, xoffset, yoffset, width, height, format, imagesize, realptr), data)
CR_FUNC_SUBIMAGE(CompressedTexSubImage3DARB,
(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imagesize, const GLvoid * data),
(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imagesize, realptr), data)
CR_FUNC_IMAGE(CompressedTexImage1DARB,
(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imagesize, const GLvoid * data),
(target, level, internalFormat, width, border, imagesize, realptr), data)
CR_FUNC_IMAGE(CompressedTexImage2DARB,
(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imagesize, const GLvoid * data),
(target, level, internalFormat, width, height, border, imagesize, realptr), data)
CR_FUNC_IMAGE(CompressedTexImage3DARB,
(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imagesize, const GLvoid * data),
(target, level, internalFormat, width, height, depth, border, imagesize, realptr), data)
#endif
CR_FUNC_SUBIMAGE(TexSubImage1D,
(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels),
(target, level, xoffset, width, format, type, realptr), pixels)
CR_FUNC_SUBIMAGE(TexSubImage2D,
(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels),
(target, level, xoffset, yoffset, width, height, format, type, realptr), pixels)
CR_FUNC_SUBIMAGE(TexSubImage3D,
(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels),
(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, realptr), pixels)
CR_FUNC_IMAGE(TexImage1D,
(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels),
(target, level, internalFormat, width, border, format, type, realptr), pixels)
CR_FUNC_IMAGE(TexImage2D,
(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels),
(target, level, internalFormat, width, height, border, format, type, realptr), pixels)
CR_FUNC_IMAGE(TexImage3D,
(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels),
(target, level, internalFormat, width, height, depth, border, format, type, realptr), pixels)
void SERVER_DISPATCH_APIENTRY crServerDispatchTexEnvf( GLenum target, GLenum pname, GLfloat param )
{
crStateTexEnvf( target, pname, param );
if (GL_POINT_SPRITE != target && pname != GL_COORD_REPLACE)
CR_GLERR_CHECK(cr_server.head_spu->dispatch_table.TexEnvf( target, pname, param ););
}
void SERVER_DISPATCH_APIENTRY crServerDispatchTexEnvfv( GLenum target, GLenum pname, const GLfloat * params )
{
crStateTexEnvfv( target, pname, params );
if (GL_POINT_SPRITE != target && pname != GL_COORD_REPLACE)
CR_GLERR_CHECK(cr_server.head_spu->dispatch_table.TexEnvfv( target, pname, params ););
}
void SERVER_DISPATCH_APIENTRY crServerDispatchTexEnvi( GLenum target, GLenum pname, GLint param )
{
crStateTexEnvi( target, pname, param );
if (GL_POINT_SPRITE != target && pname != GL_COORD_REPLACE)
CR_GLERR_CHECK(cr_server.head_spu->dispatch_table.TexEnvi( target, pname, param ););
}
void SERVER_DISPATCH_APIENTRY crServerDispatchTexEnviv( GLenum target, GLenum pname, const GLint * params )
{
crStateTexEnviv( target, pname, params );
if (GL_POINT_SPRITE != target && pname != GL_COORD_REPLACE)
CR_GLERR_CHECK(cr_server.head_spu->dispatch_table.TexEnviv( target, pname, params ););
}
void SERVER_DISPATCH_APIENTRY crServerDispatchGetTexEnvfv( GLenum target, GLenum pname, GLfloat * params )
{
GLfloat local_params[4];
(void) params;
if (GL_POINT_SPRITE != target && pname != GL_COORD_REPLACE)
cr_server.head_spu->dispatch_table.GetTexEnvfv( target, pname, local_params );
else
crStateGetTexEnvfv( target, pname, local_params );
crServerReturnValue( &(local_params[0]), crStateHlpComponentsCount(pname)*sizeof (GLfloat) );
}
void SERVER_DISPATCH_APIENTRY crServerDispatchGetTexEnviv( GLenum target, GLenum pname, GLint * params )
{
GLint local_params[4];
(void) params;
if (GL_POINT_SPRITE != target && pname != GL_COORD_REPLACE)
cr_server.head_spu->dispatch_table.GetTexEnviv( target, pname, local_params );
else
crStateGetTexEnviv( target, pname, local_params );
crServerReturnValue( &(local_params[0]), crStateHlpComponentsCount(pname)*sizeof (GLint) );
}
|