server_simpleget.py revision 6e7c344fc7cdb580356704e8201207b394d367bb
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync# Copyright (c) 2001, Stanford University
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync# All rights reserved.
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync#
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync# See the file LICENSE.txt for information on redistributing this software.
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsyncimport sys
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsyncimport apiutil
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsyncapiutil.CopyrightC()
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsyncprint """#include "cr_spu.h"
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync#include "chromium.h"
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync#include "cr_error.h"
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync#include "cr_mem.h"
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync#include "cr_net.h"
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync#include "server_dispatch.h"
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync#include "server.h"
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync"""
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsyncfrom get_sizes import *;
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsyncfuncs = [ 'GetIntegerv', 'GetFloatv', 'GetDoublev', 'GetBooleanv' ]
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsynctypes = [ 'GLint', 'GLfloat', 'GLdouble', 'GLboolean' ]
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsyncfor index in range(len(funcs)):
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync func_name = funcs[index]
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync params = apiutil.Parameters(func_name)
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params))
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync print '{'
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync print '\t%s *get_values;' % types[index]
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync print '\tint tablesize;'
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync print """
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync #ifdef CR_ARB_texture_compression
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync if (GL_COMPRESSED_TEXTURE_FORMATS_ARB == pname)
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync {
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync GLint numtexfmts = 0;
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync cr_server.head_spu->dispatch_table.GetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, &numtexfmts);
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync tablesize = numtexfmts * sizeof(%s);
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync }
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync else
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync #endif
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync {
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync tablesize = __numValues( pname ) * sizeof(%s);
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync }
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync """ % (types[index], types[index])
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync print '\t(void) params;'
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync print '\tget_values = (%s *) crAlloc( tablesize );' % types[index]
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync print '\tif (tablesize>0)'
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync print '\tcr_server.head_spu->dispatch_table.%s( pname, get_values );' % func_name
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync print """
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync if (GL_TEXTURE_BINDING_1D==pname
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync || GL_TEXTURE_BINDING_2D==pname
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync || GL_TEXTURE_BINDING_3D==pname
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync || GL_TEXTURE_BINDING_RECTANGLE_ARB==pname
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync || GL_TEXTURE_BINDING_CUBE_MAP_ARB==pname)
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync {
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync GLuint texid;
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync CRASSERT(tablesize/sizeof(%s)==1);
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync texid = (GLuint) *get_values;
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync *get_values = (%s) (texid - cr_server.curClient->number * 100000);
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync }
9c136b2f28d002b4807422ec86ca2d5a499649e7vboxsync else if (GL_CURRENT_PROGRAM==pname)
9c136b2f28d002b4807422ec86ca2d5a499649e7vboxsync {
9c136b2f28d002b4807422ec86ca2d5a499649e7vboxsync GLuint programid;
9c136b2f28d002b4807422ec86ca2d5a499649e7vboxsync CRASSERT(tablesize/sizeof(%s)==1);
9c136b2f28d002b4807422ec86ca2d5a499649e7vboxsync programid = (GLuint) *get_values;
9c136b2f28d002b4807422ec86ca2d5a499649e7vboxsync *get_values = (%s) crStateGLSLProgramHWIDtoID(programid);
9c136b2f28d002b4807422ec86ca2d5a499649e7vboxsync }
9c136b2f28d002b4807422ec86ca2d5a499649e7vboxsync """ % (types[index], types[index], types[index], types[index])
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync print '\tcrServerReturnValue( get_values, tablesize );'
9fc464631dc4a68fbb5eb6419d61fbe91b6b16bdvboxsync print '\tcrFree(get_values);'
8e9d8c088aac57bedb558d3164bb681a582e4474vboxsync print '}\n'
8e9d8c088aac57bedb558d3164bb681a582e4474vboxsync