mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
writer/spirv: Fix [[override]] for zero-init defaults
These expressions were not emitted as spec-ops, failing new CTS tests. Change-Id: I56e8f56a22de2b8dac9a8bd7a2d694d8d81dca35 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67480 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@chromium.org> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
0436d045ab
commit
6c4effe654
6
test/var/override/numbered/zero_init/bool.wgsl
Normal file
6
test/var/override/numbered/zero_init/bool.wgsl
Normal file
@@ -0,0 +1,6 @@
|
||||
[[override(1234)]] let o : bool = bool();
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn main() {
|
||||
_ = o;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef WGSL_SPEC_CONSTANT_1234
|
||||
#define WGSL_SPEC_CONSTANT_1234 false
|
||||
#endif
|
||||
static const bool o = WGSL_SPEC_CONSTANT_1234;
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
constant bool o [[function_constant(1234)]];
|
||||
kernel void tint_symbol() {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 7
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %o "o"
|
||||
OpName %main "main"
|
||||
OpDecorate %o SpecId 1234
|
||||
%bool = OpTypeBool
|
||||
%o = OpSpecConstantFalse %bool
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%main = OpFunction %void None %3
|
||||
%6 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,6 @@
|
||||
[[override(1234)]] let o : bool = bool();
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn main() {
|
||||
_ = o;
|
||||
}
|
||||
6
test/var/override/numbered/zero_init/f32.wgsl
Normal file
6
test/var/override/numbered/zero_init/f32.wgsl
Normal file
@@ -0,0 +1,6 @@
|
||||
[[override(1234)]] let o : f32 = f32();
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn main() {
|
||||
_ = o;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef WGSL_SPEC_CONSTANT_1234
|
||||
#define WGSL_SPEC_CONSTANT_1234 0.0f
|
||||
#endif
|
||||
static const float o = WGSL_SPEC_CONSTANT_1234;
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
constant float o [[function_constant(1234)]];
|
||||
kernel void tint_symbol() {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 7
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %o "o"
|
||||
OpName %main "main"
|
||||
OpDecorate %o SpecId 1234
|
||||
%float = OpTypeFloat 32
|
||||
%o = OpSpecConstant %float 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%main = OpFunction %void None %3
|
||||
%6 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,6 @@
|
||||
[[override(1234)]] let o : f32 = f32();
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn main() {
|
||||
_ = o;
|
||||
}
|
||||
6
test/var/override/numbered/zero_init/i32.wgsl
Normal file
6
test/var/override/numbered/zero_init/i32.wgsl
Normal file
@@ -0,0 +1,6 @@
|
||||
[[override(1234)]] let o : i32 = i32();
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn main() {
|
||||
_ = o;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef WGSL_SPEC_CONSTANT_1234
|
||||
#define WGSL_SPEC_CONSTANT_1234 0
|
||||
#endif
|
||||
static const int o = WGSL_SPEC_CONSTANT_1234;
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
constant int o [[function_constant(1234)]];
|
||||
kernel void tint_symbol() {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 7
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %o "o"
|
||||
OpName %main "main"
|
||||
OpDecorate %o SpecId 1234
|
||||
%int = OpTypeInt 32 1
|
||||
%o = OpSpecConstant %int 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%main = OpFunction %void None %3
|
||||
%6 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,6 @@
|
||||
[[override(1234)]] let o : i32 = i32();
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn main() {
|
||||
_ = o;
|
||||
}
|
||||
6
test/var/override/numbered/zero_init/u32.wgsl
Normal file
6
test/var/override/numbered/zero_init/u32.wgsl
Normal file
@@ -0,0 +1,6 @@
|
||||
[[override(1234)]] let o : u32 = u32();
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn main() {
|
||||
_ = o;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef WGSL_SPEC_CONSTANT_1234
|
||||
#define WGSL_SPEC_CONSTANT_1234 0u
|
||||
#endif
|
||||
static const uint o = WGSL_SPEC_CONSTANT_1234;
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
constant uint o [[function_constant(1234)]];
|
||||
kernel void tint_symbol() {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 7
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %o "o"
|
||||
OpName %main "main"
|
||||
OpDecorate %o SpecId 1234
|
||||
%uint = OpTypeInt 32 0
|
||||
%o = OpSpecConstant %uint 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%main = OpFunction %void None %3
|
||||
%6 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,6 @@
|
||||
[[override(1234)]] let o : u32 = u32();
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn main() {
|
||||
_ = o;
|
||||
}
|
||||
Reference in New Issue
Block a user