Add maximum limitation for query count in CreateQuerySet

- Limit the maximum query count to 8192 to fit Metal restriction.
- Add unittest tests of query count and remove the test of buffer
size overflow validation on 32-bits.

Bug: dawn:434
Change-Id: Ie573b715cc3f67ec158996119a8b4a49e493680a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36021
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Hao Li
2020-12-24 02:57:07 +00:00
committed by Commit Bot service account
parent 700809a7f7
commit c08276644f
4 changed files with 19 additions and 16 deletions

View File

@@ -68,4 +68,9 @@ static_assert(1 << (kMaxTexture2DMipLevels - 1) == kMaxTextureSize,
// on macOS, but we decide to do it on all platforms.
static constexpr uint64_t kCopyBufferToBufferOffsetAlignment = 4u;
// The maximum size of visibilityResultBuffer is 256KB on Metal, to fit the restriction, limit the
// maximum size of query set to 64KB. The size of a query is 8-bytes, the maximum query count is 64
// * 1024 / 8.
static constexpr uint32_t kMaxQueryCount = 8192u;
#endif // COMMON_CONSTANTS_H_