diff options
author | Hans-Kristian Arntzen <hans-kristian.arntzen@arm.com> | 2018-11-01 16:56:25 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <hans-kristian.arntzen@arm.com> | 2018-11-01 16:58:02 +0300 |
commit | 480acdad1868b41d6130f7e343b37bc7a58e28cf (patch) | |
tree | 4dfa4da710b6ec8d8217820c1b314b73633a1836 /shaders | |
parent | 37dbdf14faf8ce62250500ac8b60f57400f20378 (diff) |
Deal with OpSpecConstantOp used as array size.
When trying to validate buffer sizes, we usually need to bail out when
using SpecConstantOps, but for some very specific cases where we allow
unsized arrays currently, we can safely allow "unknown" sized arrays as
well.
This is probably the best we can do, when we have even more difficult
cases than this, we throw a more sensible error message.
Diffstat (limited to 'shaders')
-rw-r--r-- | shaders/vulkan/comp/spec-constant-op-member-array.vk.comp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp b/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp new file mode 100644 index 00000000..0b428eb0 --- /dev/null +++ b/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp @@ -0,0 +1,33 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(constant_id = 0) const int a = 100; +layout(constant_id = 1) const int b = 200; +layout(constant_id = 2) const int c = 300; +const int d = c + 50; +layout(constant_id = 3) const int e = 400; + +struct A +{ + int member0[a]; + int member1[b]; +}; + +struct B +{ + int member0[b]; + int member1[a]; +}; + +layout(set = 1, binding = 0) buffer SSBO +{ + A member_a; + B member_b; + int v[a]; + int w[d]; +}; + +void main() +{ + w[gl_GlobalInvocationID.x] += v[gl_GlobalInvocationID.x] + e; +} |