diff --git a/src/common/BUILD.gn b/src/common/BUILD.gn index e0cea4fbb2..160ef99ad9 100644 --- a/src/common/BUILD.gn +++ b/src/common/BUILD.gn @@ -120,7 +120,6 @@ config("dawn_internal") { "-Wno-language-extension-token", "-Wno-microsoft-enum-value", "-Wno-nested-anon-types", - "-Wno-vla-extension", ] } } diff --git a/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp b/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp index 6300ada188..4ba327e375 100644 --- a/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp +++ b/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp @@ -788,8 +788,8 @@ namespace dawn_native { namespace vulkan { // Draw a non-trivial picture uint32_t width = 640, height = 480, pixelSize = 4; uint32_t bytesPerRow = Align(width * pixelSize, kTextureBytesPerRowAlignment); - uint32_t size = bytesPerRow * (height - 1) + width * pixelSize; - unsigned char data[size]; + std::vector data(bytesPerRow * (height - 1) + width * pixelSize); + for (uint32_t row = 0; row < height; row++) { for (uint32_t col = 0; col < width; col++) { float normRow = static_cast(row) / height; @@ -805,8 +805,8 @@ namespace dawn_native { namespace vulkan { // Write the picture { - wgpu::Buffer copySrcBuffer = - utils::CreateBufferFromData(secondDevice, data, size, wgpu::BufferUsage::CopySrc); + wgpu::Buffer copySrcBuffer = utils::CreateBufferFromData( + secondDevice, data.data(), data.size(), wgpu::BufferUsage::CopySrc); wgpu::BufferCopyView copySrc = utils::CreateBufferCopyView(copySrcBuffer, 0, bytesPerRow, 0); wgpu::TextureCopyView copyDst = @@ -829,7 +829,7 @@ namespace dawn_native { namespace vulkan { // Copy the image into a buffer for comparison wgpu::BufferDescriptor copyDesc; - copyDesc.size = size; + copyDesc.size = data.size(); copyDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; wgpu::Buffer copyDstBuffer = device.CreateBuffer(©Desc); { @@ -847,7 +847,8 @@ namespace dawn_native { namespace vulkan { } // Check the image is not corrupted on |device| - EXPECT_BUFFER_U32_RANGE_EQ(reinterpret_cast(data), copyDstBuffer, 0, size / 4); + EXPECT_BUFFER_U32_RANGE_EQ(reinterpret_cast(data.data()), copyDstBuffer, 0, + data.size() / 4); IgnoreSignalSemaphore(device, nextWrappedTexture); } diff --git a/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp b/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp index 6e7764b27f..b897e62af2 100644 --- a/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp +++ b/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp @@ -962,8 +962,8 @@ namespace dawn_native { namespace vulkan { // Draw a non-trivial picture uint32_t width = 640, height = 480, pixelSize = 4; uint32_t bytesPerRow = Align(width * pixelSize, kTextureBytesPerRowAlignment); - uint32_t size = bytesPerRow * (height - 1) + width * pixelSize; - unsigned char data[size]; + std::vector data(bytesPerRow * (height - 1) + width * pixelSize); + for (uint32_t row = 0; row < height; row++) { for (uint32_t col = 0; col < width; col++) { float normRow = static_cast(row) / height; @@ -979,8 +979,8 @@ namespace dawn_native { namespace vulkan { // Write the picture { - wgpu::Buffer copySrcBuffer = - utils::CreateBufferFromData(secondDevice, data, size, wgpu::BufferUsage::CopySrc); + wgpu::Buffer copySrcBuffer = utils::CreateBufferFromData( + secondDevice, data.data(), data.size(), wgpu::BufferUsage::CopySrc); wgpu::BufferCopyView copySrc = utils::CreateBufferCopyView(copySrcBuffer, 0, bytesPerRow, 0); wgpu::TextureCopyView copyDst = @@ -1003,7 +1003,7 @@ namespace dawn_native { namespace vulkan { // Copy the image into a buffer for comparison wgpu::BufferDescriptor copyDesc; - copyDesc.size = size; + copyDesc.size = data.size(); copyDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; wgpu::Buffer copyDstBuffer = device.CreateBuffer(©Desc); { @@ -1021,7 +1021,8 @@ namespace dawn_native { namespace vulkan { } // Check the image is not corrupted on |device| - EXPECT_BUFFER_U32_RANGE_EQ(reinterpret_cast(data), copyDstBuffer, 0, size / 4); + EXPECT_BUFFER_U32_RANGE_EQ(reinterpret_cast(data.data()), copyDstBuffer, 0, + data.size() / 4); IgnoreSignalSemaphore(device, nextWrappedTexture); secondDeviceVk->GetFencedDeleter()->DeleteWhenUnused(imageA);