Removes remaining V1 deprecation utilities.
- Note: Any future deprecations should directly use device->EmitDeprecationWarning and switch to a ValidationError after the deprecation period if applicable. Bug: dawn:1685 Change-Id: Ia2e51eca32a9645ce362718200c50240d51d6ea0 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130840 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Loko Kung <lokokung@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
980afb7cca
commit
ba242e53cc
|
@ -87,22 +87,6 @@ using ResultOrError = Result<T, ErrorData>;
|
||||||
for (;;) \
|
for (;;) \
|
||||||
break
|
break
|
||||||
|
|
||||||
// DAWN_MAKE_DEPRECATION_ERROR is used at deprecation paths. It returns a MaybeError.
|
|
||||||
// When the allow_deprecated_apis toggle is disabled, it creates an internal validation error.
|
|
||||||
// Otherwise it returns {}, emits a deprecation warning, and moves on.
|
|
||||||
#define DAWN_MAKE_DEPRECATION_ERROR(device, ...) \
|
|
||||||
device->IsToggleEnabled(Toggle::AllowDeprecatedAPIs) \
|
|
||||||
? (device->EmitDeprecationWarning(absl::StrFormat(__VA_ARGS__)), MaybeError{}) \
|
|
||||||
: MaybeError(DAWN_VALIDATION_ERROR(__VA_ARGS__))
|
|
||||||
|
|
||||||
// DAWN_DEPRECATED_IF is used analogous to DAWN_INVALID_IF at deprecation paths.
|
|
||||||
#define DAWN_DEPRECATED_IF(device, EXPR, ...) \
|
|
||||||
if (DAWN_UNLIKELY(EXPR)) { \
|
|
||||||
return DAWN_MAKE_DEPRECATION_ERROR(device, __VA_ARGS__); \
|
|
||||||
} \
|
|
||||||
for (;;) \
|
|
||||||
break
|
|
||||||
|
|
||||||
// DAWN_DEVICE_LOST_ERROR means that there was a real unrecoverable native device lost error.
|
// DAWN_DEVICE_LOST_ERROR means that there was a real unrecoverable native device lost error.
|
||||||
// We can't even do a graceful shutdown because the Device is gone.
|
// We can't even do a graceful shutdown because the Device is gone.
|
||||||
#define DAWN_DEVICE_LOST_ERROR(MESSAGE) DAWN_MAKE_ERROR(InternalErrorType::DeviceLost, MESSAGE)
|
#define DAWN_DEVICE_LOST_ERROR(MESSAGE) DAWN_MAKE_ERROR(InternalErrorType::DeviceLost, MESSAGE)
|
||||||
|
|
|
@ -387,12 +387,6 @@ static constexpr ToggleEnumAndInfoList kToggleNameAndInfoList = {{
|
||||||
"srcBlendFactor is 'DstAlpha'. Works around an Intel D3D12 driver issue about alpha "
|
"srcBlendFactor is 'DstAlpha'. Works around an Intel D3D12 driver issue about alpha "
|
||||||
"blending.",
|
"blending.",
|
||||||
"https://crbug.com/dawn/1579", ToggleStage::Device}},
|
"https://crbug.com/dawn/1579", ToggleStage::Device}},
|
||||||
{Toggle::AllowDeprecatedAPIs,
|
|
||||||
{"allow_deprecated_apis",
|
|
||||||
"Allows deprecated paths by changing the validation errors to deprecation warnings. This "
|
|
||||||
"toggle is off by default and is expected to get removed when WebGPU V1 ships and stays "
|
|
||||||
"stable.",
|
|
||||||
"https://crbug.com/dawn/1563", ToggleStage::Device}},
|
|
||||||
{Toggle::D3D12PolyfillReflectVec2F32,
|
{Toggle::D3D12PolyfillReflectVec2F32,
|
||||||
{"d3d12_polyfill_reflect_vec2_f32",
|
{"d3d12_polyfill_reflect_vec2_f32",
|
||||||
"Polyfill the reflect builtin for vec2<f32> for D3D12. This toggle is enabled by default on "
|
"Polyfill the reflect builtin for vec2<f32> for D3D12. This toggle is enabled by default on "
|
||||||
|
|
|
@ -92,7 +92,6 @@ enum class Toggle {
|
||||||
UseBlitForBufferToStencilTextureCopy,
|
UseBlitForBufferToStencilTextureCopy,
|
||||||
UseBlitForDepthTextureToTextureCopyToNonzeroSubresource,
|
UseBlitForDepthTextureToTextureCopyToNonzeroSubresource,
|
||||||
D3D12ReplaceAddWithMinusWhenDstFactorIsZeroAndSrcFactorIsDstAlpha,
|
D3D12ReplaceAddWithMinusWhenDstFactorIsZeroAndSrcFactorIsDstAlpha,
|
||||||
AllowDeprecatedAPIs,
|
|
||||||
D3D12PolyfillReflectVec2F32,
|
D3D12PolyfillReflectVec2F32,
|
||||||
VulkanClearGen12TextureWithCCSAmbiguateOnCreation,
|
VulkanClearGen12TextureWithCCSAmbiguateOnCreation,
|
||||||
|
|
||||||
|
|
|
@ -332,8 +332,6 @@ dawn_test("dawn_unittests") {
|
||||||
"unittests/validation/CopyCommandsValidationTests.cpp",
|
"unittests/validation/CopyCommandsValidationTests.cpp",
|
||||||
"unittests/validation/CopyTextureForBrowserTests.cpp",
|
"unittests/validation/CopyTextureForBrowserTests.cpp",
|
||||||
"unittests/validation/DebugMarkerValidationTests.cpp",
|
"unittests/validation/DebugMarkerValidationTests.cpp",
|
||||||
"unittests/validation/DeprecatedAPITests.cpp",
|
|
||||||
"unittests/validation/DeprecatedAPITests.h",
|
|
||||||
"unittests/validation/DeviceValidationTests.cpp",
|
"unittests/validation/DeviceValidationTests.cpp",
|
||||||
"unittests/validation/DrawIndirectValidationTests.cpp",
|
"unittests/validation/DrawIndirectValidationTests.cpp",
|
||||||
"unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp",
|
"unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp",
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
// Copyright 2020 The Dawn Authors
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
#include "dawn/tests/unittests/validation/DeprecatedAPITests.h"
|
|
||||||
|
|
||||||
#include "dawn/common/Constants.h"
|
|
||||||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
|
||||||
#include "dawn/utils/WGPUHelpers.h"
|
|
||||||
|
|
||||||
WGPUDevice DeprecationTests::CreateTestDevice(dawn::native::Adapter dawnAdapter) {
|
|
||||||
wgpu::DeviceDescriptor descriptor = {};
|
|
||||||
return dawnAdapter.CreateDevice(&descriptor);
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
// Copyright 2022 The Dawn Authors
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#ifndef SRC_DAWN_TESTS_UNITTESTS_VALIDATION_DEPRECATEDAPITESTS_H_
|
|
||||||
#define SRC_DAWN_TESTS_UNITTESTS_VALIDATION_DEPRECATEDAPITESTS_H_
|
|
||||||
|
|
||||||
#include "dawn/tests/unittests/validation/ValidationTest.h"
|
|
||||||
|
|
||||||
// This test header should be included when testing for deprecated parts of Dawn's API while
|
|
||||||
// following WebGPU's evolution. Tests in this suite test that a deprecation warning is emitted when
|
|
||||||
// the "old" behavior is used, and tests that an error is emitted when both the old and the new
|
|
||||||
// behavior are used (when applicable). Note that implementations of tests in this suite may be
|
|
||||||
// scattered in other files as well for organizational purposes so that similar tests can live
|
|
||||||
// together.
|
|
||||||
|
|
||||||
static constexpr char kAllowDeprecatedAPIsToggleName[] = "allow_deprecated_apis";
|
|
||||||
|
|
||||||
#define EXPECT_DEPRECATION_ERROR_OR_WARNING(statement) \
|
|
||||||
if (!HasToggleEnabled(kAllowDeprecatedAPIsToggleName)) { \
|
|
||||||
ASSERT_DEVICE_ERROR(statement); \
|
|
||||||
} else { \
|
|
||||||
EXPECT_DEPRECATION_WARNING(statement); \
|
|
||||||
} \
|
|
||||||
for (;;) \
|
|
||||||
break
|
|
||||||
|
|
||||||
#define EXPECT_DEPRECATION_WARNING_ONLY(statement) \
|
|
||||||
if (HasToggleEnabled(kAllowDeprecatedAPIsToggleName)) { \
|
|
||||||
EXPECT_DEPRECATION_WARNING(statement); \
|
|
||||||
} else { \
|
|
||||||
statement; \
|
|
||||||
} \
|
|
||||||
for (;;) \
|
|
||||||
break
|
|
||||||
|
|
||||||
#define EXPECT_DEPRECATION_ERROR_ONLY(statement) \
|
|
||||||
if (!HasToggleEnabled(kAllowDeprecatedAPIsToggleName)) { \
|
|
||||||
ASSERT_DEVICE_ERROR(statement); \
|
|
||||||
} else { \
|
|
||||||
statement; \
|
|
||||||
} \
|
|
||||||
for (;;) \
|
|
||||||
break
|
|
||||||
|
|
||||||
// Parameter is a single bool. When true, deprecated APIs are strictly disallowed (i.e. generate
|
|
||||||
// errors). Otherwise, deprecated APIs only generate a warning message.
|
|
||||||
class DeprecationTests : public ValidationTest, public testing::WithParamInterface<bool> {
|
|
||||||
protected:
|
|
||||||
WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // SRC_DAWN_TESTS_UNITTESTS_VALIDATION_DEPRECATEDAPITESTS_H_
|
|
|
@ -14,11 +14,8 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "dawn/tests/unittests/validation/DeprecatedAPITests.h"
|
|
||||||
#include "dawn/tests/unittests/validation/ValidationTest.h"
|
|
||||||
|
|
||||||
#include "dawn/common/Constants.h"
|
#include "dawn/common/Constants.h"
|
||||||
|
#include "dawn/tests/unittests/validation/ValidationTest.h"
|
||||||
#include "dawn/utils/ComboRenderBundleEncoderDescriptor.h"
|
#include "dawn/utils/ComboRenderBundleEncoderDescriptor.h"
|
||||||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||||
#include "dawn/utils/WGPUHelpers.h"
|
#include "dawn/utils/WGPUHelpers.h"
|
||||||
|
|
|
@ -15,11 +15,8 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "dawn/tests/unittests/validation/DeprecatedAPITests.h"
|
|
||||||
#include "dawn/tests/unittests/validation/ValidationTest.h"
|
|
||||||
|
|
||||||
#include "dawn/common/Constants.h"
|
#include "dawn/common/Constants.h"
|
||||||
|
#include "dawn/tests/unittests/validation/ValidationTest.h"
|
||||||
#include "dawn/utils/ComboRenderBundleEncoderDescriptor.h"
|
#include "dawn/utils/ComboRenderBundleEncoderDescriptor.h"
|
||||||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||||
#include "dawn/utils/WGPUHelpers.h"
|
#include "dawn/utils/WGPUHelpers.h"
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "dawn/common/Constants.h"
|
#include "dawn/common/Constants.h"
|
||||||
#include "dawn/tests/unittests/validation/DeprecatedAPITests.h"
|
|
||||||
#include "dawn/tests/unittests/validation/ValidationTest.h"
|
#include "dawn/tests/unittests/validation/ValidationTest.h"
|
||||||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||||
#include "dawn/utils/WGPUHelpers.h"
|
#include "dawn/utils/WGPUHelpers.h"
|
||||||
|
|
Loading…
Reference in New Issue