Remove deprecated zero default size of setIndexBuffer and setVertexBuffer

Remove deprecated usage of size=0 as default size in setIndexBuffer and
setVertexBuffer. Using size=0 now result in a zero-size binding instead
of default size.

Bug: dawn:1058
Change-Id: I2ef0afc8d8826aa87a17c037d4dd1baf14e09f89
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67744
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Zhaoming Jiang 2021-11-15 08:15:34 +00:00 committed by Dawn LUCI CQ
parent c38c4d32f4
commit 90c30f7355
3 changed files with 1 additions and 63 deletions

View File

@ -285,17 +285,6 @@ namespace dawn_native {
uint64_t remainingSize = bufferSize - offset;
// Temporarily treat 0 as undefined for size, and give a warning
// TODO(dawn:1058): Remove this if block
if (size == 0) {
size = wgpu::kWholeSize;
GetDevice()->EmitDeprecationWarning(
"Using size=0 to indicate default binding size for setIndexBuffer "
"is deprecated. In the future it will result in a zero-size binding. "
"Use `undefined` (wgpu::kWholeSize) or just omit the parameter "
"instead.");
}
if (size == wgpu::kWholeSize) {
size = remainingSize;
} else {
@ -353,17 +342,6 @@ namespace dawn_native {
uint64_t remainingSize = bufferSize - offset;
// Temporarily treat 0 as undefined for size, and give a warning
// TODO(dawn:1058): Remove this if block
if (size == 0) {
size = wgpu::kWholeSize;
GetDevice()->EmitDeprecationWarning(
"Using size=0 to indicate default binding size for setVertexBuffer "
"is deprecated. In the future it will result in a zero-size binding. "
"Use `undefined` (wgpu::kWholeSize) or just omit the parameter "
"instead.");
}
if (size == wgpu::kWholeSize) {
size = remainingSize;
} else {

View File

@ -34,43 +34,6 @@ class DeprecationTests : public DawnTest {
}
};
// Test that using size=0 to indicate default size in setVertexBuffer and setIndexBuffer is
// deprecated.
TEST_P(DeprecationTests, SetBufferWithZeroSizeAsDefault) {
wgpu::BufferDescriptor bufferDesc;
bufferDesc.size = 128;
bufferDesc.usage = wgpu::BufferUsage::Index | wgpu::BufferUsage::Vertex;
wgpu::Buffer buffer = device.CreateBuffer(&bufferDesc);
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass;
{
// Control case, use wgpu::kWholeSize to indicate default size.
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetIndexBuffer(buffer, wgpu::IndexFormat::Uint32, 0, wgpu::kWholeSize);
pass.SetVertexBuffer(0, buffer, 0, wgpu::kWholeSize);
pass.EndPass();
}
{
// Control case, omitting size parameter to indicate default size.
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetIndexBuffer(buffer, wgpu::IndexFormat::Uint32, 0);
pass.SetVertexBuffer(0, buffer, 0);
pass.EndPass();
}
{
// Deprecated case, use 0 to indicate default size will cause deprecated warning.
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
EXPECT_DEPRECATION_WARNING(pass.SetIndexBuffer(buffer, wgpu::IndexFormat::Uint32, 0, 0));
EXPECT_DEPRECATION_WARNING(pass.SetVertexBuffer(0, buffer, 0, 0));
pass.EndPass();
}
}
DAWN_INSTANTIATE_TEST(DeprecationTests,
D3D12Backend(),
MetalBackend(),

View File

@ -351,10 +351,7 @@ namespace {
{
// Explicit zero size
VertexBufferList vertexBufferList = {{0, vertexBuffer, 0, 0}};
// size=0 used as default size is deprecated but still avaliable.
// TODO(dawn:1058): Change the expectation when size=0 special case is removed.
EXPECT_DEPRECATION_WARNING(
TestRenderPassDraw(pipeline, vertexBufferList, 3, 1, 0, 0, true));
TestRenderPassDraw(pipeline, vertexBufferList, 3, 1, 0, 0, false);
}
}