mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-15 03:41:34 +00:00
test/tint: add test case for tint:1563
Demonstrates that this is not an issue. Fixed: tint:1563 Change-Id: I5a33e6805cf0a5c52a6306f6d7e5949cee5636a5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105641 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com> Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
138ddcc08c
commit
51cc480b69
8
test/tint/bug/tint/1563.wgsl
Normal file
8
test/tint/bug/tint/1563.wgsl
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// flags: --transform robustness
|
||||||
|
fn foo() -> f32 {
|
||||||
|
let oob = 99;
|
||||||
|
let b = vec4<f32>()[oob]; // 99 is out of bounds
|
||||||
|
var v: vec4<f32>;
|
||||||
|
v[oob] = b; // 99 is out of bounds
|
||||||
|
return b;
|
||||||
|
}
|
16
test/tint/bug/tint/1563.wgsl.expected.dxc.hlsl
Normal file
16
test/tint/bug/tint/1563.wgsl.expected.dxc.hlsl
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
void set_float4(inout float4 vec, int idx, float val) {
|
||||||
|
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float foo() {
|
||||||
|
const int oob = 99;
|
||||||
|
const float b = (0.0f).xxxx[min(uint(oob), 3u)];
|
||||||
|
float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
set_float4(v, min(uint(oob), 3u), b);
|
||||||
|
return b;
|
||||||
|
}
|
16
test/tint/bug/tint/1563.wgsl.expected.fxc.hlsl
Normal file
16
test/tint/bug/tint/1563.wgsl.expected.fxc.hlsl
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
void set_float4(inout float4 vec, int idx, float val) {
|
||||||
|
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float foo() {
|
||||||
|
const int oob = 99;
|
||||||
|
const float b = (0.0f).xxxx[min(uint(oob), 3u)];
|
||||||
|
float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
set_float4(v, min(uint(oob), 3u), b);
|
||||||
|
return b;
|
||||||
|
}
|
14
test/tint/bug/tint/1563.wgsl.expected.glsl
Normal file
14
test/tint/bug/tint/1563.wgsl.expected.glsl
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#version 310 es
|
||||||
|
|
||||||
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
float foo() {
|
||||||
|
int oob = 99;
|
||||||
|
float b = vec4(0.0f)[min(uint(oob), 3u)];
|
||||||
|
vec4 v = vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
v[min(uint(oob), 3u)] = b;
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
11
test/tint/bug/tint/1563.wgsl.expected.msl
Normal file
11
test/tint/bug/tint/1563.wgsl.expected.msl
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
float foo() {
|
||||||
|
int const oob = 99;
|
||||||
|
float const b = float4(0.0f)[min(uint(oob), 3u)];
|
||||||
|
float4 v = 0.0f;
|
||||||
|
v[min(uint(oob), 3u)] = b;
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
41
test/tint/bug/tint/1563.wgsl.expected.spvasm
Normal file
41
test/tint/bug/tint/1563.wgsl.expected.spvasm
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 25
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
%15 = OpExtInstImport "GLSL.std.450"
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
OpName %foo "foo"
|
||||||
|
OpName %v "v"
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%1 = OpTypeFunction %void
|
||||||
|
%float = OpTypeFloat 32
|
||||||
|
%5 = OpTypeFunction %float
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%int_99 = OpConstant %int 99
|
||||||
|
%v4float = OpTypeVector %float 4
|
||||||
|
%12 = OpConstantNull %v4float
|
||||||
|
%uint = OpTypeInt 32 0
|
||||||
|
%uint_3 = OpConstant %uint 3
|
||||||
|
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||||
|
%_ptr_Function_float = OpTypePointer Function %float
|
||||||
|
%unused_entry_point = OpFunction %void None %1
|
||||||
|
%4 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%foo = OpFunction %float None %5
|
||||||
|
%8 = OpLabel
|
||||||
|
%v = OpVariable %_ptr_Function_v4float Function %12
|
||||||
|
%16 = OpBitcast %uint %int_99
|
||||||
|
%13 = OpExtInst %uint %15 UMin %16 %uint_3
|
||||||
|
%18 = OpVectorExtractDynamic %float %12 %13
|
||||||
|
%22 = OpBitcast %uint %int_99
|
||||||
|
%21 = OpExtInst %uint %15 UMin %22 %uint_3
|
||||||
|
%24 = OpAccessChain %_ptr_Function_float %v %21
|
||||||
|
OpStore %24 %18
|
||||||
|
OpReturnValue %18
|
||||||
|
OpFunctionEnd
|
7
test/tint/bug/tint/1563.wgsl.expected.wgsl
Normal file
7
test/tint/bug/tint/1563.wgsl.expected.wgsl
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fn foo() -> f32 {
|
||||||
|
let oob = 99;
|
||||||
|
let b = vec4<f32>()[min(u32(oob), 3u)];
|
||||||
|
var v : vec4<f32>;
|
||||||
|
v[min(u32(oob), 3u)] = b;
|
||||||
|
return b;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user