server_simpleget.py revision 080a4072bc16d97c4e9dbd5c476c69f8f02d16fd
# Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.
import sys
import apiutil
print """#include "cr_spu.h"
#include "chromium.h"
#include "cr_error.h"
#include "cr_mem.h"
#include "cr_net.h"
#include "server_dispatch.h"
#include "server.h"
"""
from get_sizes import *;
print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params))
print '{'
print '\tint tablesize;'
print """
#ifdef CR_ARB_texture_compression
if (GL_COMPRESSED_TEXTURE_FORMATS_ARB == pname)
{
GLint numtexfmts = 0;
cr_server.head_spu->dispatch_table.GetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, &numtexfmts);
tablesize = numtexfmts * sizeof(%s);
}
else
#endif
{
tablesize = __numValues( pname ) * sizeof(%s);
}
print '\t(void) params;'
print '\tif (tablesize>0)'
print '\tcr_server.head_spu->dispatch_table.%s( pname, get_values );' % func_name
print """
if (GL_TEXTURE_BINDING_1D==pname
|| GL_TEXTURE_BINDING_2D==pname
|| GL_TEXTURE_BINDING_3D==pname
|| GL_TEXTURE_BINDING_RECTANGLE_ARB==pname
|| GL_TEXTURE_BINDING_CUBE_MAP_ARB==pname)
{
GLuint texid;
texid = (GLuint) *get_values;
*get_values = (%s) crStateTextureHWIDtoID(texid);
}
else if (GL_CURRENT_PROGRAM==pname)
{
GLuint programid;
programid = (GLuint) *get_values;
*get_values = (%s) crStateGLSLProgramHWIDtoID(programid);
}
else if (GL_FRAMEBUFFER_BINDING_EXT==pname
||GL_READ_FRAMEBUFFER_BINDING==pname)
{
GLuint fboid;
fboid = crStateFBOHWIDtoID((GLuint) *get_values);
if (crServerIsRedirectedToFBO()
&& fboid==cr_server.curClient->currentMural->idFBO)
{
fboid = 0;
}
*get_values = (%s) fboid;
}
else if (GL_RENDERBUFFER_BINDING_EXT==pname)
{
GLuint rbid;
rbid = (GLuint) *get_values;
*get_values = (%s) crStateRBOHWIDtoID(rbid);
}
else if (GL_ARRAY_BUFFER_BINDING_ARB==pname
|| GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB==pname
|| GL_VERTEX_ARRAY_BUFFER_BINDING_ARB==pname
|| GL_NORMAL_ARRAY_BUFFER_BINDING_ARB==pname
|| GL_COLOR_ARRAY_BUFFER_BINDING_ARB==pname
|| GL_INDEX_ARRAY_BUFFER_BINDING_ARB==pname
|| GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB==pname
|| GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB==pname
|| GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB==pname
|| GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB==pname
|| GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB==pname)
{
GLuint bufid;
bufid = (GLuint) *get_values;
*get_values = (%s) crStateBufferHWIDtoID(bufid);
}
else if (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS==pname)
{
if (CR_MAX_TEXTURE_UNITS < (GLuint)*get_values)
{
*get_values = (%s)CR_MAX_TEXTURE_UNITS;
}
}
""" % (types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index])
print '\tcrServerReturnValue( get_values, tablesize );'
print '\tcrFree(get_values);'
print '}\n'