예제 #1
0
    def testGlTracerGeneration(self):
        # Parse the preprocessed GL header
        l = Library.Library("GL", "libgles_cm_orig.dll")
        l.merge(Parser.parseSource(open("data/gl-cpp.h").read()))
        l.merge(Parser.parseSource(open("data/egl-cpp.h").read()))
        defFile = open("data/opengles11u.def").read()
        for function, ordinal in Parser.parseDefFile(defFile):
            if function in l.functions:
                l.functions[function].ordinal = ordinal

        # Add a custom function hook
        customSource = """
    GLenum xglGetError(void)
    {
      wtf();
    }
    """
        l.merge(Parser.parseSource(customSource))
        T = Library.Type

        # GL types
        l.typeMap[T("GLenum")] = "int"
        l.typeMap[T("GLint")] = "int"
        l.typeMap[T("GLintptr")] = "int"
        l.typeMap[T("GLuint")] = "int"
        l.typeMap[T("GLboolean")] = "int"
        l.typeMap[T("GLbitfield")] = "int"
        l.typeMap[T("GLsizei")] = "int"
        l.typeMap[T("GLsizeiptr")] = "int"
        l.typeMap[T("GLfixed")] = "int"
        l.typeMap[T("GLclampx")] = "int"
        l.typeMap[T("GLubyte")] = "byte"
        l.typeMap[T("GLshort")] = "short"
        l.typeMap[T("GLclampf")] = "float"
        l.typeMap[T("GLfloat")] = "float"
        l.typeMap[T("void")] = "void"

        # EGL types
        l.typeMap[T("EGLboolean")] = "int"
        l.typeMap[T("EGLint")] = "int"
        l.typeMap[T("EGLDisplay")] = "int"
        l.typeMap[T("EGLSurface")] = "int"
        l.typeMap[T("EGLContext")] = "int"
        l.typeMap[T("EGLConfig")] = "int"
        l.typeMap[T("EGLBoolean")] = "int"
        l.typeMap[T("NativeDisplayType")] = "int"
        l.typeMap[T("NativeWindowType")] = "pointer"
        l.typeMap[T("NativePixmapType")] = "pointer"

        # Mark eglTerminate as a terminator
        l.functions["eglTerminate"].isTerminator = True

        g = TracerGenerator(self.config, self.platform, [l])
        g.generate(open("generator_test_output.txt", "w"))
예제 #2
0
 def testBasicTracerGeneration(self):
     g = TracerGenerator(self.config, self.platform, [self.library])
     o = StringIO()
     g.generate(outputFile=o)