VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/expando/expando.py@ 62258

最後變更 在這個檔案從62258是 54905,由 vboxsync 提交於 10 年 前

Host 3D: Chromium server: add Expando SPU and DLM module in order to record and save OpenGL Display Lists (currently disabled).

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 2.9 KB
 
1# $Id: expando.py 54905 2015-03-23 11:20:58Z vboxsync $
2# This script generates calls for display list compilation
3# and state management.
4import sys
5
6sys.path.append( "../../glapi_parser" )
7import apiutil
8
9apiutil.CopyrightC()
10
11print """
12/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY expando.py SCRIPT */
13#include <stdio.h>
14#include "cr_error.h"
15#include "cr_spu.h"
16#include "cr_dlm.h"
17#include "expandospu.h"
18"""
19
20allFunctions = []
21generatedFunctions = []
22
23for func_name in apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt"):
24 if apiutil.FindSpecial("expando", func_name):
25 allFunctions.append(func_name)
26 elif apiutil.CanCompile(func_name) or apiutil.SetsClientState(func_name):
27 generatedFunctions.append(func_name)
28 allFunctions.append(func_name)
29
30for func_name in generatedFunctions:
31 params = apiutil.Parameters(func_name)
32 return_type = apiutil.ReturnType(func_name)
33 basicCallString = apiutil.MakeCallString(params)
34 declarationString = apiutil.MakeDeclarationString(params)
35 dlmCallString = basicCallString
36 chromiumProps = apiutil.ChromiumProps(func_name)
37
38 needClientState = 0
39 if apiutil.UsesClientState(func_name):
40 dlmCallString = basicCallString + ", clientState"
41 needClientState = 1
42
43 needDL = 0
44 if apiutil.CanCompile(func_name):
45 needDL = 1
46
47 print 'static %s EXPANDOSPU_APIENTRY expando%s( %s )' % ( return_type, func_name, declarationString)
48 print '{'
49 if needDL:
50 print '\tGLenum dlMode = crDLMGetCurrentMode();'
51 if needClientState:
52 print '\tCRContext *stateContext = crStateGetCurrent();'
53 print '\tCRClientState *clientState = NULL;'
54 print '\tif (stateContext != NULL) {'
55 print '\t\tclientState = &(stateContext->client);'
56 print '\t}'
57
58 if needDL:
59 if "checklist" in chromiumProps:
60 print '\tif (dlMode != GL_FALSE && crDLMCheckList%s(%s)) {' % (func_name, basicCallString)
61 else:
62 print '\tif (dlMode != GL_FALSE) {'
63 print '\t\tcrDLMCompile%s(%s);' % (func_name, dlmCallString)
64 # If we're only compiling, return now.
65 print '\t\tif (dlMode == GL_COMPILE) return %s;' % '0' if return_type != "void" else ""
66 print '\t}'
67
68 # If it gets this far, we're either just executing, or executing
69 # and compiling. Either way, pass the call to the super SPU,
70 # and to the state tracker (if appropriate; note that we only
71 # track client-side state, not all state).
72 if return_type != "void":
73 print '\t%s rc = expando_spu.super.%s(%s);' % (return_type, func_name, basicCallString)
74 else:
75 print '\texpando_spu.super.%s(%s);' % (func_name, basicCallString)
76 if apiutil.SetsClientState(func_name):
77 print '\tcrState%s( %s );' % (func_name, basicCallString)
78
79 if return_type != "void":
80 print "\treturn rc;"
81
82 print '}'
83 print ''
84
85# Generate the table of named functions. including all the static generated
86# functions as well as the special functions.
87print 'SPUNamedFunctionTable _cr_expando_table[] = {'
88for func_name in allFunctions:
89 print '\t{ "%s", (SPUGenericFunction) expando%s },' % (func_name, func_name )
90print '\t{ NULL, NULL }'
91print '};'
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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