writer/hlsl: Emit zero values for private variables

Also remove the unreachanble constructor logic in EmitHandleVariable.
Variables of the handle storage class cannot have initializers.

Fixed: tint:173
Change-Id: I7c997a8b6a70308ff9b5c42fa1198810ee365bac
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55258
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2021-06-21 19:37:58 +00:00
committed by Tint LUCI CQ
parent 3b02d54ab0
commit 41f21fe05b
28 changed files with 46 additions and 53 deletions

View File

@@ -1,21 +1,21 @@
struct S {
};
static bool bool_var;
static int i32_var;
static uint u32_var;
static float f32_var;
static int2 v2i32_var;
static uint3 v3u32_var;
static float4 v4f32_var;
static float2x3 m2x3_var;
static bool bool_var = false;
static int i32_var = 0;
static uint u32_var = 0u;
static float f32_var = 0.0f;
static int2 v2i32_var = int2(0, 0);
static uint3 v3u32_var = uint3(0u, 0u, 0u);
static float4 v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float2x3 m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
struct tint_array_wrapper {
float arr[4];
};
static tint_array_wrapper arr_var;
static S struct_var;
static tint_array_wrapper arr_var = {{0.0f, 0.0f, 0.0f, 0.0f}};
static S struct_var = {};
[numthreads(1, 1, 1)]
void main() {