Esempio n. 1
0
for line in file_in:
    if line[0] != '#':
        continue

    if line.startswith("# GLSL"):
        glsl_version = int(line.split(" ")[2])
    elif line.startswith("# EXTENSIONS"):
        extensions = ast.literal_eval(line[12:].strip())
    elif line.startswith("# PACKING"):
        packing_str = line.split(" ")[2].strip()

        if packing_str == "shared":
            packing = random_ubo.shared_packing_rules()
        elif packing_str == "std140":
            packing = random_ubo.std140_packing_rules()
        else:
            print("Invalid packing string '{}'.".format(packing_str))
            sys.exit(1)
    elif line.startswith("# STRUCT"):
        struct_name, struct_fields = ast.literal_eval(line[8:].strip())
        struct_types[struct_name] = struct_fields
    elif line.startswith("# UBO"):
        blocks.append(ast.literal_eval(line[5:].strip()))
    elif line.startswith("# DATA END"):
        break
    else:
        pass

file_in.close()
        # however, do this explicitly.
        False)

    blocks = random_ubo.generate_block_list(130, packing, fields, layouts)

    print basename
    file.write(
        random_ubo.emit_shader_test(
            blocks, packing, 130,
            ["GL_ARB_uniform_buffer_object", "GL_ARB_arrays_of_arrays"]))

    file.close()


all_packing = [
    random_ubo.std140_packing_rules(),
    random_ubo.shared_packing_rules()
]

all_requirements = []

# Generate a test for each matrix type that:
#
# - Explicitly declares one as row-major and another as column-major.
#
# - Embeds the matrix in a structure without a layout.
#
# - Embeds the matrix in a structure with a row-major layout.
#
# - Embeds the matrix in a structure with a column-major layout.
#
    blocks = random_ubo.generate_block_list(
        130,
        packing,
        fields,
        layouts)

    print basename
    file.write(random_ubo.emit_shader_test(
        blocks,
        packing,
        130,
        ["GL_ARB_uniform_buffer_object"]))

    file.close()

all_packing = [random_ubo.std140_packing_rules(),
               random_ubo.shared_packing_rules()]

all_requirements = []

# Generate a test for each matrix type that:
#
# - Explicitly declares one as row-major and another as column-major.
#
# - Embeds the matrix in a structure without a layout.
#
# - Embeds the matrix in a structure with a row-major layout.
#
# - Embeds the matrix in a structure with a column-major layout.
#
# - Each of the above in an array