Skip to content

Commit

Permalink
Merge pull request #2417 from KhronosGroup/metal-sdk-ci-fix
Browse files Browse the repository at this point in the history
Get rid of MSL SDK check on CI.
  • Loading branch information
HansKristian-Work authored Nov 13, 2024
2 parents 25ffa1e + 5b93397 commit 9040e0d
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 272 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 10 additions & 2 deletions spirv_msl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13063,7 +13063,11 @@ string CompilerMSL::member_attribute_qualifier(const SPIRType &type, uint32_t in
{
if (!quals.empty())
quals += ", ";
if (has_member_decoration(type.self, index, DecorationNoPerspective) || builtin == BuiltInBaryCoordNoPerspKHR)

if (builtin == BuiltInBaryCoordNoPerspKHR || builtin == BuiltInBaryCoordKHR)
SPIRV_CROSS_THROW("Centroid interpolation not supported for barycentrics in MSL.");

if (has_member_decoration(type.self, index, DecorationNoPerspective))
quals += "centroid_no_perspective";
else
quals += "centroid_perspective";
Expand All @@ -13072,7 +13076,11 @@ string CompilerMSL::member_attribute_qualifier(const SPIRType &type, uint32_t in
{
if (!quals.empty())
quals += ", ";
if (has_member_decoration(type.self, index, DecorationNoPerspective) || builtin == BuiltInBaryCoordNoPerspKHR)

if (builtin == BuiltInBaryCoordNoPerspKHR || builtin == BuiltInBaryCoordKHR)
SPIRV_CROSS_THROW("Sample interpolation not supported for barycentrics in MSL.");

if (has_member_decoration(type.self, index, DecorationNoPerspective))
quals += "sample_no_perspective";
else
quals += "sample_perspective";
Expand Down
45 changes: 1 addition & 44 deletions test_shaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,6 @@ def print_msl_compiler_version():
except subprocess.CalledProcessError:
pass

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):
if '.msl31.' in shader:
return '-std=metal3.1'
Expand Down Expand Up @@ -905,23 +888,7 @@ def test_shader_msl(stats, shader, args, paths):
# executable from Xcode using args: `--msl --entry main --output msl_path spirv_path`.
# print('SPRIV shader: ' + spirv)

shader_is_msl22 = '.msl22.' in joined_path
shader_is_msl23 = '.msl23.' in joined_path
shader_is_msl24 = '.msl24.' in joined_path
shader_is_msl30 = '.msl3.' in joined_path
shader_is_msl31 = '.msl31.' in joined_path
skip_validation = (shader_is_msl22 and (not args.msl22)) or \
(shader_is_msl23 and (not args.msl23)) or \
(shader_is_msl24 and (not args.msl24)) or \
(shader_is_msl30 and (not args.msl30)) or \
(shader_is_msl31 and (not args.msl31))

if skip_validation:
print('Skipping validation for {} due to lack of toolchain support.'.format(joined_path))

if '.invalid.' in joined_path:
skip_validation = True

skip_validation = '.invalid.' in joined_path
if (not args.force_no_external_validation) and (not skip_validation):
validate_shader_msl(shader, args.opt)

Expand Down Expand Up @@ -1068,18 +1035,8 @@ def main():
sys.stderr.write('Parallel execution is disabled when using the flags --update, --malisc or --force-no-external-validation\n')
args.parallel = False

args.msl22 = False
args.msl23 = False
args.msl24 = False
args.msl30 = False
args.msl31 = False
if args.msl:
print_msl_compiler_version()
args.msl22 = msl_compiler_supports_version('-std=macos-metal2.2')
args.msl23 = msl_compiler_supports_version('-std=macos-metal2.3')
args.msl24 = msl_compiler_supports_version('-std=macos-metal2.4')
args.msl30 = msl_compiler_supports_version('-std=metal3.0')
args.msl31 = msl_compiler_supports_version('-std=metal3.1')

backend = 'glsl'
if (args.msl or args.metal):
Expand Down

0 comments on commit 9040e0d

Please sign in to comment.