Changeset 63939 in vbox for trunk/src/VBox/GuestHost/OpenGL/packer/packer.py
- Timestamp:
- Sep 22, 2016 7:58:05 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/packer/packer.py
r52451 r63939 6 6 # This script generates the packer.c file from the gl_header.parsed file. 7 7 8 from __future__ import print_function 8 9 import sys, string, re 9 10 … … 46 47 name = '%s%s' % (k[:1].lower(),k[1:]) 47 48 type = m.group(3) + m.group(2) 48 print "\tpc->current.c.%s.%s = data_ptr;" % (name,type)49 print("\tpc->current.c.%s.%s = data_ptr;" % (name,type)) 49 50 return 50 51 … … 54 55 name = 'secondaryColor' 55 56 type = m.group(3) + m.group(2) 56 print "\tpc->current.c.%s.%s = data_ptr;" % (name,type)57 print("\tpc->current.c.%s.%s = data_ptr;" % (name,type)) 57 58 return 58 59 … … 62 63 name = 'texCoord' 63 64 type = m.group(3) + m.group(2) 64 print "\tpc->current.c.%s.%s[0] = data_ptr;" % (name,type)65 print("\tpc->current.c.%s.%s[0] = data_ptr;" % (name,type)) 65 66 return 66 67 … … 70 71 name = 'texCoord' 71 72 type = m.group(3) + m.group(2) 72 print "\tpc->current.c.%s.%s[texture-GL_TEXTURE0_ARB] = data_ptr + 4;" % (name,type)73 print("\tpc->current.c.%s.%s[texture-GL_TEXTURE0_ARB] = data_ptr + 4;" % (name,type)) 73 74 return 74 75 … … 78 79 name = 'index' 79 80 type = m.group(2) + "1" 80 print "\tpc->current.c.%s.%s = data_ptr;" % (name,type)81 print("\tpc->current.c.%s.%s = data_ptr;" % (name,type)) 81 82 return 82 83 … … 86 87 name = 'edgeFlag' 87 88 type = "l1" 88 print "\tpc->current.c.%s.%s = data_ptr;" % (name,type)89 print("\tpc->current.c.%s.%s = data_ptr;" % (name,type)) 89 90 return 90 91 … … 94 95 name = 'fogCoord' 95 96 type = m.group(2) + "1" 96 print "\tpc->current.c.%s.%s = data_ptr;" % (name,type)97 print("\tpc->current.c.%s.%s = data_ptr;" % (name,type)) 97 98 return 98 99 … … 104 105 type = m.group(3) + m.group(2) 105 106 # Add 12 to skip the packet length, opcode and index fields 106 print "\tpc->current.c.%s.%s[index] = data_ptr + 4;" % (name,type)107 print("\tpc->current.c.%s.%s[index] = data_ptr + 4;" % (name,type)) 107 108 if m.group(4) == "ARB" or m.group(4) == "NV": 108 print "\tpc->current.attribsUsedMask |= (1 << index);"109 print "\tpc->current.changedVertexAttrib |= (1 << index);"109 print("\tpc->current.attribsUsedMask |= (1 << index);") 110 print("\tpc->current.changedVertexAttrib |= (1 << index);") 110 111 return 111 112 … … 115 116 """Emit a packer function.""" 116 117 if is_swapped: 117 print 'void PACK_APIENTRY crPack%sSWAP( %s )' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', params))118 else: 119 print 'void PACK_APIENTRY crPack%s( %s )' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', params))120 print '{'121 print '\tCR_GET_PACKER_CONTEXT(pc);'118 print('void PACK_APIENTRY crPack%sSWAP( %s )' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', params))) 119 else: 120 print('void PACK_APIENTRY crPack%s( %s )' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', params))) 121 print('{') 122 print('\tCR_GET_PACKER_CONTEXT(pc);') 122 123 123 124 # Save original function name … … 138 139 if bail_out: 139 140 for (name, type, vecSize) in nonVecParams: 140 print '\t(void)%s;' % (name)141 print '\tcrError ( "%s needs to be special cased %d %d!");' % (func_name, vecSize, can_have_pointers)142 print '\t(void) pc;'143 print '}'141 print('\t(void)%s;' % (name)) 142 print('\tcrError ( "%s needs to be special cased %d %d!");' % (func_name, vecSize, can_have_pointers)) 143 print('\t(void) pc;') 144 print('}') 144 145 # XXX we should really abort here 145 146 return … … 151 152 152 153 153 print "\tunsigned char *data_ptr;"154 print '\t(void) pc;'154 print("\tunsigned char *data_ptr;") 155 print('\t(void) pc;') 155 156 #if func_name == "Enable" or func_name == "Disable": 156 157 # print "\tCRASSERT(!pc->buffer.geometry_only); /* sanity check */" … … 159 160 (name, type, vecSize) = params[index] 160 161 if vecSize>0 and func_name!=orig_func_name: 161 print " if (!%s) {" % name162 print(" if (!%s) {" % name) 162 163 # Know the reason for this one, so avoid the spam. 163 164 if orig_func_name != "SecondaryColor3fvEXT": 164 print " crDebug(\"App passed NULL as %s for %s\");" % (name, orig_func_name)165 print " return;"166 print " }"165 print(" crDebug(\"App passed NULL as %s for %s\");" % (name, orig_func_name)) 166 print(" return;") 167 print(" }") 167 168 168 169 packet_length = apiutil.PacketLength(nonVecParams) 169 170 170 171 if packet_length == 0 and not is_extended: 171 print "\tCR_GET_BUFFERED_POINTER_NO_ARGS( pc );"172 print("\tCR_GET_BUFFERED_POINTER_NO_ARGS( pc );") 172 173 elif func_name[:9] == "Translate" or func_name[:5] == "Color": 173 174 # XXX WTF is the purpose of this? 174 175 if is_extended: 175 176 packet_length += 8 176 print "\tCR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH( pc, %d, GL_TRUE );" % packet_length177 print("\tCR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH( pc, %d, GL_TRUE );" % packet_length) 177 178 else: 178 179 if is_extended: 179 180 packet_length += 8 180 print "\tCR_GET_BUFFERED_POINTER( pc, %d );" % packet_length181 print("\tCR_GET_BUFFERED_POINTER( pc, %d );" % packet_length) 181 182 UpdateCurrentPointer( func_name ) 182 183 183 184 if is_extended: 184 185 counter = 8 185 print WriteData( 0, 'GLint', packet_length, is_swapped)186 print WriteData( 4, 'GLenum', apiutil.ExtendedOpcodeName( func_name ), is_swapped)186 print(WriteData( 0, 'GLint', packet_length, is_swapped )) 187 print(WriteData( 4, 'GLenum', apiutil.ExtendedOpcodeName( func_name ), is_swapped )) 187 188 else: 188 189 counter = 0 … … 195 196 ptrType = apiutil.PointerType(type) 196 197 for i in range(0, vecSize): 197 print 198 ptrType, "%s[%d]" % (name, i), is_swapped ) 198 print(WriteData( counter + i * apiutil.sizeof(ptrType), 199 ptrType, "%s[%d]" % (name, i), is_swapped )) 199 200 # XXX increment counter here? 200 201 else: 201 print WriteData( counter, type, name, is_swapped)202 print(WriteData( counter, type, name, is_swapped )) 202 203 if apiutil.IsPointer(type): 203 204 counter += apiutil.PointerSize() … … 207 208 # finish up 208 209 if is_extended: 209 print "\tWRITE_OPCODE( pc, CR_EXTEND_OPCODE );"210 else: 211 print "\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name)210 print("\tWRITE_OPCODE( pc, CR_EXTEND_OPCODE );") 211 else: 212 print("\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name )) 212 213 213 214 if "get" in apiutil.Properties(func_name): 214 print '\tCR_CMDBLOCK_CHECK_FLUSH(pc);'215 216 print '\tCR_UNLOCK_PACKER_CONTEXT(pc);'217 print '}\n'215 print('\tCR_CMDBLOCK_CHECK_FLUSH(pc);') 216 217 print('\tCR_UNLOCK_PACKER_CONTEXT(pc);') 218 print('}\n') 218 219 219 220 … … 223 224 apiutil.CopyrightC() 224 225 225 print 226 print(""" 226 227 /* DO NOT EDIT - THIS FILE GENERATED BY THE packer.py SCRIPT */ 227 228 … … 233 234 #include "cr_opcodes.h" 234 235 235 """ 236 """) 236 237 237 238 … … 252 253 if return_type != 'void': 253 254 # Yet another gross hack for glGetString 254 if string.find( return_type, '*') == -1:255 if return_type.find('*') == -1: 255 256 return_type = return_type + " *" 256 257 params.append(("return_value", return_type, 0)) … … 264 265 265 266 if not func_name in r0_funcs: 266 print '#ifndef IN_RING0'267 print('#ifndef IN_RING0') 267 268 268 269 PrintFunc( func_name, params, 0, pointers_ok ) … … 270 271 271 272 if not func_name in r0_funcs: 272 print '#endif'273 print('#endif') 273 274
Note:
See TracChangeset
for help on using the changeset viewer.