2 * (C) Copyright IBM Corporation 2005, 2006
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sub license,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 #ifdef HAVE_DIX_CONFIG_H
27 #include <dix-config.h>
30 #include "glxserver.h"
31 #include "glxbyteorder.h"
33 #include "singlesize.h"
35 #include "indirect_size_get.h"
36 #include "indirect_dispatch.h"
39 __glXDisp_GetCompressedTexImage(struct __GLXclientStateRec
*cl
, GLbyte
* pc
)
41 xGLXSingleReq
*const req
= (xGLXSingleReq
*) pc
;
43 __GLXcontext
*const cx
= __glXForceCurrent(cl
, req
->contextTag
, &error
);
44 ClientPtr client
= cl
->client
;
46 pc
+= __GLX_SINGLE_HDR_SIZE
;
48 const GLenum target
= *(GLenum
*) (pc
+ 0);
49 const GLint level
= *(GLint
*) (pc
+ 4);
51 char *answer
= NULL
, answerBuffer
[200];
53 glGetTexLevelParameteriv(target
, level
, GL_TEXTURE_COMPRESSED_IMAGE_SIZE
,
57 __GLX_GET_ANSWER_BUFFER(answer
, cl
, compsize
, 1);
58 __glXClearErrorOccured();
59 glGetCompressedTexImageARB(target
, level
, answer
);
62 if (__glXErrorOccured()) {
67 __GLX_BEGIN_REPLY(compsize
);
68 ((xGLXGetTexImageReply
*) &__glXReply
)->width
= compsize
;
70 __GLX_SEND_VOID_ARRAY(compsize
);
80 __glXDispSwap_GetCompressedTexImage(struct __GLXclientStateRec
*cl
, GLbyte
* pc
)
82 xGLXSingleReq
*const req
= (xGLXSingleReq
*) pc
;
84 __GLXcontext
*const cx
=
85 __glXForceCurrent(cl
, bswap_32(req
->contextTag
), &error
);
86 ClientPtr client
= cl
->client
;
88 pc
+= __GLX_SINGLE_HDR_SIZE
;
90 const GLenum target
= (GLenum
) bswap_32(*(int *) (pc
+ 0));
91 const GLint level
= (GLint
) bswap_32(*(int *) (pc
+ 4));
93 char *answer
= NULL
, answerBuffer
[200];
95 glGetTexLevelParameteriv(target
, level
, GL_TEXTURE_COMPRESSED_IMAGE_SIZE
,
99 __GLX_GET_ANSWER_BUFFER(answer
, cl
, compsize
, 1);
100 __glXClearErrorOccured();
101 glGetCompressedTexImageARB(target
, level
, answer
);
104 if (__glXErrorOccured()) {
105 __GLX_BEGIN_REPLY(0);
109 __GLX_BEGIN_REPLY(compsize
);
110 ((xGLXGetTexImageReply
*) &__glXReply
)->width
= compsize
;
112 __GLX_SEND_VOID_ARRAY(compsize
);