mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-13 00:26:00 +00:00
This CL adds element count limits to arrays. In FXC there is a maximum of 65536 elements in an array. This limit is not yet in WGSL, but adding this here allows us to fix the issue with large arrays and GLSL. Bug: chromium:1367602 Change-Id: I7df9d3e4f6c3e5107420d5f8e576d1f33e453161 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104240 Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
21 lines
705 B
Plaintext
21 lines
705 B
Plaintext
#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() {
|
|
tint_array<bool, 65535> v = {};
|
|
}
|
|
|