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>
This commit is contained in:
parent
e236f7df27
commit
13f3340173
|
@ -175,14 +175,6 @@
|
|||
"buffer": {
|
||||
"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": [
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -271,17 +271,6 @@ namespace dawn_native {
|
|||
}
|
||||
}
|
||||
|
||||
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");
|
||||
|
|
|
@ -61,7 +61,6 @@ namespace dawn_native {
|
|||
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,
|
||||
|
|
|
@ -417,16 +417,6 @@ namespace dawn_wire { namespace client {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -51,8 +51,6 @@ namespace dawn_wire { namespace client {
|
|||
|
||||
void Destroy();
|
||||
|
||||
void SetSubData(uint64_t start, uint64_t count, const void* data);
|
||||
|
||||
private:
|
||||
bool IsMappedForReading() const;
|
||||
bool IsMappedForWriting() const;
|
||||
|
|
|
@ -168,24 +168,6 @@ namespace dawn_wire { namespace server {
|
|||
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) {
|
||||
|
|
|
@ -58,30 +58,6 @@ class DeprecationTests : public DawnTest {
|
|||
} \
|
||||
} 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(),
|
||||
|
|
Loading…
Reference in New Issue