Ejemplo n.º 1
0
void PACK_APIENTRY crPackPrioritizeTexturesSWAP( GLsizei n,
		const GLuint *textures, const GLclampf *priorities )
{
	unsigned char *data_ptr;
	int packet_length = 
		sizeof( n ) + 
		n*sizeof( *textures ) + 
		n*sizeof( *priorities );
	int i;

	data_ptr = (unsigned char *) crPackAlloc( packet_length );
	WRITE_DATA( 0, GLsizei, SWAP32(n) );
	for ( i = 0 ; i < n ; i++)
	{
		WRITE_DATA( i*sizeof(int) + 4, GLint, SWAP32(textures[i]));
	}
	for ( i = 0 ; i < n ; i++)
	{
		WRITE_DATA( i*sizeof(int) + 4 + n*sizeof( *textures ),
				GLuint, SWAPFLOAT(priorities[i]));
	}

	crHugePacket( CR_PRIORITIZETEXTURES_OPCODE, data_ptr );
	crPackFree( data_ptr );
}
static unsigned char * __gl_HandlePixelMapData(GLenum map, GLsizei mapsize, int size_of_value, const GLvoid *values)
{
    int nodata = (values == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB);
    int packet_length = 
        sizeof( map ) + 
        sizeof( mapsize ) + sizeof(int) + sizeof(GLint);
    unsigned char *data_ptr;

    if (!nodata)
    {
        packet_length += mapsize*size_of_value;
    }

    data_ptr = (unsigned char *) crPackAlloc( packet_length );

    WRITE_DATA( 0, GLenum, map );
    WRITE_DATA( 4, GLsizei, mapsize );
    WRITE_DATA( 8, int, nodata);
    WRITE_DATA( 12, GLint, (GLint)(uintptr_t)values);

    if (!nodata)
    {
        crMemcpy( data_ptr + 16, values, mapsize*size_of_value );
    }

    return data_ptr;
}
Ejemplo n.º 3
0
static void __handleTexEnvData( GLenum target, GLenum pname, const GLfloat *params )
{
	GET_PACKER_CONTEXT(pc);
	unsigned char *data_ptr;
	int num_params;
	int i;

	int packet_length = 
		sizeof( int ) + 
		sizeof( target ) + 
		sizeof( pname );

	num_params = 1;
	if ( pname == GL_TEXTURE_ENV_COLOR )
	{
		num_params = 4;
	}

	packet_length += num_params*sizeof(*params);

	GET_BUFFERED_POINTER(pc, packet_length );
	WRITE_DATA( 0, int, SWAP32(packet_length) );
	WRITE_DATA( sizeof( int ) + 0, GLenum, SWAP32(target) );
	WRITE_DATA( sizeof( int ) + 4, GLenum, SWAP32(pname) );
	for ( i = 0 ; i < num_params ; i++)
	{
		WRITE_DATA( (i+1)*sizeof( int ) + 8, GLuint, SWAPFLOAT( params[i] ) );
	}
}
Ejemplo n.º 4
0
void PACK_APIENTRY crPackLoadTransposeMatrixdARB( const GLdouble *m )
{
    CR_GET_PACKER_CONTEXT(pc);
    unsigned char *data_ptr;
    int packet_length = 16*sizeof( *m ) + sizeof(GLint) + sizeof(GLenum);
    CR_GET_BUFFERED_POINTER(pc, packet_length );
    WRITE_DATA( 0, GLint, packet_length );
    WRITE_DATA( 4, GLenum, CR_LOADTRANSPOSEMATRIXDARB_EXTEND_OPCODE );
    WRITE_DOUBLE( 8 + 0*sizeof(double), m[ 0] );
    WRITE_DOUBLE( 8 + 1*sizeof(double), m[ 1] );
    WRITE_DOUBLE( 8 + 2*sizeof(double), m[ 2] );
    WRITE_DOUBLE( 8 + 3*sizeof(double), m[ 3] );
    WRITE_DOUBLE( 8 + 4*sizeof(double), m[ 4] );
    WRITE_DOUBLE( 8 + 5*sizeof(double), m[ 5] );
    WRITE_DOUBLE( 8 + 6*sizeof(double), m[ 6] );
    WRITE_DOUBLE( 8 + 7*sizeof(double), m[ 7] );
    WRITE_DOUBLE( 8 + 8*sizeof(double), m[ 8] );
    WRITE_DOUBLE( 8 + 9*sizeof(double), m[ 9] );
    WRITE_DOUBLE( 8 + 10*sizeof(double), m[10] );
    WRITE_DOUBLE( 8 + 11*sizeof(double), m[11] );
    WRITE_DOUBLE( 8 + 12*sizeof(double), m[12] );
    WRITE_DOUBLE( 8 + 13*sizeof(double), m[13] );
    WRITE_DOUBLE( 8 + 14*sizeof(double), m[14] );
    WRITE_DOUBLE( 8 + 15*sizeof(double), m[15] );
    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    CR_UNLOCK_PACKER_CONTEXT(pc);
}
Ejemplo n.º 5
0
static GLboolean __handleLightModelData( GLenum pname, const GLfloat *params )
{
    CR_GET_PACKER_CONTEXT(pc);
    unsigned int packet_length = sizeof( int ) + sizeof( pname );
    unsigned int params_length = 0;
    unsigned char *data_ptr;
    switch( pname )
    {
        case GL_LIGHT_MODEL_AMBIENT:
            params_length = 4*sizeof( *params );
            break;
        case GL_LIGHT_MODEL_TWO_SIDE:
        case GL_LIGHT_MODEL_LOCAL_VIEWER:
            params_length = sizeof( *params );
            break;
        default:
            __PackError( __LINE__, __FILE__, GL_INVALID_ENUM,
                                     "crPackLightModelSWAP(bad pname)" );
            return GL_FALSE;
    }
    packet_length += params_length;
    CR_GET_BUFFERED_POINTER(pc, packet_length );
    WRITE_DATA( 0, int, SWAP32(packet_length) );
    WRITE_DATA( sizeof( int ) + 0, GLenum, SWAP32(pname) );
    WRITE_DATA( sizeof( int ) + 4, GLuint, SWAPFLOAT(params[0]) );
    if (params_length > sizeof( *params ))
    {
        WRITE_DATA( sizeof( int ) + 8, GLuint, SWAPFLOAT(params[1]) );
        WRITE_DATA( sizeof( int ) + 12, GLuint, SWAPFLOAT(params[2]) );
        WRITE_DATA( sizeof( int ) + 16, GLuint, SWAPFLOAT(params[3]) );
    }
    return GL_TRUE;
}
Ejemplo n.º 6
0
static unsigned char * __gl_HandlePixelMapData( GLenum map, GLsizei mapsize, int size_of_value, const GLvoid *values )
{
	int i;

	int packet_length = 
		sizeof( map ) + 
		sizeof( mapsize ) + 
		mapsize*size_of_value;
	unsigned char *data_ptr = (unsigned char *) crPackAlloc( packet_length );

	WRITE_DATA( 0, GLenum, SWAP32(map) );
	WRITE_DATA( 4, GLsizei, SWAP32(mapsize) );

	for (i = 0 ; i < mapsize ; i++)
	{
		switch( size_of_value )
		{
			case 2:
				WRITE_DATA( 8 + i*sizeof(GLshort), GLshort, SWAP16(*((GLshort *)values + i) ));
				break;
			case 4:
				WRITE_DATA( 8 + i*sizeof(GLint), GLint, SWAP32(*((GLint *)values + i) ));
				break;
		}
	}
	return data_ptr;
}
Ejemplo n.º 7
0
void PACK_APIENTRY
crPackAreProgramsResidentNV(GLsizei n, const GLuint * programs,
                                                        GLboolean *residences, GLboolean *return_val,
                                                        int *writeback)
{
    CR_GET_PACKER_CONTEXT(pc);
    unsigned char *data_ptr;
    int packet_length;

    (void) return_val; /* Caller must compute this from residences!!! */

    packet_length = sizeof(int) +   /* packet length */
        sizeof(GLenum) +                        /* extend opcode */
        sizeof(n) +                                 /* num programs */
        n * sizeof(*programs) +         /* programs */
        8 + 8;

    CR_GET_BUFFERED_POINTER(pc, packet_length);
    WRITE_DATA(0, int, packet_length);
    WRITE_DATA(4, GLenum, CR_AREPROGRAMSRESIDENTNV_EXTEND_OPCODE);
    WRITE_DATA(8, GLsizei, n);
    crMemcpy(data_ptr + 12, programs, n * sizeof(*programs));
    WRITE_NETWORK_POINTER(12 + n * sizeof(*programs),   (void *) residences);
    WRITE_NETWORK_POINTER(20 + n * sizeof(*programs), (void *) writeback);
    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    CR_CMDBLOCK_CHECK_FLUSH(pc);
    CR_UNLOCK_PACKER_CONTEXT(pc);
}
Ejemplo n.º 8
0
/* Write a record for a packet to a dump file.
   Returns TRUE on success, FALSE on failure. */
gboolean
libpcap_write_enhanced_packet_block(FILE *fp,
                                    const struct pcap_pkthdr *phdr,
                                    guint32 interface_id,
                                    const u_char *pd,
                                    long *bytes_written,
                                    int *err)
{
	struct epb epb;
	guint32 block_total_length;
	guint64 timestamp;
	const guint32 padding = 0;

	block_total_length = sizeof(struct epb) +
	                     ADD_PADDING(phdr->caplen) +
	                     sizeof(guint32);
	timestamp = (guint64)(phdr->ts.tv_sec) * 1000000 +
	            (guint64)(phdr->ts.tv_usec);
	epb.block_type = ENHANCED_PACKET_BLOCK_TYPE;
	epb.block_total_length = block_total_length;
	epb.interface_id = interface_id;
	epb.timestamp_high = (guint32)((timestamp>>32) & 0xffffffff);
	epb.timestamp_low = (guint32)(timestamp & 0xffffffff);
	epb.captured_len = phdr->caplen;
	epb.packet_len = phdr->len;
	WRITE_DATA(fp, &epb, sizeof(struct epb), *bytes_written, err);
	WRITE_DATA(fp, pd, phdr->caplen, *bytes_written, err);
	if (phdr->caplen % 4) {
		WRITE_DATA(fp, &padding, 4 - phdr->caplen % 4, *bytes_written, err);
	}
	WRITE_DATA(fp, &block_total_length, sizeof(guint32), *bytes_written, err);
	return TRUE;
}
Ejemplo n.º 9
0
void PACK_APIENTRY crPackAreTexturesResidentSWAP( GLsizei n, const GLuint *textures, GLboolean *residences, GLboolean *return_val, int *writeback )
{
	GET_PACKER_CONTEXT(pc);
	unsigned char *data_ptr;
	int packet_length;
	int i;

	packet_length = 
		sizeof( int ) +            /* packet length */
		sizeof( GLenum ) +       /* extend-o opcode */
		sizeof( n ) +            /* num_textures */
		n*sizeof( *textures ) +  /* textures */
		8 + 8 + 8;               /* return pointers */

	GET_BUFFERED_POINTER(pc, packet_length);
	WRITE_DATA( 0, int, SWAP32(packet_length) );
	WRITE_DATA( sizeof( int ) + 0, GLenum, SWAP32(CR_ARETEXTURESRESIDENT_EXTEND_OPCODE) );
	WRITE_DATA( sizeof( int ) + 4, GLsizei, SWAP32(n) );
	for (i = 0 ; i < n ; i++)
	{
		WRITE_DATA( (i+1)*sizeof( int ) + 8, GLuint, SWAP32(textures[i]) );
	}
	WRITE_NETWORK_POINTER( sizeof( int ) + 8 + n*sizeof( *textures ), (void *) residences );
	WRITE_NETWORK_POINTER( sizeof( int ) + 16 + n*sizeof( *textures ), (void *) return_val );
	WRITE_NETWORK_POINTER( sizeof( int ) + 24 + n*sizeof( *textures ), (void *) writeback );
	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
}
Ejemplo n.º 10
0
void PACK_APIENTRY crPackMap2dSWAP(GLenum target, GLdouble u1, 
        GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, 
        GLint vstride, GLint vorder, const GLdouble *points)
{
    unsigned char *data_ptr;
    int u,v;
    int comp;
    GLdouble *dest_data, *src_data;
    int packet_length = 
        sizeof(target) + 
        sizeof(u1) +
        sizeof(u2) +
        sizeof(uorder) +
        sizeof(ustride) +
        sizeof(v1) +
        sizeof(v2) + 
        sizeof(vorder) +
        sizeof(vstride);

    int num_components = __gl_Map2NumComponents(target);
    if (num_components < 0)
    {
        __PackError(__LINE__, __FILE__, GL_INVALID_ENUM,
                                 "crPackMap2d(bad target)");
        return;
    }

    packet_length += num_components*uorder*vorder*sizeof(*points);

    data_ptr = (unsigned char *) crPackAlloc(packet_length);

    WRITE_DATA(0, GLenum, SWAP32(target));
    WRITE_SWAPPED_DOUBLE(4, u1);
    WRITE_SWAPPED_DOUBLE(12, u2);
    WRITE_DATA(20, GLint, SWAP32(num_components));
    WRITE_DATA(24, GLint, SWAP32(uorder));
    WRITE_SWAPPED_DOUBLE(28, v1);
    WRITE_SWAPPED_DOUBLE(36, v2);
    WRITE_DATA(44, GLint, SWAP32(num_components*uorder));
    WRITE_DATA(48, GLint, SWAP32(vorder));

    dest_data = (GLdouble *) (data_ptr + 52);
    src_data = (GLdouble *) points;
    for (v = 0 ; v < vorder ; v++)
    {
        for (u = 0 ; u < uorder ; u++)
        {
            for (comp = 0 ; comp < num_components ; comp++)
            {
                WRITE_SWAPPED_DOUBLE(((unsigned char *) dest_data + comp*sizeof(*points)) - data_ptr, *(src_data + comp));
            }
            dest_data += num_components;
            src_data += ustride;
        }
        src_data += vstride - ustride*uorder;
    }

    crHugePacket(CR_MAP2D_OPCODE, data_ptr);
    crPackFree(data_ptr);
}
Ejemplo n.º 11
0
void PACK_APIENTRY crPackEndListSWAP( void )
{
    GET_PACKER_CONTEXT(pc);
    unsigned char *data_ptr;
    (void) pc;
    GET_BUFFERED_POINTER( pc, 8 );
    WRITE_DATA( 0, GLint, SWAP32(8) );
    WRITE_DATA( 4, GLenum, SWAP32(CR_ENDLIST_EXTEND_OPCODE) );
    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    pc->buffer.in_List = GL_FALSE;
}
Ejemplo n.º 12
0
void PACK_APIENTRY crPackEdgeFlagPointer( GLsizei stride, const GLvoid *pointer )
{
	GET_PACKER_CONTEXT(pc);
	unsigned char *data_ptr;
	int packet_length = 12 + sizeof(GLintptrARB);
	GET_BUFFERED_POINTER( pc, packet_length );
	WRITE_DATA( 0, GLint, packet_length );
	WRITE_DATA( 4, GLenum, CR_EDGEFLAGPOINTER_EXTEND_OPCODE );
	WRITE_DATA( 8, GLsizei, stride );
	WRITE_DATA( 12, GLintptrARB, (GLintptrARB) pointer );
	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
}
Ejemplo n.º 13
0
void PACK_APIENTRY crPackCallListsSWAP(GLint n, GLenum type,
                                       const GLvoid *lists )
{
    unsigned char *data_ptr;
    int packet_length;
    GLshort *shortPtr;
    GLint   *intPtr;
    int i;

    int bytesPerList = __gl_CallListsNumBytes( type );
    int numBytes = bytesPerList * n;

    if (numBytes < 0)
    {
        __PackError( __LINE__, __FILE__, GL_INVALID_ENUM,
                     "crPackCallLists(bad type)" );
        return;
    }

    packet_length = sizeof( n ) +
                    sizeof( type ) +
                    numBytes;

    data_ptr = (unsigned char *) crPackAlloc( packet_length );
    WRITE_DATA( 0, GLint, SWAP32(n) );
    WRITE_DATA( 4, GLenum, SWAP32(type) );

    crMemcpy( data_ptr + 8, lists, numBytes );
    shortPtr = (GLshort *) (data_ptr + 8);
    intPtr   = (GLint *) (data_ptr + 8);

    if (bytesPerList > 1)
    {
        for ( i = 0 ; i < n ; i++)
        {
            switch( bytesPerList )
            {
            case 2:
                *shortPtr = SWAP16(*shortPtr);
                shortPtr+=1;
                break;
            case 4:
                *intPtr = SWAP32(*intPtr);
                intPtr+=1;
                break;
            }
        }
    }

    crHugePacket( CR_CALLLISTS_OPCODE, data_ptr );
    crPackFree( data_ptr );
}
Ejemplo n.º 14
0
void PACK_APIENTRY crPackFogCoordPointerEXT( GLenum type, GLsizei stride, const GLvoid * pointer )
{
	GET_PACKER_CONTEXT(pc);
	unsigned char *data_ptr;
	int packet_length = 16 + sizeof(GLintptrARB);
	GET_BUFFERED_POINTER( pc, packet_length );
	WRITE_DATA( 0, GLint, packet_length );
	WRITE_DATA( 4, GLenum, CR_FOGCOORDPOINTEREXT_EXTEND_OPCODE );
	WRITE_DATA( 8, GLenum, type );
	WRITE_DATA( 12, GLsizei, stride );
	WRITE_DATA( 16, GLintptrARB, (GLintptrARB) pointer );
	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
}
Ejemplo n.º 15
0
void PACK_APIENTRY crPackInterleavedArrays( GLenum format, GLsizei stride, const GLvoid *pointer )
{
	GET_PACKER_CONTEXT(pc);
	unsigned char *data_ptr;
	int packet_length = 16 + sizeof(GLintptrARB);
	GET_BUFFERED_POINTER( pc, packet_length );
	WRITE_DATA( 0, GLint, packet_length );
	WRITE_DATA( 4, GLenum, CR_INTERLEAVEDARRAYS_EXTEND_OPCODE );
	WRITE_DATA( 8, GLenum, format );
	WRITE_DATA( 12, GLsizei, stride );
	WRITE_DATA( 16, GLintptrARB, (GLintptrARB) pointer );
	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
}
Ejemplo n.º 16
0
void PACK_APIENTRY crPackNewListSWAP( GLuint list, GLenum mode )
{
    GET_PACKER_CONTEXT(pc);
    unsigned char *data_ptr;
    (void) pc;
    GET_BUFFERED_POINTER( pc, 16 );
    WRITE_DATA( 0, GLint, SWAP32(16) );
    WRITE_DATA( 4, GLenum, SWAP32(CR_NEWLIST_EXTEND_OPCODE) );
    WRITE_DATA( 8, GLuint, SWAP32(list) );
    WRITE_DATA( 12, GLenum, SWAP32(mode) );
    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    pc->buffer.in_List = GL_TRUE;
    pc->buffer.holds_List = GL_TRUE;
}
Ejemplo n.º 17
0
void PACK_APIENTRY crPackWindowVisibleRegion( CR_PACKER_CONTEXT_ARGDECL GLint window, GLint cRects, const GLint * pRects )
{
    GLint i, size, cnt;

    CR_GET_PACKER_CONTEXT(pc);
    unsigned char *data_ptr;
    (void) pc;
    size = 16 + cRects * 4 * sizeof(GLint);
    CR_GET_BUFFERED_POINTER( pc, size );
    WRITE_DATA( 0, GLint, size );
    WRITE_DATA( 4, GLenum, CR_WINDOWVISIBLEREGION_EXTEND_OPCODE );
    WRITE_DATA( 8, GLint, window );
    WRITE_DATA( 12, GLint, cRects );

    cnt = 16;
    for (i=0; i<cRects; ++i)
    {
        WRITE_DATA(cnt, GLint, (GLint) pRects[4*i+0]);
        WRITE_DATA(cnt+4, GLint, (GLint) pRects[4*i+1]);
        WRITE_DATA(cnt+8, GLint, (GLint) pRects[4*i+2]);
        WRITE_DATA(cnt+12, GLint, (GLint) pRects[4*i+3]);
        cnt += 16;
    }
    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    CR_UNLOCK_PACKER_CONTEXT(pc);
}
Ejemplo n.º 18
0
static void write_yuv420p(decode_t *decode, const mpeg2_info_t *info,
                          const mpeg2_sequence_t *sequence)
{
    static const char *plane_id[] = { "Y", "U", "V" };
    int len = 0;
    /* FIXME: move to libtc/tcframes routines? */

    len = sequence->width * sequence->height;
    WRITE_DATA(info->display_fbuf->buf[0], len, plane_id[0]);
                
    len = sequence->chroma_width * sequence->chroma_height;
    WRITE_DATA(info->display_fbuf->buf[1], len, plane_id[1]);
    WRITE_DATA(info->display_fbuf->buf[2], len, plane_id[2]);
}
Ejemplo n.º 19
0
void PACK_APIENTRY crPackNormalPointer( GLenum type, GLsizei stride, const GLvoid *pointer )
{
	CR_GET_PACKER_CONTEXT(pc);
	unsigned char *data_ptr;
	int packet_length = 20;
	CR_GET_BUFFERED_POINTER( pc, packet_length );
	WRITE_DATA( 0, GLint, packet_length );
	WRITE_DATA( 4, GLenum, CR_NORMALPOINTER_EXTEND_OPCODE );
	WRITE_DATA( 8, GLenum, type );
	WRITE_DATA( 12, GLsizei, stride );
	WRITE_DATA( 16, GLuint, (GLuint) ((uintptr_t) pointer) );
	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    CR_UNLOCK_PACKER_CONTEXT(pc);
}
Ejemplo n.º 20
0
void PACK_APIENTRY crPackGetInfoLogARB(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog, int * writeback)
{
	CR_GET_PACKER_CONTEXT(pc);
	unsigned char *data_ptr;
	(void) pc;
	CR_GET_BUFFERED_POINTER(pc, 32);
	WRITE_DATA(0, GLint, 32);
	WRITE_DATA(4, GLenum, CR_GETINFOLOGARB_EXTEND_OPCODE);
	WRITE_DATA(8, GLhandleARB, obj);
	WRITE_DATA(12, GLsizei, maxLength);
	WRITE_NETWORK_POINTER(16, (void *) length);
	WRITE_NETWORK_POINTER(24, (void *) writeback);
	WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    CR_UNLOCK_PACKER_CONTEXT(pc);
}
Ejemplo n.º 21
0
void PACK_APIENTRY crPackGetUniformsLocations(GLuint program, GLsizei maxcbData, GLsizei * cbData, GLvoid * pData, int * writeback)
{
	CR_GET_PACKER_CONTEXT(pc);
    unsigned char *data_ptr;
    (void) pData;
    CR_GET_BUFFERED_POINTER(pc, 32);
    WRITE_DATA(0, GLint, 32);
    WRITE_DATA(4, GLenum, CR_GETUNIFORMSLOCATIONS_EXTEND_OPCODE);
    WRITE_DATA(8, GLuint, program);
    WRITE_DATA(12, GLsizei, maxcbData);
    WRITE_NETWORK_POINTER(16, (void *) cbData);
    WRITE_NETWORK_POINTER(24, (void *) writeback);
    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    CR_UNLOCK_PACKER_CONTEXT(pc);
}
Ejemplo n.º 22
0
void PACK_APIENTRY crPackVertexAttrib4ubvARB(GLuint index, const GLubyte * v)
{
    CR_GET_PACKER_CONTEXT(pc);
    unsigned char *data_ptr;
    CR_GET_BUFFERED_POINTER(pc, 8);
    pc->current.c.vertexAttrib.ub4[index] = data_ptr + 4;
    pc->current.attribsUsedMask |= (1 << index);
    WRITE_DATA(0, GLuint, index);
    WRITE_DATA(4, GLubyte, v[0]);
    WRITE_DATA(5, GLubyte, v[1]);
    WRITE_DATA(6, GLubyte, v[2]);
    WRITE_DATA(7, GLubyte, v[3]);
    WRITE_OPCODE(pc, CR_VERTEXATTRIB4UBVARB_OPCODE);
    CR_UNLOCK_PACKER_CONTEXT(pc);
}
Ejemplo n.º 23
0
void PACK_APIENTRY crPackGetAttachedObjectsARB(GLhandleARB containerObj, GLsizei maxCount, GLsizei * count, GLhandleARB * obj, int * writeback)
{
	CR_GET_PACKER_CONTEXT(pc);
	unsigned char *data_ptr;
	(void) pc;
	CR_GET_BUFFERED_POINTER(pc, 32);
	WRITE_DATA(0, GLint, 32);
	WRITE_DATA(4, GLenum, CR_GETATTACHEDOBJECTSARB_EXTEND_OPCODE);
	WRITE_DATA(8, GLhandleARB, containerObj);
	WRITE_DATA(12, GLsizei, maxCount);
	WRITE_NETWORK_POINTER(16, (void *) count);
	WRITE_NETWORK_POINTER(24, (void *) writeback);
	WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    CR_UNLOCK_PACKER_CONTEXT(pc);
}
Ejemplo n.º 24
0
void PACK_APIENTRY crPackDeleteProgramsARB(GLsizei n, const GLuint *ids)
{
    unsigned char *data_ptr;
    int packet_length = sizeof(GLenum) + sizeof(n) + n * sizeof(*ids);

    if (!ids)
        return;

    data_ptr = (unsigned char *) crPackAlloc(packet_length);
    WRITE_DATA(0, GLenum, CR_DELETEPROGRAMSARB_EXTEND_OPCODE);
    WRITE_DATA(4, GLsizei, n);
    crMemcpy(data_ptr + 8, ids, n * sizeof(*ids));
    crHugePacket(CR_EXTEND_OPCODE, data_ptr);
    crPackFree(data_ptr);
}
Ejemplo n.º 25
0
void PACK_APIENTRY crPackMap1dSWAP(GLenum target, GLdouble u1,
        GLdouble u2, GLint stride, GLint order, const GLdouble *points)
{
    unsigned char *data_ptr;
    int packet_length = 
        sizeof(target) + 
        sizeof(u1) +
        sizeof(u2) + 
        sizeof(stride) + 
        sizeof(order);

    int num_components = __gl_Map1NumComponents(target);
    GLdouble *src_data, *dest_data;
    int u;
    int comp;

    if (num_components < 0)
    {
        __PackError(__LINE__, __FILE__, GL_INVALID_ENUM,
                                 "crPackMap1d(bad target)");
        return;
    }

    packet_length += num_components * order * sizeof(*points);

    data_ptr = (unsigned char *) crPackAlloc(packet_length);

    WRITE_DATA(0, GLenum, SWAP32(target));
    WRITE_SWAPPED_DOUBLE(4, u1);
    WRITE_SWAPPED_DOUBLE(12, u2);
    WRITE_DATA(20, GLint, SWAP32(num_components));
    WRITE_DATA(24, GLint, SWAP32(order));

    dest_data = (GLdouble *) (data_ptr + 28);
    src_data = (GLdouble *) points;
    for (u = 0 ; u < order ; u++)
    {
        for (comp = 0 ; comp < num_components ; comp++)
        {
            WRITE_SWAPPED_DOUBLE((unsigned char *) dest_data + comp*sizeof(*points) - data_ptr, *(src_data + comp));
        }
        dest_data += num_components;
        src_data += stride;
    }

    crHugePacket(CR_MAP1D_OPCODE, data_ptr);
    crPackFree(data_ptr);
}
Ejemplo n.º 26
0
void PACK_APIENTRY
crPackDeleteBuffersARBSWAP(GLsizei n, const GLuint * buffers)
{
	unsigned char *data_ptr;
	int packet_length = sizeof(GLenum) + sizeof(n) + n * sizeof(*buffers);

	if (!buffers)
		return;

	data_ptr = (unsigned char *) crPackAlloc(packet_length);
	WRITE_DATA( 0, GLenum, SWAP32(CR_DELETEBUFFERSARB_EXTEND_OPCODE) );
	WRITE_DATA( 4, GLsizei, SWAP32(n) );
	crMemcpy( data_ptr + 8, buffers, n * sizeof(*buffers) );
	crHugePacket( CR_EXTEND_OPCODE, data_ptr );
    crPackFree( data_ptr );
}
Ejemplo n.º 27
0
void PACK_APIENTRY 
crPackDeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers)
{
    unsigned char *data_ptr;
    int packet_length = sizeof(GLenum) + sizeof(n) + n*sizeof(*framebuffers);

    if (!framebuffers)
        return;

    data_ptr = (unsigned char *) crPackAlloc(packet_length);
    WRITE_DATA(0, GLenum, CR_DELETEFRAMEBUFFERSEXT_EXTEND_OPCODE);
    WRITE_DATA(4, GLsizei, n);
    crMemcpy(data_ptr + 8, framebuffers, n* sizeof(*framebuffers));
    crHugePacket(CR_EXTEND_OPCODE, data_ptr);
    crPackFree(data_ptr);
}
Ejemplo n.º 28
0
void PACK_APIENTRY crPackGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei * length, char * source, int * writeback)
{
    CR_GET_PACKER_CONTEXT(pc);
    unsigned char *data_ptr;
    (void) pc;
    (void) source;
    CR_GET_BUFFERED_POINTER(pc, 32);
    WRITE_DATA(0, GLint, 32);
    WRITE_DATA(4, GLenum, CR_GETSHADERSOURCE_EXTEND_OPCODE);
    WRITE_DATA(8, GLuint, shader);
    WRITE_DATA(12, GLsizei, bufSize);
    WRITE_NETWORK_POINTER(16, (void *) length);
    WRITE_NETWORK_POINTER(24, (void *) writeback);
    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    CR_UNLOCK_PACKER_CONTEXT(pc);
}
Ejemplo n.º 29
0
void PACK_APIENTRY crPackGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei * length, char * infoLog, int * writeback)
{
    CR_GET_PACKER_CONTEXT(pc);
    unsigned char *data_ptr;
    (void) pc;
    (void) infoLog;
    CR_GET_BUFFERED_POINTER(pc, 32);
    WRITE_DATA(0, GLint, 32);
    WRITE_DATA(4, GLenum, CR_GETPROGRAMINFOLOG_EXTEND_OPCODE);
    WRITE_DATA(8, GLuint, program);
    WRITE_DATA(12, GLsizei, bufSize);
    WRITE_NETWORK_POINTER(16, (void *) length);
    WRITE_NETWORK_POINTER(24, (void *) writeback);
    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    CR_UNLOCK_PACKER_CONTEXT(pc);
}
Ejemplo n.º 30
0
void PACK_APIENTRY crPackGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders, int * writeback)
{
    CR_GET_PACKER_CONTEXT(pc);
    unsigned char *data_ptr;
    (void) pc;
    (void) shaders;
    CR_GET_BUFFERED_POINTER(pc, 32);
    WRITE_DATA(0, GLint, 32);
    WRITE_DATA(4, GLenum, CR_GETATTACHEDSHADERS_EXTEND_OPCODE);
    WRITE_DATA(8, GLuint, program);
    WRITE_DATA(12, GLsizei, maxCount);
    WRITE_NETWORK_POINTER(16, (void *) count);
    WRITE_NETWORK_POINTER(24, (void *) writeback);
    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    CR_UNLOCK_PACKER_CONTEXT(pc);
}