mirror of
https://github.com/KhronosGroup/SPIRV-Cross.git
synced 2024-11-09 13:50:05 +00:00
Add test for SPIR-V 1.6 Volatile HelperInvocation.
This commit is contained in:
parent
93b0dc7718
commit
15d29f00e2
@ -0,0 +1,29 @@
|
||||
static float FragColor;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
bool _12 = IsHelperLane();
|
||||
float _15 = float(_12);
|
||||
FragColor = _15;
|
||||
discard;
|
||||
bool _16 = IsHelperLane();
|
||||
float _17 = float(_16);
|
||||
FragColor = _17;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float FragColor [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0()
|
||||
{
|
||||
main0_out out = {};
|
||||
bool gl_HelperInvocation = simd_is_helper_thread();
|
||||
bool _12 = gl_HelperInvocation;
|
||||
float _15 = float(_12);
|
||||
out.FragColor = _15;
|
||||
discard_fragment();
|
||||
bool _16 = gl_HelperInvocation;
|
||||
float _17 = float(_16);
|
||||
out.FragColor = _17;
|
||||
return out;
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
#version 450
|
||||
#extension GL_EXT_demote_to_helper_invocation : require
|
||||
|
||||
layout(location = 0) out float FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
bool _12 = gl_HelperInvocation;
|
||||
float _15 = float(_12);
|
||||
FragColor = _15;
|
||||
demote;
|
||||
bool _16 = gl_HelperInvocation;
|
||||
float _17 = float(_16);
|
||||
FragColor = _17;
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
#version 450
|
||||
#extension GL_EXT_demote_to_helper_invocation : require
|
||||
|
||||
layout(location = 0) out float FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = float(gl_HelperInvocation);
|
||||
demote;
|
||||
FragColor = float(gl_HelperInvocation);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
#version 450
|
||||
#extension GL_EXT_demote_to_helper_invocation : require
|
||||
|
||||
layout(location = 0) out float FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = float(gl_HelperInvocation);
|
||||
demote;
|
||||
FragColor = float(gl_HelperInvocation);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
#version 450
|
||||
#extension GL_EXT_demote_to_helper_invocation : require
|
||||
|
||||
layout(location = 0) out float FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = float(gl_HelperInvocation);
|
||||
demote;
|
||||
FragColor = float(gl_HelperInvocation);
|
||||
}
|
@ -192,8 +192,18 @@ def cross_compile_msl(shader, spirv, opt, iterations, paths):
|
||||
spirv_path = create_temporary()
|
||||
msl_path = create_temporary(os.path.basename(shader))
|
||||
|
||||
spirv_16 = '.spv16.' in shader
|
||||
spirv_14 = '.spv14.' in shader
|
||||
spirv_env = 'vulkan1.1spv1.4' if spirv_14 else 'vulkan1.1'
|
||||
|
||||
if spirv_16:
|
||||
spirv_env = 'spv1.6'
|
||||
glslang_env = 'spirv1.6'
|
||||
elif spirv_14:
|
||||
spirv_env = 'vulkan1.1spv1.4'
|
||||
glslang_env = 'spirv1.4'
|
||||
else:
|
||||
spirv_env = 'vulkan1.1'
|
||||
glslang_env = 'vulkan1.1'
|
||||
|
||||
spirv_cmd = [paths.spirv_as, '--target-env', spirv_env, '-o', spirv_path, shader]
|
||||
if '.preserve.' in shader:
|
||||
@ -202,7 +212,6 @@ def cross_compile_msl(shader, spirv, opt, iterations, paths):
|
||||
if spirv:
|
||||
subprocess.check_call(spirv_cmd)
|
||||
else:
|
||||
glslang_env = 'spirv1.4' if spirv_14 else 'vulkan1.1'
|
||||
subprocess.check_call([paths.glslang, '--amb' ,'--target-env', glslang_env, '-V', '-o', spirv_path, shader])
|
||||
|
||||
if opt and (not shader_is_invalid_spirv(shader)):
|
||||
@ -442,8 +451,19 @@ def cross_compile_hlsl(shader, spirv, opt, force_no_external_validation, iterati
|
||||
spirv_path = create_temporary()
|
||||
hlsl_path = create_temporary(os.path.basename(shader))
|
||||
|
||||
spirv_16 = '.spv16.' in shader
|
||||
spirv_14 = '.spv14.' in shader
|
||||
spirv_env = 'vulkan1.1spv1.4' if spirv_14 else 'vulkan1.1'
|
||||
|
||||
if spirv_16:
|
||||
spirv_env = 'spv1.6'
|
||||
glslang_env = 'spirv1.6'
|
||||
elif spirv_14:
|
||||
spirv_env = 'vulkan1.1spv1.4'
|
||||
glslang_env = 'spirv1.4'
|
||||
else:
|
||||
spirv_env = 'vulkan1.1'
|
||||
glslang_env = 'vulkan1.1'
|
||||
|
||||
spirv_cmd = [paths.spirv_as, '--target-env', spirv_env, '-o', spirv_path, shader]
|
||||
if '.preserve.' in shader:
|
||||
spirv_cmd.append('--preserve-numeric-ids')
|
||||
@ -451,7 +471,6 @@ def cross_compile_hlsl(shader, spirv, opt, force_no_external_validation, iterati
|
||||
if spirv:
|
||||
subprocess.check_call(spirv_cmd)
|
||||
else:
|
||||
glslang_env = 'spirv1.4' if spirv_14 else 'vulkan1.1'
|
||||
subprocess.check_call([paths.glslang, '--amb', '--target-env', glslang_env, '-V', '-o', spirv_path, shader])
|
||||
|
||||
if opt and (not shader_is_invalid_spirv(hlsl_path)):
|
||||
@ -526,10 +545,13 @@ def cross_compile(shader, vulkan, spirv, invalid_spirv, eliminate, is_legacy, fl
|
||||
spirv_14 = '.spv14.' in shader
|
||||
if spirv_16:
|
||||
spirv_env = 'spv1.6'
|
||||
glslang_env = 'spirv1.6'
|
||||
elif spirv_14:
|
||||
spirv_env = 'vulkan1.1spv1.4'
|
||||
glslang_env = 'spirv1.4'
|
||||
else:
|
||||
spirv_env = 'vulkan1.1'
|
||||
glslang_env = 'vulkan1.1'
|
||||
|
||||
if vulkan or spirv:
|
||||
vulkan_glsl_path = create_temporary('vk' + os.path.basename(shader))
|
||||
@ -541,7 +563,6 @@ def cross_compile(shader, vulkan, spirv, invalid_spirv, eliminate, is_legacy, fl
|
||||
if spirv:
|
||||
subprocess.check_call(spirv_cmd)
|
||||
else:
|
||||
glslang_env = 'spirv1.4' if spirv_14 else 'vulkan1.1'
|
||||
subprocess.check_call([paths.glslang, '--amb', '--target-env', glslang_env, '-V', '-o', spirv_path, shader])
|
||||
|
||||
if opt and (not invalid_spirv):
|
||||
|
Loading…
Reference in New Issue
Block a user