mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 09:25:25 +00:00
Add a toggle to disable Dawn validation
Trusted users of Dawn should be able to use it without the overhead of command validation. This patch adds the toggle and skips validation for object creation. Bug: dawn:271 Change-Id: Ica9a1988177685d73e2c36e05c4d525ad1ab0fdb Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13802 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
98ba76af00
commit
4d15609d26
@@ -137,6 +137,11 @@ DawnTestEnvironment::DawnTestEnvironment(int argc, char** argv) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp("--skip-validation", argv[i]) == 0) {
|
||||
mSkipDawnValidation = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
constexpr const char kVendorIdFilterArg[] = "--adapter-vendor-id=";
|
||||
if (strstr(argv[i], kVendorIdFilterArg) == argv[i]) {
|
||||
const char* vendorIdFilter = argv[i] + strlen(kVendorIdFilterArg);
|
||||
@@ -156,6 +161,7 @@ DawnTestEnvironment::DawnTestEnvironment(int argc, char** argv) {
|
||||
" to disabled)\n"
|
||||
" -c, --begin-capture-on-startup: Begin debug capture on startup "
|
||||
"(defaults to no capture)\n"
|
||||
" --skip-validation: Skip Dawn validation\n"
|
||||
" --adapter-vendor-id: Select adapter by vendor id to run end2end tests"
|
||||
"on multi-GPU systems \n"
|
||||
<< std::endl;
|
||||
@@ -184,6 +190,9 @@ void DawnTestEnvironment::SetUp() {
|
||||
<< "\n"
|
||||
"EnableBackendValidation: "
|
||||
<< (mEnableBackendValidation ? "true" : "false")
|
||||
<< "\n"
|
||||
"SkipDawnValidation: "
|
||||
<< (mSkipDawnValidation ? "true" : "false")
|
||||
<< "\n"
|
||||
"BeginCaptureOnStartup: "
|
||||
<< (mBeginCaptureOnStartup ? "true" : "false")
|
||||
@@ -228,6 +237,10 @@ bool DawnTestEnvironment::IsBackendValidationEnabled() const {
|
||||
return mEnableBackendValidation;
|
||||
}
|
||||
|
||||
bool DawnTestEnvironment::IsDawnValidationSkipped() const {
|
||||
return mSkipDawnValidation;
|
||||
}
|
||||
|
||||
dawn_native::Instance* DawnTestEnvironment::GetInstance() const {
|
||||
return mInstance.get();
|
||||
}
|
||||
@@ -353,6 +366,10 @@ bool DawnTestBase::IsBackendValidationEnabled() const {
|
||||
return gTestEnv->IsBackendValidationEnabled();
|
||||
}
|
||||
|
||||
bool DawnTestBase::IsDawnValidationSkipped() const {
|
||||
return gTestEnv->IsDawnValidationSkipped();
|
||||
}
|
||||
|
||||
bool DawnTestBase::HasVendorIdFilter() const {
|
||||
return gTestEnv->HasVendorIdFilter();
|
||||
}
|
||||
@@ -431,6 +448,13 @@ void DawnTestBase::SetUp() {
|
||||
deviceDescriptor.forceEnabledToggles = mParam.forceEnabledWorkarounds;
|
||||
deviceDescriptor.forceDisabledToggles = mParam.forceDisabledWorkarounds;
|
||||
deviceDescriptor.requiredExtensions = GetRequiredExtensions();
|
||||
|
||||
static constexpr char kSkipValidationToggle[] = "skip_validation";
|
||||
if (gTestEnv->IsDawnValidationSkipped()) {
|
||||
ASSERT(gTestEnv->GetInstance()->GetToggleInfo(kSkipValidationToggle) != nullptr);
|
||||
deviceDescriptor.forceEnabledToggles.push_back(kSkipValidationToggle);
|
||||
}
|
||||
|
||||
backendDevice = mBackendAdapter.CreateDevice(&deviceDescriptor);
|
||||
ASSERT_NE(nullptr, backendDevice);
|
||||
|
||||
|
||||
@@ -134,6 +134,7 @@ class DawnTestEnvironment : public testing::Environment {
|
||||
|
||||
bool UsesWire() const;
|
||||
bool IsBackendValidationEnabled() const;
|
||||
bool IsDawnValidationSkipped() const;
|
||||
dawn_native::Instance* GetInstance() const;
|
||||
bool HasVendorIdFilter() const;
|
||||
uint32_t GetVendorIdFilter() const;
|
||||
@@ -146,6 +147,7 @@ class DawnTestEnvironment : public testing::Environment {
|
||||
|
||||
bool mUseWire = false;
|
||||
bool mEnableBackendValidation = false;
|
||||
bool mSkipDawnValidation = false;
|
||||
bool mBeginCaptureOnStartup = false;
|
||||
bool mHasVendorIdFilter = false;
|
||||
uint32_t mVendorIdFilter = 0;
|
||||
@@ -179,6 +181,7 @@ class DawnTestBase {
|
||||
|
||||
bool UsesWire() const;
|
||||
bool IsBackendValidationEnabled() const;
|
||||
bool IsDawnValidationSkipped() const;
|
||||
|
||||
void StartExpectDeviceError();
|
||||
bool EndExpectDeviceError();
|
||||
|
||||
@@ -23,6 +23,7 @@ class DestroyTest : public DawnTest {
|
||||
protected:
|
||||
void TestSetUp() override {
|
||||
DawnTest::TestSetUp();
|
||||
DAWN_SKIP_TEST_IF(IsDawnValidationSkipped());
|
||||
|
||||
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
|
||||
@@ -81,6 +81,8 @@ TEST_P(ObjectCachingTest, BindGroupLayoutTextureDimension) {
|
||||
|
||||
// Test that an error object doesn't try to uncache itself
|
||||
TEST_P(ObjectCachingTest, ErrorObjectDoesntUncache) {
|
||||
DAWN_SKIP_TEST_IF(IsDawnValidationSkipped());
|
||||
|
||||
ASSERT_DEVICE_ERROR(
|
||||
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::UniformBuffer},
|
||||
|
||||
Reference in New Issue
Block a user