示例#1
0
def test_extensions(gldir, command):
    # See if removing an extension gives us a real entry
    for extension in sl_extensions:
        if command[-len(extension):] == extension:
            command_file = shared_glsl.find_command_file(
                gldir, command[0:-len(extension)])
            if not command_file == False:
                return command[0:-len(extension)]

    return ""
示例#2
0
        dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
</script>"""'''
        footer_for_command = footer_for_command.replace(
            "{$comments}", comments)

        version_dir = version

        create_directory(output_dir + version_dir)

        command_file = {}
        if API_type == "gl":
            command_file = shared.find_command_file(version, command)
        if API_type == "sl":
            command_file = shared_glsl.find_command_file(version, command)
        if command_file == False:
            raise IOError("Couldn't find page for command " + command + " (" +
                          version + ")")

        fp = open(command_file)
        command_html = fp.read()
        fp.close()

        if args.buildmode == 'full':
            command_html = command_html.decode('utf8')

        command_html = command_html.replace("{$pipelinestall}", "")

        examples_html = ""
        example_functions = {}
示例#3
0
文件: compile.py 项目: BSVino/docs.gl
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
</script>"""'''
    footer_for_command = footer_for_command.replace("{$comments}", comments)

    version_dir = version
    
    create_directory(output_dir + version_dir)

    command_file = {}
    if API_type == "gl":
        command_file = shared.find_command_file(version, command)
    if API_type == "sl":
        command_file = shared_glsl.find_command_file(version, command)
    if command_file == False:
      raise IOError("Couldn't find page for command " + command + " (" + version + ")")

    fp = open(command_file)
    command_html = fp.read()
    fp.close()
    
    if args.buildmode == 'full':
      command_html = command_html.decode('utf8')

    command_html = command_html.replace("{$pipelinestall}", "")
    
    examples_html = ""
    example_functions ={}
    if API_type == "gl":
示例#4
0
def test_replacements(gldir, command):
    command_docs = test_extensions(gldir, command)

    if (len(command_docs)):
        return command_docs

    #GLSL ES tests

    #dfdx
    command_test = command.replace("", "x")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    #GLSL tests

    #dfdx
    command_test = command.replace("y", "x")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    #dfdy
    for ext in sl_extensions:
        command_test = command.replace("y", "x")
        command_test = command_test.replace(ext, "")
        if not shared_glsl.find_command_file(gldir, command_test) == False:
            return command_test

    command_test = command.replace("U", "")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("u", "")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("imul", "umul")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    for ext in sl_extensions:
        command_test = command.replace("S", "U")
        command_test = command_test.replace(ext, "")
        if not shared_glsl.find_command_file(gldir, command_test) == False:
            return command_test

    #I don't think we need anything under this part for GLSL

    # Some commands need just a single letter removed
    command_test = command.replace("I", "")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("L", "")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("Getn", "Get")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    if command_test != command:
        test = test_extensions(gldir, command_test)
        if len(test):
            return test

    command_test = command.replace("Readn", "Read")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    # Named commands are stored under their non-named equivalents
    command_test = command.replace("NamedFramebuffer", "")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("NamedFramebuffer", "Buffer")
    if command_test != command:
        test = test_extensions(gldir, command_test)
        if len(test):
            return test

    command_test = command.replace("Named", "")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    if command_test != command:
        test = test_extensions(gldir, command_test)
        if len(test):
            return test

    command_test = command.replace("Named", "").replace("Data", "")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("Named", "").replace("SubData", "")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("Texture", "")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("ArrayAttrib", "AttribArray")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("VertexArray", "Bind")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("Array", "")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("ArrayAttribI", "Attrib")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("ArrayAttribL", "Attrib")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    # For glTextureBuffer -> glTexBuffer and glTextureBufferRange -> glTexBufferRange
    command_test = command.replace("ture", "")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    if command_test != command:
        return test_extensions(gldir, command_test)

    command_test = command.replace("ByRegion", "")
    if not shared_glsl.find_command_file(gldir, command_test) == False:
        return command_test

    return command
示例#5
0
    for command_name in current_command_list:
        path_file = path + "\\" + api + "\\" + command_name + ".xhtml"
        if (os.path.isfile(path_file)):
            versions = []
            if api[0:2] == 'sl':
                versions = get_versions(path_file)
            if api[0:2] == 'el':
                versions = get_el_versions(path_file)
            for x in xrange(len(versions)):
                print command_name
                stored_version_commands[versions[x]].append(
                    {command_name: command_name})
        else:
            if os.path.exists(api):
                test_extensions(api, command_name)
                command_file = shared_glsl.find_command_file(api, command_name)
                if command_file == False:
                    command_docs = test_replacements(api, command_name)
                    command_file = shared_glsl.find_command_file(
                        api, command_docs)

                    if command_file == False:
                        print "No command docs file found for " + command_name + " (" + api + ")"
                        print command_name + " does not exist"
                        #Todo: Skip ES errors for now
                        if api[0:2] != 'el':
                            assert (False)
                    else:
                        versions = []
                        if api[0:2] == 'sl':
                            versions = get_versions(path + "\\" + api + "\\" +