Spanification of src/dawn/tests/end2end/QueueTests.cpp, etc. This is the result of running the automatic spanification on linux and updating code to use and pass spans where size is known. The original patch was fully automated using script: //tools/clang/spanify/rewrite-multiple-platforms.sh -platforms=linux Then refined with jetski-cli and at last manually refined Original patch: patch_8.txt Bug: 501143858 Change-Id: I4191a10b7c2c2b460328a1558dbe1855d73d83aa Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/327595 Commit-Queue: Daniel Angulo <angdaniel@google.com> Reviewed-by: Loko Kung <lokokung@google.com>
diff --git a/src/dawn/tests/end2end/QueueTests.cpp b/src/dawn/tests/end2end/QueueTests.cpp index 5c5476a..ee3c333 100644 --- a/src/dawn/tests/end2end/QueueTests.cpp +++ b/src/dawn/tests/end2end/QueueTests.cpp
@@ -25,6 +25,8 @@ // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include "src/utils/span.h" + #ifdef UNSAFE_BUFFERS_BUILD // TODO(crbug.com/40285824): Remove this and convert code to safer constructs. #pragma allow_unsafe_buffers @@ -320,8 +322,8 @@ } } -void FillData(uint8_t* data, size_t count) { - for (size_t i = 0; i < count; ++i) { +void FillData(Span<uint8_t> data) { + for (size_t i = 0; i < data.size(); ++i) { data[i] = static_cast<uint8_t>(i % 253); } } @@ -354,7 +356,7 @@ wgpu::TextureViewDimension::Undefined) { // Create data of size `size` and populate it std::vector<uint8_t> data(dataSpec.size); - FillData(data.data(), data.size()); + FillData(data); // Create a texture that is `width` x `height` with (`level` + 1) mip levels. wgpu::TextureDescriptor descriptor = {};