void PACK_APIENTRY crPackCombinerParameterfvNV( GLenum pname, const GLfloat *params ) { CR_GET_PACKER_CONTEXT(pc); if (__handleCombinerParameterData( pname, params, CR_COMBINERPARAMETERFVNV_EXTEND_OPCODE )) WRITE_OPCODE( pc, CR_EXTEND_OPCODE ); CR_UNLOCK_PACKER_CONTEXT(pc); }
int crPackCanHoldBoundedBuffer( const CRPackBuffer *src ) { const int len_aligned = (src->data_current - src->opcode_current - 1 + 3) & ~3; CR_GET_PACKER_CONTEXT(pc); /* 24 is the size of the bounds-info packet... */ return crPackCanHoldOpcode( pc, 1, len_aligned + 24 ); }
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); }
void PACK_APIENTRY crPackLoadTransposeMatrixfARB( const GLfloat *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_LOADTRANSPOSEMATRIXFARB_EXTEND_OPCODE ); WRITE_DATA( 8 + 0*sizeof(GLfloat), GLfloat, m[ 0] ); WRITE_DATA( 8 + 1*sizeof(GLfloat), GLfloat, m[ 1] ); WRITE_DATA( 8 + 2*sizeof(GLfloat), GLfloat, m[ 2] ); WRITE_DATA( 8 + 3*sizeof(GLfloat), GLfloat, m[ 3] ); WRITE_DATA( 8 + 4*sizeof(GLfloat), GLfloat, m[ 4] ); WRITE_DATA( 8 + 5*sizeof(GLfloat), GLfloat, m[ 5] ); WRITE_DATA( 8 + 6*sizeof(GLfloat), GLfloat, m[ 6] ); WRITE_DATA( 8 + 7*sizeof(GLfloat), GLfloat, m[ 7] ); WRITE_DATA( 8 + 8*sizeof(GLfloat), GLfloat, m[ 8] ); WRITE_DATA( 8 + 9*sizeof(GLfloat), GLfloat, m[ 9] ); WRITE_DATA( 8 + 10*sizeof(GLfloat), GLfloat, m[10] ); WRITE_DATA( 8 + 11*sizeof(GLfloat), GLfloat, m[11] ); WRITE_DATA( 8 + 12*sizeof(GLfloat), GLfloat, m[12] ); WRITE_DATA( 8 + 13*sizeof(GLfloat), GLfloat, m[13] ); WRITE_DATA( 8 + 14*sizeof(GLfloat), GLfloat, m[14] ); WRITE_DATA( 8 + 15*sizeof(GLfloat), GLfloat, m[15] ); WRITE_OPCODE( pc, CR_EXTEND_OPCODE ); CR_UNLOCK_PACKER_CONTEXT(pc); }
void PACK_APIENTRY crPackLightfvSWAP (GLenum light, GLenum pname, const GLfloat *params) { CR_GET_PACKER_CONTEXT(pc); if (__handleLightData( light, pname, params )) WRITE_OPCODE( pc, CR_LIGHTFV_OPCODE ); CR_UNLOCK_PACKER_CONTEXT(pc); }
void PACK_APIENTRY crPackPolygonStipple( const GLubyte *mask ) { CR_GET_PACKER_CONTEXT(pc); unsigned char *data_ptr; int nodata = crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB); int packet_length = sizeof(int); if (nodata) packet_length += sizeof(GLint); else packet_length += 32*32/8; CR_GET_BUFFERED_POINTER(pc, packet_length ); WRITE_DATA_AI(int, nodata); if (nodata) { WRITE_DATA_AI(GLint, (GLint)(uintptr_t)mask); } else { crMemcpy( data_ptr, mask, 32*32/8 ); } WRITE_OPCODE( pc, CR_POLYGONSTIPPLE_OPCODE ); CR_UNLOCK_PACKER_CONTEXT(pc); }
void PACK_APIENTRY crPackLoadMatrixf( const GLfloat *m ) { CR_GET_PACKER_CONTEXT(pc); unsigned char *data_ptr; int packet_length = 16*sizeof( *m ); CR_GET_BUFFERED_POINTER(pc, packet_length ); WRITE_DATA( 0*sizeof(GLfloat), GLfloat, m[ 0] ); WRITE_DATA( 1*sizeof(GLfloat), GLfloat, m[ 1] ); WRITE_DATA( 2*sizeof(GLfloat), GLfloat, m[ 2] ); WRITE_DATA( 3*sizeof(GLfloat), GLfloat, m[ 3] ); WRITE_DATA( 4*sizeof(GLfloat), GLfloat, m[ 4] ); WRITE_DATA( 5*sizeof(GLfloat), GLfloat, m[ 5] ); WRITE_DATA( 6*sizeof(GLfloat), GLfloat, m[ 6] ); WRITE_DATA( 7*sizeof(GLfloat), GLfloat, m[ 7] ); WRITE_DATA( 8*sizeof(GLfloat), GLfloat, m[ 8] ); WRITE_DATA( 9*sizeof(GLfloat), GLfloat, m[ 9] ); WRITE_DATA( 10*sizeof(GLfloat), GLfloat, m[10] ); WRITE_DATA( 11*sizeof(GLfloat), GLfloat, m[11] ); WRITE_DATA( 12*sizeof(GLfloat), GLfloat, m[12] ); WRITE_DATA( 13*sizeof(GLfloat), GLfloat, m[13] ); WRITE_DATA( 14*sizeof(GLfloat), GLfloat, m[14] ); WRITE_DATA( 15*sizeof(GLfloat), GLfloat, m[15] ); WRITE_OPCODE( pc, CR_LOADMATRIXF_OPCODE ); CR_UNLOCK_PACKER_CONTEXT(pc); }
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); }
void PACK_APIENTRY crPackMultMatrixd( const GLdouble *m ) { CR_GET_PACKER_CONTEXT(pc); unsigned char *data_ptr; int packet_length = 16*sizeof( *m ); CR_GET_BUFFERED_POINTER(pc, packet_length ); WRITE_DOUBLE( 0*sizeof(double), m[ 0] ); WRITE_DOUBLE( 1*sizeof(double), m[ 1] ); WRITE_DOUBLE( 2*sizeof(double), m[ 2] ); WRITE_DOUBLE( 3*sizeof(double), m[ 3] ); WRITE_DOUBLE( 4*sizeof(double), m[ 4] ); WRITE_DOUBLE( 5*sizeof(double), m[ 5] ); WRITE_DOUBLE( 6*sizeof(double), m[ 6] ); WRITE_DOUBLE( 7*sizeof(double), m[ 7] ); WRITE_DOUBLE( 8*sizeof(double), m[ 8] ); WRITE_DOUBLE( 9*sizeof(double), m[ 9] ); WRITE_DOUBLE( 10*sizeof(double), m[10] ); WRITE_DOUBLE( 11*sizeof(double), m[11] ); WRITE_DOUBLE( 12*sizeof(double), m[12] ); WRITE_DOUBLE( 13*sizeof(double), m[13] ); WRITE_DOUBLE( 14*sizeof(double), m[14] ); WRITE_DOUBLE( 15*sizeof(double), m[15] ); WRITE_OPCODE( pc, CR_MULTMATRIXD_OPCODE ); CR_UNLOCK_PACKER_CONTEXT(pc); }
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; }
void PACK_APIENTRY crPackRequestResidentProgramsNV(GLsizei n, const GLuint *ids) { CR_GET_PACKER_CONTEXT(pc); (void) pc; (void) n; (void) ids; /* We're no-op'ing this function for now. */ }
void PACK_APIENTRY crPackDrawBuffersSWAP(GLsizei n, const GLenum *bufs) { CR_GET_PACKER_CONTEXT(pc); (void)n; (void)bufs; (void)pc; crError ("No swap version"); }
void PACK_APIENTRY crPackLightivSWAP (GLenum light, GLenum pname, const GLint *params) { /* floats and ints are the same size, so the packing should be the same */ CR_GET_PACKER_CONTEXT(pc); if (__handleLightData( light, pname, (const GLfloat *) params )) WRITE_OPCODE( pc, CR_LIGHTIV_OPCODE ); CR_UNLOCK_PACKER_CONTEXT(pc); }
void PACK_APIENTRY crPackCombinerParameterivNV( GLenum pname, const GLint *params ) { /* floats and ints are the same size, so the packing should be the same */ CR_GET_PACKER_CONTEXT(pc); if (__handleCombinerParameterData( pname, (const GLfloat *) params, CR_COMBINERPARAMETERIVNV_EXTEND_OPCODE )) WRITE_OPCODE( pc, CR_EXTEND_OPCODE ); CR_UNLOCK_PACKER_CONTEXT(pc); }
void PACK_APIENTRY crPackUniform4ivSWAP(GLint location, GLsizei count, const GLint *value) { CR_GET_PACKER_CONTEXT(pc); (void)location; (void)count; (void)value; (void)pc; crError ("No swap version"); }
void PACK_APIENTRY crPackShaderSource(GLuint shader, GLsizei count, const char **string, const GLint *length) { CR_GET_PACKER_CONTEXT(pc); unsigned char *data_ptr; GLint *pLocalLength; int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(shader)+sizeof(count)+sizeof(GLint)+count*sizeof(*pLocalLength); GLsizei i; if ((0==count) || (!string)) return; pLocalLength = crAlloc(count*sizeof(*length)); if (!pLocalLength) return; for (i=0; i<count; ++i) { pLocalLength[i] = (length && (length[i]>=0)) ? length[i] : crStrlen(string[i])+1; packet_length += pLocalLength[i]; } if (length) { packet_length += count*sizeof(*length); } CR_GET_BUFFERED_POINTER(pc, packet_length); WRITE_DATA_AI(int, packet_length); WRITE_DATA_AI(GLenum, CR_SHADERSOURCE_EXTEND_OPCODE); WRITE_DATA_AI(GLuint, shader); WRITE_DATA_AI(GLsizei, count); WRITE_DATA_AI(GLint, (GLint)(length ? 1:0)); crMemcpy(data_ptr, pLocalLength, count*sizeof(*pLocalLength)); data_ptr += count*sizeof(*pLocalLength); if (length) { crMemcpy(data_ptr, length, count*sizeof(*length)); data_ptr += count*sizeof(*length); } for (i=0; i<count; ++i) { if (string[i]) { crMemcpy(data_ptr, string[i], pLocalLength[i]); } else { CRASSERT(pLocalLength[i]==1); *data_ptr = 0; } data_ptr += pLocalLength[i]; } WRITE_OPCODE(pc, CR_EXTEND_OPCODE); CR_UNLOCK_PACKER_CONTEXT(pc); crFree(pLocalLength); }
void PACK_APIENTRY crPackBindAttribLocationSWAP(GLuint program, GLuint index, const char *name) { CR_GET_PACKER_CONTEXT(pc); (void)program; (void)index; (void)name; (void)pc; crError ("No swap version"); }
void PACK_APIENTRY crPackShaderSourceSWAP(GLuint shader, GLsizei count, const char **string, const GLint *length) { CR_GET_PACKER_CONTEXT(pc); (void)shader; (void)count; (void)string; (void)length; (void)pc; crError ("No swap version"); }
void PACK_APIENTRY crPackUniformMatrix4x3fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { CR_GET_PACKER_CONTEXT(pc); (void)location; (void)count; (void)transpose; (void)value; (void)pc; crError ("No swap version"); }
void PACK_APIENTRY crPackGetUniformLocationSWAP(GLuint program, const char * name, GLint * return_value, int * writeback) { CR_GET_PACKER_CONTEXT(pc); (void)program; (void)name; (void)return_value; (void)writeback; (void)pc; crError ("No swap version"); }
int crPackCanHoldBuffer( const CRPackBuffer *src ) { const int num_data = crPackNumData(src); const int num_opcode = crPackNumOpcodes(src); int res; CR_GET_PACKER_CONTEXT(pc); CR_LOCK_PACKER_CONTEXT(pc); res = crPackCanHoldOpcode( pc, num_opcode, num_data ); CR_UNLOCK_PACKER_CONTEXT(pc); return res; }
void PACK_APIENTRY crPackEndListSWAP( void ) { CR_GET_PACKER_CONTEXT(pc); unsigned char *data_ptr; (void) pc; CR_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; CR_UNLOCK_PACKER_CONTEXT(pc); }
/* * Transmit a packet which was allocated with crPackAlloc. */ void crHugePacket( CROpcode opcode, void *packet ) { CR_GET_PACKER_CONTEXT(pc); #ifndef CHROMIUM_THREADSAFE CRASSERT(sanityCheckPointer == packet); sanityCheckPointer = NULL; #endif if ( IS_BUFFERED( packet ) ) WRITE_OPCODE( pc, opcode ); else pc->SendHuge( opcode, packet ); }
void PACK_APIENTRY crPackEdgeFlagPointer( GLsizei stride, const GLvoid *pointer ) { CR_GET_PACKER_CONTEXT(pc); unsigned char *data_ptr; int packet_length = 16; CR_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, GLuint, (GLuint) ((uintptr_t) pointer) ); WRITE_OPCODE( pc, CR_EXTEND_OPCODE ); CR_UNLOCK_PACKER_CONTEXT(pc); }
void PACK_APIENTRY crPackFogCoordPointerEXT( 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_FOGCOORDPOINTEREXT_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); }
void PACK_APIENTRY crPackInterleavedArrays( GLenum format, 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_INTERLEAVEDARRAYS_EXTEND_OPCODE ); WRITE_DATA( 8, GLenum, format ); WRITE_DATA( 12, GLsizei, stride ); WRITE_DATA( 16, GLuint, (GLuint) ((uintptr_t) pointer) ); WRITE_OPCODE( pc, CR_EXTEND_OPCODE ); CR_UNLOCK_PACKER_CONTEXT(pc); }
void PACK_APIENTRY crPackDrawBuffers(GLsizei n, const GLenum *bufs) { CR_GET_PACKER_CONTEXT(pc); unsigned char *data_ptr; int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(n) + n*sizeof(*bufs); CR_GET_BUFFERED_POINTER(pc, packet_length); WRITE_DATA_AI(int, packet_length); WRITE_DATA_AI(GLenum, CR_DRAWBUFFERS_EXTEND_OPCODE); WRITE_DATA_AI(GLsizei, n); crMemcpy(data_ptr, bufs, n*sizeof(*bufs)); WRITE_OPCODE(pc, CR_EXTEND_OPCODE); CR_UNLOCK_PACKER_CONTEXT(pc); }
void PACK_APIENTRY crPackReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels, const CRPixelPackState *packstate, int *writeback) { CR_GET_PACKER_CONTEXT(pc); unsigned char *data_ptr; GLint stride = 0; GLint bytes_per_row; int bytes_per_pixel; *writeback = 0; bytes_per_pixel = crPixelSize(format, type); if (bytes_per_pixel <= 0) { char string[80]; sprintf(string, "crPackReadPixels(format 0x%x or type 0x%x)", format, type); __PackError(__LINE__, __FILE__, GL_INVALID_ENUM, string); return; } /* default bytes_per_row so crserver can allocate memory */ bytes_per_row = width * bytes_per_pixel; stride = bytes_per_row; if (packstate->alignment != 1) { GLint remainder = bytes_per_row % packstate->alignment; if (remainder) stride = bytes_per_row + (packstate->alignment - remainder); } CR_GET_BUFFERED_POINTER(pc, 48 + sizeof(CRNetworkPointer) ); WRITE_DATA( 0, GLint, x ); WRITE_DATA( 4, GLint, y ); WRITE_DATA( 8, GLsizei, width ); WRITE_DATA( 12, GLsizei, height ); WRITE_DATA( 16, GLenum, format ); WRITE_DATA( 20, GLenum, type ); WRITE_DATA( 24, GLint, stride ); /* XXX not really used! */ WRITE_DATA( 28, GLint, packstate->alignment ); WRITE_DATA( 32, GLint, packstate->skipRows ); WRITE_DATA( 36, GLint, packstate->skipPixels ); WRITE_DATA( 40, GLint, bytes_per_row ); WRITE_DATA( 44, GLint, packstate->rowLength ); WRITE_NETWORK_POINTER( 48, (char *) pixels ); WRITE_OPCODE( pc, CR_READPIXELS_OPCODE ); CR_CMDBLOCK_CHECK_FLUSH(pc); CR_UNLOCK_PACKER_CONTEXT(pc); }
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); }
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); }