Remove wgpu::Buffer::SetSubData

Bug: dawn:22

Change-Id: Id2bb79e84064c0d81d4dec5e85340d015806f9bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26701
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/dawn.json b/dawn.json
index 64fca2a..72074db 100644
--- a/dawn.json
+++ b/dawn.json
@@ -176,14 +176,6 @@
         "category": "object",
         "methods": [
             {
-                "name": "set sub data",
-                "args": [
-                    {"name": "start", "type": "uint64_t"},
-                    {"name": "count", "type": "uint64_t"},
-                    {"name": "data", "type": "void", "annotation": "const*", "length": "count"}
-                ]
-            },
-            {
                 "name": "map read async",
                 "args": [
                     {"name": "callback", "type": "buffer map read callback"},
diff --git a/dawn_wire.json b/dawn_wire.json
index 51ab477..b2256a5 100644
--- a/dawn_wire.json
+++ b/dawn_wire.json
@@ -27,12 +27,6 @@
             { "name": "handle create info length", "type": "uint64_t" },
             { "name": "handle create info", "type": "uint8_t", "annotation": "const*", "length": "handle create info length", "skip_serialize": true}
         ],
-        "buffer set sub data internal": [
-            {"name": "buffer id", "type": "ObjectId" },
-            {"name": "start", "type": "uint64_t"},
-            {"name": "count", "type": "uint64_t"},
-            {"name": "data", "type": "uint8_t", "annotation": "const*", "length": "count"}
-        ],
         "buffer update mapped data": [
             { "name": "buffer id", "type": "ObjectId" },
             { "name": "write flush info length", "type": "uint64_t" },
@@ -105,7 +99,6 @@
             "BufferMapAsync",
             "BufferMapReadAsync",
             "BufferMapWriteAsync",
-            "BufferSetSubData",
             "BufferGetConstMappedRange",
             "BufferGetMappedRange",
             "DeviceCreateBuffer",
diff --git a/src/dawn_native/Buffer.cpp b/src/dawn_native/Buffer.cpp
index 1fcc3be..4dd1f3a 100644
--- a/src/dawn_native/Buffer.cpp
+++ b/src/dawn_native/Buffer.cpp
@@ -271,17 +271,6 @@
         }
     }
 
-    void BufferBase::SetSubData(uint64_t start, uint64_t count, const void* data) {
-        if (count > uint64_t(std::numeric_limits<size_t>::max())) {
-            GetDevice()->HandleError(InternalErrorType::Validation, "count too big");
-        }
-
-        Ref<QueueBase> queue = AcquireRef(GetDevice()->GetDefaultQueue());
-        GetDevice()->EmitDeprecationWarning(
-            "Buffer::SetSubData is deprecate. Use Queue::WriteBuffer instead");
-        queue->WriteBuffer(this, start, data, static_cast<size_t>(count));
-    }
-
     void BufferBase::MapReadAsync(WGPUBufferMapReadCallback callback, void* userdata) {
         GetDevice()->EmitDeprecationWarning(
             "Buffer::MapReadAsync is deprecated. Use Buffer::MapAsync instead");
diff --git a/src/dawn_native/Buffer.h b/src/dawn_native/Buffer.h
index 12aaade..1dd5278 100644
--- a/src/dawn_native/Buffer.h
+++ b/src/dawn_native/Buffer.h
@@ -61,7 +61,6 @@
         void SetIsDataInitialized();
 
         // Dawn API
-        void SetSubData(uint64_t start, uint64_t count, const void* data);
         void MapReadAsync(WGPUBufferMapReadCallback callback, void* userdata);
         void MapWriteAsync(WGPUBufferMapWriteCallback callback, void* userdata);
         void MapAsync(wgpu::MapMode mode,
diff --git a/src/dawn_wire/client/Buffer.cpp b/src/dawn_wire/client/Buffer.cpp
index f744ee6..86f5944 100644
--- a/src/dawn_wire/client/Buffer.cpp
+++ b/src/dawn_wire/client/Buffer.cpp
@@ -417,16 +417,6 @@
         device->GetClient()->SerializeCommand(cmd);
     }
 
-    void Buffer::SetSubData(uint64_t start, uint64_t count, const void* data) {
-        BufferSetSubDataInternalCmd cmd;
-        cmd.bufferId = id;
-        cmd.start = start;
-        cmd.count = count;
-        cmd.data = static_cast<const uint8_t*>(data);
-
-        device->GetClient()->SerializeCommand(cmd);
-    }
-
     bool Buffer::IsMappedForReading() const {
         return mReadHandle != nullptr;
     }
diff --git a/src/dawn_wire/client/Buffer.h b/src/dawn_wire/client/Buffer.h
index 1143779..5c32c75 100644
--- a/src/dawn_wire/client/Buffer.h
+++ b/src/dawn_wire/client/Buffer.h
@@ -51,8 +51,6 @@
 
         void Destroy();
 
-        void SetSubData(uint64_t start, uint64_t count, const void* data);
-
       private:
         bool IsMappedForReading() const;
         bool IsMappedForWriting() const;
diff --git a/src/dawn_wire/server/ServerBuffer.cpp b/src/dawn_wire/server/ServerBuffer.cpp
index dd71638..f85ff15 100644
--- a/src/dawn_wire/server/ServerBuffer.cpp
+++ b/src/dawn_wire/server/ServerBuffer.cpp
@@ -168,24 +168,6 @@
         return true;
     }
 
-    bool Server::DoBufferSetSubDataInternal(ObjectId bufferId,
-                                            uint64_t start,
-                                            uint64_t offset,
-                                            const uint8_t* data) {
-        // The null object isn't valid as `self`
-        if (bufferId == 0) {
-            return false;
-        }
-
-        auto* buffer = BufferObjects().Get(bufferId);
-        if (buffer == nullptr) {
-            return false;
-        }
-
-        mProcs.bufferSetSubData(buffer->handle, start, offset, data);
-        return true;
-    }
-
     bool Server::DoBufferUpdateMappedData(ObjectId bufferId,
                                           uint64_t writeFlushInfoLength,
                                           const uint8_t* writeFlushInfo) {
diff --git a/src/tests/end2end/DeprecatedAPITests.cpp b/src/tests/end2end/DeprecatedAPITests.cpp
index bc0bca9..66fc4c4 100644
--- a/src/tests/end2end/DeprecatedAPITests.cpp
+++ b/src/tests/end2end/DeprecatedAPITests.cpp
@@ -58,30 +58,6 @@
         }                                                                        \
     } while (0)
 
-// Test that using SetSubData emits a deprecation warning.
-TEST_P(DeprecationTests, SetSubDataDeprecated) {
-    wgpu::BufferDescriptor descriptor;
-    descriptor.usage = wgpu::BufferUsage::CopyDst;
-    descriptor.size = 4;
-    wgpu::Buffer buffer = device.CreateBuffer(&descriptor);
-
-    EXPECT_DEPRECATION_WARNING(buffer.SetSubData(0, 0, nullptr));
-}
-
-// Test that using SetSubData works
-TEST_P(DeprecationTests, SetSubDataStillWorks) {
-    DAWN_SKIP_TEST_IF(IsNull());
-
-    wgpu::BufferDescriptor descriptor;
-    descriptor.usage = wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::CopySrc;
-    descriptor.size = 4;
-    wgpu::Buffer buffer = device.CreateBuffer(&descriptor);
-
-    uint32_t data = 2020;
-    EXPECT_DEPRECATION_WARNING(buffer.SetSubData(0, 4, &data));
-    EXPECT_BUFFER_U32_EQ(data, buffer, 0);
-}
-
 DAWN_INSTANTIATE_TEST(DeprecationTests,
                       D3D12Backend(),
                       MetalBackend(),