示例#1
0
void crUnpackExtendShaderSource(void)
{
    GLint *length = NULL;
    GLuint shader = READ_DATA(8, GLuint);
    GLsizei count = READ_DATA(12, GLsizei);
    GLint hasNonLocalLen = READ_DATA(16, GLsizei);
    GLint *pLocalLength = DATA_POINTER(20, GLint);
    const char **ppStrings = NULL;
    GLsizei i;
    int pos=20+count*sizeof(*pLocalLength);

    if (hasNonLocalLen>0)
    {
        length = DATA_POINTER(pos, GLint);
        pos += count*sizeof(*length);
    }

    ppStrings = crAlloc(count*sizeof(char*));
    if (!ppStrings) return;

    for (i=0; i<count; ++i)
    {
        ppStrings[i] = DATA_POINTER(pos, char);
        pos += pLocalLength[i];
        if (!length)
        {
            pLocalLength[i] -= 1;
        }
    }

    cr_unpackDispatch.ShaderSource(shader, count, ppStrings, length ? length : pLocalLength);
    crFree(ppStrings);
}
void crUnpackPrioritizeTextures( void )
{
    GLsizei n = READ_DATA( sizeof( int ) + 0, GLsizei );
    GLuint *textures = DATA_POINTER( sizeof( int ) + 4, GLuint );
    GLclampf *priorities = DATA_POINTER( sizeof( int ) + 4 + n*sizeof( GLuint ),
                                         GLclampf );

    cr_unpackDispatch.PrioritizeTextures( n, textures, priorities );
    INCR_VAR_PTR();
}
void crUnpackExtendShaderSource(void)
{
    GLint *length = NULL;
    GLuint shader = READ_DATA(8, GLuint);
    GLsizei count = READ_DATA(12, GLsizei);
    GLint hasNonLocalLen = READ_DATA(16, GLsizei);
    GLint *pLocalLength = DATA_POINTER(20, GLint);
    char **ppStrings = NULL;
    GLsizei i, j, jUpTo;
    int pos=20+count*sizeof(*pLocalLength);

    if (hasNonLocalLen>0)
    {
        length = DATA_POINTER(pos, GLint);
        pos += count*sizeof(*length);
    }

    ppStrings = crAlloc(count*sizeof(char*));
    if (!ppStrings) return;

    for (i=0; i<count; ++i)
    {
        ppStrings[i] = DATA_POINTER(pos, char);
        pos += pLocalLength[i];
        if (!length)
        {
            pLocalLength[i] -= 1;
        }

        Assert(pLocalLength[i] > 0);
        jUpTo = i == count -1 ? pLocalLength[i] - 1 : pLocalLength[i];
        for (j = 0; j < jUpTo; ++j)
        {
            char *pString = ppStrings[i];

            if (pString[j] == '\0')
            {
                Assert(j == jUpTo - 1);
                pString[j] = '\n';
            }
        }
    }

//    cr_unpackDispatch.ShaderSource(shader, count, ppStrings, length ? length : pLocalLength);
    cr_unpackDispatch.ShaderSource(shader, 1, ppStrings, 0);

    crFree(ppStrings);
}
void crUnpackTexImage3DEXT( void )
{
    GLenum target = READ_DATA( sizeof( int ) + 0, GLenum );
    GLint level = READ_DATA( sizeof( int ) + 4, GLint );
    GLenum internalformat = READ_DATA( sizeof( int ) + 8, GLint );
    GLsizei width = READ_DATA( sizeof( int ) + 12, GLsizei );
    GLsizei height = READ_DATA( sizeof( int ) + 16, GLsizei );
    GLsizei depth = READ_DATA( sizeof( int ) + 20, GLsizei );
    GLint border = READ_DATA( sizeof( int ) + 24, GLint );
    GLenum format = READ_DATA( sizeof( int ) + 28, GLenum );
    GLenum type = READ_DATA( sizeof( int ) + 32, GLenum );
    int noimagedata = READ_DATA( sizeof( int ) + 36, int );
    GLvoid *pixels;

    /*If there's no imagedata send, it's either that passed pointer was NULL or
      there was GL_PIXEL_UNPACK_BUFFER_ARB bound, in both cases 4bytes of passed
      pointer would convert to either NULL or offset in the bound buffer.
     */
    if ( noimagedata )
        pixels = (void*) (uintptr_t) READ_DATA(sizeof(int)+40, GLint);
    else
        pixels = DATA_POINTER( sizeof( int ) + 44, GLvoid );

    cr_unpackDispatch.TexImage3DEXT(target, level, internalformat, width,
                                    height, depth, border, format, type,
                                    pixels);
    INCR_VAR_PTR();
}
示例#5
0
void crUnpackExtendPointParameteriv( void  )
{
	GLenum pname = READ_DATA( sizeof( int ) + 0, GLenum );
	GLint *params = DATA_POINTER( sizeof( int ) + 4, GLint );

	cr_unpackDispatch.PointParameteriv( pname, params );
}
void crUnpackTexSubImage1D( void )
{
    GLenum target = READ_DATA( sizeof( int ) + 0, GLenum );
    GLint level = READ_DATA( sizeof( int ) + 4, GLint );
    GLint xoffset = READ_DATA( sizeof( int ) + 8, GLint );
    GLsizei width = READ_DATA( sizeof( int ) + 12, GLsizei );
    GLenum format = READ_DATA( sizeof( int ) + 16, GLenum );
    GLenum type = READ_DATA( sizeof( int ) + 20, GLenum );
    int noimagedata = READ_DATA( sizeof( int ) + 24, int );
    GLvoid *pixels;

    if ( noimagedata )
        pixels = (void*) (uintptr_t) READ_DATA(sizeof(int)+28, GLint);
    else 
        pixels = DATA_POINTER( sizeof( int ) + 32, GLvoid );

    cr_unpackDispatch.PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
    cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
    cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
    cr_unpackDispatch.PixelStorei( GL_UNPACK_ALIGNMENT, 1 );

    cr_unpackDispatch.TexSubImage1D( target, level, xoffset, width, format,
                                     type, pixels );
    INCR_VAR_PTR();
}
void crUnpackExtendLockArraysEXT(void)
{
    GLint first    = READ_DATA(sizeof(int) + 4, GLint);
    GLint count    = READ_DATA(sizeof(int) + 8, GLint);
    int numenabled = READ_DATA(sizeof(int) + 12, int);

    CRContext *g = crStateGetCurrent();
    CRClientState *c = &g->client;
    CRClientPointer *cp;
    int i, index, offset;
    unsigned char *data;
    
    offset = 2*sizeof(int)+12;

    /*crDebug("crUnpackExtendLockArraysEXT(%i, %i) ne=%i", first, count, numenabled);*/

    for (i=0; i<numenabled; ++i)
    {
        index = READ_DATA(offset, int);
        offset += sizeof(int);
        cp = crStateGetClientPointerByIndex(index, &c->array);
        CRASSERT(cp && cp->enabled && (!cp->buffer || !cp->buffer->id));
        data = crAlloc((first+count)*cp->bytesPerIndex);
        crMemcpy(data+first*cp->bytesPerIndex, DATA_POINTER(offset, GLvoid), count*cp->bytesPerIndex);
        offset += count*cp->bytesPerIndex;
        /*crDebug("crUnpackExtendLockArraysEXT: old cp(%i): en/l=%i(%i) p=%p size=%i type=0x%x n=%i str=%i pp=%p pstr=%i",
                index, cp->enabled, cp->locked, cp->p, cp->size, cp->type, cp->normalized, cp->stride, cp->prevPtr, cp->prevStride);*/
        crUnpackSetClientPointerByIndex(index, cp->size, cp->type, cp->normalized, 0, data, c);
        /*crDebug("crUnpackExtendLockArraysEXT: new cp(%i): en/l=%i(%i) p=%p size=%i type=0x%x n=%i str=%i pp=%p pstr=%i",
                index, cp->enabled, cp->locked, cp->p, cp->size, cp->type, cp->normalized, cp->stride, cp->prevPtr, cp->prevStride);*/
    }
    cr_unpackDispatch.LockArraysEXT(first, count);
}
void crUnpackExtendCompressedTexSubImage3DARB( void )
{
    GLenum  target    = READ_DATA( 4 + sizeof(int) +  0, GLenum );
    GLint   level     = READ_DATA( 4 + sizeof(int) +  4, GLint );
    GLint   xoffset   = READ_DATA( 4 + sizeof(int) +  8, GLint );
    GLint   yoffset   = READ_DATA( 4 + sizeof(int) + 12, GLint );
    GLint   zoffset   = READ_DATA( 4 + sizeof(int) + 16, GLint );
    GLsizei width     = READ_DATA( 4 + sizeof(int) + 20, GLsizei );
    GLsizei height    = READ_DATA( 4 + sizeof(int) + 24, GLsizei );
    GLsizei depth     = READ_DATA( 4 + sizeof(int) + 28, GLsizei );
    GLenum  format    = READ_DATA( 4 + sizeof(int) + 32, GLenum );
    GLsizei imagesize = READ_DATA( 4 + sizeof(int) + 36, GLsizei );
    int     noimagedata   = READ_DATA( 4 + sizeof(int) + 40, int );
    GLvoid  *pixels;

    if( noimagedata )
        pixels = (void*) (uintptr_t) READ_DATA(4+sizeof(int)+44, GLint);
    else
        pixels = DATA_POINTER( 4 + sizeof(int) + 48, GLvoid );

    cr_unpackDispatch.CompressedTexSubImage3DARB(target, level, xoffset,
                                                 yoffset, zoffset, width,
                                                 height, depth, format,
                                                 imagesize, pixels);
}
示例#9
0
void crUnpackLoadMatrixf( void  )
{
	GLfloat *m = DATA_POINTER( 0, GLfloat );

	cr_unpackDispatch.LoadMatrixf( m );
	INCR_DATA_PTR( 16*sizeof( GLfloat ) );
}
示例#10
0
void crUnpackExtendLoadTransposeMatrixdARB( void  )
{
	GLdouble m[16];
	crMemcpy( m, DATA_POINTER( 8, GLdouble ), sizeof(m) );

	cr_unpackDispatch.LoadTransposeMatrixdARB( m );
}
void crUnpackExtendWindowVisibleRegion( void )
{
    GLint window = READ_DATA( 8, GLint );
    GLint cRects = READ_DATA( 12, GLint );
    GLvoid *pRects = DATA_POINTER( 16, GLvoid );;
    cr_unpackDispatch.WindowVisibleRegion( window, cRects, pRects );
}
示例#12
0
void crUnpackMultMatrixd( void  )
{
	GLdouble m[16];
	crMemcpy( m, DATA_POINTER( 0, GLdouble ), sizeof(m) );

	cr_unpackDispatch.MultMatrixd( m );
	INCR_DATA_PTR( 16*sizeof( GLdouble ) );
}
示例#13
0
void crUnpackExtendProgramStringARB(void)
{ 
      GLenum target = READ_DATA(8, GLenum);
      GLenum format = READ_DATA(12, GLuint);
      GLsizei len = READ_DATA(16, GLsizei);
      GLvoid *program = DATA_POINTER(20, GLvoid);
      cr_unpackDispatch.ProgramStringARB(target, format, len, program);
}
void crUnpackDeleteTextures( void )
{
    GLsizei n = READ_DATA( sizeof( int ) + 0, GLsizei );
    GLuint *textures = DATA_POINTER( sizeof( int ) + 4, GLuint );

    cr_unpackDispatch.DeleteTextures( n, textures );
    INCR_VAR_PTR();
}
示例#15
0
void crUnpackExtendLoadProgramNV(void)
{
	GLenum target = READ_DATA(8, GLenum);
	GLuint id = READ_DATA(12, GLuint);
	GLsizei len = READ_DATA(16, GLsizei);
	GLvoid *program = DATA_POINTER(20, GLvoid);
	cr_unpackDispatch.LoadProgramNV(target, id, len, program);
}
示例#16
0
void crUnpackMaterialfv( void  )
{
	GLenum face = READ_DATA( sizeof( int ) + 0, GLenum );
	GLenum pname = READ_DATA( sizeof( int ) + 4, GLenum );
	GLfloat *params = DATA_POINTER( sizeof( int ) + 8, GLfloat );

	cr_unpackDispatch.Materialfv( face, pname, params );
	INCR_VAR_PTR();
}
void crUnpackTexEnviv( void )
{
    GLenum target = READ_DATA( sizeof( int ) + 0, GLenum );
    GLenum pname = READ_DATA( sizeof( int ) + 4, GLenum );
    GLint *params = DATA_POINTER( sizeof( int ) + 8, GLint );

    cr_unpackDispatch.TexEnviv( target, pname, params );
    INCR_VAR_PTR();
}
示例#18
0
void crUnpackExtendGetProgramNamedParameterfvNV(void)
{
	GLuint id = READ_DATA(8, GLuint);
	GLsizei len = READ_DATA(12, GLsizei);
	const GLubyte *name = DATA_POINTER(16, GLubyte);
	SET_RETURN_PTR(16+len);
	SET_WRITEBACK_PTR(16+len+8);
	cr_unpackDispatch.GetProgramNamedParameterfvNV(id, len, name, NULL);
}
void crUnpackTexGeniv( void )
{
    GLenum coord = READ_DATA( sizeof( int ) + 0, GLenum );
    GLenum pname = READ_DATA( sizeof( int ) + 4, GLenum );
    GLint *params = DATA_POINTER( sizeof( int ) + 8, GLint );

    cr_unpackDispatch.TexGeniv( coord, pname, params );
    INCR_VAR_PTR();
}
示例#20
0
void crUnpackExtendBufferSubDataARB( void )
{
	GLenum target = READ_DATA( sizeof(int) + 4, GLenum );
	GLintptrARB offset = READ_DATA( sizeof(int) + 8, GLintptrARB );
	GLsizeiptrARB size = READ_DATA( sizeof(int) + 12, GLsizeiptrARB );
	GLvoid *data = DATA_POINTER( sizeof(int) + 16, GLvoid );

	cr_unpackDispatch.BufferSubDataARB( target, offset, size, data );
}
示例#21
0
void crUnpackCallLists( void  )
{
	GLint n = READ_DATA( sizeof( int ) + 0, GLint );
	GLenum type = READ_DATA( sizeof( int ) + 4, GLenum );
	GLvoid *lists = DATA_POINTER( sizeof( int ) + 8, GLvoid );

	cr_unpackDispatch.CallLists( n, type, lists );
	INCR_VAR_PTR();
}
void crUnpackClipPlane(PCrUnpackerState pState)
{
	GLdouble equation[4];
    CHECK_BUFFER_SIZE_STATIC(pState, 4 + sizeof(equation));

	GLenum plane = READ_DATA(pState, 0, GLenum );
	crMemcpy( equation, DATA_POINTER(pState, 4, GLdouble ), sizeof(equation) );

	pState->pDispatchTbl->ClipPlane( plane, equation );
	INCR_DATA_PTR(pState, sizeof( GLenum ) + 4*sizeof( GLdouble ));
}
示例#23
0
void crUnpackExtendBufferDataARB( void )
{
	GLenum target = READ_DATA( sizeof(int) + 4, GLenum );
	GLsizeiptrARB size = READ_DATA( sizeof(int) + 8, GLsizeiptrARB );
	GLenum usage = READ_DATA( sizeof(int) + 12, GLenum );
	GLvoid *data = DATA_POINTER( sizeof(int) + 16, GLvoid );

	CRASSERT(sizeof(GLsizeiptrARB) == 4);
	CRASSERT(usage == GL_STATIC_DRAW_ARB);

	cr_unpackDispatch.BufferDataARB( target, size, data, usage );
}
void crUnpackExtendGetCompressedTexImageARB(void)
{
    GLenum target = READ_DATA( 8, GLenum );
    GLint level   = READ_DATA( 12, GLint );
    GLvoid *img;

    SET_RETURN_PTR( 16 );
    SET_WRITEBACK_PTR( 24 );
    img = DATA_POINTER(16, GLvoid);

    cr_unpackDispatch.GetCompressedTexImageARB( target, level, img );
}
示例#25
0
void crUnpackExtendProgramNamedParameter4fvNV(void)
{
	GLenum id = READ_DATA(8, GLuint);
	GLsizei len = READ_DATA(12, GLsizei);
	GLfloat params[4];
	GLubyte *name = crAlloc(len);
	params[0] = READ_DATA(16, GLfloat);
	params[1] = READ_DATA(20, GLfloat);
	params[2] = READ_DATA(24, GLfloat);
	params[3] = READ_DATA(28, GLfloat);
	crMemcpy(name, DATA_POINTER(32, GLubyte), len);
	cr_unpackDispatch.ProgramNamedParameter4fvNV(id, len, name, params);
}
示例#26
0
void crUnpackExtendProgramNamedParameter4dNV(void)
{
	GLuint id = READ_DATA(8, GLuint);
	GLsizei len = READ_DATA(12, GLsizei);
	GLdouble params[4];
	GLubyte *name = crAlloc (len);
	params[0] = READ_DOUBLE(16);
	params[1] = READ_DOUBLE(24);
	params[2] = READ_DOUBLE(32);
	params[3] = READ_DOUBLE(40);
	crMemcpy(name, DATA_POINTER(48, GLubyte), len);
	cr_unpackDispatch.ProgramNamedParameter4dNV(id, len, name, params[0], params[1], params[2], params[3]);
}
void crUnpackExtendGetTexImage(void)
{
    GLenum target = READ_DATA( 8, GLenum );
    GLint level   = READ_DATA( 12, GLint );
    GLenum format = READ_DATA( 16, GLenum );
    GLenum type   = READ_DATA( 20, GLenum );
    GLvoid *pixels;

    SET_RETURN_PTR(24);
    SET_WRITEBACK_PTR(32);
    pixels = DATA_POINTER(24, GLvoid);

    cr_unpackDispatch.GetTexImage(target, level, format, type, pixels);
}
void crUnpackPixelMapfv( void  )
{
    GLenum map = READ_DATA( sizeof( int ) + 0, GLenum );
    GLsizei mapsize = READ_DATA( sizeof( int ) + 4, GLsizei );
    int nodata = READ_DATA( sizeof(int) + 8, int);
    GLfloat *values;

    if (nodata)
        values = (GLfloat*) (uintptr_t) READ_DATA(sizeof(int) + 12, GLint);
    else
        values = DATA_POINTER( sizeof( int ) + 16, GLfloat );

    cr_unpackDispatch.PixelMapfv( map, mapsize, values );
    INCR_VAR_PTR();
}
void crUnpackTexGendv( void )
{
    GLenum coord = READ_DATA( sizeof( int ) + 0, GLenum );
    GLenum pname = READ_DATA( sizeof( int ) + 4, GLenum );
    GLdouble params[4];
    unsigned int n_param = READ_DATA( 0, int ) - ( sizeof(int) + 8 );

    if ( n_param > sizeof(params) )
        crError( "crUnpackTexGendv: n_param=%d, expected <= %d\n", n_param,
                 (unsigned int)sizeof(params) );
    crMemcpy( params, DATA_POINTER( sizeof( int ) + 8, GLdouble ), n_param );

    cr_unpackDispatch.TexGendv( coord, pname, params );
    INCR_VAR_PTR();
}
示例#30
0
void crUnpackExtendGetBufferSubDataARB( void )
{
	GLenum target = READ_DATA( 8, GLenum );
	GLintptrARB offset = READ_DATA( 12, GLint );
	GLsizeiptrARB size = READ_DATA( 16, GLint );
#if 0
	GLvoid *data;
#endif

	SET_RETURN_PTR( 20 );
	SET_WRITEBACK_PTR( 28 );
#if 0
	crMemcpy( &data, DATA_POINTER( 20, GLvoid ), sizeof(data) );
	printf("%s data=%p\n", __FUNCTION__, data);
	cr_unpackDispatch.GetBufferSubDataARB( target, offset, size, data );
#endif
	cr_unpackDispatch.GetBufferSubDataARB( target, offset, size, NULL );
}