summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <idr@umwelt.(none)>2006-08-24 17:58:52 -0700
committerIan Romanick <idr@umwelt.(none)>2006-08-24 17:58:52 -0700
commita29e6dd2d2d45c18c52737bb3b7945aafcea5032 (patch)
treeb4d356eb3fc6d715bcf6d5ce04331bd91118e635
parentae608b2071d882966e9c7ede71f846b1ecec0b23 (diff)
Add some missing bits of GL_SGI_color_table.
-rw-r--r--GL/glx/indirect_size_get.c2
-rw-r--r--GL/glx/indirect_size_get.h2
-rw-r--r--GL/glx/singlepix.c53
-rw-r--r--GL/glx/singlepixswap.c59
4 files changed, 116 insertions, 0 deletions
diff --git a/GL/glx/indirect_size_get.c b/GL/glx/indirect_size_get.c
index a81465530..c16b29a89 100644
--- a/GL/glx/indirect_size_get.c
+++ b/GL/glx/indirect_size_get.c
@@ -1154,6 +1154,8 @@ ALIAS( GetMinmaxParameteriv, GetMinmaxParameterfv )
ALIAS( GetVertexAttribfvARB, GetVertexAttribdvARB )
ALIAS( GetVertexAttribivARB, GetVertexAttribdvARB )
ALIAS( GetQueryObjectuivARB, GetQueryObjectivARB )
+ALIAS( GetColorTableParameterfvSGI, GetColorTableParameterfv )
+ALIAS( GetColorTableParameterivSGI, GetColorTableParameterfv )
ALIAS( GetVertexAttribfvNV, GetVertexAttribdvNV )
ALIAS( GetVertexAttribivNV, GetVertexAttribdvNV )
ALIAS( PointParameterivNV, PointParameterfvEXT )
diff --git a/GL/glx/indirect_size_get.h b/GL/glx/indirect_size_get.h
index 3e46b3fdd..c6f9532ce 100644
--- a/GL/glx/indirect_size_get.h
+++ b/GL/glx/indirect_size_get.h
@@ -86,6 +86,8 @@ extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectivARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectuivARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetQueryivARB_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameterfvSGI_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameterivSGI_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetProgramivNV_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvNV_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvNV_size(GLenum);
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;
diff --git a/GL/glx/singlepixswap.c b/GL/glx/singlepixswap.c
index b22dc5f53..d5510b9c0 100644
--- a/GL/glx/singlepixswap.c
+++ b/GL/glx/singlepixswap.c
@@ -518,6 +518,65 @@ int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc)
return Success;
}
+int __glXDispSwap_GetColorTableSGI(__GLXclientState *cl, GLbyte *pc)
+{
+ GLint compsize;
+ GLenum format, type, target;
+ GLboolean swapBytes;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ 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;
+ __GLX_SWAP_INT(pc+0);
+ __GLX_SWAP_INT(pc+4);
+ __GLX_SWAP_INT(pc+8);
+
+ format = *(GLenum *)(pc + 4);
+ type = *(GLenum *)(pc + 8);
+ target = *(GLenum *)(pc + 0);
+ 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_SWAP_REPLY_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SWAP_INT(&width);
+ ((xGLXGetColorTableReply *)&__glXReply)->width = width;
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+
+ return Success;
+}
+
int __glXDispSwap_GetCompressedTexImageARB(__GLXclientState *cl, GLbyte *pc)
{
return BadRequest;