Add test for disable-storage-image-qualifier-deduction.

This commit is contained in:
Hans-Kristian Arntzen 2020-03-04 16:41:00 +01:00
parent c27e1efbf1
commit 95cd20f1c7
8 changed files with 74 additions and 0 deletions

View File

@ -527,6 +527,7 @@ struct CLIArguments
bool glsl_emit_ubo_as_plain_uniforms = false;
bool vulkan_glsl_disable_ext_samplerless_texture_functions = false;
bool emit_line_directives = false;
bool enable_storage_image_qualifier_deduction = true;
SmallVector<uint32_t> msl_discrete_descriptor_sets;
SmallVector<uint32_t> msl_device_argument_buffers;
SmallVector<pair<uint32_t, uint32_t>> msl_dynamic_buffers;
@ -595,6 +596,7 @@ static void print_help()
"\t[--iterations iter]\n"
"\t[--cpp]\n"
"\t[--cpp-interface-name <name>]\n"
"\t[--disable-storage-image-qualifier-deduction]\n"
"\t[--glsl-emit-push-constant-as-ubo]\n"
"\t[--glsl-emit-ubo-as-plain-uniforms]\n"
"\t[--vulkan-glsl-disable-ext-samplerless-texture-functions]\n"
@ -944,6 +946,7 @@ static string compile_iteration(const CLIArguments &args, std::vector<uint32_t>
opts.emit_push_constant_as_uniform_buffer = args.glsl_emit_push_constant_as_ubo;
opts.emit_uniform_buffer_as_plain_uniforms = args.glsl_emit_ubo_as_plain_uniforms;
opts.emit_line_directives = args.emit_line_directives;
opts.enable_storage_image_qualifier_deduction = args.enable_storage_image_qualifier_deduction;
compiler->set_common_options(opts);
// Set HLSL specific options.
@ -1124,6 +1127,7 @@ static int main_inner(int argc, char *argv[])
cbs.add("--glsl-emit-ubo-as-plain-uniforms", [&args](CLIParser &) { args.glsl_emit_ubo_as_plain_uniforms = true; });
cbs.add("--vulkan-glsl-disable-ext-samplerless-texture-functions",
[&args](CLIParser &) { args.vulkan_glsl_disable_ext_samplerless_texture_functions = true; });
cbs.add("--disable-storage-image-qualifier-deduction", [&args](CLIParser &) { args.enable_storage_image_qualifier_deduction = false; });
cbs.add("--msl", [&args](CLIParser &) { args.msl = true; });
cbs.add("--hlsl", [&args](CLIParser &) { args.hlsl = true; });
cbs.add("--hlsl-enable-compat", [&args](CLIParser &) { args.hlsl_compat = true; });

View File

@ -0,0 +1,12 @@
#version 450
layout(binding = 0, r32f) uniform readonly writeonly image2D uImage1;
layout(binding = 1, r32f) uniform readonly writeonly image2D uImage2;
layout(location = 0) out vec4 FragColor;
void main()
{
FragColor = vec4(vec2(imageSize(uImage1)), vec2(imageSize(uImage2)));
}

View File

@ -0,0 +1,12 @@
#version 450
layout(binding = 0, r32f) uniform image2D uImage1;
layout(binding = 1, r32f) uniform image2D uImage2;
layout(location = 0) out vec4 FragColor;
void main()
{
FragColor = vec4(vec2(imageSize(uImage1)), vec2(imageSize(uImage2)));
}

View File

@ -0,0 +1,12 @@
#version 450
layout(binding = 0, r32f) uniform readonly writeonly image2D uImage1;
layout(binding = 1, r32f) uniform readonly writeonly image2D uImage2;
layout(location = 0) out vec4 FragColor;
void main()
{
FragColor = vec4(vec2(imageSize(uImage1)), vec2(imageSize(uImage2)));
}

View File

@ -0,0 +1,12 @@
#version 450
layout(binding = 0, r32f) uniform image2D uImage1;
layout(binding = 1, r32f) uniform image2D uImage2;
layout(location = 0) out vec4 FragColor;
void main()
{
FragColor = vec4(vec2(imageSize(uImage1)), vec2(imageSize(uImage2)));
}

View File

@ -0,0 +1,10 @@
#version 450
layout(location = 0) out vec4 FragColor;
layout(r32f, set = 0, binding = 0) uniform image2D uImage1;
layout(r32f, set = 0, binding = 1) uniform image2D uImage2;
void main()
{
FragColor = vec4(imageSize(uImage1), imageSize(uImage2));
}

View File

@ -0,0 +1,10 @@
#version 450
layout(location = 0) out vec4 FragColor;
layout(r32f, set = 0, binding = 0) uniform image2D uImage1;
layout(r32f, set = 0, binding = 1) uniform image2D uImage2;
void main()
{
FragColor = vec4(imageSize(uImage1), imageSize(uImage2));
}

View File

@ -438,6 +438,8 @@ def cross_compile(shader, vulkan, spirv, invalid_spirv, eliminate, is_legacy, fl
extra_args += ['--emit-line-directives']
if '.no-samplerless.' in shader:
extra_args += ['--vulkan-glsl-disable-ext-samplerless-texture-functions']
if '.no-qualifier-deduction.' in shader:
extra_args += ['--disable-storage-image-qualifier-deduction']
spirv_cross_path = paths.spirv_cross