2004-10-25 22:09:16 +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 22:16:53 +01: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.
|
|
|
|
*/
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
2005-02-22 22:36:31 +00:00
|
|
|
#include <assert.h>
|
2004-10-25 22:09:16 +01:00
|
|
|
#include "glxclient.h"
|
|
|
|
#include "packsingle.h"
|
|
|
|
#include "glxextensions.h"
|
2005-04-14 21:35:33 +01:00
|
|
|
#include "indirect.h"
|
2005-02-22 22:36:31 +00:00
|
|
|
#include "indirect_vertex_array.h"
|
2008-11-10 21:27:42 +00:00
|
|
|
#include "glapi.h"
|
2008-11-12 13:56:42 +00:00
|
|
|
#include <xcb/xcb.h>
|
|
|
|
#include <xcb/glx.h>
|
2008-11-24 19:39:07 +00:00
|
|
|
#include <X11/Xlib-xcb.h>
|
2008-11-12 13:56:42 +00:00
|
|
|
|
2010-03-12 18:27:03 +00:00
|
|
|
#if !defined(__GNUC__)
|
|
|
|
# define __builtin_expect(x, y) x
|
|
|
|
#endif
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
/* Used for GL_ARB_transpose_matrix */
|
2008-10-13 13:35:18 +01:00
|
|
|
static void
|
|
|
|
TransposeMatrixf(GLfloat m[16])
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
int i, j;
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
for (j = 0; j < i; j++) {
|
|
|
|
GLfloat tmp = m[i * 4 + j];
|
|
|
|
m[i * 4 + j] = m[j * 4 + i];
|
|
|
|
m[j * 4 + i] = tmp;
|
|
|
|
}
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Used for GL_ARB_transpose_matrix */
|
2008-10-13 13:35:18 +01:00
|
|
|
static void
|
|
|
|
TransposeMatrixb(GLboolean m[16])
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
int i, j;
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
for (j = 0; j < i; j++) {
|
|
|
|
GLboolean tmp = m[i * 4 + j];
|
|
|
|
m[i * 4 + j] = m[j * 4 + i];
|
|
|
|
m[j * 4 + i] = tmp;
|
|
|
|
}
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Used for GL_ARB_transpose_matrix */
|
2008-10-13 13:35:18 +01:00
|
|
|
static void
|
|
|
|
TransposeMatrixd(GLdouble m[16])
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
int i, j;
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
for (j = 0; j < i; j++) {
|
|
|
|
GLdouble tmp = m[i * 4 + j];
|
|
|
|
m[i * 4 + j] = m[j * 4 + i];
|
|
|
|
m[j * 4 + i] = tmp;
|
|
|
|
}
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Used for GL_ARB_transpose_matrix */
|
2008-10-13 13:35:18 +01:00
|
|
|
static void
|
|
|
|
TransposeMatrixi(GLint m[16])
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
int i, j;
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
for (j = 0; j < i; j++) {
|
|
|
|
GLint tmp = m[i * 4 + j];
|
|
|
|
m[i * 4 + j] = m[j * 4 + i];
|
|
|
|
m[j * 4 + i] = tmp;
|
|
|
|
}
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
2005-01-07 02:53:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remap a transpose-matrix enum to a non-transpose-matrix enum. Enums
|
|
|
|
* that are not transpose-matrix enums are unaffected.
|
|
|
|
*/
|
|
|
|
static GLenum
|
2008-10-13 13:35:18 +01:00
|
|
|
RemapTransposeEnum(GLenum e)
|
2005-01-07 02:53:04 +00:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
switch (e) {
|
|
|
|
case GL_TRANSPOSE_MODELVIEW_MATRIX:
|
|
|
|
case GL_TRANSPOSE_PROJECTION_MATRIX:
|
|
|
|
case GL_TRANSPOSE_TEXTURE_MATRIX:
|
|
|
|
return e - (GL_TRANSPOSE_MODELVIEW_MATRIX - GL_MODELVIEW_MATRIX);
|
|
|
|
case GL_TRANSPOSE_COLOR_MATRIX:
|
|
|
|
return GL_COLOR_MATRIX;
|
|
|
|
default:
|
|
|
|
return e;
|
|
|
|
};
|
2005-01-07 02:53:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
GLenum
|
|
|
|
__indirect_glGetError(void)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
__GLX_SINGLE_DECLARE_VARIABLES();
|
|
|
|
GLuint retval = GL_NO_ERROR;
|
|
|
|
xGLXGetErrorReply reply;
|
|
|
|
|
|
|
|
if (gc->error) {
|
|
|
|
/* Use internal error first */
|
|
|
|
retval = gc->error;
|
|
|
|
gc->error = GL_NO_ERROR;
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
__GLX_SINGLE_LOAD_VARIABLES();
|
|
|
|
__GLX_SINGLE_BEGIN(X_GLsop_GetError, 0);
|
|
|
|
__GLX_SINGLE_READ_XREPLY();
|
|
|
|
retval = reply.error;
|
|
|
|
__GLX_SINGLE_END();
|
|
|
|
|
|
|
|
return retval;
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
2005-02-22 22:36:31 +00:00
|
|
|
|
|
|
|
/**
|
2005-02-23 20:06:52 +00:00
|
|
|
* Get the selected attribute from the client state.
|
2009-08-12 11:41:22 +01:00
|
|
|
*
|
2005-02-22 22:36:31 +00:00
|
|
|
* \returns
|
|
|
|
* On success \c GL_TRUE is returned. Otherwise, \c GL_FALSE is returned.
|
|
|
|
*/
|
|
|
|
static GLboolean
|
2010-07-28 16:16:00 +01:00
|
|
|
get_client_data(struct glx_context * gc, GLenum cap, GLintptr * data)
|
2005-02-22 22:36:31 +00:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
GLboolean retval = GL_TRUE;
|
|
|
|
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
|
|
|
|
const GLint tex_unit = __glXGetActiveTextureUnit(state);
|
|
|
|
|
|
|
|
|
|
|
|
switch (cap) {
|
|
|
|
case GL_VERTEX_ARRAY:
|
|
|
|
case GL_NORMAL_ARRAY:
|
|
|
|
case GL_COLOR_ARRAY:
|
|
|
|
case GL_INDEX_ARRAY:
|
|
|
|
case GL_EDGE_FLAG_ARRAY:
|
|
|
|
case GL_SECONDARY_COLOR_ARRAY:
|
|
|
|
case GL_FOG_COORD_ARRAY:
|
|
|
|
retval = __glXGetArrayEnable(state, cap, 0, data);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GL_VERTEX_ARRAY_SIZE:
|
|
|
|
retval = __glXGetArraySize(state, GL_VERTEX_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
case GL_COLOR_ARRAY_SIZE:
|
|
|
|
retval = __glXGetArraySize(state, GL_COLOR_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
case GL_SECONDARY_COLOR_ARRAY_SIZE:
|
|
|
|
retval = __glXGetArraySize(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GL_VERTEX_ARRAY_TYPE:
|
|
|
|
retval = __glXGetArrayType(state, GL_VERTEX_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
case GL_NORMAL_ARRAY_TYPE:
|
|
|
|
retval = __glXGetArrayType(state, GL_NORMAL_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
case GL_INDEX_ARRAY_TYPE:
|
|
|
|
retval = __glXGetArrayType(state, GL_INDEX_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
case GL_COLOR_ARRAY_TYPE:
|
|
|
|
retval = __glXGetArrayType(state, GL_COLOR_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
case GL_SECONDARY_COLOR_ARRAY_TYPE:
|
|
|
|
retval = __glXGetArrayType(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
case GL_FOG_COORD_ARRAY_TYPE:
|
|
|
|
retval = __glXGetArrayType(state, GL_FOG_COORD_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GL_VERTEX_ARRAY_STRIDE:
|
|
|
|
retval = __glXGetArrayStride(state, GL_VERTEX_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
case GL_NORMAL_ARRAY_STRIDE:
|
|
|
|
retval = __glXGetArrayStride(state, GL_NORMAL_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
case GL_INDEX_ARRAY_STRIDE:
|
|
|
|
retval = __glXGetArrayStride(state, GL_INDEX_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
case GL_EDGE_FLAG_ARRAY_STRIDE:
|
|
|
|
retval = __glXGetArrayStride(state, GL_EDGE_FLAG_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
case GL_COLOR_ARRAY_STRIDE:
|
|
|
|
retval = __glXGetArrayStride(state, GL_COLOR_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
case GL_SECONDARY_COLOR_ARRAY_STRIDE:
|
|
|
|
retval = __glXGetArrayStride(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
case GL_FOG_COORD_ARRAY_STRIDE:
|
|
|
|
retval = __glXGetArrayStride(state, GL_FOG_COORD_ARRAY, 0, data);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GL_TEXTURE_COORD_ARRAY:
|
|
|
|
retval =
|
|
|
|
__glXGetArrayEnable(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
|
|
|
|
break;
|
|
|
|
case GL_TEXTURE_COORD_ARRAY_SIZE:
|
|
|
|
retval =
|
|
|
|
__glXGetArraySize(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
|
|
|
|
break;
|
|
|
|
case GL_TEXTURE_COORD_ARRAY_TYPE:
|
|
|
|
retval =
|
|
|
|
__glXGetArrayType(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
|
|
|
|
break;
|
|
|
|
case GL_TEXTURE_COORD_ARRAY_STRIDE:
|
|
|
|
retval =
|
|
|
|
__glXGetArrayStride(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GL_MAX_ELEMENTS_VERTICES:
|
|
|
|
case GL_MAX_ELEMENTS_INDICES:
|
|
|
|
retval = GL_TRUE;
|
|
|
|
*data = ~0UL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case GL_PACK_ROW_LENGTH:
|
|
|
|
*data = (GLintptr) state->storePack.rowLength;
|
|
|
|
break;
|
|
|
|
case GL_PACK_IMAGE_HEIGHT:
|
|
|
|
*data = (GLintptr) state->storePack.imageHeight;
|
|
|
|
break;
|
|
|
|
case GL_PACK_SKIP_ROWS:
|
|
|
|
*data = (GLintptr) state->storePack.skipRows;
|
|
|
|
break;
|
|
|
|
case GL_PACK_SKIP_PIXELS:
|
|
|
|
*data = (GLintptr) state->storePack.skipPixels;
|
|
|
|
break;
|
|
|
|
case GL_PACK_SKIP_IMAGES:
|
|
|
|
*data = (GLintptr) state->storePack.skipImages;
|
|
|
|
break;
|
|
|
|
case GL_PACK_ALIGNMENT:
|
|
|
|
*data = (GLintptr) state->storePack.alignment;
|
|
|
|
break;
|
|
|
|
case GL_PACK_SWAP_BYTES:
|
|
|
|
*data = (GLintptr) state->storePack.swapEndian;
|
|
|
|
break;
|
|
|
|
case GL_PACK_LSB_FIRST:
|
|
|
|
*data = (GLintptr) state->storePack.lsbFirst;
|
|
|
|
break;
|
|
|
|
case GL_UNPACK_ROW_LENGTH:
|
|
|
|
*data = (GLintptr) state->storeUnpack.rowLength;
|
|
|
|
break;
|
|
|
|
case GL_UNPACK_IMAGE_HEIGHT:
|
|
|
|
*data = (GLintptr) state->storeUnpack.imageHeight;
|
|
|
|
break;
|
|
|
|
case GL_UNPACK_SKIP_ROWS:
|
|
|
|
*data = (GLintptr) state->storeUnpack.skipRows;
|
|
|
|
break;
|
|
|
|
case GL_UNPACK_SKIP_PIXELS:
|
|
|
|
*data = (GLintptr) state->storeUnpack.skipPixels;
|
|
|
|
break;
|
|
|
|
case GL_UNPACK_SKIP_IMAGES:
|
|
|
|
*data = (GLintptr) state->storeUnpack.skipImages;
|
|
|
|
break;
|
|
|
|
case GL_UNPACK_ALIGNMENT:
|
|
|
|
*data = (GLintptr) state->storeUnpack.alignment;
|
|
|
|
break;
|
|
|
|
case GL_UNPACK_SWAP_BYTES:
|
|
|
|
*data = (GLintptr) state->storeUnpack.swapEndian;
|
|
|
|
break;
|
|
|
|
case GL_UNPACK_LSB_FIRST:
|
|
|
|
*data = (GLintptr) state->storeUnpack.lsbFirst;
|
|
|
|
break;
|
|
|
|
case GL_CLIENT_ATTRIB_STACK_DEPTH:
|
|
|
|
*data = (GLintptr) (gc->attributes.stackPointer - gc->attributes.stack);
|
|
|
|
break;
|
|
|
|
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
|
|
|
|
*data = (GLintptr) __GL_CLIENT_ATTRIB_STACK_DEPTH;
|
|
|
|
break;
|
|
|
|
case GL_CLIENT_ACTIVE_TEXTURE:
|
|
|
|
*data = (GLintptr) (tex_unit + GL_TEXTURE0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
retval = GL_FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return retval;
|
2005-02-22 22:36:31 +00:00
|
|
|
}
|
|
|
|
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
void
|
|
|
|
__indirect_glGetBooleanv(GLenum val, GLboolean * b)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
const GLenum origVal = val;
|
|
|
|
__GLX_SINGLE_DECLARE_VARIABLES();
|
|
|
|
xGLXSingleReply reply;
|
|
|
|
|
|
|
|
val = RemapTransposeEnum(val);
|
|
|
|
|
|
|
|
__GLX_SINGLE_LOAD_VARIABLES();
|
|
|
|
__GLX_SINGLE_BEGIN(X_GLsop_GetBooleanv, 4);
|
|
|
|
__GLX_SINGLE_PUT_LONG(0, val);
|
|
|
|
__GLX_SINGLE_READ_XREPLY();
|
|
|
|
__GLX_SINGLE_GET_SIZE(compsize);
|
|
|
|
|
|
|
|
if (compsize == 0) {
|
|
|
|
/*
|
2015-04-22 11:33:17 +01:00
|
|
|
** Error occurred; don't modify user's buffer.
|
2008-10-13 13:35:18 +01:00
|
|
|
*/
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
GLintptr data;
|
|
|
|
|
|
|
|
/*
|
|
|
|
** We still needed to send the request to the server in order to
|
|
|
|
** find out whether it was legal to make a query (it's illegal,
|
|
|
|
** for example, to call a query between glBegin() and glEnd()).
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (get_client_data(gc, val, &data)) {
|
|
|
|
*b = (GLboolean) data;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/*
|
|
|
|
** Not a local value, so use what we got from the server.
|
|
|
|
*/
|
|
|
|
if (compsize == 1) {
|
|
|
|
__GLX_SINGLE_GET_CHAR(b);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__GLX_SINGLE_GET_CHAR_ARRAY(b, compsize);
|
|
|
|
if (val != origVal) {
|
|
|
|
/* matrix transpose */
|
|
|
|
TransposeMatrixb(b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
__GLX_SINGLE_END();
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
void
|
|
|
|
__indirect_glGetDoublev(GLenum val, GLdouble * d)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
const GLenum origVal = val;
|
|
|
|
__GLX_SINGLE_DECLARE_VARIABLES();
|
|
|
|
xGLXSingleReply reply;
|
|
|
|
|
|
|
|
val = RemapTransposeEnum(val);
|
|
|
|
|
|
|
|
__GLX_SINGLE_LOAD_VARIABLES();
|
|
|
|
__GLX_SINGLE_BEGIN(X_GLsop_GetDoublev, 4);
|
|
|
|
__GLX_SINGLE_PUT_LONG(0, val);
|
|
|
|
__GLX_SINGLE_READ_XREPLY();
|
|
|
|
__GLX_SINGLE_GET_SIZE(compsize);
|
|
|
|
|
|
|
|
if (compsize == 0) {
|
|
|
|
/*
|
2015-04-22 11:33:17 +01:00
|
|
|
** Error occurred; don't modify user's buffer.
|
2008-10-13 13:35:18 +01:00
|
|
|
*/
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
GLintptr data;
|
|
|
|
|
|
|
|
/*
|
|
|
|
** We still needed to send the request to the server in order to
|
|
|
|
** find out whether it was legal to make a query (it's illegal,
|
|
|
|
** for example, to call a query between glBegin() and glEnd()).
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (get_client_data(gc, val, &data)) {
|
|
|
|
*d = (GLdouble) data;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/*
|
|
|
|
** Not a local value, so use what we got from the server.
|
|
|
|
*/
|
|
|
|
if (compsize == 1) {
|
|
|
|
__GLX_SINGLE_GET_DOUBLE(d);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__GLX_SINGLE_GET_DOUBLE_ARRAY(d, compsize);
|
|
|
|
if (val != origVal) {
|
|
|
|
/* matrix transpose */
|
|
|
|
TransposeMatrixd(d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
__GLX_SINGLE_END();
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
void
|
|
|
|
__indirect_glGetFloatv(GLenum val, GLfloat * f)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
const GLenum origVal = val;
|
|
|
|
__GLX_SINGLE_DECLARE_VARIABLES();
|
|
|
|
xGLXSingleReply reply;
|
|
|
|
|
|
|
|
val = RemapTransposeEnum(val);
|
|
|
|
|
|
|
|
__GLX_SINGLE_LOAD_VARIABLES();
|
|
|
|
__GLX_SINGLE_BEGIN(X_GLsop_GetFloatv, 4);
|
|
|
|
__GLX_SINGLE_PUT_LONG(0, val);
|
|
|
|
__GLX_SINGLE_READ_XREPLY();
|
|
|
|
__GLX_SINGLE_GET_SIZE(compsize);
|
|
|
|
|
|
|
|
if (compsize == 0) {
|
|
|
|
/*
|
2015-04-22 11:33:17 +01:00
|
|
|
** Error occurred; don't modify user's buffer.
|
2008-10-13 13:35:18 +01:00
|
|
|
*/
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
GLintptr data;
|
|
|
|
|
|
|
|
/*
|
|
|
|
** We still needed to send the request to the server in order to
|
|
|
|
** find out whether it was legal to make a query (it's illegal,
|
|
|
|
** for example, to call a query between glBegin() and glEnd()).
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (get_client_data(gc, val, &data)) {
|
|
|
|
*f = (GLfloat) data;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/*
|
|
|
|
** Not a local value, so use what we got from the server.
|
|
|
|
*/
|
|
|
|
if (compsize == 1) {
|
|
|
|
__GLX_SINGLE_GET_FLOAT(f);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__GLX_SINGLE_GET_FLOAT_ARRAY(f, compsize);
|
|
|
|
if (val != origVal) {
|
|
|
|
/* matrix transpose */
|
|
|
|
TransposeMatrixf(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
__GLX_SINGLE_END();
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
void
|
|
|
|
__indirect_glGetIntegerv(GLenum val, GLint * i)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
const GLenum origVal = val;
|
|
|
|
__GLX_SINGLE_DECLARE_VARIABLES();
|
|
|
|
xGLXSingleReply reply;
|
|
|
|
|
|
|
|
val = RemapTransposeEnum(val);
|
|
|
|
|
|
|
|
__GLX_SINGLE_LOAD_VARIABLES();
|
|
|
|
__GLX_SINGLE_BEGIN(X_GLsop_GetIntegerv, 4);
|
|
|
|
__GLX_SINGLE_PUT_LONG(0, val);
|
|
|
|
__GLX_SINGLE_READ_XREPLY();
|
|
|
|
__GLX_SINGLE_GET_SIZE(compsize);
|
|
|
|
|
|
|
|
if (compsize == 0) {
|
|
|
|
/*
|
2015-04-22 11:33:17 +01:00
|
|
|
** Error occurred; don't modify user's buffer.
|
2008-10-13 13:35:18 +01:00
|
|
|
*/
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
GLintptr data;
|
|
|
|
|
|
|
|
/*
|
|
|
|
** We still needed to send the request to the server in order to
|
|
|
|
** find out whether it was legal to make a query (it's illegal,
|
|
|
|
** for example, to call a query between glBegin() and glEnd()).
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (get_client_data(gc, val, &data)) {
|
|
|
|
*i = (GLint) data;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/*
|
|
|
|
** Not a local value, so use what we got from the server.
|
|
|
|
*/
|
|
|
|
if (compsize == 1) {
|
|
|
|
__GLX_SINGLE_GET_LONG(i);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__GLX_SINGLE_GET_LONG_ARRAY(i, compsize);
|
|
|
|
if (val != origVal) {
|
|
|
|
/* matrix transpose */
|
|
|
|
TransposeMatrixi(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
__GLX_SINGLE_END();
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Send all pending commands to server.
|
|
|
|
*/
|
2008-10-13 13:35:18 +01:00
|
|
|
void
|
|
|
|
__indirect_glFlush(void)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
__GLX_SINGLE_DECLARE_VARIABLES();
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
if (!dpy)
|
|
|
|
return;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
__GLX_SINGLE_LOAD_VARIABLES();
|
|
|
|
__GLX_SINGLE_BEGIN(X_GLsop_Flush, 0);
|
|
|
|
__GLX_SINGLE_END();
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
/* And finally flush the X protocol data */
|
|
|
|
XFlush(dpy);
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
void
|
|
|
|
__indirect_glFeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
__GLX_SINGLE_DECLARE_VARIABLES();
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
if (!dpy)
|
|
|
|
return;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
__GLX_SINGLE_LOAD_VARIABLES();
|
|
|
|
__GLX_SINGLE_BEGIN(X_GLsop_FeedbackBuffer, 8);
|
|
|
|
__GLX_SINGLE_PUT_LONG(0, size);
|
|
|
|
__GLX_SINGLE_PUT_LONG(4, type);
|
|
|
|
__GLX_SINGLE_END();
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
gc->feedbackBuf = buffer;
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
void
|
|
|
|
__indirect_glSelectBuffer(GLsizei numnames, GLuint * buffer)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
__GLX_SINGLE_DECLARE_VARIABLES();
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
if (!dpy)
|
|
|
|
return;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
__GLX_SINGLE_LOAD_VARIABLES();
|
|
|
|
__GLX_SINGLE_BEGIN(X_GLsop_SelectBuffer, 4);
|
|
|
|
__GLX_SINGLE_PUT_LONG(0, numnames);
|
|
|
|
__GLX_SINGLE_END();
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
gc->selectBuf = buffer;
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
GLint
|
|
|
|
__indirect_glRenderMode(GLenum mode)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
__GLX_SINGLE_DECLARE_VARIABLES();
|
|
|
|
GLint retval = 0;
|
|
|
|
xGLXRenderModeReply reply;
|
|
|
|
|
|
|
|
if (!dpy)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
__GLX_SINGLE_LOAD_VARIABLES();
|
|
|
|
__GLX_SINGLE_BEGIN(X_GLsop_RenderMode, 4);
|
|
|
|
__GLX_SINGLE_PUT_LONG(0, mode);
|
|
|
|
__GLX_SINGLE_READ_XREPLY();
|
|
|
|
__GLX_SINGLE_GET_RETVAL(retval, GLint);
|
|
|
|
|
|
|
|
if (reply.newMode != mode) {
|
|
|
|
/*
|
|
|
|
** Switch to new mode did not take effect, therefore an error
|
2015-04-22 11:33:17 +01:00
|
|
|
** occurred. When an error happens the server won't send us any
|
2008-10-13 13:35:18 +01:00
|
|
|
** other data.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Read the feedback or selection data */
|
|
|
|
if (gc->renderMode == GL_FEEDBACK) {
|
|
|
|
__GLX_SINGLE_GET_SIZE(compsize);
|
|
|
|
__GLX_SINGLE_GET_FLOAT_ARRAY(gc->feedbackBuf, compsize);
|
|
|
|
}
|
|
|
|
else if (gc->renderMode == GL_SELECT) {
|
|
|
|
__GLX_SINGLE_GET_SIZE(compsize);
|
|
|
|
__GLX_SINGLE_GET_LONG_ARRAY(gc->selectBuf, compsize);
|
|
|
|
}
|
|
|
|
gc->renderMode = mode;
|
|
|
|
}
|
|
|
|
__GLX_SINGLE_END();
|
|
|
|
|
|
|
|
return retval;
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
void
|
|
|
|
__indirect_glFinish(void)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
__GLX_SINGLE_DECLARE_VARIABLES();
|
|
|
|
xGLXSingleReply reply;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
__GLX_SINGLE_LOAD_VARIABLES();
|
|
|
|
__GLX_SINGLE_BEGIN(X_GLsop_Finish, 0);
|
|
|
|
__GLX_SINGLE_READ_XREPLY();
|
|
|
|
__GLX_SINGLE_END();
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Extract the major and minor version numbers from a version string.
|
|
|
|
*/
|
|
|
|
static void
|
2008-10-13 13:35:18 +01:00
|
|
|
version_from_string(const char *ver, int *major_version, int *minor_version)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
const char *end;
|
|
|
|
long major;
|
|
|
|
long minor;
|
|
|
|
|
|
|
|
major = strtol(ver, (char **) &end, 10);
|
|
|
|
minor = strtol(end + 1, NULL, 10);
|
|
|
|
*major_version = major;
|
|
|
|
*minor_version = minor;
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
const GLubyte *
|
|
|
|
__indirect_glGetString(GLenum name)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2010-07-28 16:16:00 +01:00
|
|
|
struct glx_context *gc = __glXGetCurrentContext();
|
2008-10-13 13:35:18 +01:00
|
|
|
Display *dpy = gc->currentDpy;
|
|
|
|
GLubyte *s = NULL;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
if (!dpy)
|
2021-08-02 22:39:27 +01:00
|
|
|
return NULL;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
/*
|
2004-10-25 22:09:16 +01:00
|
|
|
** Return the cached copy if the string has already been fetched
|
|
|
|
*/
|
2008-10-13 13:35:18 +01:00
|
|
|
switch (name) {
|
|
|
|
case GL_VENDOR:
|
|
|
|
if (gc->vendor)
|
|
|
|
return gc->vendor;
|
|
|
|
break;
|
|
|
|
case GL_RENDERER:
|
|
|
|
if (gc->renderer)
|
|
|
|
return gc->renderer;
|
|
|
|
break;
|
|
|
|
case GL_VERSION:
|
|
|
|
if (gc->version)
|
|
|
|
return gc->version;
|
|
|
|
break;
|
|
|
|
case GL_EXTENSIONS:
|
|
|
|
if (gc->extensions)
|
|
|
|
return gc->extensions;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
__glXSetError(gc, GL_INVALID_ENUM);
|
2021-08-02 22:39:27 +01:00
|
|
|
return NULL;
|
2008-10-13 13:35:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2004-10-25 22:09:16 +01:00
|
|
|
** Get requested string from server
|
|
|
|
*/
|
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
2021-04-22 23:39:41 +01:00
|
|
|
s = (GLubyte *) __glXGetString(dpy, gc->currentContextTag, name);
|
2008-10-13 13:35:18 +01:00
|
|
|
if (!s) {
|
|
|
|
/* Throw data on the floor */
|
|
|
|
__glXSetError(gc, GL_OUT_OF_MEMORY);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/*
|
|
|
|
** Update local cache
|
|
|
|
*/
|
|
|
|
switch (name) {
|
|
|
|
case GL_VENDOR:
|
|
|
|
gc->vendor = s;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GL_RENDERER:
|
|
|
|
gc->renderer = s;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GL_VERSION:{
|
2021-04-13 21:01:38 +01:00
|
|
|
const int client_major = 1;
|
|
|
|
const int client_minor = 4;
|
2008-10-13 13:35:18 +01:00
|
|
|
|
|
|
|
version_from_string((char *) s,
|
|
|
|
&gc->server_major, &gc->server_minor);
|
|
|
|
|
|
|
|
if ((gc->server_major < client_major)
|
|
|
|
|| ((gc->server_major == client_major)
|
|
|
|
&& (gc->server_minor <= client_minor))) {
|
|
|
|
gc->version = s;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Allow 7 bytes for the client-side GL version. This allows
|
|
|
|
* for upto version 999.999. I'm not holding my breath for
|
|
|
|
* that one! The extra 4 is for the ' ()\0' that will be
|
|
|
|
* added.
|
|
|
|
*/
|
|
|
|
const size_t size = 7 + strlen((char *) s) + 4;
|
|
|
|
|
2012-09-05 06:52:36 +01:00
|
|
|
gc->version = malloc(size);
|
2008-10-13 13:35:18 +01:00
|
|
|
if (gc->version == NULL) {
|
|
|
|
/* If we couldn't allocate memory for the new string,
|
|
|
|
* make a best-effort and just copy the client-side version
|
|
|
|
* to the string and use that. It probably doesn't
|
|
|
|
* matter what is done here. If there not memory available
|
|
|
|
* for a short string, the system is probably going to die
|
|
|
|
* soon anyway.
|
|
|
|
*/
|
|
|
|
snprintf((char *) s, strlen((char *) s) + 1, "%u.%u",
|
|
|
|
client_major, client_minor);
|
|
|
|
gc->version = s;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
snprintf((char *) gc->version, size, "%u.%u (%s)",
|
|
|
|
client_major, client_minor, s);
|
2012-09-05 06:52:36 +01:00
|
|
|
free(s);
|
2008-10-13 13:35:18 +01:00
|
|
|
s = gc->version;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case GL_EXTENSIONS:{
|
2021-04-13 21:21:09 +01:00
|
|
|
__glXCalculateUsableGLExtensions(gc, (char *) s);
|
2012-09-05 06:52:36 +01:00
|
|
|
free(s);
|
2008-10-13 13:35:18 +01:00
|
|
|
s = gc->extensions;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return s;
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
GLboolean
|
|
|
|
__indirect_glIsEnabled(GLenum cap)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 13:35:18 +01:00
|
|
|
__GLX_SINGLE_DECLARE_VARIABLES();
|
|
|
|
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
|
|
|
|
xGLXSingleReply reply;
|
|
|
|
GLboolean retval = 0;
|
|
|
|
GLintptr enable;
|
|
|
|
|
|
|
|
if (!dpy)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (cap) {
|
|
|
|
case GL_VERTEX_ARRAY:
|
|
|
|
case GL_NORMAL_ARRAY:
|
|
|
|
case GL_COLOR_ARRAY:
|
|
|
|
case GL_INDEX_ARRAY:
|
|
|
|
case GL_EDGE_FLAG_ARRAY:
|
|
|
|
case GL_SECONDARY_COLOR_ARRAY:
|
|
|
|
case GL_FOG_COORD_ARRAY:
|
|
|
|
retval = __glXGetArrayEnable(state, cap, 0, &enable);
|
|
|
|
assert(retval);
|
|
|
|
return (GLboolean) enable;
|
|
|
|
break;
|
|
|
|
case GL_TEXTURE_COORD_ARRAY:
|
|
|
|
retval = __glXGetArrayEnable(state, GL_TEXTURE_COORD_ARRAY,
|
|
|
|
__glXGetActiveTextureUnit(state), &enable);
|
|
|
|
assert(retval);
|
|
|
|
return (GLboolean) enable;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
__GLX_SINGLE_LOAD_VARIABLES();
|
|
|
|
__GLX_SINGLE_BEGIN(X_GLsop_IsEnabled, 4);
|
|
|
|
__GLX_SINGLE_PUT_LONG(0, cap);
|
|
|
|
__GLX_SINGLE_READ_XREPLY();
|
|
|
|
__GLX_SINGLE_GET_RETVAL(retval, GLboolean);
|
|
|
|
__GLX_SINGLE_END();
|
|
|
|
return retval;
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:35:18 +01:00
|
|
|
void
|
|
|
|
__indirect_glGetPointerv(GLenum pname, void **params)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2010-07-28 16:16:00 +01:00
|
|
|
struct glx_context *gc = __glXGetCurrentContext();
|
2008-10-13 13:35:18 +01:00
|
|
|
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
|
|
|
|
Display *dpy = gc->currentDpy;
|
|
|
|
|
|
|
|
if (!dpy)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (pname) {
|
|
|
|
case GL_VERTEX_ARRAY_POINTER:
|
|
|
|
case GL_NORMAL_ARRAY_POINTER:
|
|
|
|
case GL_COLOR_ARRAY_POINTER:
|
|
|
|
case GL_INDEX_ARRAY_POINTER:
|
|
|
|
case GL_EDGE_FLAG_ARRAY_POINTER:
|
|
|
|
__glXGetArrayPointer(state, pname - GL_VERTEX_ARRAY_POINTER
|
|
|
|
+ GL_VERTEX_ARRAY, 0, params);
|
|
|
|
return;
|
|
|
|
case GL_TEXTURE_COORD_ARRAY_POINTER:
|
|
|
|
__glXGetArrayPointer(state, GL_TEXTURE_COORD_ARRAY,
|
|
|
|
__glXGetActiveTextureUnit(state), params);
|
|
|
|
return;
|
|
|
|
case GL_SECONDARY_COLOR_ARRAY_POINTER:
|
|
|
|
case GL_FOG_COORD_ARRAY_POINTER:
|
|
|
|
__glXGetArrayPointer(state, pname - GL_FOG_COORD_ARRAY_POINTER
|
|
|
|
+ GL_FOG_COORD_ARRAY, 0, params);
|
|
|
|
return;
|
|
|
|
case GL_FEEDBACK_BUFFER_POINTER:
|
|
|
|
*params = (void *) gc->feedbackBuf;
|
|
|
|
return;
|
|
|
|
case GL_SELECTION_BUFFER_POINTER:
|
|
|
|
*params = (void *) gc->selectBuf;
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
__glXSetError(gc, GL_INVALID_ENUM);
|
|
|
|
return;
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
2008-11-10 21:27:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This was previously auto-generated, but we need to special-case
|
|
|
|
* how we handle writing into the 'residences' buffer when n%4!=0.
|
|
|
|
*/
|
|
|
|
#define X_GLsop_AreTexturesResident 143
|
|
|
|
GLboolean
|
|
|
|
__indirect_glAreTexturesResident(GLsizei n, const GLuint * textures,
|
|
|
|
GLboolean * residences)
|
|
|
|
{
|
2010-07-28 16:16:00 +01:00
|
|
|
struct glx_context *const gc = __glXGetCurrentContext();
|
2009-08-12 11:41:22 +01:00
|
|
|
Display *const dpy = gc->currentDpy;
|
|
|
|
GLboolean retval = (GLboolean) 0;
|
|
|
|
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
|
|
|
|
xcb_connection_t *c = XGetXCBConnection(dpy);
|
2013-06-26 20:38:18 +01:00
|
|
|
xcb_glx_are_textures_resident_reply_t *reply;
|
2009-08-12 11:41:22 +01:00
|
|
|
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
2013-06-26 20:38:18 +01:00
|
|
|
reply =
|
2009-08-12 11:41:22 +01:00
|
|
|
xcb_glx_are_textures_resident_reply(c,
|
|
|
|
xcb_glx_are_textures_resident
|
|
|
|
(c, gc->currentContextTag, n,
|
|
|
|
textures), NULL);
|
|
|
|
(void) memcpy(residences, xcb_glx_are_textures_resident_data(reply),
|
|
|
|
xcb_glx_are_textures_resident_data_length(reply) *
|
|
|
|
sizeof(GLboolean));
|
|
|
|
retval = reply->ret_val;
|
|
|
|
free(reply);
|
|
|
|
}
|
|
|
|
return retval;
|
2008-11-10 21:27:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This was previously auto-generated, but we need to special-case
|
|
|
|
* how we handle writing into the 'residences' buffer when n%4!=0.
|
|
|
|
*/
|
|
|
|
#define X_GLvop_AreTexturesResidentEXT 11
|
|
|
|
GLboolean
|
|
|
|
glAreTexturesResidentEXT(GLsizei n, const GLuint * textures,
|
|
|
|
GLboolean * residences)
|
|
|
|
{
|
2010-07-28 16:16:00 +01:00
|
|
|
struct glx_context *const gc = __glXGetCurrentContext();
|
2009-08-12 11:41:22 +01:00
|
|
|
|
|
|
|
if (gc->isDirect) {
|
2012-08-01 00:58:41 +01:00
|
|
|
const _glapi_proc *const table = (_glapi_proc *) GET_DISPATCH();
|
|
|
|
PFNGLARETEXTURESRESIDENTEXTPROC p =
|
|
|
|
(PFNGLARETEXTURESRESIDENTEXTPROC) table[332];
|
|
|
|
|
|
|
|
return p(n, textures, residences);
|
2009-08-12 11:41:22 +01:00
|
|
|
}
|
|
|
|
else {
|
2010-07-28 16:16:00 +01:00
|
|
|
struct glx_context *const gc = __glXGetCurrentContext();
|
2009-08-12 11:41:22 +01:00
|
|
|
Display *const dpy = gc->currentDpy;
|
|
|
|
GLboolean retval = (GLboolean) 0;
|
|
|
|
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
|
|
|
|
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
|
|
|
|
GLubyte const *pc =
|
|
|
|
__glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
|
|
|
|
X_GLvop_AreTexturesResidentEXT,
|
|
|
|
cmdlen);
|
|
|
|
(void) memcpy((void *) (pc + 0), (void *) (&n), 4);
|
|
|
|
(void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
|
|
|
|
if (n & 3) {
|
|
|
|
/* see comments in __indirect_glAreTexturesResident() */
|
|
|
|
GLboolean *res4 = malloc((n + 3) & ~3);
|
|
|
|
retval = (GLboolean) __glXReadReply(dpy, 1, res4, GL_TRUE);
|
|
|
|
memcpy(residences, res4, n);
|
|
|
|
free(res4);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
|
|
|
|
}
|
|
|
|
UnlockDisplay(dpy);
|
|
|
|
SyncHandle();
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
2008-11-10 21:27:42 +00:00
|
|
|
}
|