INNER CODE UNIT · Python

cross_compile_reflect

Hongtae/SwiftVVD · SupportPackages/SPIRV-Cross/Sources/test_shaders.py:568

def cross_compile_reflect(shader, spirv, opt, iterations, paths):
    spirv_path = create_temporary()
    reflect_path = create_temporary(os.path.basename(shader))

    spirv_cmd = [paths.spirv_as, '--preserve-numeric-ids', '--target-env', 'vulkan1.1', '-o', spirv_path, shader]

    if spirv:
        subprocess.check_call(spirv_cmd)
    else:
        subprocess.check_call([paths.glslang, '--amb', '--target-env', 'vulkan1.1', '-V', '-o', spirv_path, shader])

    if opt and (not shader_is_invalid_spirv(reflect_path)):
        subprocess.check_call([paths.spirv_opt, '--skip-validation', '-O', '-o', spirv_path, spirv_path])

    spirv_cross_path = paths.spirv_cross

    sm = shader_to_sm(shader)
    subprocess.check_call([spirv_cross_path, '--entry', 'main', '--output', reflect_path, spirv_path, '--reflect', '--iterations', str(iterations)])

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…