INNER CODE UNIT · Python

validate_shader_msl

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

def validate_shader_msl(shader, opt):
    msl_path = reference_path(shader[0], shader[1], opt)
    global ignore_win_metal_tool
    try:
        if '.ios.' in msl_path:
            msl_os = 'iphoneos'
        else:
            msl_os = 'macosx'

        if platform.system() == 'Darwin':
            subprocess.check_call(['xcrun', '--sdk', msl_os, 'metal', '-x', 'metal', path_to_msl_standard(msl_path), '-Werror', '-Wno-unused-variable', msl_path])
            print('Compiled Metal shader: ' + msl_path)   # display after so xcrun FNF is silent
        elif not ignore_win_metal_tool:
            # Use Metal Windows toolkit to test on Linux (Wine) and Windows. Running offline tool on Linux gets weird.
            # Normal winepath doesn't work, it must be Z:/abspath *exactly* for some bizarre reason.
            target_path = msl_path if platform.system == 'Windows' else ('Z:' + os.path.abspath(msl_path))
            subprocess.check_call(['metal', '-x', 'metal', path_to_msl_standard(msl_path), '-Werror', '-Wno-unused-variable', target_path])

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…