Fixup runtime/arrays issue.

This CL converts a variable-length array into a std::array and enables
the runtime/arrays lint check.

Bug: dawn:1339
Change-Id: Ib71828dab84c1651655494108d9fd11922b84e81
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86868
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
dan sinclair 2022-04-19 08:44:05 +00:00 committed by Dawn LUCI CQ
parent 3878a30828
commit d1b9d5cc4f
2 changed files with 6 additions and 6 deletions

View File

@ -4,7 +4,6 @@ filter=-build/namespaces
filter=-readability/casting filter=-readability/casting
filter=-readability/namespace filter=-readability/namespace
filter=-readability/todo filter=-readability/todo
filter=-runtime/arrays
filter=-runtime/explicit filter=-runtime/explicit
filter=-runtime/indentation_namespace filter=-runtime/indentation_namespace
filter=-runtime/int filter=-runtime/int

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include <array>
#include <cmath> #include <cmath>
#include "dawn/tests/DawnTest.h" #include "dawn/tests/DawnTest.h"
@ -97,12 +98,12 @@ class SamplerTest : public DawnTest {
// Create a 2x2 checkerboard texture, with black in the top left and bottom right corners. // Create a 2x2 checkerboard texture, with black in the top left and bottom right corners.
const uint32_t rowPixels = kTextureBytesPerRowAlignment / sizeof(RGBA8); const uint32_t rowPixels = kTextureBytesPerRowAlignment / sizeof(RGBA8);
RGBA8 data[rowPixels * 2]; std::array<RGBA8, rowPixels * 2> pixels;
data[0] = data[rowPixels + 1] = RGBA8::kBlack; pixels[0] = pixels[rowPixels + 1] = RGBA8::kBlack;
data[1] = data[rowPixels] = RGBA8::kWhite; pixels[1] = pixels[rowPixels] = RGBA8::kWhite;
wgpu::Buffer stagingBuffer = wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
utils::CreateBufferFromData(device, data, sizeof(data), wgpu::BufferUsage::CopySrc); device, pixels.data(), pixels.size() * sizeof(RGBA8), wgpu::BufferUsage::CopySrc);
wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(stagingBuffer, 0, 256); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(stagingBuffer, 0, 256);
wgpu::ImageCopyTexture imageCopyTexture = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateImageCopyTexture(texture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});