Suggested changes to pixel.c and tilesort's diffapi.py
[email protected] Tue, 26 Jul 2005 15:43:08 -0600
| Newsgroups | gmane.comp.graphics.chromium.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all, (I'm resending this message with smaller attachments.) Here are updated versions of util/pixel.c and diffapi.py from the tilesort spu which include work-arounds/fixes for release builds under Win32 (with Visual Studio .NET 2003). In pixel.c I've converted the outer switch/case statements into if-else blocks. The old code is there in an ifdef if anyone would like to compare the two versions. For diffapi.py I removed the nop function and replaced it with more fleshed out no-ops for the two functions that nop was being assigned to - ActiveTextureARB and TexEnviv. (Can anyone explain why those are no-ops? There are still many parts of Cr that are mysterious to me!) Let me know what you think (and if they work under other platforms...!), Jon
pixel.tar.gz
(application/x-gzip, 7.3 KB) - not displayed
diffapi.py
(text/plain, 2.5 KB)
# Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.
import sys
sys.path.append( "../../glapi_parser" )
import apiutil
apiutil.CopyrightC()
print """
/* DO NOT EDIT - THIS FILE GENERATED BY THE diffapi.py SCRIPT */
#include "cr_spu.h"
#include "cr_packfunctions.h"
#include "tilesortspu.h"
#include <stdio.h>
static const CRPixelPackState defaultPacking = {
0, /* rowLength */
0, /* skipRows */
0, /* skipPixels */
1, /* alignment */
0, /* imageHeight */
0, /* skipImages */
GL_FALSE, /* swapBytes */
GL_FALSE /* psLSBFirst */
};
"""
keys = apiutil.GetDispatchedFunctions("../../glapi_parser/APIspec.txt")
for func_name in keys:
props = apiutil.Properties(func_name)
if "pixelstore" in props and "get" not in props:
return_type = apiutil.ReturnType(func_name)
params = apiutil.Parameters(func_name)
print 'static %s TILESORTSPU_APIENTRY tilesortspuDiff%s( %s )' % (return_type, func_name, apiutil.MakeDeclarationString( params ) )
print '{'
params.append( ('&defaultPacking', 'foo', 0) )
print '\tif (tilesort_spu.swap)'
print '\t{'
print '\t\tcrPack%sSWAP( %s );' % (func_name, apiutil.MakeCallString( params ) )
print '\t}'
print '\telse'
print '\t{'
print '\t\tcrPack%s( %s );' % (func_name, apiutil.MakeCallString( params ) )
print '\t}'
print '}'
print """
static void TILESORTSPU_APIENTRY tilesortspuActiveTextureARB(GLenum textureUnit)
{
return;
}
"""
print """
static void TILESORTSPU_APIENTRY tilesortspuTexEnviv(GLenum target, GLenum pname, const GLint *params )
{
return;
}
"""
print """
void tilesortspuCreateDiffAPI( void )
{
SPUDispatchTable diff;
crSPUInitDispatchTable(&diff);
/* Note: state differencing should never involve calling a "glGet"
* function. So we set those pointers to NULL.
*/
"""
for func_name in keys:
props = apiutil.Properties(func_name)
if not apiutil.CanPack(func_name):
continue
if func_name == 'ActiveTextureARB':
print '\tdiff.ActiveTextureARB = tilesortspuActiveTextureARB;'
continue
if func_name == 'TexEnviv':
print '\tdiff.TexEnviv = tilesortspuTexEnviv;'
continue
if "get" in props:
print '\tdiff.%s = NULL;' % func_name
elif "pixelstore" in props:
print '\tdiff.%s = tilesortspuDiff%s;' % (func_name, func_name)
else:
print '\tdiff.%s = tilesort_spu.swap ? crPack%sSWAP : crPack%s;' % (func_name, func_name, func_name)
print '\tcrStateDiffAPI( &diff );'
print '}'