HLSL: Does not support case-fallthrough.

Disable any fallthrough on HLSL. Risky business if fallthrough blocks
had a barrier(), but can't do anything about that ...
This commit is contained in:
Hans-Kristian Arntzen 2019-06-27 15:10:17 +02:00
parent c76b99b711
commit 581ed0fd59
4 changed files with 12 additions and 1 deletions

View File

@ -30,16 +30,23 @@ void frag_main()
case 0:
{
_30 = 3;
j = _30;
_31 = 0;
j = _31;
break;
}
default:
{
j = _30;
_31 = 0;
j = _31;
break;
}
case 1:
case 11:
{
j = _31;
break;
}
case 2:
{
@ -59,6 +66,8 @@ void frag_main()
}
case 4:
{
i = 0;
break;
}
case 5:
{

View File

@ -11702,7 +11702,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
}
auto &case_block = get<SPIRBlock>(target_block);
if (i + 1 < num_blocks &&
if (backend.support_case_fallthrough && i + 1 < num_blocks &&
execution_is_direct_branch(case_block, get<SPIRBlock>(block_declaration_order[i + 1])))
{
// We will fall through here, so just terminate the block chain early.

View File

@ -405,6 +405,7 @@ protected:
bool comparison_image_samples_scalar = false;
bool native_pointers = false;
bool support_small_type_sampling_result = false;
bool support_case_fallthrough = true;
} backend;
void emit_struct(SPIRType &type);

View File

@ -4700,6 +4700,7 @@ string CompilerHLSL::compile()
backend.can_declare_arrays_inline = false;
backend.can_return_array = false;
backend.nonuniform_qualifier = "NonUniformResourceIndex";
backend.support_case_fallthrough = false;
fixup_type_alias();
reorder_type_alias();