示例#1
0
void __glXDispSwap_Rectiv(GLbyte *pc)
{
	__GLX_DECLARE_SWAP_VARIABLES;
	__GLX_DECLARE_SWAP_ARRAY_VARIABLES;

	__GLX_SWAP_INT_ARRAY(pc + 0, 2);
	__GLX_SWAP_INT_ARRAY(pc + 8, 2);

}
示例#2
0
void __glXDispSwap_CallLists(GLbyte *pc)
{
    GLenum type;
    GLsizei n;
    __GLX_DECLARE_SWAP_VARIABLES;

    __GLX_SWAP_INT(pc + 4);
    __GLX_SWAP_INT(pc + 0);
    type = *(GLenum *)(pc + 4);
    n = *(GLsizei *)(pc + 0);

    switch (type) {
      case GL_BYTE:
      case GL_UNSIGNED_BYTE:
      case GL_2_BYTES:
      case GL_3_BYTES:
      case GL_4_BYTES:
	break;
      case GL_SHORT:
      case GL_UNSIGNED_SHORT:
	__GLX_SWAP_SHORT_ARRAY(pc+8, n);
	break;
      case GL_INT:
      case GL_UNSIGNED_INT:
	__GLX_SWAP_INT_ARRAY(pc+8, n);
	break;
      case GL_FLOAT:
	__GLX_SWAP_FLOAT_ARRAY(pc+8, n);
	break;
    }

}
示例#3
0
void __glXDispSwap_Color3uiv(GLbyte *pc)
{
	__GLX_DECLARE_SWAP_VARIABLES;
	__GLX_DECLARE_SWAP_ARRAY_VARIABLES;

	__GLX_SWAP_INT_ARRAY(pc + 0, 3);
}
示例#4
0
int
__glXVForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc)
{
    xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;

    __GLX_DECLARE_SWAP_VARIABLES;
    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;

    __GLX_SWAP_SHORT(&req->length);
    __GLX_SWAP_INT(&req->vendorCode);
    __GLX_SWAP_INT(&req->contextTag);

    swap_vec_element_size = 8;

    /*
     * swap extra data in request - assuming all data
     * (if available) are arrays of 4 bytes components !
     */
    if (req->length > sz_xGLXVendorPrivateReq / 4) {
        int *data = (int *) (req + 1);
        int count = req->length - sz_xGLXVendorPrivateReq / 4;

        __GLX_SWAP_INT_ARRAY(data, count);
    }

    return (__glXVForwardAllWithReply(cl, pc));
}
示例#5
0
void __glXDispSwap_Vertex4iv(GLbyte *pc)
{
	__GLX_DECLARE_SWAP_VARIABLES;
	__GLX_DECLARE_SWAP_ARRAY_VARIABLES;

	__GLX_SWAP_INT_ARRAY(pc + 0, 4);

}
示例#6
0
void __glXDispSwap_TexCoord2iv(GLbyte *pc)
{
	__GLX_DECLARE_SWAP_VARIABLES;
	__GLX_DECLARE_SWAP_ARRAY_VARIABLES;

	__GLX_SWAP_INT_ARRAY(pc + 0, 2);

}
示例#7
0
void __glXDispSwap_RasterPos3iv(GLbyte *pc)
{
	__GLX_DECLARE_SWAP_VARIABLES;
	__GLX_DECLARE_SWAP_ARRAY_VARIABLES;

	__GLX_SWAP_INT_ARRAY(pc + 0, 3);

}
示例#8
0
void __glXDispSwap_Indexiv(GLbyte *pc)
{
	__GLX_DECLARE_SWAP_VARIABLES;
	__GLX_DECLARE_SWAP_ARRAY_VARIABLES;

	__GLX_SWAP_INT_ARRAY(pc + 0, 1);

}
示例#9
0
void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *pc)
{
	__GLX_DECLARE_SWAP_VARIABLES;
	__GLX_DECLARE_SWAP_ARRAY_VARIABLES;

	__GLX_SWAP_INT(pc + 0);
	__GLX_SWAP_INT_ARRAY(pc + 4, 4);

}
示例#10
0
static int
ephyrGLXGetFBConfigsSGIXReal (__GLXclientState *a_cl,
                              GLbyte *a_pc,
                              Bool a_do_swap)
{
    xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)a_pc;
    ClientPtr client = a_cl->client;
    xGLXGetVisualConfigsReply reply;
    int32_t *props_buf=NULL, num_visuals=0,
            num_props=0, res=BadImplementation, i=0,
            props_per_visual_size=0,
            props_buf_size=0;
    __GLX_DECLARE_SWAP_VARIABLES;
    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;

    EPHYR_LOG ("enter\n") ;

    if (!ephyrHostGLXVendorPrivGetFBConfigsSGIX (req->screen,
                                                 &num_visuals,
                                                 &num_props,
                                                 &props_buf_size,
                                                 &props_buf)) {
        EPHYR_LOG_ERROR ("ephyrHostGLXGetVisualConfigs() failed\n") ;
        goto out ;
    }
    EPHYR_LOG ("num_visuals:%d, num_props:%d\n", num_visuals, num_props) ;

    reply.numVisuals = num_visuals;
    reply.numProps = num_props;
    reply.length = props_buf_size >> 2;
    reply.type = X_Reply;
    reply.sequenceNumber = client->sequence;

    if (a_do_swap) {
        __GLX_SWAP_SHORT(&reply.sequenceNumber);
        __GLX_SWAP_INT(&reply.length);
        __GLX_SWAP_INT(&reply.numVisuals);
        __GLX_SWAP_INT(&reply.numProps);
        __GLX_SWAP_INT_ARRAY (props_buf, num_props) ;
    }
    WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char*)&reply);
    props_per_visual_size = props_buf_size/num_visuals ;
    for (i=0; i < num_visuals; i++) {
        WriteToClient (client,
                       props_per_visual_size,
                       &((char*)props_buf)[i*props_per_visual_size]);
    }
    res = Success ;

out:
    EPHYR_LOG ("leave\n") ;
    free(props_buf) ;
    props_buf = NULL ;

    return res ;
}
示例#11
0
void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXTReply *reply, int *buf)
{
    int length = reply->length;
    __GLX_DECLARE_SWAP_VARIABLES;
    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
    __GLX_SWAP_SHORT(&reply->sequenceNumber);
    __GLX_SWAP_INT(&reply->length);
    __GLX_SWAP_INT(&reply->n);
    WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply);
    __GLX_SWAP_INT_ARRAY((int *)buf, length);
    WriteToClient(client, length << 2, (char *)buf);
}
示例#12
0
void __glXDispSwap_PrioritizeTextures(GLbyte *pc)
{
	GLsizei n;
	__GLX_DECLARE_SWAP_VARIABLES;
	__GLX_DECLARE_SWAP_ARRAY_VARIABLES;

	__GLX_SWAP_INT(pc + 0);
	n = *(GLsizei *)(pc + 0);
	__GLX_SWAP_INT_ARRAY(pc + 4, n);
	__GLX_SWAP_FLOAT_ARRAY(pc + 4+n*4, n);

}
示例#13
0
void __glXDispSwap_PixelMapuiv(GLbyte *pc)
{
	GLint mapsize;
	__GLX_DECLARE_SWAP_VARIABLES;
	__GLX_DECLARE_SWAP_ARRAY_VARIABLES;

	__GLX_SWAP_INT(pc + 4);
	mapsize = *(GLint *)(pc + 4);
	__GLX_SWAP_INT(pc + 0);
	__GLX_SWAP_INT_ARRAY(pc + 8, mapsize);

}
示例#14
0
void __glXSwapGetDrawableAttributesReply(ClientPtr client,
					 xGLXGetDrawableAttributesReply *reply, CARD32 *buf)
{
    int length = reply->length;
    __GLX_DECLARE_SWAP_VARIABLES;
    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
    __GLX_SWAP_SHORT(&reply->sequenceNumber);
    __GLX_SWAP_INT(&reply->length);
    __GLX_SWAP_INT(&reply->numAttribs);
    WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)reply);
    __GLX_SWAP_INT_ARRAY((int *)buf, length);
    WriteToClient(client, length << 2, (char *)buf);
}
示例#15
0
void glxSwapQueryExtensionsStringReply(ClientPtr client,
				       xGLXQueryExtensionsStringReply *reply, char *buf)
{
    int length = reply->length;
    __GLX_DECLARE_SWAP_VARIABLES;
    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
    __GLX_SWAP_SHORT(&reply->sequenceNumber);
    __GLX_SWAP_INT(&reply->length);
    __GLX_SWAP_INT(&reply->n);
    WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *)reply);
    __GLX_SWAP_INT_ARRAY((int *)buf, length);
    WriteToClient(client, length << 2, buf);
}
示例#16
0
void __glXDispSwap_LightModeliv(GLbyte *pc)
{
	GLenum pname;
	GLint compsize;
	__GLX_DECLARE_SWAP_VARIABLES;
	__GLX_DECLARE_SWAP_ARRAY_VARIABLES;

	__GLX_SWAP_INT(pc + 0);
	pname = *(GLenum *)(pc + 0);
	compsize = __glLightModeliv_size(pname);
	if (compsize < 0) compsize = 0;
	__GLX_SWAP_INT_ARRAY(pc + 4, compsize);

}
示例#17
0
void __glXDispSwap_ConvolutionParameteriv(GLbyte *pc)
{
	GLenum pname;
	GLint compsize;
	__GLX_DECLARE_SWAP_VARIABLES;
	__GLX_DECLARE_SWAP_ARRAY_VARIABLES;

	__GLX_SWAP_INT(pc + 4);
	pname = *(GLenum *)(pc + 4);
	compsize = __glConvolutionParameteriv_size(pname);
	if (compsize < 0) compsize = 0;
	__GLX_SWAP_INT(pc + 0);
	__GLX_SWAP_INT_ARRAY(pc + 8, compsize);

}
示例#18
0
文件: glxcmdsswap.c 项目: mozyg/xorg
int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
{
    xGLXChangeDrawableAttributesReq *req =
	(xGLXChangeDrawableAttributesReq *) req;
    __GLX_DECLARE_SWAP_VARIABLES;
    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
    CARD32 *attribs;

    __GLX_SWAP_INT(&req->drawable);
    __GLX_SWAP_INT(&req->numAttribs);
    attribs = (CARD32*)(req + 1);
    __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);

    return __glXDisp_ChangeDrawableAttributes(cl, pc);
}
示例#19
0
文件: glxcmdsswap.c 项目: mozyg/xorg
int __glXDispSwap_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
{
    xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;    
    __GLX_DECLARE_SWAP_VARIABLES;
    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
    CARD32 *attribs;

    __GLX_SWAP_INT(&req->screen);
    __GLX_SWAP_INT(&req->fbconfig);
    __GLX_SWAP_INT(&req->pbuffer);
    __GLX_SWAP_INT(&req->numAttribs);
    attribs = (CARD32*)(req + 1);
    __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);

    return __glXDisp_CreatePbuffer(cl, pc);
}
示例#20
0
文件: glxcmdsswap.c 项目: mozyg/xorg
int __glXDispSwap_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
{
    xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
    CARD32 *attribs;
    __GLX_DECLARE_SWAP_VARIABLES;
    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;

    __GLX_SWAP_SHORT(&req->length);
    __GLX_SWAP_INT(&req->screen);
    __GLX_SWAP_INT(&req->fbconfig);
    __GLX_SWAP_INT(&req->pixmap);
    __GLX_SWAP_INT(&req->glxpixmap);
    __GLX_SWAP_INT(&req->numAttribs);
    attribs = (CARD32*)(req + 1);
    __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);

    return __glXDisp_CreatePixmap(cl, pc);
}
示例#21
0
int
__glXDispSwap_RenderMode(__GLXclientState * cl, GLbyte * pc)
{
    ClientPtr client = cl->client;
    __GLXcontext *cx;
    xGLXRenderModeReply reply;
    GLint nitems = 0, retBytes = 0, retval, newModeCheck;
    GLubyte *retBuffer = NULL;
    GLenum newMode;

    __GLX_DECLARE_SWAP_VARIABLES;
    __GLX_DECLARE_SWAP_ARRAY_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);
    newMode = *(GLenum *) pc;
    retval = glRenderMode(newMode);

    /* Check that render mode worked */
    glGetIntegerv(GL_RENDER_MODE, &newModeCheck);
    if (newModeCheck != newMode) {
        /* Render mode change failed.  Bail */
        newMode = newModeCheck;
        goto noChangeAllowed;
    }

    /*
     ** Render mode might have still failed if we get here.  But in this
     ** case we can't really tell, nor does it matter.  If it did fail, it
     ** will return 0, and thus we won't send any data across the wire.
     */

    switch (cx->renderMode) {
    case GL_RENDER:
        cx->renderMode = newMode;
        break;
    case GL_FEEDBACK:
        if (retval < 0) {
            /* Overflow happened. Copy the entire buffer */
            nitems = cx->feedbackBufSize;
        }
        else {
            nitems = retval;
        }
        retBytes = nitems * __GLX_SIZE_FLOAT32;
        retBuffer = (GLubyte *) cx->feedbackBuf;
        __GLX_SWAP_FLOAT_ARRAY((GLbyte *) retBuffer, nitems);
        cx->renderMode = newMode;
        break;
    case GL_SELECT:
        if (retval < 0) {
            /* Overflow happened.  Copy the entire buffer */
            nitems = cx->selectBufSize;
        }
        else {
            GLuint *bp = cx->selectBuf;
            GLint i;

            /*
             ** Figure out how many bytes of data need to be sent.  Parse
             ** the selection buffer to determine this fact as the
             ** return value is the number of hits, not the number of
             ** items in the buffer.
             */
            nitems = 0;
            i = retval;
            while (--i >= 0) {
                GLuint n;

                /* Parse select data for this hit */
                n = *bp;
                bp += 3 + n;
            }
            nitems = bp - cx->selectBuf;
        }
        retBytes = nitems * __GLX_SIZE_CARD32;
        retBuffer = (GLubyte *) cx->selectBuf;
        __GLX_SWAP_INT_ARRAY((GLbyte *) retBuffer, nitems);
        cx->renderMode = newMode;
        break;
    }

    /*
     ** First reply is the number of elements returned in the feedback or
     ** selection array, as per the API for glRenderMode itself.
     */
 noChangeAllowed:;
    reply = (xGLXRenderModeReply) {
        .type = X_Reply,
        .sequenceNumber = client->sequence,
        .length = nitems,
        .retval = retval,
        .size = nitems,
        .newMode = newMode
    };
    __GLX_SWAP_SHORT(&reply.sequenceNumber);
    __GLX_SWAP_INT(&reply.length);
    __GLX_SWAP_INT(&reply.retval);
    __GLX_SWAP_INT(&reply.size);
    __GLX_SWAP_INT(&reply.newMode);
    WriteToClient(client, sz_xGLXRenderModeReply, &reply);
    if (retBytes) {
        WriteToClient(client, retBytes, retBuffer);
    }
    return Success;
}

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();
    return Success;
}
示例#22
0
static int
ephyrGLXGetVisualConfigsReal(__GLXclientState * a_cl,
                             GLbyte * a_pc, Bool a_do_swap)
{
    xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) a_pc;
    ClientPtr client = a_cl->client;
    xGLXGetVisualConfigsReply reply;
    int32_t *props_buf = NULL, num_visuals = 0,
        num_props = 0, res = BadImplementation, i = 0,
        props_per_visual_size = 0, props_buf_size = 0;
    __GLX_DECLARE_SWAP_VARIABLES;
    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;

    EPHYR_LOG("enter\n");

    if (!ephyrHostGLXGetVisualConfigs(req->screen,
                                      &num_visuals,
                                      &num_props,
                                      &props_buf_size, &props_buf)) {
        EPHYR_LOG_ERROR("ephyrHostGLXGetVisualConfigs() failed\n");
        goto out;
    }
    EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props);

    reply = (xGLXGetVisualConfigsReply) {
        .type = X_Reply,
        .sequenceNumber = client->sequence,
        .length = (num_visuals * __GLX_SIZE_CARD32 * num_props) >> 2,
        .numVisuals = num_visuals,
        .numProps = num_props
    };

    if (a_do_swap) {
        __GLX_SWAP_SHORT(&reply.sequenceNumber);
        __GLX_SWAP_INT(&reply.length);
        __GLX_SWAP_INT(&reply.numVisuals);
        __GLX_SWAP_INT(&reply.numProps);
        __GLX_SWAP_INT_ARRAY(props_buf, num_props);
    }
    WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
    props_per_visual_size = props_buf_size / num_visuals;
    for (i = 0; i < num_visuals; i++) {
        WriteToClient(client,
                      props_per_visual_size,
                      (char *) props_buf + i * props_per_visual_size);
    }
    res = Success;

 out:
    EPHYR_LOG("leave\n");
    free(props_buf);
    props_buf = NULL;

    return res;
}

static int
ephyrGLXGetFBConfigsSGIXReal(__GLXclientState * a_cl,
                             GLbyte * a_pc, Bool a_do_swap)
{
    xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) a_pc;
    ClientPtr client = a_cl->client;
    xGLXGetVisualConfigsReply reply;
    int32_t *props_buf = NULL, num_visuals = 0,
        num_props = 0, res = BadImplementation, i = 0,
        props_per_visual_size = 0, props_buf_size = 0;
    __GLX_DECLARE_SWAP_VARIABLES;
    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;

    EPHYR_LOG("enter\n");

    if (!ephyrHostGLXVendorPrivGetFBConfigsSGIX(req->screen,
                                                &num_visuals,
                                                &num_props,
                                                &props_buf_size, &props_buf)) {
        EPHYR_LOG_ERROR("ephyrHostGLXGetVisualConfigs() failed\n");
        goto out;
    }
    EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props);

    reply = (xGLXGetVisualConfigsReply) {
        .type = X_Reply,
        .sequenceNumber = client->sequence,
        .length = props_buf_size >> 2,
        .numVisuals = num_visuals,
        .numProps = num_props
    };

    if (a_do_swap) {
        __GLX_SWAP_SHORT(&reply.sequenceNumber);
        __GLX_SWAP_INT(&reply.length);
        __GLX_SWAP_INT(&reply.numVisuals);
        __GLX_SWAP_INT(&reply.numProps);
        __GLX_SWAP_INT_ARRAY(props_buf, num_props);
    }
    WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
    props_per_visual_size = props_buf_size / num_visuals;
    for (i = 0; i < num_visuals; i++) {
        WriteToClient(client,
                      props_per_visual_size,
                      &((char *) props_buf)[i * props_per_visual_size]);
    }
    res = Success;

 out:
    EPHYR_LOG("leave\n");
    free(props_buf);
    props_buf = NULL;

    return res;
}

int
ephyrGLXGetVisualConfigs(__GLXclientState * a_cl, GLbyte * a_pc)
{
    return ephyrGLXGetVisualConfigsReal(a_cl, a_pc, FALSE);
}

int
ephyrGLXGetVisualConfigsSwap(__GLXclientState * a_cl, GLbyte * a_pc)
{
    return ephyrGLXGetVisualConfigsReal(a_cl, a_pc, TRUE);
}

int
ephyrGLXClientInfo(__GLXclientState * a_cl, GLbyte * a_pc)
{
    int res = BadImplementation;
    xGLXClientInfoReq *req = (xGLXClientInfoReq *) a_pc;

    EPHYR_LOG("enter\n");
    if (!ephyrHostGLXSendClientInfo(req->major, req->minor, (char *) req + 1)) {
        EPHYR_LOG_ERROR("failed to send client info to host\n");
        goto out;
    }
    res = Success;

 out:
    EPHYR_LOG("leave\n");
    return res;
}