2003-11-14 17:48:57 +01:00
|
|
|
/*
|
Update to SGI FreeB 2.0.
Under the terms of version 1.1, "once Covered Code has been published
under a particular version of the License, Recipient may, for the
duration of the License, continue to use it under the terms of that
version, or choose to use such Covered Code under the terms of any
subsequent version published by SGI."
FreeB 2.0 license refers to "dates of first publication". They are here
taken to be 1991-2000, as noted in the original license text:
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
Official FreeB 2.0 text:
http://oss.sgi.com/projects/FreeB/SGIFreeSWLicB.2.0.pdf
As always, this code has not been tested for conformance with the OpenGL
specification. OpenGL conformance testing is available from
http://khronos.org/ and is required for use of the OpenGL logo in
product advertising and promotion.
2008-09-19 18:02:28 +02:00
|
|
|
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
|
|
|
|
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice including the dates of first publication and
|
|
|
|
* either this permission notice or a reference to
|
|
|
|
* http://oss.sgi.com/projects/FreeB/
|
|
|
|
* shall be included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*
|
|
|
|
* Except as contained in this notice, the name of Silicon Graphics, Inc.
|
|
|
|
* shall not be used in advertising or otherwise to promote the sale, use or
|
|
|
|
* other dealings in this Software without prior written authorization from
|
|
|
|
* Silicon Graphics, Inc.
|
|
|
|
*/
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "glxserver.h"
|
|
|
|
#include "glxext.h"
|
|
|
|
#include "singlesize.h"
|
|
|
|
#include "unpack.h"
|
2006-01-12 01:21:59 +01:00
|
|
|
#include "indirect_size_get.h"
|
|
|
|
#include "indirect_dispatch.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
GLsizei width, height;
|
|
|
|
GLenum format, type;
|
|
|
|
GLboolean swapBytes, lsbFirst;
|
|
|
|
GLint compsize;
|
|
|
|
__GLXcontext *cx;
|
|
|
|
ClientPtr client = cl->client;
|
|
|
|
int error;
|
|
|
|
char *answer, answerBuffer[200];
|
2017-06-16 21:44:48 +02:00
|
|
|
xGLXSingleReply reply = { 0, };
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2014-11-10 18:13:47 +01:00
|
|
|
REQUEST_FIXED_SIZE(xGLXSingleReq, 28);
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
|
|
|
|
if (!cx) {
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pc += __GLX_SINGLE_HDR_SIZE;
|
2012-03-21 20:55:09 +01:00
|
|
|
width = *(GLsizei *) (pc + 8);
|
|
|
|
height = *(GLsizei *) (pc + 12);
|
|
|
|
format = *(GLenum *) (pc + 16);
|
|
|
|
type = *(GLenum *) (pc + 20);
|
|
|
|
swapBytes = *(GLboolean *) (pc + 24);
|
|
|
|
lsbFirst = *(GLboolean *) (pc + 25);
|
|
|
|
compsize = __glReadPixels_size(format, type, width, height);
|
|
|
|
if (compsize < 0)
|
2014-11-10 18:13:37 +01:00
|
|
|
return BadLength;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2013-07-10 16:00:46 +02:00
|
|
|
glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
|
|
|
|
glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst);
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
|
2003-11-14 17:48:57 +01:00
|
|
|
__glXClearErrorOccured();
|
2013-07-10 16:00:46 +02:00
|
|
|
glReadPixels(*(GLint *) (pc + 0), *(GLint *) (pc + 4),
|
|
|
|
*(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12),
|
|
|
|
*(GLenum *) (pc + 16), *(GLenum *) (pc + 20), answer);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if (__glXErrorOccured()) {
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_BEGIN_REPLY(0);
|
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__GLX_BEGIN_REPLY(compsize);
|
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
__GLX_SEND_VOID_ARRAY(compsize);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXDisp_GetTexImage(__GLXclientState * cl, GLbyte * pc)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
GLint level, compsize;
|
|
|
|
GLenum format, type, target;
|
|
|
|
GLboolean swapBytes;
|
|
|
|
__GLXcontext *cx;
|
|
|
|
ClientPtr client = cl->client;
|
|
|
|
int error;
|
|
|
|
char *answer, answerBuffer[200];
|
2012-03-21 20:55:09 +01:00
|
|
|
GLint width = 0, height = 0, depth = 1;
|
2017-06-16 21:44:48 +02:00
|
|
|
xGLXSingleReply reply = { 0, };
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2014-11-10 18:13:47 +01:00
|
|
|
REQUEST_FIXED_SIZE(xGLXSingleReq, 20);
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
|
|
|
|
if (!cx) {
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pc += __GLX_SINGLE_HDR_SIZE;
|
2012-03-21 20:55:09 +01:00
|
|
|
level = *(GLint *) (pc + 4);
|
|
|
|
format = *(GLenum *) (pc + 8);
|
|
|
|
type = *(GLenum *) (pc + 12);
|
|
|
|
target = *(GLenum *) (pc + 0);
|
|
|
|
swapBytes = *(GLboolean *) (pc + 16);
|
|
|
|
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width);
|
|
|
|
glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (target == GL_TEXTURE_3D) {
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* The three queries above might fail if we're in a state where queries
|
|
|
|
* are illegal, but then width, height, and depth would still be zero anyway.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
compsize =
|
|
|
|
__glGetTexImage_size(target, level, format, type, width, height, depth);
|
|
|
|
if (compsize < 0)
|
2014-11-10 18:13:37 +01:00
|
|
|
return BadLength;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2013-07-10 16:00:46 +02:00
|
|
|
glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
|
2003-11-14 17:48:57 +01:00
|
|
|
__glXClearErrorOccured();
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetTexImage(*(GLenum *) (pc + 0), *(GLint *) (pc + 4),
|
|
|
|
*(GLenum *) (pc + 8), *(GLenum *) (pc + 12), answer);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if (__glXErrorOccured()) {
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_BEGIN_REPLY(0);
|
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__GLX_BEGIN_REPLY(compsize);
|
2017-06-16 21:44:48 +02:00
|
|
|
((xGLXGetTexImageReply *) &reply)->width = width;
|
|
|
|
((xGLXGetTexImageReply *) &reply)->height = height;
|
|
|
|
((xGLXGetTexImageReply *) &reply)->depth = depth;
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
__GLX_SEND_VOID_ARRAY(compsize);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXDisp_GetPolygonStipple(__GLXclientState * cl, GLbyte * pc)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
GLboolean lsbFirst;
|
|
|
|
__GLXcontext *cx;
|
|
|
|
ClientPtr client = cl->client;
|
|
|
|
int error;
|
|
|
|
GLubyte answerBuffer[200];
|
|
|
|
char *answer;
|
2017-06-16 21:44:48 +02:00
|
|
|
xGLXSingleReply reply = { 0, };
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2014-11-10 18:13:47 +01:00
|
|
|
REQUEST_FIXED_SIZE(xGLXSingleReq, 4);
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
|
|
|
|
if (!cx) {
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pc += __GLX_SINGLE_HDR_SIZE;
|
2012-03-21 20:55:09 +01:00
|
|
|
lsbFirst = *(GLboolean *) (pc + 0);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2013-07-10 16:00:46 +02:00
|
|
|
glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst);
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_GET_ANSWER_BUFFER(answer, cl, 128, 1);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
__glXClearErrorOccured();
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetPolygonStipple((GLubyte *) answer);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if (__glXErrorOccured()) {
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_BEGIN_REPLY(0);
|
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__GLX_BEGIN_REPLY(128);
|
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
__GLX_SEND_BYTE_ARRAY(128);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static int
|
|
|
|
GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
GLint compsize, compsize2;
|
|
|
|
GLenum format, type, target;
|
|
|
|
GLboolean swapBytes;
|
|
|
|
__GLXcontext *cx;
|
|
|
|
ClientPtr client = cl->client;
|
|
|
|
int error;
|
|
|
|
char *answer, answerBuffer[200];
|
2012-03-21 20:55:09 +01:00
|
|
|
GLint width = 0, height = 0;
|
2017-06-16 21:44:48 +02:00
|
|
|
xGLXSingleReply reply = { 0, };
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2006-10-12 00:41:22 +02:00
|
|
|
cx = __glXForceCurrent(cl, tag, &error);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!cx) {
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
format = *(GLenum *) (pc + 4);
|
|
|
|
type = *(GLenum *) (pc + 8);
|
|
|
|
target = *(GLenum *) (pc + 0);
|
|
|
|
swapBytes = *(GLboolean *) (pc + 12);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
/* target must be SEPARABLE_2D, however I guess we can let the GL
|
|
|
|
barf on this one.... */
|
|
|
|
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width);
|
|
|
|
glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height);
|
2003-11-14 17:48:57 +01:00
|
|
|
/*
|
|
|
|
* The two queries above might fail if we're in a state where queries
|
|
|
|
* are illegal, but then width and height would still be zero anyway.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1);
|
|
|
|
compsize2 = __glGetTexImage_size(target, 1, format, type, height, 1, 1);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2014-11-10 18:13:47 +01:00
|
|
|
if ((compsize = safe_pad(compsize)) < 0)
|
2014-11-10 18:13:37 +01:00
|
|
|
return BadLength;
|
2014-11-10 18:13:47 +01:00
|
|
|
if ((compsize2 = safe_pad(compsize2)) < 0)
|
2014-11-10 18:13:37 +01:00
|
|
|
return BadLength;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2013-07-10 16:00:46 +02:00
|
|
|
glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
|
2014-11-10 18:13:47 +01:00
|
|
|
__GLX_GET_ANSWER_BUFFER(answer, cl, safe_add(compsize, compsize2), 1);
|
2003-11-14 17:48:57 +01:00
|
|
|
__glXClearErrorOccured();
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetSeparableFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
|
|
|
|
*(GLenum *) (pc + 8), answer, answer + compsize, NULL);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if (__glXErrorOccured()) {
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_BEGIN_REPLY(0);
|
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__GLX_BEGIN_REPLY(compsize + compsize2);
|
2017-06-16 21:44:48 +02:00
|
|
|
((xGLXGetSeparableFilterReply *) &reply)->width = width;
|
|
|
|
((xGLXGetSeparableFilterReply *) &reply)->height = height;
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
__GLX_SEND_VOID_ARRAY(compsize + compsize2);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXDisp_GetSeparableFilter(__GLXclientState * cl, GLbyte * pc)
|
2006-10-12 00:41:22 +02:00
|
|
|
{
|
|
|
|
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
|
2014-11-10 18:13:47 +01:00
|
|
|
ClientPtr client = cl->client;
|
|
|
|
REQUEST_FIXED_SIZE(xGLXSingleReq, 16);
|
2006-10-12 00:41:22 +02:00
|
|
|
return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXDisp_GetSeparableFilterEXT(__GLXclientState * cl, GLbyte * pc)
|
2006-10-12 00:41:22 +02:00
|
|
|
{
|
|
|
|
const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
|
2014-11-10 18:13:47 +01:00
|
|
|
ClientPtr client = cl->client;
|
|
|
|
REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16);
|
2006-10-12 00:41:22 +02:00
|
|
|
return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static int
|
|
|
|
GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
GLint compsize;
|
|
|
|
GLenum format, type, target;
|
|
|
|
GLboolean swapBytes;
|
|
|
|
__GLXcontext *cx;
|
|
|
|
ClientPtr client = cl->client;
|
|
|
|
int error;
|
|
|
|
char *answer, answerBuffer[200];
|
2012-03-21 20:55:09 +01:00
|
|
|
GLint width = 0, height = 0;
|
2017-06-16 21:44:48 +02:00
|
|
|
xGLXSingleReply reply = { 0, };
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2006-10-12 00:41:22 +02:00
|
|
|
cx = __glXForceCurrent(cl, tag, &error);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!cx) {
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
format = *(GLenum *) (pc + 4);
|
|
|
|
type = *(GLenum *) (pc + 8);
|
|
|
|
target = *(GLenum *) (pc + 0);
|
|
|
|
swapBytes = *(GLboolean *) (pc + 12);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (target == GL_CONVOLUTION_1D) {
|
|
|
|
height = 1;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* The two queries above might fail if we're in a state where queries
|
|
|
|
* are illegal, but then width and height would still be zero anyway.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
compsize = __glGetTexImage_size(target, 1, format, type, width, height, 1);
|
|
|
|
if (compsize < 0)
|
2014-11-10 18:13:37 +01:00
|
|
|
return BadLength;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2013-07-10 16:00:46 +02:00
|
|
|
glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
|
2003-11-14 17:48:57 +01:00
|
|
|
__glXClearErrorOccured();
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetConvolutionFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
|
|
|
|
*(GLenum *) (pc + 8), answer);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if (__glXErrorOccured()) {
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_BEGIN_REPLY(0);
|
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__GLX_BEGIN_REPLY(compsize);
|
2017-06-16 21:44:48 +02:00
|
|
|
((xGLXGetConvolutionFilterReply *) &reply)->width = width;
|
|
|
|
((xGLXGetConvolutionFilterReply *) &reply)->height = height;
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
__GLX_SEND_VOID_ARRAY(compsize);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXDisp_GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc)
|
2006-10-12 00:41:22 +02:00
|
|
|
{
|
|
|
|
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
|
2014-11-10 18:13:47 +01:00
|
|
|
ClientPtr client = cl->client;
|
|
|
|
REQUEST_FIXED_SIZE(xGLXSingleReq, 16);
|
2006-10-12 00:41:22 +02:00
|
|
|
return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXDisp_GetConvolutionFilterEXT(__GLXclientState * cl, GLbyte * pc)
|
2006-10-12 00:41:22 +02:00
|
|
|
{
|
|
|
|
const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
|
2014-11-10 18:13:47 +01:00
|
|
|
ClientPtr client = cl->client;
|
|
|
|
REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16);
|
2006-10-12 00:41:22 +02:00
|
|
|
return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static int
|
|
|
|
GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
GLint compsize;
|
|
|
|
GLenum format, type, target;
|
|
|
|
GLboolean swapBytes, reset;
|
|
|
|
__GLXcontext *cx;
|
|
|
|
ClientPtr client = cl->client;
|
|
|
|
int error;
|
|
|
|
char *answer, answerBuffer[200];
|
2012-03-21 20:55:09 +01:00
|
|
|
GLint width = 0;
|
2017-06-16 21:44:48 +02:00
|
|
|
xGLXSingleReply reply = { 0, };
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2006-10-12 00:41:22 +02:00
|
|
|
cx = __glXForceCurrent(cl, tag, &error);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!cx) {
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
format = *(GLenum *) (pc + 4);
|
|
|
|
type = *(GLenum *) (pc + 8);
|
|
|
|
target = *(GLenum *) (pc + 0);
|
|
|
|
swapBytes = *(GLboolean *) (pc + 12);
|
|
|
|
reset = *(GLboolean *) (pc + 13);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width);
|
2003-11-14 17:48:57 +01:00
|
|
|
/*
|
|
|
|
* The one query above might fail if we're in a state where queries
|
|
|
|
* are illegal, but then width would still be zero anyway.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1);
|
|
|
|
if (compsize < 0)
|
2014-11-10 18:13:37 +01:00
|
|
|
return BadLength;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2013-07-10 16:00:46 +02:00
|
|
|
glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
|
2003-11-14 17:48:57 +01:00
|
|
|
__glXClearErrorOccured();
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetHistogram(target, reset, format, type, answer);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if (__glXErrorOccured()) {
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_BEGIN_REPLY(0);
|
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__GLX_BEGIN_REPLY(compsize);
|
2017-06-16 21:44:48 +02:00
|
|
|
((xGLXGetHistogramReply *) &reply)->width = width;
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
__GLX_SEND_VOID_ARRAY(compsize);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXDisp_GetHistogram(__GLXclientState * cl, GLbyte * pc)
|
2006-10-12 00:41:22 +02:00
|
|
|
{
|
|
|
|
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
|
2014-11-10 18:13:47 +01:00
|
|
|
ClientPtr client = cl->client;
|
|
|
|
REQUEST_FIXED_SIZE(xGLXSingleReq, 16);
|
2006-10-12 00:41:22 +02:00
|
|
|
return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXDisp_GetHistogramEXT(__GLXclientState * cl, GLbyte * pc)
|
2006-10-12 00:41:22 +02:00
|
|
|
{
|
|
|
|
const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
|
2014-11-10 18:13:47 +01:00
|
|
|
ClientPtr client = cl->client;
|
|
|
|
REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16);
|
2006-10-12 00:41:22 +02:00
|
|
|
return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static int
|
|
|
|
GetMinmax(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
GLint compsize;
|
|
|
|
GLenum format, type, target;
|
|
|
|
GLboolean swapBytes, reset;
|
|
|
|
__GLXcontext *cx;
|
|
|
|
ClientPtr client = cl->client;
|
|
|
|
int error;
|
|
|
|
char *answer, answerBuffer[200];
|
2017-06-16 21:44:48 +02:00
|
|
|
xGLXSingleReply reply = { 0, };
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2006-10-12 00:41:22 +02:00
|
|
|
cx = __glXForceCurrent(cl, tag, &error);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!cx) {
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
format = *(GLenum *) (pc + 4);
|
|
|
|
type = *(GLenum *) (pc + 8);
|
|
|
|
target = *(GLenum *) (pc + 0);
|
|
|
|
swapBytes = *(GLboolean *) (pc + 12);
|
|
|
|
reset = *(GLboolean *) (pc + 13);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
compsize = __glGetTexImage_size(target, 1, format, type, 2, 1, 1);
|
|
|
|
if (compsize < 0)
|
2014-11-10 18:13:37 +01:00
|
|
|
return BadLength;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2013-07-10 16:00:46 +02:00
|
|
|
glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
|
2003-11-14 17:48:57 +01:00
|
|
|
__glXClearErrorOccured();
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetMinmax(target, reset, format, type, answer);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if (__glXErrorOccured()) {
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_BEGIN_REPLY(0);
|
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__GLX_BEGIN_REPLY(compsize);
|
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
__GLX_SEND_VOID_ARRAY(compsize);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXDisp_GetMinmax(__GLXclientState * cl, GLbyte * pc)
|
2006-10-12 00:41:22 +02:00
|
|
|
{
|
|
|
|
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
|
2014-11-10 18:13:47 +01:00
|
|
|
ClientPtr client = cl->client;
|
|
|
|
REQUEST_FIXED_SIZE(xGLXSingleReq, 16);
|
2006-10-12 00:41:22 +02:00
|
|
|
return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXDisp_GetMinmaxEXT(__GLXclientState * cl, GLbyte * pc)
|
2006-10-12 00:41:22 +02:00
|
|
|
{
|
|
|
|
const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
|
2014-11-10 18:13:47 +01:00
|
|
|
ClientPtr client = cl->client;
|
|
|
|
REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16);
|
2006-10-12 00:41:22 +02:00
|
|
|
return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static int
|
|
|
|
GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
GLint compsize;
|
|
|
|
GLenum format, type, target;
|
|
|
|
GLboolean swapBytes;
|
|
|
|
__GLXcontext *cx;
|
|
|
|
ClientPtr client = cl->client;
|
|
|
|
int error;
|
|
|
|
char *answer, answerBuffer[200];
|
2012-03-21 20:55:09 +01:00
|
|
|
GLint width = 0;
|
2017-06-16 21:44:48 +02:00
|
|
|
xGLXSingleReply reply = { 0, };
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2006-10-12 00:41:22 +02:00
|
|
|
cx = __glXForceCurrent(cl, tag, &error);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!cx) {
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
target = *(GLenum *) (pc + 0);
|
|
|
|
format = *(GLenum *) (pc + 4);
|
|
|
|
type = *(GLenum *) (pc + 8);
|
|
|
|
swapBytes = *(GLboolean *) (pc + 12);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width);
|
2003-11-14 17:48:57 +01:00
|
|
|
/*
|
|
|
|
* The one query above might fail if we're in a state where queries
|
|
|
|
* are illegal, but then width would still be zero anyway.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1);
|
|
|
|
if (compsize < 0)
|
2014-11-10 18:13:37 +01:00
|
|
|
return BadLength;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2013-07-10 16:00:46 +02:00
|
|
|
glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
|
2003-11-14 17:48:57 +01:00
|
|
|
__glXClearErrorOccured();
|
2013-07-10 16:00:46 +02:00
|
|
|
glGetColorTable(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
|
|
|
|
*(GLenum *) (pc + 8), answer);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if (__glXErrorOccured()) {
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_BEGIN_REPLY(0);
|
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__GLX_BEGIN_REPLY(compsize);
|
2017-06-16 21:44:48 +02:00
|
|
|
((xGLXGetColorTableReply *) &reply)->width = width;
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLX_SEND_HEADER();
|
|
|
|
__GLX_SEND_VOID_ARRAY(compsize);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
2006-08-23 22:30:13 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXDisp_GetColorTable(__GLXclientState * cl, GLbyte * pc)
|
2006-08-25 02:58:52 +02:00
|
|
|
{
|
2006-10-12 00:41:22 +02:00
|
|
|
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
|
2014-11-10 18:13:47 +01:00
|
|
|
ClientPtr client = cl->client;
|
|
|
|
REQUEST_FIXED_SIZE(xGLXSingleReq, 16);
|
2006-10-12 00:41:22 +02:00
|
|
|
return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
|
|
|
|
}
|
2006-08-25 02:58:52 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXDisp_GetColorTableSGI(__GLXclientState * cl, GLbyte * pc)
|
2006-10-12 00:41:22 +02:00
|
|
|
{
|
|
|
|
const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
|
2014-11-10 18:13:47 +01:00
|
|
|
ClientPtr client = cl->client;
|
|
|
|
REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16);
|
2006-10-12 00:41:22 +02:00
|
|
|
return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
|
2006-08-25 02:58:52 +02:00
|
|
|
}
|