INNER CODE UNIT · Python

msl_compiler_supports_version

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

def msl_compiler_supports_version(version):
    try:
        if platform.system() == 'Darwin':
            subprocess.check_call(['xcrun', '--sdk', 'macosx', 'metal', '-x', 'metal', version, '-'],
                stdin = subprocess.DEVNULL, stdout = subprocess.DEVNULL, stderr = subprocess.DEVNULL)
            print('Current SDK supports MSL {0}. Enabling validation for MSL {0} shaders.'.format(version))
        else:
            print('Running on {}, assuming {} is supported.'.format(platform.system(), version))
        # If we're running on non-macOS system, assume it's supported.
        return True
    except OSError as e:
        print('Failed to check if MSL {} is not supported. It probably is not.'.format(version))
        return False
    except subprocess.CalledProcessError:
        print('Current SDK does NOT support MSL {0}. Disabling validation for MSL {0} shaders.'.format(version))
        return False

def path_to_msl_standard(shader):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…