Use correct spirv-cross version when testing MSL 1.1 shaders.

This commit is contained in:
Hans-Kristian Arntzen 2018-09-07 09:45:25 +02:00
parent 32823b0838
commit 652d8263e5
3 changed files with 22 additions and 28 deletions

View File

@ -3,10 +3,8 @@
using namespace metal;
constant float a_tmp [[function_constant(1)]];
constant float a = is_function_constant_defined(a_tmp) ? a_tmp : 1.0;
constant float b_tmp [[function_constant(2)]];
constant float b = is_function_constant_defined(b_tmp) ? b_tmp : 2.0;
constant float a = 1.0;
constant float b = 2.0;
struct main0_out
{

View File

@ -3,25 +3,19 @@
using namespace metal;
constant float a_tmp [[function_constant(1)]];
constant float a = is_function_constant_defined(a_tmp) ? a_tmp : 1.0;
constant float b_tmp [[function_constant(2)]];
constant float b = is_function_constant_defined(b_tmp) ? b_tmp : 2.0;
constant int c_tmp [[function_constant(3)]];
constant int c = is_function_constant_defined(c_tmp) ? c_tmp : 3;
constant float a = 1.0;
constant float b = 2.0;
constant int c = 3;
constant uint _18 = (uint(c) + 0u);
constant int _21 = (-c);
constant int _23 = (~c);
constant int d_tmp [[function_constant(4)]];
constant int d = is_function_constant_defined(d_tmp) ? d_tmp : 4;
constant int d = 4;
constant int _26 = (c + d);
constant int _28 = (c - d);
constant int _30 = (c * d);
constant int _32 = (c / d);
constant uint e_tmp [[function_constant(5)]];
constant uint e = is_function_constant_defined(e_tmp) ? e_tmp : 5u;
constant uint f_tmp [[function_constant(6)]];
constant uint f = is_function_constant_defined(f_tmp) ? f_tmp : 6u;
constant uint e = 5u;
constant uint f = 6u;
constant uint _36 = (e / f);
constant int _38 = (c % d);
constant uint _40 = (e % f);
@ -31,10 +25,8 @@ constant int _46 = (c << d);
constant int _48 = (c | d);
constant int _50 = (c ^ d);
constant int _52 = (c & d);
constant bool g_tmp [[function_constant(7)]];
constant bool g = is_function_constant_defined(g_tmp) ? g_tmp : false;
constant bool h_tmp [[function_constant(8)]];
constant bool h = is_function_constant_defined(h_tmp) ? h_tmp : true;
constant bool g = false;
constant bool h = true;
constant bool _58 = (g || h);
constant bool _60 = (g && h);
constant bool _62 = (!g);

View File

@ -96,6 +96,16 @@ def path_to_msl_standard(shader):
else:
return '-std=macos-metal1.2'
def path_to_msl_standard_cli(shader):
if '.msl2.' in shader:
return '20000'
elif '.msl21.' in shader:
return '20100'
elif '.msl11.' in shader:
return '10100'
else:
return '10200'
def validate_shader_msl(shader, opt):
msl_path = reference_path(shader[0], shader[1], opt)
try:
@ -111,8 +121,6 @@ def validate_shader_msl(shader, opt):
sys.exit(1)
def cross_compile_msl(shader, spirv, opt):
msl2 = '.msl2.' in shader
msl21 = '.msl21.' in shader
spirv_path = create_temporary()
msl_path = create_temporary(os.path.basename(shader))
@ -127,12 +135,8 @@ def cross_compile_msl(shader, spirv, opt):
spirv_cross_path = './spirv-cross'
msl_args = [spirv_cross_path, '--entry', 'main', '--output', msl_path, spirv_path, '--msl']
if msl2:
msl_args.append('--msl-version')
msl_args.append('20000')
elif msl21:
msl_args.append('--msl-version')
msl_args.append('20100')
msl_args.append('--msl-version')
msl_args.append(path_to_msl_standard_cli(shader))
subprocess.check_call(msl_args)