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:
parent
003e879fd9
commit
c421a4b0ce
|
@ -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.",
|
||||
descriptor->size);
|
||||
|
||||
if (descriptor->size > device->GetLimits().v1.maxBufferSize) {
|
||||
DAWN_TRY(DAWN_MAKE_DEPRECATION_ERROR(
|
||||
device, "Buffer size (%u) exceeds the max buffer size limit (%u).", descriptor->size,
|
||||
device->GetLimits().v1.maxBufferSize));
|
||||
}
|
||||
DAWN_INVALID_IF(descriptor->size > device->GetLimits().v1.maxBufferSize,
|
||||
"Buffer size (%u) exceeds the max buffer size limit (%u).", descriptor->size,
|
||||
device->GetLimits().v1.maxBufferSize);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -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_F(BufferValidationTest, CreationMapUsageNotZero) {
|
||||
// Zero (None) usage is an error
|
||||
|
|
|
@ -120,22 +120,6 @@ TEST_P(DeprecationTests, Dispatch) {
|
|||
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,
|
||||
DeprecationTests,
|
||||
testing::Values(true, false),
|
||||
|
|
Loading…
Reference in New Issue