writer/hlsl: Inline fallthrough case statements

FXC does not support fallthrough case statements (DXC does).

Fixed: tint:1082
Change-Id: I82e1add5455e438056259f773f34bf9db05970b4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60480
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
Ben Clayton
2021-08-02 12:58:19 +00:00
committed by Tint LUCI CQ
parent 8ebff3dc85
commit c0fbce65d8
43 changed files with 385 additions and 142 deletions

View File

@@ -4,6 +4,9 @@ void main_1() {
switch(42u) {
case 20u: {
/* fallthrough */
{
}
break;
}
case 40u: {
break;

View File

@@ -4,6 +4,9 @@ void main_1() {
switch(42u) {
case 20u: {
/* fallthrough */
{
}
break;
}
default: {
break;

View File

@@ -4,6 +4,9 @@ void main_1() {
switch(42u) {
default: {
/* fallthrough */
{
}
break;
}
case 40u: {
break;

View File

@@ -10,6 +10,13 @@ void main_1() {
}
default: {
/* fallthrough */
{
if (false) {
} else {
break;
}
}
break;
}
case 50u: {
if (false) {

View File

@@ -9,9 +9,22 @@ void main_1() {
break;
}
/* fallthrough */
{
/* fallthrough */
}
{
if (false) {
}
}
break;
}
default: {
/* fallthrough */
{
if (false) {
}
}
break;
}
case 50u: {
if (false) {

View File

@@ -9,6 +9,11 @@ void main_1() {
}
default: {
/* fallthrough */
{
if (false) {
}
}
break;
}
case 50u: {
if (false) {

View File

@@ -4,12 +4,18 @@ void main_1() {
switch(42u) {
case 30u: {
/* fallthrough */
{
}
break;
}
case 50u: {
break;
}
case 20u: {
/* fallthrough */
{
}
break;
}
case 40u: {
break;

View File

@@ -4,9 +4,18 @@ void main_1() {
switch(42u) {
case 20u: {
/* fallthrough */
{
/* fallthrough */
}
{
}
break;
}
default: {
/* fallthrough */
{
}
break;
}
case 30u: {
break;

View File

@@ -7,9 +7,18 @@ void main_1() {
}
default: {
/* fallthrough */
{
/* fallthrough */
}
{
}
break;
}
case 30u: {
/* fallthrough */
{
}
break;
}
case 40u: {
break;

View File

@@ -4,12 +4,18 @@ void main_1() {
switch(42u) {
case 30u: {
/* fallthrough */
{
}
break;
}
case 50u: {
break;
}
case 20u: {
/* fallthrough */
{
}
break;
}
case 40u: {
break;

View File

@@ -10,6 +10,9 @@ void main_1() {
}
default: {
/* fallthrough */
{
}
break;
}
case 30u: {
break;

View File

@@ -6,6 +6,10 @@ void main_1() {
case 20u: {
var_1 = 20u;
/* fallthrough */
{
var_1 = 30u;
}
break;
}
case 30u: {
var_1 = 30u;

View File

@@ -9,6 +9,10 @@ void main_1() {
break;
}
/* fallthrough */
{
var_1 = 30u;
}
break;
}
case 30u: {
var_1 = 30u;

View File

@@ -10,6 +10,10 @@ void main_1() {
break;
}
/* fallthrough */
{
var_1 = 30u;
}
break;
}
case 30u: {
var_1 = 30u;

View File

@@ -6,6 +6,10 @@ void main_1() {
case 20u: {
var_1 = 20u;
/* fallthrough */
{
var_1 = 30u;
}
break;
}
case 30u: {
var_1 = 30u;

View File

@@ -13,6 +13,10 @@ void main_1() {
}
default: {
/* fallthrough */
{
var_1 = 30u;
}
break;
}
case 30u: {
var_1 = 30u;

View File

@@ -4,6 +4,9 @@ void main_1() {
switch(42u) {
default: {
/* fallthrough */
{
}
break;
}
case 200u: {
break;

View File

@@ -4,6 +4,9 @@ void main_1() {
switch(42u) {
case 20u: {
/* fallthrough */
{
}
break;
}
case 30u: {
break;

View File

@@ -7,9 +7,30 @@ void main_1() {
switch(1u) {
default: {
/* fallthrough */
{
/* fallthrough */
}
{
if (true) {
} else {
x_41_phi = 0u;
break;
}
x_41_phi = 1u;
}
break;
}
case 0u: {
/* fallthrough */
{
if (true) {
} else {
x_41_phi = 0u;
break;
}
x_41_phi = 1u;
}
break;
}
case 1u: {
if (true) {