diff --git a/dawn.json b/dawn.json index 72074db8eb..3a5bb80ddc 100644 --- a/dawn.json +++ b/dawn.json @@ -228,10 +228,7 @@ "extensible": true, "members": [ {"name": "layout", "type": "texture data layout"}, - {"name": "buffer", "type": "buffer"}, - {"name": "offset", "type": "uint64_t", "default": 0}, - {"name": "bytes per row", "type": "uint32_t"}, - {"name": "rows per image", "type": "uint32_t", "default": 0} + {"name": "buffer", "type": "buffer"} ] }, "buffer descriptor": { diff --git a/src/dawn_native/CommandEncoder.cpp b/src/dawn_native/CommandEncoder.cpp index 45fb193784..db4968c302 100644 --- a/src/dawn_native/CommandEncoder.cpp +++ b/src/dawn_native/CommandEncoder.cpp @@ -437,35 +437,6 @@ namespace dawn_native { return {}; } - ResultOrError FixBufferCopyView(DeviceBase* device, - const BufferCopyView* view) { - BufferCopyView fixedView = *view; - - TextureDataLayout& layout = fixedView.layout; - if (layout.offset != 0 || layout.bytesPerRow != 0 || layout.rowsPerImage != 0) { - // Using non-deprecated path - if (fixedView.offset != 0 || fixedView.bytesPerRow != 0 || - fixedView.rowsPerImage != 0) { - return DAWN_VALIDATION_ERROR( - "WGPUBufferCopyView.offset/bytesPerRow/rowsPerImage is deprecated; use " - "only WGPUBufferCopyView.layout"); - } - } else if (fixedView.offset != 0 || fixedView.bytesPerRow != 0 || - fixedView.rowsPerImage != 0) { - device->EmitDeprecationWarning( - "WGPUBufferCopyView.offset/bytesPerRow/rowsPerImage is deprecated; use " - "WGPUBufferCopyView.layout"); - - layout.offset = fixedView.offset; - layout.bytesPerRow = fixedView.bytesPerRow; - layout.rowsPerImage = fixedView.rowsPerImage; - fixedView.offset = 0; - fixedView.bytesPerRow = 0; - fixedView.rowsPerImage = 0; - } - return fixedView; - } - MaybeError ValidateQuerySetResolve(const QuerySetBase* querySet, uint32_t firstQuery, uint32_t queryCount, @@ -668,11 +639,6 @@ namespace dawn_native { const TextureCopyView* destination, const Extent3D* copySize) { mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError { - // TODO(crbug.com/dawn/22): Remove once migration to .layout is done. - BufferCopyView fixedSource; - DAWN_TRY_ASSIGN(fixedSource, FixBufferCopyView(GetDevice(), source)); - source = &fixedSource; - if (GetDevice()->IsValidationEnabled()) { DAWN_TRY(ValidateBufferCopyView(GetDevice(), *source)); DAWN_TRY(ValidateCanUseAs(source->buffer, wgpu::BufferUsage::CopySrc)); @@ -732,11 +698,6 @@ namespace dawn_native { const BufferCopyView* destination, const Extent3D* copySize) { mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError { - // TODO(crbug.com/dawn/22): Remove once migration to .layout is done. - BufferCopyView fixedDst; - DAWN_TRY_ASSIGN(fixedDst, FixBufferCopyView(GetDevice(), destination)); - destination = &fixedDst; - if (GetDevice()->IsValidationEnabled()) { DAWN_TRY(ValidateTextureCopyView(GetDevice(), *source)); DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc)); diff --git a/src/dawn_native/CommandValidation.cpp b/src/dawn_native/CommandValidation.cpp index 7b2d8fc597..497a8dee0d 100644 --- a/src/dawn_native/CommandValidation.cpp +++ b/src/dawn_native/CommandValidation.cpp @@ -473,10 +473,6 @@ namespace dawn_native { MaybeError ValidateBufferCopyView(DeviceBase const* device, const BufferCopyView& bufferCopyView) { - // Should have already been fixed up to not use deprecated fields. - ASSERT(bufferCopyView.offset == 0 && bufferCopyView.bytesPerRow == 0 && - bufferCopyView.rowsPerImage == 0); - DAWN_TRY(device->ValidateObject(bufferCopyView.buffer)); if (bufferCopyView.layout.bytesPerRow % kTextureBytesPerRowAlignment != 0) { return DAWN_VALIDATION_ERROR("bytesPerRow must be a multiple of 256"); diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp index f1d790f9a7..ef635ce5ac 100644 --- a/src/tests/end2end/BindGroupTests.cpp +++ b/src/tests/end2end/BindGroupTests.cpp @@ -1119,7 +1119,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) { utils::CreateBufferFromData(device, wgpu::BufferUsage::CopySrc, {expectedValue}); wgpu::BufferCopyView bufferCopyView = {}; bufferCopyView.buffer = textureData; - bufferCopyView.bytesPerRow = 256; + bufferCopyView.layout.bytesPerRow = 256; wgpu::TextureCopyView textureCopyView = {}; textureCopyView.texture = texture; diff --git a/src/tests/end2end/DeprecatedAPITests.cpp b/src/tests/end2end/DeprecatedAPITests.cpp index 66fc4c4c06..1fd9d1a420 100644 --- a/src/tests/end2end/DeprecatedAPITests.cpp +++ b/src/tests/end2end/DeprecatedAPITests.cpp @@ -82,96 +82,3 @@ class BufferCopyViewDeprecationTests : public DeprecationTests { wgpu::Extent3D copySize = {1, 1, 1}; }; - -// Test that using BufferCopyView::{offset,bytesPerRow,rowsPerImage} emits a warning. -TEST_P(BufferCopyViewDeprecationTests, DeprecationWarning) { - wgpu::BufferDescriptor desc; - desc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; - desc.size = 8; - wgpu::Buffer buffer = device.CreateBuffer(&desc); - - wgpu::TextureCopyView texCopy = MakeTextureCopyView(); - - { - wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::BufferCopyView bufCopy = {}; - bufCopy.buffer = buffer; - bufCopy.offset = 4; - EXPECT_DEPRECATION_WARNING(encoder.CopyBufferToTexture(&bufCopy, &texCopy, ©Size)); - EXPECT_DEPRECATION_WARNING(encoder.CopyTextureToBuffer(&texCopy, &bufCopy, ©Size)); - wgpu::CommandBuffer command = encoder.Finish(); - queue.Submit(1, &command); - } - { - wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::BufferCopyView bufCopy = {}; - bufCopy.buffer = buffer; - bufCopy.bytesPerRow = 128; - EXPECT_DEPRECATION_WARNING(encoder.CopyBufferToTexture(&bufCopy, &texCopy, ©Size)); - EXPECT_DEPRECATION_WARNING(encoder.CopyTextureToBuffer(&texCopy, &bufCopy, ©Size)); - // Since bytesPerRow is not 256-aligned. - ASSERT_DEVICE_ERROR(encoder.Finish()); - } - { - wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::BufferCopyView bufCopy = {}; - bufCopy.buffer = buffer; - bufCopy.rowsPerImage = 1; - EXPECT_DEPRECATION_WARNING(encoder.CopyBufferToTexture(&bufCopy, &texCopy, ©Size)); - EXPECT_DEPRECATION_WARNING(encoder.CopyTextureToBuffer(&texCopy, &bufCopy, ©Size)); - wgpu::CommandBuffer command = encoder.Finish(); - queue.Submit(1, &command); - } -} - -// Test that using both any old field and any new field is an error -TEST_P(BufferCopyViewDeprecationTests, BothOldAndNew) { - wgpu::BufferDescriptor desc; - desc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; - desc.size = 8; - wgpu::Buffer buffer = device.CreateBuffer(&desc); - - wgpu::TextureCopyView texCopy = MakeTextureCopyView(); - - auto testOne = [=](const wgpu::BufferCopyView& bufCopy) { - { - wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - encoder.CopyBufferToTexture(&bufCopy, &texCopy, ©Size); - ASSERT_DEVICE_ERROR(encoder.Finish()); - } - { - wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - encoder.CopyTextureToBuffer(&texCopy, &bufCopy, ©Size); - ASSERT_DEVICE_ERROR(encoder.Finish()); - } - }; - - { - wgpu::BufferCopyView bufCopy = {}; - bufCopy.buffer = buffer; - bufCopy.layout.bytesPerRow = kTextureBytesPerRowAlignment; - { - wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - encoder.CopyBufferToTexture(&bufCopy, &texCopy, ©Size); - encoder.CopyTextureToBuffer(&texCopy, &bufCopy, ©Size); - wgpu::CommandBuffer command = encoder.Finish(); - queue.Submit(1, &command); - } - - bufCopy.offset = 4; - testOne(bufCopy); - bufCopy.offset = 0; - bufCopy.bytesPerRow = kTextureBytesPerRowAlignment; - testOne(bufCopy); - bufCopy.bytesPerRow = 0; - bufCopy.rowsPerImage = 1; - testOne(bufCopy); - } -} - -DAWN_INSTANTIATE_TEST(BufferCopyViewDeprecationTests, - D3D12Backend(), - MetalBackend(), - NullBackend(), - OpenGLBackend(), - VulkanBackend());