Removes deprecation period code for maxBufferSize.

- Note that by default these are already errors, not warnings.

Change-Id: I46afa6e54e7915ba54aa6990cd641288609108c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128101
Reviewed-by: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
This commit is contained in:
Loko Kung 2023-04-21 08:40:54 +00:00 committed by Dawn LUCI CQ
parent 003e879fd9
commit c421a4b0ce
3 changed files with 26 additions and 21 deletions

View File

@ -131,11 +131,9 @@ MaybeError ValidateBufferDescriptor(DeviceBase* device, const BufferDescriptor*
"Buffer is mapped at creation but its size (%u) is not a multiple of 4.", "Buffer is mapped at creation but its size (%u) is not a multiple of 4.",
descriptor->size); descriptor->size);
if (descriptor->size > device->GetLimits().v1.maxBufferSize) { DAWN_INVALID_IF(descriptor->size > device->GetLimits().v1.maxBufferSize,
DAWN_TRY(DAWN_MAKE_DEPRECATION_ERROR( "Buffer size (%u) exceeds the max buffer size limit (%u).", descriptor->size,
device, "Buffer size (%u) exceeds the max buffer size limit (%u).", descriptor->size, device->GetLimits().v1.maxBufferSize);
device->GetLimits().v1.maxBufferSize));
}
return {}; return {};
} }

View File

@ -96,6 +96,29 @@ TEST_F(BufferValidationTest, CreationSuccess) {
} }
} }
// Test case where creation should succeed
TEST_F(BufferValidationTest, CreationMaxBufferSize) {
// Success when at limit
{
wgpu::BufferDescriptor descriptor;
descriptor.size = GetSupportedLimits().limits.maxBufferSize;
descriptor.usage = wgpu::BufferUsage::Uniform;
device.CreateBuffer(&descriptor);
}
// Error once it is pass the (default) limit on the device. (Note that MaxLimitTests tests at
// max possible limit given the adapters.)
{
wgpu::BufferDescriptor descriptor;
ASSERT_TRUE(GetSupportedLimits().limits.maxBufferSize <
std::numeric_limits<uint32_t>::max());
descriptor.size = GetSupportedLimits().limits.maxBufferSize + 1;
descriptor.usage = wgpu::BufferUsage::Uniform;
ASSERT_DEVICE_ERROR(device.CreateBuffer(&descriptor));
}
}
// Test restriction on usages must not be None (0) // Test restriction on usages must not be None (0)
TEST_F(BufferValidationTest, CreationMapUsageNotZero) { TEST_F(BufferValidationTest, CreationMapUsageNotZero) {
// Zero (None) usage is an error // Zero (None) usage is an error

View File

@ -120,22 +120,6 @@ TEST_P(DeprecationTests, Dispatch) {
pass.End(); pass.End();
} }
// Test that creating a buffer with size exceeding the maximum buffer size limit should emits a
// warning. (dawn:1525)
TEST_P(DeprecationTests, MaxBufferSizeValidation) {
wgpu::BufferDescriptor descriptor;
descriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
descriptor.size = 256;
device.CreateBuffer(&descriptor);
descriptor.size = GetSupportedLimits().limits.maxBufferSize;
device.CreateBuffer(&descriptor);
descriptor.size = GetSupportedLimits().limits.maxBufferSize + 1;
EXPECT_DEPRECATION_ERROR_OR_WARNING(device.CreateBuffer(&descriptor));
}
INSTANTIATE_TEST_SUITE_P(DeprecatedAPITest, INSTANTIATE_TEST_SUITE_P(DeprecatedAPITest,
DeprecationTests, DeprecationTests,
testing::Values(true, false), testing::Values(true, false),