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": {
|
"buffer": {
|
||||||
"category": "object",
|
"category": "object",
|
||||||
"methods": [
|
"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",
|
"name": "map read async",
|
||||||
"args": [
|
"args": [
|
||||||
|
|
|
@ -27,12 +27,6 @@
|
||||||
{ "name": "handle create info length", "type": "uint64_t" },
|
{ "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}
|
{ "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": [
|
"buffer update mapped data": [
|
||||||
{ "name": "buffer id", "type": "ObjectId" },
|
{ "name": "buffer id", "type": "ObjectId" },
|
||||||
{ "name": "write flush info length", "type": "uint64_t" },
|
{ "name": "write flush info length", "type": "uint64_t" },
|
||||||
|
@ -105,7 +99,6 @@
|
||||||
"BufferMapAsync",
|
"BufferMapAsync",
|
||||||
"BufferMapReadAsync",
|
"BufferMapReadAsync",
|
||||||
"BufferMapWriteAsync",
|
"BufferMapWriteAsync",
|
||||||
"BufferSetSubData",
|
|
||||||
"BufferGetConstMappedRange",
|
"BufferGetConstMappedRange",
|
||||||
"BufferGetMappedRange",
|
"BufferGetMappedRange",
|
||||||
"DeviceCreateBuffer",
|
"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) {
|
void BufferBase::MapReadAsync(WGPUBufferMapReadCallback callback, void* userdata) {
|
||||||
GetDevice()->EmitDeprecationWarning(
|
GetDevice()->EmitDeprecationWarning(
|
||||||
"Buffer::MapReadAsync is deprecated. Use Buffer::MapAsync instead");
|
"Buffer::MapReadAsync is deprecated. Use Buffer::MapAsync instead");
|
||||||
|
|
|
@ -61,7 +61,6 @@ namespace dawn_native {
|
||||||
void SetIsDataInitialized();
|
void SetIsDataInitialized();
|
||||||
|
|
||||||
// Dawn API
|
// Dawn API
|
||||||
void SetSubData(uint64_t start, uint64_t count, const void* data);
|
|
||||||
void MapReadAsync(WGPUBufferMapReadCallback callback, void* userdata);
|
void MapReadAsync(WGPUBufferMapReadCallback callback, void* userdata);
|
||||||
void MapWriteAsync(WGPUBufferMapWriteCallback callback, void* userdata);
|
void MapWriteAsync(WGPUBufferMapWriteCallback callback, void* userdata);
|
||||||
void MapAsync(wgpu::MapMode mode,
|
void MapAsync(wgpu::MapMode mode,
|
||||||
|
|
|
@ -417,16 +417,6 @@ namespace dawn_wire { namespace client {
|
||||||
device->GetClient()->SerializeCommand(cmd);
|
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 {
|
bool Buffer::IsMappedForReading() const {
|
||||||
return mReadHandle != nullptr;
|
return mReadHandle != nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,6 @@ namespace dawn_wire { namespace client {
|
||||||
|
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
|
||||||
void SetSubData(uint64_t start, uint64_t count, const void* data);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool IsMappedForReading() const;
|
bool IsMappedForReading() const;
|
||||||
bool IsMappedForWriting() const;
|
bool IsMappedForWriting() const;
|
||||||
|
|
|
@ -168,24 +168,6 @@ namespace dawn_wire { namespace server {
|
||||||
return true;
|
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,
|
bool Server::DoBufferUpdateMappedData(ObjectId bufferId,
|
||||||
uint64_t writeFlushInfoLength,
|
uint64_t writeFlushInfoLength,
|
||||||
const uint8_t* writeFlushInfo) {
|
const uint8_t* writeFlushInfo) {
|
||||||
|
|
|
@ -58,30 +58,6 @@ class DeprecationTests : public DawnTest {
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} 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,
|
DAWN_INSTANTIATE_TEST(DeprecationTests,
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
|
|
Loading…
Reference in New Issue