gpuweb / gpuweb

Where the GPU for the Web work happens!

Home Page:http://webgpu.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reduce limit for maximum number of elements in const-expression of array type

jrprice opened this issue · comments

The WGSL spec currently has a 65535 limit for the number of elements in a constexpr array constructor.

Through CTS testing, we have found that this limit is impractical on multiple platforms. SPIR-V has a maximum operand count of 65535, with two of those operands already reserved for the result type and result ID. We also observed excessively large compile times for these tests on various D3D, Metal, and Vulkan drivers.

To better reflect reality, I propose that we lower the limit to 2048 elements. This would align with the proposed new limit for private/function variable byte-sizes, allowing those variables to have array initializers.

Since these limits are purely informative and implementations are permitted to support shaders that go beyond them, this would be a backwards compatible change.