Пример #1
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();
}
Пример #2
0
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();
}
Пример #3
0
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();
}
Пример #4
0
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();
}
Пример #5
0
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 );
	GLvoid *pixels = DATA_POINTER( sizeof( int ) + 24, 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 crUnpackBoundsInfoCR(PCrUnpackerState pState)
{
    CHECK_BUFFER_SIZE_STATIC(pState, 24 + sizeof(GLbyte));

	CRrecti bounds;
	GLint len;
	GLuint num_opcodes;
	GLbyte *payload;

	len = READ_DATA(pState, 0, GLint );
	bounds.x1 = READ_DATA(pState, 4, GLint );
	bounds.y1 = READ_DATA(pState, 8, GLint );
	bounds.x2 = READ_DATA(pState, 12, GLint );
	bounds.y2 = READ_DATA(pState, 16, GLint );
	num_opcodes = READ_DATA(pState, 20, GLuint );
	payload = DATA_POINTER(pState, 24, GLbyte );

	pState->pDispatchTbl->BoundsInfoCR( &bounds, payload, len, num_opcodes );
	INCR_VAR_PTR(pState);
}
void crUnpackBitmap(PCrUnpackerState pState)
{
    CHECK_BUFFER_SIZE_STATIC_LAST(pState, sizeof(int) + 28, GLint);

    GLsizei width   = READ_DATA(pState, sizeof( int ) + 0, GLsizei );
    GLsizei height  = READ_DATA(pState,sizeof( int ) + 4, GLsizei );
    GLfloat xorig   = READ_DATA(pState, sizeof( int ) + 8, GLfloat );
    GLfloat yorig   = READ_DATA(pState, sizeof( int ) + 12, GLfloat );
    GLfloat xmove   = READ_DATA(pState, sizeof( int ) + 16, GLfloat );
    GLfloat ymove   = READ_DATA(pState, sizeof( int ) + 20, GLfloat );
    GLuint noimagedata = READ_DATA(pState, sizeof( int ) + 24, GLuint );
    GLubyte *bitmap;

    if (noimagedata && !crStateIsBufferBound(pState->pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB))
        return;

    if (noimagedata)
        bitmap = (GLubyte *) (uintptr_t) READ_DATA(pState,sizeof(int) + 28, GLint);
    else
    {
        /* Each pixel is one bit => 8 pixels per byte. */
        size_t cbImg = crImageSize(GL_COLOR_INDEX, GL_BITMAP, width, height);
        if (RT_UNLIKELY(cbImg == 0))
        {
            pState->rcUnpack = VERR_INVALID_PARAMETER;
            return;
        }

        bitmap = DATA_POINTER(pState, sizeof(int) + 32, GLubyte );
        CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, bitmap, cbImg, GLubyte);
    }

    pState->pDispatchTbl->PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
    pState->pDispatchTbl->PixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
    pState->pDispatchTbl->PixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
    pState->pDispatchTbl->PixelStorei( GL_UNPACK_ALIGNMENT, 1 );

    pState->pDispatchTbl->Bitmap( width, height, xorig, yorig, xmove, ymove, bitmap );

    INCR_VAR_PTR(pState);
}
Пример #8
0
void crUnpackTexImage1D( void )
{
    GLenum target = READ_DATA( sizeof( int ) + 0, GLenum );
    GLint level = READ_DATA( sizeof( int ) + 4, GLint );
    GLint internalformat = READ_DATA( sizeof( int ) + 8, GLint );
    GLsizei width = READ_DATA( sizeof( int ) + 12, GLsizei );
    GLint border = READ_DATA( sizeof( int ) + 16, GLint );
    GLenum format = READ_DATA( sizeof( int ) + 20, GLenum );
    GLenum type = READ_DATA( sizeof( int ) + 24, GLenum );
    int noimagedata = READ_DATA( sizeof( int ) + 28, int );
    GLvoid *pixels;

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

    cr_unpackDispatch.TexImage1D( target, level, internalformat, width, border,
                          format, type, pixels );
    INCR_VAR_PTR();
}
Пример #9
0
void crUnpackTexImage2D( void )
{
	GLenum target = READ_DATA( sizeof( int ) + 0, GLenum );
	GLint level = READ_DATA( sizeof( int ) + 4, GLint );
	GLint internalformat = READ_DATA( sizeof( int ) + 8, GLint );
	GLsizei width = READ_DATA( sizeof( int ) + 12, GLsizei );
	GLsizei height = READ_DATA( sizeof( int ) + 16, GLsizei );
	GLint border = READ_DATA( sizeof( int ) + 20, GLint );
	GLenum format = READ_DATA( sizeof( int ) + 24, GLenum );
	GLenum type = READ_DATA( sizeof( int ) + 28, GLenum );
	int is_null = READ_DATA( sizeof( int ) + 32, int );
	GLvoid *pixels;

	if ( is_null )
		pixels = NULL;
	else 
		pixels = DATA_POINTER( sizeof( int ) + 36, GLvoid );

	cr_unpackDispatch.TexImage2D( target, level, internalformat, width, height,
						  border, format, type, pixels );
	INCR_VAR_PTR();
}
void crUnpackDrawPixels(PCrUnpackerState pState)
{
    CHECK_BUFFER_SIZE_STATIC_LAST(pState, sizeof(int) + 20, GLint);

    GLsizei width  = READ_DATA(pState, sizeof( int ) + 0, GLsizei );
    GLsizei height = READ_DATA(pState, sizeof( int ) + 4, GLsizei );
    GLenum format  = READ_DATA(pState, sizeof( int ) + 8, GLenum );
    GLenum type    = READ_DATA(pState, sizeof( int ) + 12, GLenum );
    GLint noimagedata = READ_DATA(pState, sizeof( int ) + 16, GLint );
    GLvoid *pixels;

    if (noimagedata && !crStateIsBufferBound(pState->pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB))
        return;

    if (noimagedata)
        pixels = (void*) (uintptr_t) READ_DATA(pState, sizeof( int ) + 20, GLint);
    else
    {
        size_t cbImg = crImageSize( format, type, width, height );
        if (RT_UNLIKELY(cbImg == 0))
        {
            pState->rcUnpack = VERR_INVALID_PARAMETER;
            return;
        }

        pixels = DATA_POINTER(pState, sizeof( int ) + 24, GLvoid );
        CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, pixels, cbImg, GLubyte);
    }

    pState->pDispatchTbl->PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
    pState->pDispatchTbl->PixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
    pState->pDispatchTbl->PixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
    pState->pDispatchTbl->PixelStorei( GL_UNPACK_ALIGNMENT, 1 );

    pState->pDispatchTbl->DrawPixels( width, height, format, type, pixels );

    INCR_VAR_PTR(pState);
}