VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump_gen.py@ 78493

Last change on this file since 78493 was 78190, checked in by vboxsync, 6 years ago

Merge first stage of the Chromium cleanup from the branch:

  • r129818 (Remove VBOX_WITH_CR_DISPLAY_LISTS and accompanying code as it was disabled since r108676 and was never brought back (see ​bugref:3456 and ​bugref:8485))
  • r129819 (HostServices/SharedOpenGL: Remove unused main entry point from upstream server process based implementation)
  • r129820 (HostServices/SharedOpenGL: Started eliminating all backends other than HGCM. They are not used and probably wouldn't work anymore anyway)
  • r129821 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill crTimer* API as it is not used anywhere)
  • r129822 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill most from cr_process.h apart from two used methods)
  • r129823 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill crList* API as it is unused)
  • r129824 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill crHullInteriorBox API as it is unused)
  • r129825 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill crWarpPoint API as it is unused)
  • r129826 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill CrSa* API as it is unused and not even compiled in)
  • r129827 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill cr_bbox.h as it is unused)
  • r129828 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove a few crParseUrl() two uses)
  • r129829 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove last crParseURL() use)
  • r129830 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove crParseURL())
  • r129831 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove VBOX_WITH_COCOA_QT and related code when not set as it is the default for years now and we don't support anything else anymore)
  • r129832 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_logo.h)
  • r129833 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused crut_api.h and crut_clientapi.h)
  • r129834 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_dmx.h)
  • r129835 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_perf.h)
  • r129836 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove cr_rand.h and friends as it is not actively used anywhere)
  • r129837 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of all the swapped versions in the packer SPU, we never change endianess from guest to host and don't need it)
  • r129838 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129839 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129840 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused pack_pica.c)
  • r129841 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129842 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of cr_endianess.h and friends)
  • r129843 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused lowercase.py)
  • r129844 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused cr_calllists.h and friends)
  • r129845 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of completely unused idpool.c, not even compiled in)
  • r129846 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused cr_debugopcodes.h and friends)
  • r129847 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Make the cr_mem.h API inline and get rid of the implementation in the util library)
  • r129848 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of SPUOptions and related code as it is of no use for us)
  • r129849 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of cr_environment.h and friends and convert usage to RTEnv* APIs)
  • r129850 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused renderspu_agl.c)
  • r129851 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused code in cr_htable.h)
  • r129853 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Introduce a state paremeter for the unpacker workers instead of reyling on global variables, work in progress)
  • r129854 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Let the caller of crUnpack set up the initial state. This allows to get rid of the global return_ptr and writeback_ptr as they get supplied in the unpacker state by the server)
  • r129855 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of the cr_lastDispatch and cr_unpackDispatch as they are of no use now)
  • r129856 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of the global cr_unpackData and cr_unpackDataEnd symbols by indtroducing another hack to make it possible for certail server dispatch callbacks to access the data buffer)
  • r129857 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: build fix for release builds)
  • r129858 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Make the pointer to the unpacker state non const (is required for the access verification))
  • r129859 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: First iteration of the buffer size validation to prevent out of bound read access + added todos for places where additional checks are needed)
  • r129860 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129861 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129871 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129872 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Stop as soon as the unpacker encountered an error)
  • r129876 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129880 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129882 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Fixed some offsets in unpack_texture.c, 3DMark03 renders correctly again)
  • r130013 (HostServices/SharedOpenGL: Convert files to C++ so we can use C99 featuers on Windows with cl.exe)
  • r130014 (HostServices/SharedOpenGL,GuestHost/OpenGL: WIndows build fixes)
  • r130015 (HostServices/SharedOpenGL,GuestHost/OpenGL: More Windows build fixes)
  • r130036 (Config.kmk: Fix linker error on Windows by temporarily disabling the use of VBoxGuestR3DllMinW2K)
  • r130094 (src/VBox/GuestHost/OpenGL: Revert inlining the allocation/free functions in R3 completely as it doesn't work on Windows if memory is allocated and freed across different DLLs which don't share a common CRT, causes crashes in RtlValidtaeHeap())
  • r130095 (src/VBox/GuestHost/OpenGL,src/VBox/Additions/common/crOpenGL/pack: Don't use floating point specifiers in packspu_GetString() to avoid R6002 errors (couldn't fully understand why they occur suddenly after the rework but this gets rid of it))
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.8 KB
Line 
1from __future__ import print_function
2import sys
3
4import apiutil
5
6import sys, re, string
7
8
9line_re = re.compile(r'^(\S+)\s+(GL_\S+)\s+(.*)\s*$')
10extensions_line_re = re.compile(r'^(\S+)\s+(GL_\S+)\s(\S+)\s+(.*)\s*$')
11
12params = {}
13extended_params = {}
14
15input = open( sys.argv[2]+"/state_isenabled.txt", 'r' )
16for line in input.readlines():
17 match = line_re.match( line )
18 if match:
19 type = match.group(1)
20 pname = match.group(2)
21 fields = string.split( match.group(3) )
22 params[pname] = ( type, fields )
23
24input = open( sys.argv[2]+"/state_extensions_isenabled.txt", 'r' )
25for line in input.readlines():
26 match = extensions_line_re.match( line )
27 if match:
28 type = match.group(1)
29 pname = match.group(2)
30 ifdef = match.group(3)
31 fields = string.split( match.group(4) )
32 extended_params[pname] = ( type, ifdef, fields )
33
34
35apiutil.CopyrightC()
36
37print("""#include "cr_blitter.h"
38#include "cr_spu.h"
39#include "chromium.h"
40#include "cr_error.h"
41#include "cr_net.h"
42#include "cr_mem.h"
43#include "cr_string.h"
44#include <cr_dump.h>
45#include "cr_pixeldata.h"
46
47#include <iprt/cdefs.h>
48#include <iprt/types.h>
49#include <iprt/mem.h>
50
51#include <stdio.h>
52
53#ifdef VBOX_WITH_CRDUMPER
54""")
55
56from get_sizes import *;
57
58getprops = apiutil.ParamProps("GetDoublev")
59enableprops = apiutil.ParamProps("Enable")
60
61#print "//missing get props:"
62#for prop in getprops:
63# try:
64# tmp = num_get_values[prop]
65# except KeyError:
66# try:
67# keyvalues = extensions_num_get_values[prop]
68# except KeyError:
69# print "//%s" % prop
70#
71print("""
72static void crRecDumpPrintVal(CR_DUMPER *pDumper, struct nv_struct *pDesc, float *pfData)
73{
74 char aBuf[4096];
75 crDmpFormatArray(aBuf, sizeof (aBuf), "%f", sizeof (float), pfData, pDesc->num_values);
76 crDmpStrF(pDumper, "%s = %s;", pDesc->pszName, aBuf);
77}
78
79
80void crRecDumpGlGetState(CR_RECORDER *pRec, CRContext *ctx)
81{
82 float afData[CR_MAX_GET_VALUES];
83 struct nv_struct *pDesc;
84
85 for (pDesc = num_values_array; pDesc->num_values != 0 ; pDesc++)
86 {
87 memset(afData, 0, sizeof(afData));
88 pRec->pDispatch->GetFloatv(pDesc->pname, afData);
89 crRecDumpPrintVal(pRec->pDumper, pDesc, afData);
90 }
91}
92
93void crRecDumpGlEnableState(CR_RECORDER *pRec, CRContext *ctx)
94{
95 GLboolean fEnabled;
96""")
97for pname in sorted(params.keys()):
98 print("\tfEnabled = pRec->pDispatch->IsEnabled(%s);" % pname)
99 print("\tcrDmpStrF(pRec->pDumper, \"%s = %%d;\", fEnabled);" % pname)
100
101for pname in sorted(extended_params.keys()):
102 (srctype,ifdef,fields) = extended_params[pname]
103 ext = ifdef[3:] # the extension name with the "GL_" prefix removed
104 ext = ifdef
105 print('#ifdef CR_%s' % ext)
106 print("\tfEnabled = pRec->pDispatch->IsEnabled(%s);" % pname)
107 print("\tcrDmpStrF(pRec->pDumper, \"%s = %%d;\", fEnabled);" % pname)
108 print('#endif /* CR_%s */' % ext)
109
110#print "//missing enable props:"
111#for prop in enableprops:
112# try:
113# keyvalues = params[prop]
114# except KeyError:
115# try:
116# keyvalues = extended_params[prop]
117# except KeyError:
118# print "//%s" % prop
119#
120print("""
121}
122#endif
123""")
124
125texenv_mappings = {
126 'GL_TEXTURE_ENV' : [
127 'GL_TEXTURE_ENV_MODE',
128 'GL_TEXTURE_ENV_COLOR',
129 'GL_COMBINE_RGB',
130 'GL_COMBINE_ALPHA',
131 'GL_RGB_SCALE',
132 'GL_ALPHA_SCALE',
133 'GL_SRC0_RGB',
134 'GL_SRC1_RGB',
135 'GL_SRC2_RGB',
136 'GL_SRC0_ALPHA',
137 'GL_SRC1_ALPHA',
138 'GL_SRC2_ALPHA'
139 ],
140 'GL_TEXTURE_FILTER_CONTROL' : [
141 'GL_TEXTURE_LOD_BIAS'
142 ],
143 'GL_POINT_SPRITE' : [
144 'GL_COORD_REPLACE'
145 ]
146}
147
148texgen_coords = [
149 'GL_S',
150 'GL_T',
151 'GL_R',
152 'GL_Q'
153]
154
155texgen_names = [
156 'GL_TEXTURE_GEN_MODE',
157 'GL_OBJECT_PLANE',
158 'GL_EYE_PLANE'
159]
160
161texparam_names = [
162 'GL_TEXTURE_MAG_FILTER',
163 'GL_TEXTURE_MIN_FILTER',
164 'GL_TEXTURE_MIN_LOD',
165 'GL_TEXTURE_MAX_LOD',
166 'GL_TEXTURE_BASE_LEVEL',
167 'GL_TEXTURE_MAX_LEVEL',
168 'GL_TEXTURE_WRAP_S',
169 'GL_TEXTURE_WRAP_T',
170 'GL_TEXTURE_WRAP_R',
171 'GL_TEXTURE_BORDER_COLOR',
172 'GL_TEXTURE_PRIORITY',
173 'GL_TEXTURE_RESIDENT',
174 'GL_TEXTURE_COMPARE_MODE',
175 'GL_TEXTURE_COMPARE_FUNC',
176 'GL_DEPTH_TEXTURE_MODE',
177 'GL_GENERATE_MIPMAP'
178]
179
180print("""
181void crRecDumpTexParam(CR_RECORDER *pRec, CRContext *ctx, GLenum enmTarget)
182{
183 GLfloat afBuf[4];
184 char acBuf[1024];
185 unsigned int cComponents;
186 crDmpStrF(pRec->pDumper, "==TEX_PARAM for target(0x%x)==", enmTarget);
187""")
188for pname in texparam_names:
189 print("\tcComponents = crStateHlpComponentsCount(%s);" % pname)
190 print("\tAssert(cComponents <= RT_ELEMENTS(afBuf));")
191 print("\tmemset(afBuf, 0, sizeof (afBuf));")
192 print("\tpRec->pDispatch->GetTexParameterfv(enmTarget, %s, afBuf);" % pname)
193 print("\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);")
194 print("\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname)
195print("""
196 crDmpStrF(pRec->pDumper, "==Done TEX_PARAM for target(0x%x)==", enmTarget);
197}
198""")
199
200print("""
201void crRecDumpTexEnv(CR_RECORDER *pRec, CRContext *ctx)
202{
203 GLfloat afBuf[4];
204 char acBuf[1024];
205 unsigned int cComponents;
206 crDmpStrF(pRec->pDumper, "==TEX_ENV==");
207""")
208
209for target in sorted(texenv_mappings.keys()):
210 print("\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % target)
211 values = texenv_mappings[target]
212 for pname in values:
213 print("\tcComponents = crStateHlpComponentsCount(%s);" % pname)
214 print("\tAssert(cComponents <= RT_ELEMENTS(afBuf));")
215 print("\tmemset(afBuf, 0, sizeof (afBuf));")
216 print("\tpRec->pDispatch->GetTexEnvfv(%s, %s, afBuf);" % (target, pname))
217 print("\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);")
218 print("\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname)
219 print("\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % target)
220print("""
221 crDmpStrF(pRec->pDumper, "==Done TEX_ENV==");
222}
223""")
224
225
226print("""
227void crRecDumpTexGen(CR_RECORDER *pRec, CRContext *ctx)
228{
229 GLdouble afBuf[4];
230 char acBuf[1024];
231 unsigned int cComponents;
232 crDmpStrF(pRec->pDumper, "==TEX_GEN==");
233""")
234
235for coord in texgen_coords:
236 print("\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % coord)
237 for pname in texgen_names:
238 print("\tcComponents = crStateHlpComponentsCount(%s);" % pname)
239 print("\tAssert(cComponents <= RT_ELEMENTS(afBuf));")
240 print("\tmemset(afBuf, 0, sizeof (afBuf));")
241 print("\tpRec->pDispatch->GetTexGendv(%s, %s, afBuf);" % (coord, pname))
242 print("\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);")
243 print("\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname)
244 print("\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % coord)
245print("""
246 crDmpStrF(pRec->pDumper, "==Done TEX_GEN==");
247}
248""")
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette