gen_null_render_context.py revision 1abab607ca1c1b410881390f9ec47e6be04c207d
1# -*- coding: utf-8 -*- 2 3from src_util import * 4 5# Functions that have special implementation 6OVERRIDE_FUNCS = set([ 7 "glGetError", 8 "glGetIntegerv", 9 "glGetBooleanv", 10 "glGetFloatv", 11 "glGetString", 12 "glGetStringi", 13 "glCreateShader", 14 "glCreateProgram", 15 "glGetShaderiv", 16 "glGetProgramiv", 17 "glGenTextures", 18 "glGenQueries", 19 "glGenBuffers", 20 "glGenRenderbuffers", 21 "glGenFramebuffers", 22 "glGenVertexArrays", 23 "glGenSamplers", 24 "glGenTransformFeedbacks", 25 "glGenProgramPipelines", 26 "glMapBufferRange", 27 "glCheckFramebufferStatus", 28 "glReadPixels", 29 "glBindBuffer", 30 "glDeleteBuffers" 31]) 32 33NULL_PLATFORM_DIR = os.path.normpath(os.path.join(SCRIPTS_DIR, "..", "..", "framework", "platform", "null")) 34 35def commandDummyImpl (command): 36 if command.name in OVERRIDE_FUNCS: 37 return None 38 template = """ 39GLW_APICALL {returnType} GLW_APIENTRY {commandName} ({paramDecls}) 40{{ 41{body}{maybeReturn} 42}}""" 43 return template.format( 44 returnType = command.type, 45 commandName = command.name, 46 paramDecls = commandParams(command), 47 body = ''.join("\tDE_UNREF(%s);\n" % p.name for p in command.params), 48 maybeReturn = "\n\treturn (%s)0;" % command.type if command.type != 'void' else "") 49 50def commandInitStatement (command): 51 return "gl->%s\t= %s;" % (getFunctionMemberName(command.name), command.name) 52 53def genNullRenderContext (iface): 54 genCommandList(iface, commandInitStatement, 55 directory = NULL_PLATFORM_DIR, 56 filename = "tcuNullRenderContextInitFuncs.inl", 57 align = True) 58 genCommandList(iface, commandDummyImpl, 59 directory = NULL_PLATFORM_DIR, 60 filename = "tcuNullRenderContextFuncs.inl") 61 62if __name__ == "__main__": 63 genNullRenderContext(getHybridInterface()) 64