Changeset 46515 in vbox for trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump_gen.py
- Timestamp:
- Jun 12, 2013 10:47:50 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump_gen.py
r46453 r46515 128 128 #endif 129 129 """ 130 131 from get_components import *; 132 133 texenv_mappings = { 134 'GL_TEXTURE_ENV' : [ 135 'GL_TEXTURE_ENV_MODE', 136 'GL_TEXTURE_ENV_COLOR', 137 'GL_COMBINE_RGB', 138 'GL_COMBINE_ALPHA', 139 'GL_RGB_SCALE', 140 'GL_ALPHA_SCALE', 141 'GL_SRC0_RGB', 142 'GL_SRC1_RGB', 143 'GL_SRC2_RGB', 144 'GL_SRC0_ALPHA', 145 'GL_SRC1_ALPHA', 146 'GL_SRC2_ALPHA' 147 ], 148 'GL_TEXTURE_FILTER_CONTROL' : [ 149 'GL_TEXTURE_LOD_BIAS' 150 ], 151 'GL_POINT_SPRITE' : [ 152 'GL_COORD_REPLACE' 153 ] 154 } 155 156 texgen_coords = [ 157 'GL_S', 158 'GL_T', 159 'GL_R', 160 'GL_Q' 161 ] 162 163 texgen_names = [ 164 'GL_TEXTURE_GEN_MODE', 165 'GL_OBJECT_PLANE', 166 'GL_EYE_PLANE' 167 ] 168 169 texparam_names = [ 170 'GL_TEXTURE_MAG_FILTER', 171 'GL_TEXTURE_MIN_FILTER', 172 'GL_TEXTURE_MIN_LOD', 173 'GL_TEXTURE_MAX_LOD', 174 'GL_TEXTURE_BASE_LEVEL', 175 'GL_TEXTURE_MAX_LEVEL', 176 'GL_TEXTURE_WRAP_S', 177 'GL_TEXTURE_WRAP_T', 178 'GL_TEXTURE_WRAP_R', 179 'GL_TEXTURE_BORDER_COLOR', 180 'GL_TEXTURE_PRIORITY', 181 'GL_TEXTURE_RESIDENT', 182 'GL_TEXTURE_COMPARE_MODE', 183 'GL_TEXTURE_COMPARE_FUNC', 184 'GL_DEPTH_TEXTURE_MODE', 185 'GL_GENERATE_MIPMAP' 186 ] 187 188 print """ 189 void crRecDumpTexParam(CR_RECORDER *pRec, CRContext *ctx, GLenum enmTarget) 190 { 191 GLfloat afBuf[4]; 192 char acBuf[1024]; 193 unsigned int cComponents; 194 crDmpStrF(pRec->pDumper, "==TEX_PARAM for target(0x%x)==", enmTarget); 195 """ 196 for pname in texparam_names: 197 print "\tcComponents = lookupComponents(%s);" % pname 198 print "\tAssert(cComponents <= RT_ELEMENTS(afBuf));" 199 print "\tmemset(afBuf, 0, sizeof (afBuf));" 200 print "\tpRec->pDispatch->GetTexParameterfv(enmTarget, %s, afBuf);" % pname 201 print "\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);" 202 print "\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname 203 print """ 204 crDmpStrF(pRec->pDumper, "==Done TEX_PARAM for target(0x%x)==", enmTarget); 205 } 206 """ 207 208 print """ 209 void crRecDumpTexEnv(CR_RECORDER *pRec, CRContext *ctx) 210 { 211 GLfloat afBuf[4]; 212 char acBuf[1024]; 213 unsigned int cComponents; 214 crDmpStrF(pRec->pDumper, "==TEX_ENV=="); 215 """ 216 217 keys = texenv_mappings.keys() 218 keys.sort(); 219 220 for target in keys: 221 print "\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % target 222 values = texenv_mappings[target] 223 for pname in values: 224 print "\tcComponents = lookupComponents(%s);" % pname 225 print "\tAssert(cComponents <= RT_ELEMENTS(afBuf));" 226 print "\tmemset(afBuf, 0, sizeof (afBuf));" 227 print "\tpRec->pDispatch->GetTexEnvfv(%s, %s, afBuf);" % (target, pname) 228 print "\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);" 229 print "\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname 230 print "\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % target 231 print """ 232 crDmpStrF(pRec->pDumper, "==Done TEX_ENV=="); 233 } 234 """ 235 236 237 print """ 238 void crRecDumpTexGen(CR_RECORDER *pRec, CRContext *ctx) 239 { 240 GLdouble afBuf[4]; 241 char acBuf[1024]; 242 unsigned int cComponents; 243 crDmpStrF(pRec->pDumper, "==TEX_GEN=="); 244 """ 245 246 for coord in texgen_coords: 247 print "\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % coord 248 for pname in texgen_names: 249 print "\tcComponents = lookupComponents(%s);" % pname 250 print "\tAssert(cComponents <= RT_ELEMENTS(afBuf));" 251 print "\tmemset(afBuf, 0, sizeof (afBuf));" 252 print "\tpRec->pDispatch->GetTexGendv(%s, %s, afBuf);" % (coord, pname) 253 print "\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);" 254 print "\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname 255 print "\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % coord 256 print """ 257 crDmpStrF(pRec->pDumper, "==Done TEX_GEN=="); 258 } 259 """
Note:
See TracChangeset
for help on using the changeset viewer.