diff options
Diffstat (limited to 'GL/glx/singlepix.c')
-rw-r--r-- | GL/glx/singlepix.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/GL/glx/singlepix.c b/GL/glx/singlepix.c index 10a16b141..62588b0d0 100644 --- a/GL/glx/singlepix.c +++ b/GL/glx/singlepix.c @@ -463,6 +463,59 @@ int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc) return Success; } +int __glXDisp_GetColorTableSGI(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + GLint width=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_VENDPRIV_HDR_SIZE; + target = *(GLenum *)(pc + 0); + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + swapBytes = *(GLboolean *)(pc + 12); + + CALL_GetColorTableParameterivSGI( GET_DISPATCH(), (target, GL_COLOR_TABLE_WIDTH, &width) ); + /* + * The one query above might fail if we're in a state where queries + * are illegal, but then width would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + if (compsize < 0) compsize = 0; + + CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes) ); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + CALL_GetColorTableSGI( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer + ) ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetColorTableReply *)&__glXReply)->width = width; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + int __glXDisp_GetCompressedTexImageARB(__GLXclientState *cl, GLbyte *pc) { return BadRequest; |