Exemplo n.º 1
0
int __glXDisp_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc)
{
	GLsizei n;
	__GLXcontext *cx;
	ClientPtr client = cl->client;
	int error;
	GLuint answerBuffer[200];
	char *answer;

	cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error);
	if (!cx) {
		return error;
	}
	pc += __GLX_VENDPRIV_HDR_SIZE;
	n = *(GLsizei *)(pc + 0);

	__GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4);
	glGenTexturesEXT( 
		*(GLsizei  *)(pc + 0),
		(GLuint   *) answer
	);
	__GLX_BEGIN_REPLY(n*4);
	__GLX_SEND_HEADER();
	__GLX_SEND_INT_ARRAY(n);
	return Success;
}
Exemplo n.º 2
0
int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc)
{
	GLsizei n;
	GLboolean retval;
	__GLXcontext *cx;
	ClientPtr client = cl->client;
	int error;
	GLboolean answerBuffer[200];
	char *answer;

	cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error);
	if (!cx) {
		return error;
	}
	pc += __GLX_VENDPRIV_HDR_SIZE;
	n = *(GLsizei *)(pc + 0);

	__GLX_GET_ANSWER_BUFFER(answer,cl,n,1);
	retval =
	glAreTexturesResidentEXT( 
		*(GLsizei  *)(pc + 0),
		(GLuint   *)(pc + 4),
		(GLboolean *) answer
	);
	__GLX_PUT_RETVAL(retval);
	__GLX_BEGIN_REPLY(n);
	__GLX_SEND_HEADER();
	__GLX_SEND_BYTE_ARRAY(n);
	return Success;
}
Exemplo n.º 3
0
int
__glXDisp_GetPolygonStipple(__GLXclientState * cl, GLbyte * pc)
{
    GLboolean lsbFirst;
    __GLXcontext *cx;
    ClientPtr client = cl->client;
    int error;
    GLubyte answerBuffer[200];
    char *answer;

    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
    if (!cx) {
        return error;
    }

    pc += __GLX_SINGLE_HDR_SIZE;
    lsbFirst = *(GLboolean *) (pc + 0);

    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst));
    __GLX_GET_ANSWER_BUFFER(answer, cl, 128, 1);

    __glXClearErrorOccured();
    CALL_GetPolygonStipple(GET_DISPATCH(), ((GLubyte *) answer));

    if (__glXErrorOccured()) {
        __GLX_BEGIN_REPLY(0);
        __GLX_SEND_HEADER();
    }
    else {
        __GLX_BEGIN_REPLY(128);
        __GLX_SEND_HEADER();
        __GLX_SEND_BYTE_ARRAY(128);
    }
    return Success;
}
Exemplo n.º 4
0
int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
{
    __GLXcontext *cx;
    GLsizei size;
    __GLX_DECLARE_SWAP_VARIABLES;
    int error;

    __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
    if (!cx) {
	return error;
    }

    pc += __GLX_SINGLE_HDR_SIZE;
    __GLX_SWAP_INT(pc+0);
    size = *(GLsizei *)(pc+0);
    if (cx->selectBufSize < size) {
	cx->selectBuf = (GLuint *) xrealloc(cx->selectBuf,
						(size_t) size 
						* __GLX_SIZE_CARD32);
	if (!cx->selectBuf) {
	    cl->client->errorValue = size;
	    return BadAlloc;
	}
	cx->selectBufSize = size;
    }
    CALL_SelectBuffer( GET_DISPATCH(), (size, cx->selectBuf) );
    __GLX_NOTE_UNFLUSHED_CMDS(cx);
    return Success;
}
Exemplo n.º 5
0
int __glXDisp_GetClipPlane(__GLXclientState *cl, GLbyte *pc)
{
    __GLXcontext *cx;
    ClientPtr client = cl->client;
    int error;
    GLdouble answer[4];

    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
    if (!cx) {
	return error;
    }
    pc += __GLX_SINGLE_HDR_SIZE;

    __glXClearErrorOccured();
    glGetClipPlane(*(GLenum   *)(pc + 0), answer);
    if (__glXErrorOccured()) {
	__GLX_BEGIN_REPLY(0);
	__GLX_SEND_HEADER();
    } else {
	__GLX_BEGIN_REPLY(32);
	__GLX_SEND_HEADER();
	__GLX_SEND_DOUBLE_ARRAY(4);
    }
    return Success;
}
Exemplo n.º 6
0
int __glXDispSwap_Finish(__GLXclientState *cl, GLbyte *pc)
{
    __GLXcontext *cx;
    ClientPtr client;
    int error;
    __GLX_DECLARE_SWAP_VARIABLES;

    __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
    if (!cx) {
	return error;
    }

    /* Do a local glFinish */
    CALL_Finish( GET_DISPATCH(), () );
    __GLX_NOTE_FLUSHED_CMDS(cx);

    /* Send empty reply packet to indicate finish is finished */
    client = cl->client;
    __GLX_BEGIN_REPLY(0);
    __GLX_PUT_RETVAL(0);
    __GLX_SWAP_REPLY_HEADER();
    __GLX_SEND_HEADER();

    return Success;
}
Exemplo n.º 7
0
int
__glXDispSwap_SelectBuffer(__GLXclientState * cl, GLbyte * pc)
{
    ClientPtr client = cl->client;
    __GLXcontext *cx;
    GLsizei size;

    __GLX_DECLARE_SWAP_VARIABLES;
    int error;

    REQUEST_FIXED_SIZE(xGLXSingleReq, 4);

    __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag);
    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
    if (!cx) {
        return error;
    }

    pc += __GLX_SINGLE_HDR_SIZE;
    __GLX_SWAP_INT(pc + 0);
    size = *(GLsizei *) (pc + 0);
    if (cx->selectBufSize < size) {
        cx->selectBuf = reallocarray(cx->selectBuf,
                                     (size_t) size, __GLX_SIZE_CARD32);
        if (!cx->selectBuf) {
            cl->client->errorValue = size;
            return BadAlloc;
        }
        cx->selectBufSize = size;
    }
    glSelectBuffer(size, cx->selectBuf);
    return Success;
}
Exemplo n.º 8
0
int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
{
    ClientPtr client = cl->client;
    GLsizei size;
    GLenum type;
    __GLX_DECLARE_SWAP_VARIABLES;
    __GLXcontext *cx;
    int error;

    REQUEST_FIXED_SIZE(xGLXSingleReq, 8);
    __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
    if (!cx) {
	return error;
    }

    pc += __GLX_SINGLE_HDR_SIZE;
    __GLX_SWAP_INT(pc+0);
    __GLX_SWAP_INT(pc+4);
    size = *(GLsizei *)(pc+0);
    type = *(GLenum *)(pc+4);
    if (cx->feedbackBufSize < size) {
	cx->feedbackBuf = (GLfloat *) __glXRealloc(cx->feedbackBuf,
						   (size_t) size 
						   * __GLX_SIZE_FLOAT32);
	if (!cx->feedbackBuf) {
	    cl->client->errorValue = size;
	    return BadAlloc;
	}
	cx->feedbackBufSize = size;
    }
    glFeedbackBuffer(size, type, cx->feedbackBuf);
    __GLX_NOTE_UNFLUSHED_CMDS(cx);
    return Success;
}
Exemplo n.º 9
0
int
__glXDispSwap_Finish(__GLXclientState * cl, GLbyte * pc)
{
    ClientPtr client = cl->client;
    __GLXcontext *cx;
    int error;
    xGLXSingleReply reply = { 0, };

    __GLX_DECLARE_SWAP_VARIABLES;

    REQUEST_SIZE_MATCH(xGLXSingleReq);

    __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag);
    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
    if (!cx) {
        return error;
    }

    /* Do a local glFinish */
    glFinish();

    /* Send empty reply packet to indicate finish is finished */
    __GLX_BEGIN_REPLY(0);
    __GLX_PUT_RETVAL(0);
    __GLX_SWAP_REPLY_HEADER();
    __GLX_SEND_HEADER();

    return Success;
}
Exemplo n.º 10
0
int __glXDispSwap_GetClipPlane(__GLXclientState *cl, GLbyte *pc)
{
    __GLXcontext *cx;
    ClientPtr client = cl->client;
    int error;
    GLdouble answer[4];
    __GLX_DECLARE_SWAP_VARIABLES;
    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;

    __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
    if (!cx) {
	return error;
    }
    pc += __GLX_SINGLE_HDR_SIZE;
    __GLX_SWAP_INT(pc + 0);

    __glXClearErrorOccured();
    glGetClipPlane(*(GLenum   *)(pc + 0), answer);
    if (__glXErrorOccured()) {
	__GLX_BEGIN_REPLY(0);
	__GLX_SWAP_REPLY_HEADER();
	__GLX_SEND_HEADER();
    } else {
	__GLX_SWAP_DOUBLE_ARRAY((GLbyte *)answer, 4);
	__GLX_BEGIN_REPLY(32);
	__GLX_SWAP_REPLY_HEADER();
	__GLX_SEND_HEADER();
	__GLX_SEND_DOUBLE_ARRAY(4);
    }
    return Success;
}
Exemplo n.º 11
0
int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
{
    GLsizei size;
    GLenum type;
    __GLXcontext *cx;
    int error;

    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
    if (!cx) {
	return error;
    }

    pc += __GLX_SINGLE_HDR_SIZE;
    size = *(GLsizei *)(pc+0);
    type = *(GLenum *)(pc+4);
    if (cx->feedbackBufSize < size) {
	cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf,
						   (size_t)size 
						   * __GLX_SIZE_FLOAT32);
	if (!cx->feedbackBuf) {
	    cl->client->errorValue = size;
	    return BadAlloc;
	}
	cx->feedbackBufSize = size;
    }
    CALL_FeedbackBuffer( GET_DISPATCH(), (size, type, cx->feedbackBuf) );
    cx->hasUnflushedCommands = GL_TRUE;
    return Success;
}
Exemplo n.º 12
0
int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
{
    __GLXcontext *cx;
    GLsizei size;
    int error;

    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
    if (!cx) {
	return error;
    }

    pc += __GLX_SINGLE_HDR_SIZE;
    size = *(GLsizei *)(pc+0);
    if (cx->selectBufSize < size) {
	cx->selectBuf = (GLuint *) realloc(cx->selectBuf,
						(size_t) size 
						* __GLX_SIZE_CARD32);
	if (!cx->selectBuf) {
	    cl->client->errorValue = size;
	    return BadAlloc;
	}
	cx->selectBufSize = size;
    }
    CALL_SelectBuffer( GET_DISPATCH(), (size, cx->selectBuf) );
    cx->hasUnflushedCommands = GL_TRUE;
    return Success;
}
Exemplo n.º 13
0
int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
{
    GLsizei size;
    GLenum type;
    __GLXcontext *cx;
    int error;

    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
    if (!cx) {
	return error;
    }

    pc += __GLX_SINGLE_HDR_SIZE;
    size = *(GLsizei *)(pc+0);
    type = *(GLenum *)(pc+4);
    if (cx->feedbackBufSize < size) {
	cx->feedbackBuf = (GLfloat *) __glXRealloc(cx->feedbackBuf,
						   (size_t)size 
						   * __GLX_SIZE_FLOAT32);
	if (!cx->feedbackBuf) {
	    cl->client->errorValue = size;
	    return BadAlloc;
	}
	cx->feedbackBufSize = size;
    }
    glFeedbackBuffer(size, type, cx->feedbackBuf);
    __GLX_NOTE_UNFLUSHED_CMDS(cx);
    return Success;
}
Exemplo n.º 14
0
int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
{
    __GLXcontext *cx;
    GLsizei size;
    int error;

    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
    if (!cx) {
	return error;
    }

    pc += __GLX_SINGLE_HDR_SIZE;
    size = *(GLsizei *)(pc+0);
    if (cx->selectBufSize < size) {
	cx->selectBuf = (GLuint *) __glXRealloc(cx->selectBuf,
						(size_t) size 
						* __GLX_SIZE_CARD32);
	if (!cx->selectBuf) {
	    cl->client->errorValue = size;
	    return BadAlloc;
	}
	cx->selectBufSize = size;
    }
    glSelectBuffer(size, cx->selectBuf);
    __GLX_NOTE_UNFLUSHED_CMDS(cx);
    return Success;
}
Exemplo n.º 15
0
static int
GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
{
    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, tag, &error);
    if (!cx) {
        return error;
    }

    __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_GetColorTableParameteriv(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_GetColorTable(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;
}
Exemplo n.º 16
0
static int
GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
{
    GLint compsize;
    GLenum format, type, target;
    GLboolean swapBytes, reset;
    __GLXcontext *cx;
    ClientPtr client = cl->client;
    int error;

    __GLX_DECLARE_SWAP_VARIABLES;
    char *answer, answerBuffer[200];
    GLint width = 0;
    xGLXSingleReply reply = { 0, };

    cx = __glXForceCurrent(cl, tag, &error);
    if (!cx) {
        return error;
    }

    __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);
    reset = *(GLboolean *) (pc + 13);

    glGetHistogramParameteriv(target, GL_HISTOGRAM_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)
        return BadLength;

    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
    __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
    __glXClearErrorOccured();
    glGetHistogram(target, reset, format, type, answer);

    if (__glXErrorOccured()) {
        __GLX_BEGIN_REPLY(0);
        __GLX_SWAP_REPLY_HEADER();
    }
    else {
        __GLX_BEGIN_REPLY(compsize);
        __GLX_SWAP_REPLY_HEADER();
        __GLX_SWAP_INT(&width);
        ((xGLXGetHistogramReply *) &reply)->width = width;
        __GLX_SEND_VOID_ARRAY(compsize);
    }

    return Success;
}
Exemplo n.º 17
0
/**
 * Handle both types of glGetProgramString calls.
 */
static int
DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
                   PFNGLGETPROGRAMIVARBPROC get_programiv,
                   PFNGLGETPROGRAMSTRINGARBPROC get_program_string,
                   Bool do_swap)
{
    xGLXVendorPrivateWithReplyReq *const req =
        (xGLXVendorPrivateWithReplyReq *) pc;
    int error;
    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
    ClientPtr client = cl->client;

    pc += __GLX_VENDPRIV_HDR_SIZE;
    if (cx != NULL) {
        GLenum target;
        GLenum pname;
        GLint compsize = 0;
        char *answer = NULL, answerBuffer[200];

        if (do_swap) {
            target = (GLenum) bswap_32(*(int *) (pc + 0));
            pname = (GLenum) bswap_32(*(int *) (pc + 4));
        }
        else {
            target = *(GLenum *) (pc + 0);
            pname = *(GLuint *) (pc + 4);
        }

        /* The value of the GL_PROGRAM_LENGTH_ARB and GL_PROGRAM_LENGTH_NV
         * enumerants is the same.
         */
        get_programiv(target, GL_PROGRAM_LENGTH_ARB, &compsize);

        if (compsize != 0) {
            __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
            __glXClearErrorOccured();

            get_program_string(target, pname, (GLubyte *) answer);
        }

        if (__glXErrorOccured()) {
            __GLX_BEGIN_REPLY(0);
            __GLX_SEND_HEADER();
        }
        else {
            __GLX_BEGIN_REPLY(compsize);
            ((xGLXGetTexImageReply *) &__glXReply)->width = compsize;
            __GLX_SEND_HEADER();
            __GLX_SEND_VOID_ARRAY(compsize);
        }

        error = Success;
    }

    return error;
}
Exemplo n.º 18
0
int
__glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
{
    GLsizei width, height;
    GLenum format, type;
    GLboolean swapBytes, lsbFirst;
    GLint compsize;
    __GLXcontext *cx;
    ClientPtr client = cl->client;
    int error;
    char *answer, answerBuffer[200];

    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
    if (!cx) {
        return error;
    }

    pc += __GLX_SINGLE_HDR_SIZE;
    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)
        compsize = 0;

    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst));
    __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
    __glXClearErrorOccured();
    CALL_ReadPixels(GET_DISPATCH(), (*(GLint *) (pc + 0),
                                     *(GLint *) (pc + 4),
                                     *(GLsizei *) (pc + 8),
                                     *(GLsizei *) (pc + 12),
                                     *(GLenum *) (pc + 16),
                                     *(GLenum *) (pc + 20), answer));

    if (__glXErrorOccured()) {
        __GLX_BEGIN_REPLY(0);
        __GLX_SEND_HEADER();
    }
    else {
        __GLX_BEGIN_REPLY(compsize);
        __GLX_SEND_HEADER();
        __GLX_SEND_VOID_ARRAY(compsize);
    }
    cx->hasUnflushedCommands = GL_FALSE;
    return Success;
}
Exemplo n.º 19
0
int __glXDisp_EndList(__GLXclientState *cl, GLbyte *pc)
{
	__GLXcontext *cx;
	int error;

	cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
	if (!cx) {
		return error;
	}

	glEndList( 
	);
	return Success;
}
Exemplo n.º 20
0
static int
GetMinmax(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
{
    GLint compsize;
    GLenum format, type, target;
    GLboolean swapBytes, reset;
    __GLXcontext *cx;
    ClientPtr client = cl->client;
    int error;

    __GLX_DECLARE_SWAP_VARIABLES;
    char *answer, answerBuffer[200];
    xGLXSingleReply reply = { 0, };

    cx = __glXForceCurrent(cl, tag, &error);
    if (!cx) {
        return error;
    }

    __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);
    reset = *(GLboolean *) (pc + 13);

    compsize = __glGetTexImage_size(target, 1, format, type, 2, 1, 1);
    if (compsize < 0)
        return BadLength;

    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
    __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
    __glXClearErrorOccured();
    glGetMinmax(target, reset, format, type, answer);

    if (__glXErrorOccured()) {
        __GLX_BEGIN_REPLY(0);
        __GLX_SWAP_REPLY_HEADER();
    }
    else {
        __GLX_BEGIN_REPLY(compsize);
        __GLX_SWAP_REPLY_HEADER();
        __GLX_SEND_VOID_ARRAY(compsize);
    }

    return Success;
}
Exemplo n.º 21
0
int __glXDisp_Flush(__GLXclientState *cl, GLbyte *pc)
{
	__GLXcontext *cx;
	int error;

	cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
	if (!cx) {
		return error;
	}

	CALL_Flush( GET_DISPATCH(), () );
	cx->hasUnflushedCommands = GL_FALSE;
	return Success;
}
Exemplo n.º 22
0
int __glXDisp_Flush(__GLXclientState *cl, GLbyte *pc)
{
	__GLXcontext *cx;
	int error;

	cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
	if (!cx) {
		return error;
	}

	glFlush();
	__GLX_NOTE_FLUSHED_CMDS(cx);
	return Success;
}
Exemplo n.º 23
0
int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc)
{
    ClientPtr client = cl->client;
    xGLXUseXFontReq *req;
    FontPtr pFont;
    GC *pGC;
    GLuint currentListIndex;
    __GLXcontext *cx;
    int error;

    req = (xGLXUseXFontReq *) pc;
    cx = __glXForceCurrent(cl, req->contextTag, &error);
    if (!cx) {
	return error;
    }

    CALL_GetIntegerv( GET_DISPATCH(), (GL_LIST_INDEX, (GLint*) &currentListIndex) );
    if (currentListIndex != 0) {
	/*
	** A display list is currently being made.  It is an error
	** to try to make a font during another lists construction.
	*/
	client->errorValue = cx->id;
	return __glXError(GLXBadContextState);
    }

    /*
    ** Font can actually be either the ID of a font or the ID of a GC
    ** containing a font.
    */

    error = dixLookupResourceByType((pointer *)&pFont,
				    req->font, RT_FONT,
				    client, DixReadAccess);
    if (error != Success) {
	error = dixLookupResourceByType((pointer *)&pGC,
					req->font, RT_GC,
					client, DixReadAccess);
        if (error != Success) {
	    client->errorValue = req->font;
            return error == BadGC ? BadFont : error;
	}
	pFont = pGC->font;
    }

    return MakeBitmapsFromFont(pFont, req->first, req->count,
				    req->listBase);
}
Exemplo n.º 24
0
int __glXDispSwap_Flush(__GLXclientState *cl, GLbyte *pc)
{
	__GLXcontext *cx;
	int error;
	__GLX_DECLARE_SWAP_VARIABLES;

	__GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
	cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
	if (!cx) {
		return error;
	}

	CALL_Flush( GET_DISPATCH(), () );
	__GLX_NOTE_FLUSHED_CMDS(cx);
	return Success;
}
Exemplo n.º 25
0
int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc)
{
	GLenum target;
	GLenum query;
	GLint compsize;
	__GLXcontext *cx;
	ClientPtr client = cl->client;
	int error;
	GLint answerBuffer[200];
	char *answer;

	cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
	if (!cx) {
		return error;
	}
	pc += __GLX_SINGLE_HDR_SIZE;
	target = *(GLenum *)(pc + 0);
	query = *(GLenum *)(pc + 4);
	compsize = __glGetMapiv_size(target,query);
	if (compsize < 0) compsize = 0;

	__GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
	__glXClearErrorOccured();
	glGetMapiv( 
		*(GLenum   *)(pc + 0),
		*(GLenum   *)(pc + 4),
		(GLint    *) answer
	);
	if (__glXErrorOccured()) {
	    __GLX_BEGIN_REPLY(0);
	    __GLX_PUT_SIZE(0);
	    __GLX_SEND_HEADER();
	} else if (compsize == 1) {
	    __GLX_BEGIN_REPLY(0);
	    __GLX_PUT_SIZE(1);
	    __GLX_PUT_INT();
	    __GLX_SEND_HEADER();
	} else {
	    __GLX_BEGIN_REPLY(compsize*4);
	    __GLX_PUT_SIZE(compsize);
	    __GLX_SEND_HEADER();
	    __GLX_SEND_INT_ARRAY(compsize);
	}
	return Success;
}
Exemplo n.º 26
0
/**
 * Handle both types of glGetProgramString calls.
 *
 * This single function handles both \c glGetProgramStringARB and
 * \c glGetProgramStringNV.  The dispatch offsets for the functions to use
 * for \c glGetProgramivARB and \c glGetProgramStringARB are passed in by the
 * caller.  These can be the offsets of either the ARB versions or the NV
 * versions.
 */
int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc,
		       unsigned get_programiv_offset,
		       unsigned get_program_string_offset,
		       Bool do_swap)
{
    xGLXVendorPrivateWithReplyReq * const req = 
      (xGLXVendorPrivateWithReplyReq *) pc;
    int error;
    __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, & error);
    ClientPtr client = cl->client;


    pc += __GLX_VENDPRIV_HDR_SIZE;
    if (cx != NULL) {
	GLenum target;
	GLenum pname;
	GLint compsize = 0;
	char *answer = NULL, answerBuffer[200];

	if (do_swap) {
	    target = (GLenum) bswap_32(*(int *)(pc + 0));
	    pname =  (GLenum) bswap_32(*(int *)(pc + 4));
	}
	else {
	    target = *(GLenum *)(pc + 0);
	    pname =  *(GLuint *)(pc + 4);
	}

	/* The value of the GL_PROGRAM_LENGTH_ARB and GL_PROGRAM_LENGTH_NV
	 * enumerants is the same.
	 */
	CALL_by_offset(GET_DISPATCH(),
		       (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), 
		       get_programiv_offset,
		       (target, GL_PROGRAM_LENGTH_ARB, &compsize));

	if (compsize != 0) {
	    __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
	    __glXClearErrorOccured();

	    CALL_by_offset(GET_DISPATCH(), 
			   (void (GLAPIENTRYP)(GLuint, GLenum, GLubyte *)),
			   get_program_string_offset,
			   (target, pname, (GLubyte *)answer));
	}
Exemplo n.º 27
0
int __glXDispSwap_Flush(__GLXclientState *cl, GLbyte *pc)
{
    ClientPtr client = cl->client;
	__GLXcontext *cx;
	int error;
	__GLX_DECLARE_SWAP_VARIABLES;

	REQUEST_SIZE_MATCH(xGLXSingleReq);
	__GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
	cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
	if (!cx) {
		return error;
	}

	glFlush();
	__GLX_NOTE_FLUSHED_CMDS(cx);
	return Success;
}
Exemplo n.º 28
0
int __glXDisp_DeleteLists(__GLXclientState *cl, GLbyte *pc)
{
	__GLXcontext *cx;
	int error;

	cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
	if (!cx) {
		return error;
	}
	pc += __GLX_SINGLE_HDR_SIZE;

	glDeleteLists( 
		*(GLuint   *)(pc + 0),
		*(GLsizei  *)(pc + 4)
	);
	__GLX_NOTE_UNFLUSHED_CMDS(cx);
	return Success;
}
Exemplo n.º 29
0
int __glXDisp_PixelStorei(__GLXclientState *cl, GLbyte *pc)
{
	__GLXcontext *cx;
	int error;

	cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
	if (!cx) {
		return error;
	}
	pc += __GLX_SINGLE_HDR_SIZE;

	glPixelStorei( 
		*(GLenum   *)(pc + 0),
		*(GLint    *)(pc + 4)
	);
	__GLX_NOTE_UNFLUSHED_CMDS(cx);
	return Success;
}
Exemplo n.º 30
0
int __glXDisp_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc)
{
	GLenum pname;
	GLint compsize;
	__GLXcontext *cx;
	ClientPtr client = cl->client;
	int error;
	GLfloat answerBuffer[200];
	char *answer;

	cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
	if (!cx) {
		return error;
	}
	pc += __GLX_SINGLE_HDR_SIZE;
	pname = *(GLenum *)(pc + 8);
	compsize = __glGetTexLevelParameterfv_size(pname);
	if (compsize < 0) compsize = 0;

	__GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
	__glXClearErrorOccured();
	glGetTexLevelParameterfv( 
		*(GLenum   *)(pc + 0),
		*(GLint    *)(pc + 4),
		*(GLenum   *)(pc + 8),
		(GLfloat  *) answer
	);
	if (__glXErrorOccured()) {
	    __GLX_BEGIN_REPLY(0);
	    __GLX_PUT_SIZE(0);
	    __GLX_SEND_HEADER();
	} else if (compsize == 1) {
	    __GLX_BEGIN_REPLY(0);
	    __GLX_PUT_SIZE(1);
	    __GLX_PUT_FLOAT();
	    __GLX_SEND_HEADER();
	} else {
	    __GLX_BEGIN_REPLY(compsize*4);
	    __GLX_PUT_SIZE(compsize);
	    __GLX_SEND_HEADER();
	    __GLX_SEND_FLOAT_ARRAY(compsize);
	}
	return Success;
}