mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
tint/resolver: Allow array sizes to be unnamed override-expressions
I got the rules around this wrong. This should be allowed, but the array types cannot compare equal if they are unnamed override-expressions. Fixed tint:1737 Change-Id: I83dc49703eed015e9c183e804474886da5dad7b9 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107685 Reviewed-by: James Price <jrprice@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Auto-Submit: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
cc85ed6dd1
commit
22c4850b06
10
test/tint/bug/tint/1737.wgsl
Normal file
10
test/tint/bug/tint/1737.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
// flags: --overrides wgsize=10
|
||||
|
||||
override wgsize : u32;
|
||||
var<workgroup> a : array<f32, wgsize>; // Accepted
|
||||
var<workgroup> b : array<f32, wgsize * 2>; // Rejected
|
||||
|
||||
fn f() {
|
||||
let x = a[0];
|
||||
let y = b[0];
|
||||
}
|
||||
12
test/tint/bug/tint/1737.wgsl.expected.dxc.hlsl
Normal file
12
test/tint/bug/tint/1737.wgsl.expected.dxc.hlsl
Normal file
@@ -0,0 +1,12 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
groupshared float a[10];
|
||||
groupshared float b[20];
|
||||
|
||||
void f() {
|
||||
const float x = a[0];
|
||||
const float y = b[0];
|
||||
}
|
||||
12
test/tint/bug/tint/1737.wgsl.expected.fxc.hlsl
Normal file
12
test/tint/bug/tint/1737.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,12 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
groupshared float a[10];
|
||||
groupshared float b[20];
|
||||
|
||||
void f() {
|
||||
const float x = a[0];
|
||||
const float y = b[0];
|
||||
}
|
||||
13
test/tint/bug/tint/1737.wgsl.expected.glsl
Normal file
13
test/tint/bug/tint/1737.wgsl.expected.glsl
Normal file
@@ -0,0 +1,13 @@
|
||||
#version 310 es
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
shared float a[10];
|
||||
shared float b[20];
|
||||
void f() {
|
||||
float x = a[0];
|
||||
float y = b[0];
|
||||
}
|
||||
|
||||
21
test/tint/bug/tint/1737.wgsl.expected.msl
Normal file
21
test/tint/bug/tint/1737.wgsl.expected.msl
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
void f(threadgroup tint_array<float, 10>* const tint_symbol, threadgroup tint_array<float, 20>* const tint_symbol_1) {
|
||||
float const x = (*(tint_symbol))[0];
|
||||
float const y = (*(tint_symbol_1))[0];
|
||||
}
|
||||
|
||||
42
test/tint/bug/tint/1737.wgsl.expected.spvasm
Normal file
42
test/tint/bug/tint/1737.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,42 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 24
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||
OpName %a "a"
|
||||
OpName %b "b"
|
||||
OpName %unused_entry_point "unused_entry_point"
|
||||
OpName %f "f"
|
||||
OpDecorate %_arr_float_uint_10 ArrayStride 4
|
||||
OpDecorate %_arr_float_uint_20 ArrayStride 4
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_10 = OpConstant %uint 10
|
||||
%_arr_float_uint_10 = OpTypeArray %float %uint_10
|
||||
%_ptr_Workgroup__arr_float_uint_10 = OpTypePointer Workgroup %_arr_float_uint_10
|
||||
%a = OpVariable %_ptr_Workgroup__arr_float_uint_10 Workgroup
|
||||
%uint_20 = OpConstant %uint 20
|
||||
%_arr_float_uint_20 = OpTypeArray %float %uint_20
|
||||
%_ptr_Workgroup__arr_float_uint_20 = OpTypePointer Workgroup %_arr_float_uint_20
|
||||
%b = OpVariable %_ptr_Workgroup__arr_float_uint_20 Workgroup
|
||||
%void = OpTypeVoid
|
||||
%11 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%18 = OpConstantNull %int
|
||||
%_ptr_Workgroup_float = OpTypePointer Workgroup %float
|
||||
%unused_entry_point = OpFunction %void None %11
|
||||
%14 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %11
|
||||
%16 = OpLabel
|
||||
%20 = OpAccessChain %_ptr_Workgroup_float %a %18
|
||||
%21 = OpLoad %float %20
|
||||
%22 = OpAccessChain %_ptr_Workgroup_float %b %18
|
||||
%23 = OpLoad %float %22
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
10
test/tint/bug/tint/1737.wgsl.expected.wgsl
Normal file
10
test/tint/bug/tint/1737.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
const wgsize : u32 = 10u;
|
||||
|
||||
var<workgroup> a : array<f32, wgsize>;
|
||||
|
||||
var<workgroup> b : array<f32, (wgsize * 2)>;
|
||||
|
||||
fn f() {
|
||||
let x = a[0];
|
||||
let y = b[0];
|
||||
}
|
||||
Reference in New Issue
Block a user