mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-10 08:33:32 +00:00
Only Constants.h remains in no namespace; but it may be addressed in the future as well. Bug: dawn:302 Change-Id: Ib9b9ab4b974ad1de1bb9f2302f4d24d8216f55e4 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132841 Kokoro: Austin Eng <enga@chromium.org> Auto-Submit: Austin Eng <enga@chromium.org> Reviewed-by: Loko Kung <lokokung@google.com> Commit-Queue: Austin Eng <enga@chromium.org>
62 lines
2.3 KiB
C++
62 lines
2.3 KiB
C++
// 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 <vector>
|
|
|
|
#include "dawn/tests/MockCallback.h"
|
|
#include "dawn/tests/unittests/validation/ValidationTest.h"
|
|
#include "dawn/utils/ComboRenderBundleEncoderDescriptor.h"
|
|
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
|
#include "dawn/utils/WGPUHelpers.h"
|
|
|
|
namespace dawn {
|
|
namespace {
|
|
|
|
using testing::HasSubstr;
|
|
|
|
class UnsafeAPIValidationTest : public ValidationTest {
|
|
protected:
|
|
// UnsafeAPIValidationTest create the device with the AllowUnsafeAPIs toggle explicitly
|
|
// disabled, which overrides the inheritance.
|
|
WGPUDevice CreateTestDevice(native::Adapter dawnAdapter,
|
|
wgpu::DeviceDescriptor descriptor) override {
|
|
// Disable the AllowUnsafeAPIs toggles in device toggles descriptor to override the
|
|
// inheritance and create a device disallowing unsafe apis.
|
|
wgpu::DawnTogglesDescriptor deviceTogglesDesc;
|
|
descriptor.nextInChain = &deviceTogglesDesc;
|
|
const char* toggle = "allow_unsafe_apis";
|
|
deviceTogglesDesc.disabledToggles = &toggle;
|
|
deviceTogglesDesc.disabledTogglesCount = 1;
|
|
return dawnAdapter.CreateDevice(&descriptor);
|
|
}
|
|
};
|
|
|
|
// Check chromium_disable_uniformity_analysis is an unsafe API.
|
|
TEST_F(UnsafeAPIValidationTest, chromium_disable_uniformity_analysis) {
|
|
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
|
|
enable chromium_disable_uniformity_analysis;
|
|
|
|
@compute @workgroup_size(8) fn uniformity_error(
|
|
@builtin(local_invocation_id) local_invocation_id : vec3u
|
|
) {
|
|
if (local_invocation_id.x == 0u) {
|
|
workgroupBarrier();
|
|
}
|
|
}
|
|
)"));
|
|
}
|
|
|
|
} // anonymous namespace
|
|
} // namespace dawn
|