dawn-cmake/test/tint
Antonio Maiorano eab1f62629 tint/hlsl: for default-only switch, only emit condition if it has side-effects
This fixes edge-cases, like the condition expression being a type-cast,
which DXC apparently sees as a variable re-declaration. Example:

fn foo(x : f32) {
  switch (i32(x)) {
    default {
    }
  }
}

was emitted as HLSL:

void foo(float x) {
  int(x);
  do {
  } while (false);
}

The `int(x)` is seen as a re-declaration of `x` by DXC.

We fix this by only emitted the condition expression if it has
side-effects (which currently means it contains a call expression).

Bug: tint:1820
Change-Id: I7e4320fa09ea2d634c9e324cb0b752b0ee7dcde9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118161
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2023-02-01 15:46:34 +00:00
..
access tint: Implement sem::Load 2022-12-17 02:20:04 +00:00
array tint: Rename 'type' to 'alias' 2023-01-24 14:55:17 +00:00
benchmark Update GLSL test results. 2022-12-15 16:42:28 +00:00
buffer tint: Add PreservePadding transform 2022-12-06 18:32:19 +00:00
bug tint/hlsl: for default-only switch, only emit condition if it has side-effects 2023-02-01 15:46:34 +00:00
builtins tint: Rename 'type' to 'alias' 2023-01-24 14:55:17 +00:00
const tint: Rename 'type' to 'alias' 2023-01-24 14:55:17 +00:00
diagnostic_filtering tint/SingleEntryPoint: Handle diagnostic directive 2023-01-26 11:31:19 +00:00
expressions tint/spir-v backend: emit OpSRem instead of OpSMod for remainder 2023-01-31 19:09:05 +00:00
extensions/parsing wgsl: Print abstract-floats with full precision. 2022-10-12 19:13:38 +00:00
identifiers/underscore tint: Rename 'type' to 'alias' 2023-01-24 14:55:17 +00:00
layout/storage/mat2x2 tint: Add PreservePadding transform 2022-12-06 18:32:19 +00:00
let/inferred tint: Rename 'type' to 'alias' 2023-01-24 14:55:17 +00:00
loops tint: Use MergeReturn transform in SPIR-V backend 2022-10-31 15:41:41 +00:00
out_of_order_decls tint: Rename 'type' to 'alias' 2023-01-24 14:55:17 +00:00
ptr_ref tint/transform: Skip SimplifyPointers if possible 2023-01-12 18:29:07 +00:00
samples Tint/transform: make AddBlockAttribute always do wrapping if possible 2022-11-02 02:25:38 +00:00
shader_io test/tint: Update expectations 2022-12-07 18:04:59 +00:00
shadowing tint: Rename 'type' to 'alias' 2023-01-24 14:55:17 +00:00
statements tint/hlsl: for default-only switch, only emit condition if it has side-effects 2023-02-01 15:46:34 +00:00
struct tint/transform: fix PromoteInitializersToLet for constant expressions 2022-12-09 12:34:36 +00:00
types Enable the 1D -> 2D texture transform in GLSL writer. 2023-01-07 17:19:21 +00:00
unicode tint: Rename 'type' to 'alias' 2023-01-24 14:55:17 +00:00
unittest/reader/spirv Enable the 1D -> 2D texture transform in GLSL writer. 2023-01-07 17:19:21 +00:00
var tint: Rename 'type' to 'alias' 2023-01-24 14:55:17 +00:00
vk-gl-cts tint/tests: Actually validate the generated WGSL 2023-01-27 16:33:30 +00:00
extract-spvasm.py
parse_hlsl_errors.py tint: add parse_hlsl_errors.py to help triage hlsl errors 2022-10-04 19:48:41 +00:00
test-all.sh tools: Replace copy-pasta scripts 2022-04-07 18:26:45 +00:00