1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | All rights reserved.
|
---|
3 |
|
---|
4 | See the file LICENSE.txt for information on redistributing this software. */
|
---|
5 |
|
---|
6 | #include "cr_packfunctions.h"
|
---|
7 | #include "cr_glstate.h"
|
---|
8 | #include "cr_pixeldata.h"
|
---|
9 | #include "cr_version.h"
|
---|
10 | #include "packspu.h"
|
---|
11 | #include "packspu_proto.h"
|
---|
12 |
|
---|
13 | static GLboolean packspu_CheckTexImageFormat(GLenum format)
|
---|
14 | {
|
---|
15 | if (format!=GL_COLOR_INDEX
|
---|
16 | && format!=GL_RED
|
---|
17 | && format!=GL_GREEN
|
---|
18 | && format!=GL_BLUE
|
---|
19 | && format!=GL_ALPHA
|
---|
20 | && format!=GL_RGB
|
---|
21 | && format!=GL_BGR
|
---|
22 | && format!=GL_RGBA
|
---|
23 | && format!=GL_BGRA
|
---|
24 | && format!=GL_LUMINANCE
|
---|
25 | && format!=GL_LUMINANCE_ALPHA
|
---|
26 | && format!=GL_DEPTH_COMPONENT
|
---|
27 | && format!=GL_DEPTH_STENCIL)
|
---|
28 | {
|
---|
29 | /*crWarning("crPackCheckTexImageFormat FAILED format 0x%x isn't valid", format);*/
|
---|
30 | return GL_FALSE;
|
---|
31 | }
|
---|
32 |
|
---|
33 | return GL_TRUE;
|
---|
34 | }
|
---|
35 |
|
---|
36 | static GLboolean packspu_CheckTexImageType(GLenum type)
|
---|
37 | {
|
---|
38 | if (type!=GL_UNSIGNED_BYTE
|
---|
39 | && type!=GL_BYTE
|
---|
40 | && type!=GL_BITMAP
|
---|
41 | && type!=GL_UNSIGNED_SHORT
|
---|
42 | && type!=GL_SHORT
|
---|
43 | && type!=GL_UNSIGNED_INT
|
---|
44 | && type!=GL_INT
|
---|
45 | && type!=GL_FLOAT
|
---|
46 | && type!=GL_UNSIGNED_BYTE_3_3_2
|
---|
47 | && type!=GL_UNSIGNED_BYTE_2_3_3_REV
|
---|
48 | && type!=GL_UNSIGNED_SHORT_5_6_5
|
---|
49 | && type!=GL_UNSIGNED_SHORT_5_6_5_REV
|
---|
50 | && type!=GL_UNSIGNED_SHORT_4_4_4_4
|
---|
51 | && type!=GL_UNSIGNED_SHORT_4_4_4_4_REV
|
---|
52 | && type!=GL_UNSIGNED_SHORT_5_5_5_1
|
---|
53 | && type!=GL_UNSIGNED_SHORT_1_5_5_5_REV
|
---|
54 | && type!=GL_UNSIGNED_INT_8_8_8_8
|
---|
55 | && type!=GL_UNSIGNED_INT_8_8_8_8_REV
|
---|
56 | && type!=GL_UNSIGNED_INT_10_10_10_2
|
---|
57 | && type!=GL_UNSIGNED_INT_2_10_10_10_REV
|
---|
58 | && type!=GL_UNSIGNED_INT_24_8)
|
---|
59 | {
|
---|
60 | /*crWarning("crPackCheckTexImageType FAILED type 0x%x isn't valid", type);*/
|
---|
61 | return GL_FALSE;
|
---|
62 | }
|
---|
63 |
|
---|
64 | return GL_TRUE;
|
---|
65 | }
|
---|
66 |
|
---|
67 | static GLboolean packspu_CheckTexImageInternalFormat(GLint internalformat)
|
---|
68 | {
|
---|
69 | if (internalformat!=1
|
---|
70 | && internalformat!=2
|
---|
71 | && internalformat!=3
|
---|
72 | && internalformat!=4
|
---|
73 | && internalformat!=GL_ALPHA
|
---|
74 | && internalformat!=GL_ALPHA4
|
---|
75 | && internalformat!=GL_ALPHA8
|
---|
76 | && internalformat!=GL_ALPHA12
|
---|
77 | && internalformat!=GL_ALPHA16
|
---|
78 | && internalformat!=GL_COMPRESSED_ALPHA
|
---|
79 | && internalformat!=GL_COMPRESSED_LUMINANCE
|
---|
80 | && internalformat!=GL_COMPRESSED_LUMINANCE_ALPHA
|
---|
81 | && internalformat!=GL_COMPRESSED_INTENSITY
|
---|
82 | && internalformat!=GL_COMPRESSED_RGB
|
---|
83 | && internalformat!=GL_COMPRESSED_RGBA
|
---|
84 | && internalformat!=GL_DEPTH_COMPONENT
|
---|
85 | && internalformat!=GL_DEPTH_COMPONENT16
|
---|
86 | && internalformat!=GL_DEPTH_COMPONENT24
|
---|
87 | && internalformat!=GL_DEPTH_COMPONENT32
|
---|
88 | && internalformat!=GL_DEPTH24_STENCIL8
|
---|
89 | && internalformat!=GL_LUMINANCE
|
---|
90 | && internalformat!=GL_LUMINANCE4
|
---|
91 | && internalformat!=GL_LUMINANCE8
|
---|
92 | && internalformat!=GL_LUMINANCE12
|
---|
93 | && internalformat!=GL_LUMINANCE16
|
---|
94 | && internalformat!=GL_LUMINANCE_ALPHA
|
---|
95 | && internalformat!=GL_LUMINANCE4_ALPHA4
|
---|
96 | && internalformat!=GL_LUMINANCE6_ALPHA2
|
---|
97 | && internalformat!=GL_LUMINANCE8_ALPHA8
|
---|
98 | && internalformat!=GL_LUMINANCE12_ALPHA4
|
---|
99 | && internalformat!=GL_LUMINANCE12_ALPHA12
|
---|
100 | && internalformat!=GL_LUMINANCE16_ALPHA16
|
---|
101 | && internalformat!=GL_INTENSITY
|
---|
102 | && internalformat!=GL_INTENSITY4
|
---|
103 | && internalformat!=GL_INTENSITY8
|
---|
104 | && internalformat!=GL_INTENSITY12
|
---|
105 | && internalformat!=GL_INTENSITY16
|
---|
106 | && internalformat!=GL_R3_G3_B2
|
---|
107 | && internalformat!=GL_RGB
|
---|
108 | && internalformat!=GL_RGB4
|
---|
109 | && internalformat!=GL_RGB5
|
---|
110 | && internalformat!=GL_RGB8
|
---|
111 | && internalformat!=GL_RGB10
|
---|
112 | && internalformat!=GL_RGB12
|
---|
113 | && internalformat!=GL_RGB16
|
---|
114 | && internalformat!=GL_RGBA
|
---|
115 | && internalformat!=GL_RGBA2
|
---|
116 | && internalformat!=GL_RGBA4
|
---|
117 | && internalformat!=GL_RGB5_A1
|
---|
118 | && internalformat!=GL_RGBA8
|
---|
119 | && internalformat!=GL_RGB10_A2
|
---|
120 | && internalformat!=GL_RGBA12
|
---|
121 | && internalformat!=GL_RGBA16
|
---|
122 | && internalformat!=GL_SLUMINANCE
|
---|
123 | && internalformat!=GL_SLUMINANCE8
|
---|
124 | && internalformat!=GL_SLUMINANCE_ALPHA
|
---|
125 | && internalformat!=GL_SLUMINANCE8_ALPHA8
|
---|
126 | && internalformat!=GL_SRGB
|
---|
127 | && internalformat!=GL_SRGB8
|
---|
128 | && internalformat!=GL_SRGB_ALPHA
|
---|
129 | && internalformat!=GL_SRGB8_ALPHA8
|
---|
130 | #ifdef CR_EXT_texture_compression_s3tc
|
---|
131 | && internalformat!=GL_COMPRESSED_RGB_S3TC_DXT1_EXT
|
---|
132 | && internalformat!=GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
|
---|
133 | && internalformat!=GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
|
---|
134 | && internalformat!=GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
|
---|
135 | # ifdef CR_EXT_texture_sRGB
|
---|
136 | && internalformat!=GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
|
---|
137 | && internalformat!=GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
|
---|
138 | && internalformat!=GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
|
---|
139 | && internalformat!=GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
|
---|
140 | # endif
|
---|
141 | #endif
|
---|
142 | /*@todo ARB_texture_float*/
|
---|
143 | && internalformat!=GL_RGBA32F_ARB
|
---|
144 | && internalformat!=GL_RGB32F_ARB
|
---|
145 | && internalformat!=GL_ALPHA32F_ARB
|
---|
146 | && internalformat!=GL_INTENSITY32F_ARB
|
---|
147 | && internalformat!=GL_LUMINANCE32F_ARB
|
---|
148 | && internalformat!=GL_LUMINANCE_ALPHA32F_ARB
|
---|
149 | && internalformat!=GL_RGBA16F_ARB
|
---|
150 | && internalformat!=GL_RGB16F_ARB
|
---|
151 | && internalformat!=GL_ALPHA16F_ARB
|
---|
152 | && internalformat!=GL_INTENSITY16F_ARB
|
---|
153 | && internalformat!=GL_LUMINANCE16F_ARB
|
---|
154 | && internalformat!=GL_LUMINANCE_ALPHA16F_ARB
|
---|
155 | )
|
---|
156 | {
|
---|
157 | /*crWarning("crPackCheckTexImageInternalFormat FAILED internalformat 0x%x isn't valid", internalformat);*/
|
---|
158 | return GL_FALSE;
|
---|
159 | }
|
---|
160 |
|
---|
161 | return GL_TRUE;
|
---|
162 | }
|
---|
163 |
|
---|
164 | static GLboolean packspu_CheckTexImageParams(GLint internalformat, GLenum format, GLenum type)
|
---|
165 | {
|
---|
166 | return packspu_CheckTexImageFormat(format)
|
---|
167 | && packspu_CheckTexImageType(type)
|
---|
168 | && packspu_CheckTexImageInternalFormat(internalformat);
|
---|
169 | }
|
---|
170 |
|
---|
171 | static GLboolean packspu_CheckTexImageFormatType(GLenum format, GLenum type)
|
---|
172 | {
|
---|
173 | return packspu_CheckTexImageFormat(format)
|
---|
174 | && packspu_CheckTexImageType(type);
|
---|
175 | }
|
---|
176 |
|
---|
177 | void PACKSPU_APIENTRY packspu_PixelStoref( GLenum pname, GLfloat param )
|
---|
178 | {
|
---|
179 | /* NOTE: we do not send pixel store parameters to the server!
|
---|
180 | * When we pack a glDrawPixels or glTexImage2D image we interpret
|
---|
181 | * the user's pixel store parameters at that time and pack the
|
---|
182 | * image in a canonical layout (see util/pixel.c).
|
---|
183 | */
|
---|
184 | crStatePixelStoref( pname, param );
|
---|
185 | }
|
---|
186 |
|
---|
187 | void PACKSPU_APIENTRY packspu_PixelStorei( GLenum pname, GLint param )
|
---|
188 | {
|
---|
189 | crStatePixelStorei( pname, param );
|
---|
190 | }
|
---|
191 |
|
---|
192 | void PACKSPU_APIENTRY packspu_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
|
---|
193 | {
|
---|
194 | GET_THREAD(thread);
|
---|
195 | ContextInfo *ctx = thread->currentContext;
|
---|
196 | CRClientState *clientState = &(ctx->clientState->client);
|
---|
197 | if (pack_spu.swap)
|
---|
198 | crPackDrawPixelsSWAP( width, height, format, type, pixels, &(clientState->unpack) );
|
---|
199 | else
|
---|
200 | crPackDrawPixels( width, height, format, type, pixels, &(clientState->unpack) );
|
---|
201 | }
|
---|
202 |
|
---|
203 | void PACKSPU_APIENTRY packspu_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels )
|
---|
204 | {
|
---|
205 | GET_THREAD(thread);
|
---|
206 | ContextInfo *ctx = thread->currentContext;
|
---|
207 | CRClientState *clientState = &(ctx->clientState->client);
|
---|
208 | int writeback;
|
---|
209 |
|
---|
210 | if (pack_spu.swap)
|
---|
211 | {
|
---|
212 | crPackReadPixelsSWAP(x, y, width, height, format, type, pixels,
|
---|
213 | &(clientState->pack), &writeback);
|
---|
214 | }
|
---|
215 | else
|
---|
216 | {
|
---|
217 | crPackReadPixels(x, y, width, height, format, type, pixels,
|
---|
218 | &(clientState->pack), &writeback);
|
---|
219 | }
|
---|
220 |
|
---|
221 | #ifdef CR_ARB_pixel_buffer_object
|
---|
222 | if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
|
---|
223 | #endif
|
---|
224 | {
|
---|
225 | pack_spu.ReadPixels++;
|
---|
226 |
|
---|
227 | packspuFlush((void *) thread);
|
---|
228 | while (pack_spu.ReadPixels)
|
---|
229 | crNetRecv();
|
---|
230 | }
|
---|
231 | }
|
---|
232 |
|
---|
233 | void PACKSPU_APIENTRY packspu_CopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type )
|
---|
234 | {
|
---|
235 | GET_THREAD(thread);
|
---|
236 | if (pack_spu.swap)
|
---|
237 | crPackCopyPixelsSWAP( x, y, width, height, type );
|
---|
238 | else
|
---|
239 | crPackCopyPixels( x, y, width, height, type );
|
---|
240 | /* XXX why flush here? */
|
---|
241 | packspuFlush( (void *) thread );
|
---|
242 | }
|
---|
243 |
|
---|
244 | void PACKSPU_APIENTRY packspu_Bitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap )
|
---|
245 | {
|
---|
246 | GET_CONTEXT(ctx);
|
---|
247 | CRClientState *clientState = &(ctx->clientState->client);
|
---|
248 | if (pack_spu.swap)
|
---|
249 | crPackBitmapSWAP( width, height, xorig, yorig, xmove, ymove, bitmap, &(clientState->unpack) );
|
---|
250 | else
|
---|
251 | crPackBitmap( width, height, xorig, yorig, xmove, ymove, bitmap, &(clientState->unpack) );
|
---|
252 | }
|
---|
253 |
|
---|
254 | void PACKSPU_APIENTRY packspu_TexImage1D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
|
---|
255 | {
|
---|
256 | GET_CONTEXT(ctx);
|
---|
257 | CRClientState *clientState = &(ctx->clientState->client);
|
---|
258 |
|
---|
259 | if (!packspu_CheckTexImageParams(internalformat, format, type))
|
---|
260 | {
|
---|
261 | if (pixels || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
|
---|
262 | {
|
---|
263 | crWarning("packspu_TexImage1D invalid internalFormat(%x)/format(%x)/type(%x)", internalformat, format, type);
|
---|
264 | return;
|
---|
265 | }
|
---|
266 | internalformat = packspu_CheckTexImageInternalFormat(internalformat) ? internalformat:GL_RGBA;
|
---|
267 | format = packspu_CheckTexImageFormat(format) ? format:GL_RGBA;
|
---|
268 | type = packspu_CheckTexImageType(type) ? type:GL_UNSIGNED_BYTE;
|
---|
269 | }
|
---|
270 |
|
---|
271 | if (pack_spu.swap)
|
---|
272 | crPackTexImage1DSWAP( target, level, internalformat, width, border, format, type, pixels, &(clientState->unpack) );
|
---|
273 | else
|
---|
274 | crPackTexImage1D( target, level, internalformat, width, border, format, type, pixels, &(clientState->unpack) );
|
---|
275 | }
|
---|
276 |
|
---|
277 | void PACKSPU_APIENTRY packspu_TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
|
---|
278 | {
|
---|
279 | GET_CONTEXT(ctx);
|
---|
280 | CRClientState *clientState = &(ctx->clientState->client);
|
---|
281 |
|
---|
282 | if (!packspu_CheckTexImageParams(internalformat, format, type))
|
---|
283 | {
|
---|
284 | if (pixels || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
|
---|
285 | {
|
---|
286 | crWarning("packspu_TexImage2D invalid internalFormat(%x)/format(%x)/type(%x)", internalformat, format, type);
|
---|
287 | return;
|
---|
288 | }
|
---|
289 | internalformat = packspu_CheckTexImageInternalFormat(internalformat) ? internalformat:GL_RGBA;
|
---|
290 | format = packspu_CheckTexImageFormat(format) ? format:GL_RGBA;
|
---|
291 | type = packspu_CheckTexImageType(type) ? type:GL_UNSIGNED_BYTE;
|
---|
292 | }
|
---|
293 |
|
---|
294 | if (pack_spu.swap)
|
---|
295 | crPackTexImage2DSWAP( target, level, internalformat, width, height, border, format, type, pixels, &(clientState->unpack) );
|
---|
296 | else
|
---|
297 | crPackTexImage2D( target, level, internalformat, width, height, border, format, type, pixels, &(clientState->unpack) );
|
---|
298 | }
|
---|
299 |
|
---|
300 | #ifdef GL_EXT_texture3D
|
---|
301 | void PACKSPU_APIENTRY packspu_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
|
---|
302 | {
|
---|
303 | GET_CONTEXT(ctx);
|
---|
304 | CRClientState *clientState = &(ctx->clientState->client);
|
---|
305 |
|
---|
306 | if (pack_spu.swap)
|
---|
307 | crPackTexImage3DEXTSWAP( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
|
---|
308 | else
|
---|
309 | crPackTexImage3DEXT( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
|
---|
310 | }
|
---|
311 | #endif
|
---|
312 |
|
---|
313 | #ifdef CR_OPENGL_VERSION_1_2
|
---|
314 | void PACKSPU_APIENTRY packspu_TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
|
---|
315 | {
|
---|
316 | GET_CONTEXT(ctx);
|
---|
317 | CRClientState *clientState = &(ctx->clientState->client);
|
---|
318 | if (pack_spu.swap)
|
---|
319 | crPackTexImage3DSWAP( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
|
---|
320 | else
|
---|
321 | crPackTexImage3D( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
|
---|
322 | }
|
---|
323 | #endif /* CR_OPENGL_VERSION_1_2 */
|
---|
324 |
|
---|
325 | void PACKSPU_APIENTRY packspu_TexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels )
|
---|
326 | {
|
---|
327 | GET_CONTEXT(ctx);
|
---|
328 | CRClientState *clientState = &(ctx->clientState->client);
|
---|
329 |
|
---|
330 | if (!packspu_CheckTexImageFormatType(format, type))
|
---|
331 | {
|
---|
332 | crWarning("packspu_TexSubImage1D invalid format(%x)/type(%x)", format, type);
|
---|
333 | return;
|
---|
334 | }
|
---|
335 |
|
---|
336 | if (pack_spu.swap)
|
---|
337 | crPackTexSubImage1DSWAP( target, level, xoffset, width, format, type, pixels, &(clientState->unpack) );
|
---|
338 | else
|
---|
339 | crPackTexSubImage1D( target, level, xoffset, width, format, type, pixels, &(clientState->unpack) );
|
---|
340 | }
|
---|
341 |
|
---|
342 | void PACKSPU_APIENTRY packspu_TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
|
---|
343 | {
|
---|
344 | GET_CONTEXT(ctx);
|
---|
345 | CRClientState *clientState = &(ctx->clientState->client);
|
---|
346 |
|
---|
347 | if (!packspu_CheckTexImageFormatType(format, type))
|
---|
348 | {
|
---|
349 | crWarning("packspu_TexSubImage2D invalid format(%x)/type(%x)", format, type);
|
---|
350 | return;
|
---|
351 | }
|
---|
352 |
|
---|
353 | if (pack_spu.swap)
|
---|
354 | crPackTexSubImage2DSWAP( target, level, xoffset, yoffset, width, height, format, type, pixels, &(clientState->unpack) );
|
---|
355 | else
|
---|
356 | crPackTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels, &(clientState->unpack) );
|
---|
357 | }
|
---|
358 |
|
---|
359 | #ifdef CR_OPENGL_VERSION_1_2
|
---|
360 | void PACKSPU_APIENTRY packspu_TexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels )
|
---|
361 | {
|
---|
362 | GET_CONTEXT(ctx);
|
---|
363 | CRClientState *clientState = &(ctx->clientState->client);
|
---|
364 | if (pack_spu.swap)
|
---|
365 | crPackTexSubImage3DSWAP( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &(clientState->unpack) );
|
---|
366 | else
|
---|
367 | crPackTexSubImage3D( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &(clientState->unpack) );
|
---|
368 | }
|
---|
369 | #endif /* CR_OPENGL_VERSION_1_2 */
|
---|
370 |
|
---|
371 | void PACKSPU_APIENTRY packspu_ZPixCR( GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum ztype, GLint zparm, GLint length, const GLvoid *pixels )
|
---|
372 | {
|
---|
373 | GET_CONTEXT(ctx);
|
---|
374 | CRClientState *clientState = &(ctx->clientState->client);
|
---|
375 | if (pack_spu.swap)
|
---|
376 | crPackZPixCRSWAP( width, height, format, type, ztype, zparm, length, pixels, &(clientState->unpack) );
|
---|
377 | else
|
---|
378 | crPackZPixCR( width, height, format, type, ztype, zparm, length, pixels, &(clientState->unpack) );
|
---|
379 | }
|
---|
380 |
|
---|
381 | void PACKSPU_APIENTRY packspu_GetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
|
---|
382 | {
|
---|
383 | GET_THREAD(thread);
|
---|
384 | ContextInfo *ctx = thread->currentContext;
|
---|
385 | CRClientState *clientState = &(ctx->clientState->client);
|
---|
386 | int writeback = 1;
|
---|
387 | /* XXX note: we're not observing the pixel pack parameters here.
|
---|
388 | * To do so, we'd have to allocate a temporary image buffer (how large???)
|
---|
389 | * and copy the image to the user's buffer using the pixel pack params.
|
---|
390 | */
|
---|
391 | if (pack_spu.swap)
|
---|
392 | crPackGetTexImageSWAP( target, level, format, type, pixels, &(clientState->pack), &writeback );
|
---|
393 | else
|
---|
394 | crPackGetTexImage( target, level, format, type, pixels, &(clientState->pack), &writeback );
|
---|
395 |
|
---|
396 | #ifdef CR_ARB_pixel_buffer_object
|
---|
397 | if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
|
---|
398 | #endif
|
---|
399 | {
|
---|
400 | packspuFlush( (void *) thread );
|
---|
401 | while (writeback)
|
---|
402 | crNetRecv();
|
---|
403 | }
|
---|
404 | }
|
---|
405 |
|
---|
406 | void PACKSPU_APIENTRY packspu_GetCompressedTexImageARB( GLenum target, GLint level, GLvoid * img )
|
---|
407 | {
|
---|
408 | GET_THREAD(thread);
|
---|
409 | int writeback = 1;
|
---|
410 |
|
---|
411 | if (pack_spu.swap)
|
---|
412 | {
|
---|
413 | crPackGetCompressedTexImageARBSWAP( target, level, img, &writeback );
|
---|
414 | }
|
---|
415 | else
|
---|
416 | {
|
---|
417 | crPackGetCompressedTexImageARB( target, level, img, &writeback );
|
---|
418 | }
|
---|
419 |
|
---|
420 | #ifdef CR_ARB_pixel_buffer_object
|
---|
421 | if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
|
---|
422 | #endif
|
---|
423 | {
|
---|
424 | packspuFlush( (void *) thread );
|
---|
425 | while (writeback)
|
---|
426 | crNetRecv();
|
---|
427 | }
|
---|
428 | }
|
---|