Remove wgpu::BufferCopyView::rowPitch/imageHeight

They were deprecated in favor of bytesPerRow and rowsPerImage.

Bug: dawn:22
Change-Id: I5bd3262ee8ba2f891d01f6b8a3f5df86f7596686
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21684
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Corentin Wallez
2020-05-13 17:26:05 +00:00
committed by Commit Bot service account
parent 2eca22f6d7
commit ecabfe8a78
3 changed files with 19 additions and 184 deletions

View File

@@ -56,127 +56,6 @@ class DeprecationTests : public DawnTest {
} \
} while (0)
// Tests for BufferCopyView.rowPitch/imageHeight -> bytesPerRow/rowsPerImage
class BufferCopyViewDeprecationTests : public DeprecationTests {
protected:
void TestSetUp() override {
DeprecationTests::TestSetUp();
wgpu::BufferDescriptor bufferDesc;
bufferDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
bufferDesc.size = kTextureBytesPerRowAlignment * 2;
buffer = device.CreateBuffer(&bufferDesc);
wgpu::TextureDescriptor textureDesc;
textureDesc.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
textureDesc.size = {2, 2, 1};
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
texture = device.CreateTexture(&textureDesc);
}
enum CopyType {
B2T,
T2B,
};
void DoCopy(CopyType type, const wgpu::BufferCopyView& bufferView) {
wgpu::TextureCopyView textureCopyView;
textureCopyView.texture = texture;
textureCopyView.mipLevel = 0;
textureCopyView.arrayLayer = 0;
textureCopyView.origin = {0, 0};
wgpu::Extent3D copySize = {2, 2, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
switch (type) {
case B2T:
encoder.CopyBufferToTexture(&bufferView, &textureCopyView, &copySize);
break;
case T2B:
encoder.CopyTextureToBuffer(&textureCopyView, &bufferView, &copySize);
break;
}
encoder.Finish();
}
wgpu::Buffer buffer;
wgpu::Texture texture;
};
// Test that using rowPitch produces a deprecation warning.
TEST_P(BufferCopyViewDeprecationTests, RowPitchIsDeprecated) {
wgpu::BufferCopyView view;
view.buffer = buffer;
view.rowPitch = 256;
EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view));
EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view));
}
// Test that using imageHeight produces a deprecation warning.
TEST_P(BufferCopyViewDeprecationTests, ImageHeightIsDeprecated) {
wgpu::BufferCopyView view;
view.buffer = buffer;
view.imageHeight = 2;
view.bytesPerRow = 256;
EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view));
EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view));
}
// Test that using both rowPitch and bytesPerRow produces a validation error.
TEST_P(BufferCopyViewDeprecationTests, BothRowPitchAndBytesPerRowIsInvalid) {
wgpu::BufferCopyView view;
view.buffer = buffer;
view.rowPitch = 256;
view.bytesPerRow = 256;
ASSERT_DEVICE_ERROR(DoCopy(B2T, view));
ASSERT_DEVICE_ERROR(DoCopy(T2B, view));
}
// Test that using both imageHeight and rowsPerImage produces a validation error.
TEST_P(BufferCopyViewDeprecationTests, BothImageHeightAndRowsPerImageIsInvalid) {
wgpu::BufferCopyView view;
view.buffer = buffer;
view.imageHeight = 2;
view.bytesPerRow = 256;
view.rowsPerImage = 2;
ASSERT_DEVICE_ERROR(DoCopy(B2T, view));
ASSERT_DEVICE_ERROR(DoCopy(T2B, view));
}
// Test that rowPitch is correctly taken into account for validation
TEST_P(BufferCopyViewDeprecationTests, RowPitchTakenIntoAccountForValidation) {
wgpu::BufferCopyView view;
view.buffer = buffer;
view.rowPitch = 256;
EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view));
EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view));
view.rowPitch = 128;
ASSERT_DEVICE_ERROR(EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view)));
ASSERT_DEVICE_ERROR(EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view)));
}
// Test that imageHeight is correctly taken into account for validation
TEST_P(BufferCopyViewDeprecationTests, ImageHeightTakenIntoAccountForValidation) {
wgpu::BufferCopyView view;
view.buffer = buffer;
view.imageHeight = 2;
view.bytesPerRow = 256;
EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view));
EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view));
view.imageHeight = 1;
ASSERT_DEVICE_ERROR(EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view)));
ASSERT_DEVICE_ERROR(EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view)));
}
DAWN_INSTANTIATE_TEST(BufferCopyViewDeprecationTests,
D3D12Backend(),
MetalBackend(),
NullBackend(),
OpenGLBackend(),
VulkanBackend());
DAWN_INSTANTIATE_TEST(DeprecationTests,
D3D12Backend(),
MetalBackend(),