Dawn: Deprecate DawnTogglesDeviceDescriptor with DawnTogglesDescriptor
This CL deprecates DawnTogglesDeviceDescriptor and replace it with DawnTogglesDescriptor, which will be also used to provide instance and adapter toggles with future CLs. Bug: dawn:1495 Change-Id: I5f5cfdf38dcbcd237727a7f921462597b9301f1f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117174 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Kokoro: Zhaoming Jiang <zhaoming.jiang@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
64d8d18a93
commit
a12ff9abd1
19
dawn.json
19
dawn.json
|
@ -159,7 +159,7 @@
|
|||
]
|
||||
},
|
||||
"dawn toggles device descriptor": {
|
||||
"tags": ["dawn", "native"],
|
||||
"tags": ["dawn", "native", "deprecated"],
|
||||
"category": "structure",
|
||||
"chained": "in",
|
||||
"chain roots": ["device descriptor"],
|
||||
|
@ -170,6 +170,18 @@
|
|||
{"name": "force disabled toggles", "type": "char", "annotation": "const*const*", "length": "force disabled toggles count"}
|
||||
]
|
||||
},
|
||||
"dawn toggles descriptor": {
|
||||
"tags": ["dawn", "native"],
|
||||
"category": "structure",
|
||||
"chained": "in",
|
||||
"chain roots": ["device descriptor"],
|
||||
"members": [
|
||||
{"name": "enabled toggles count", "type": "uint32_t", "default": 0},
|
||||
{"name": "enabled toggles", "type": "char", "annotation": "const*const*", "length": "enabled toggles count"},
|
||||
{"name": "disabled toggles count", "type": "uint32_t", "default": 0},
|
||||
{"name": "disabled toggles", "type": "char", "annotation": "const*const*", "length": "disabled toggles count"}
|
||||
]
|
||||
},
|
||||
"dawn cache device descriptor" : {
|
||||
"tags": ["dawn", "native"],
|
||||
"category": "structure",
|
||||
|
@ -2601,12 +2613,13 @@
|
|||
{"value": 14, "name": "surface descriptor from windows swap chain panel", "tags": ["dawn"]},
|
||||
{"value": 15, "name": "render pass descriptor max draw count"},
|
||||
{"value": 1000, "name": "dawn texture internal usage descriptor", "tags": ["dawn"]},
|
||||
{"value": 1002, "name": "dawn toggles device descriptor", "tags": ["dawn", "native"]},
|
||||
{"value": 1002, "name": "dawn toggles device descriptor", "tags": ["dawn", "native", "deprecated"]},
|
||||
{"value": 1003, "name": "dawn encoder internal usage descriptor", "tags": ["dawn"]},
|
||||
{"value": 1004, "name": "dawn instance descriptor", "tags": ["dawn", "native"]},
|
||||
{"value": 1005, "name": "dawn cache device descriptor", "tags": ["dawn", "native"]},
|
||||
{"value": 1006, "name": "dawn adapter properties power preference", "tags": ["dawn", "native"]},
|
||||
{"value": 1007, "name": "dawn buffer descriptor error info from wire client", "tags": ["dawn"]}
|
||||
{"value": 1007, "name": "dawn buffer descriptor error info from wire client", "tags": ["dawn"]},
|
||||
{"value": 1008, "name": "dawn toggles descriptor", "tags": ["dawn", "native"]}
|
||||
]
|
||||
},
|
||||
"texture": {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "dawn/common/Constants.h"
|
||||
#include "dawn/common/GPUInfo.h"
|
||||
#include "dawn/common/Log.h"
|
||||
#include "dawn/native/ChainUtils_autogen.h"
|
||||
#include "dawn/native/Device.h"
|
||||
#include "dawn/native/Instance.h"
|
||||
|
@ -233,10 +234,38 @@ ResultOrError<Ref<DeviceBase>> AdapterBase::CreateDeviceInternal(
|
|||
// Check overriden toggles before creating device, as some device features may be guarded by
|
||||
// toggles, and requiring such features without using corresponding toggles should fails the
|
||||
// device creating.
|
||||
const DawnTogglesDeviceDescriptor* togglesDesc = nullptr;
|
||||
FindInChain(descriptor->nextInChain, &togglesDesc);
|
||||
const DawnTogglesDescriptor* deviceTogglesDesc = nullptr;
|
||||
FindInChain(descriptor->nextInChain, &deviceTogglesDesc);
|
||||
|
||||
// Handle the deprecated DawnTogglesDeviceDescriptor
|
||||
// TODO(dawn:1495): Remove this fallback once Chromium is changed to use DawnToggleDescriptor
|
||||
// and DawnTogglesDeviceDescriptor is removed.
|
||||
const DawnTogglesDeviceDescriptor* deprecatedTogglesDeviceDesc = nullptr;
|
||||
DawnTogglesDescriptor convertedDeviceTogglesDesc = {};
|
||||
FindInChain(descriptor->nextInChain, &deprecatedTogglesDeviceDesc);
|
||||
|
||||
if (deprecatedTogglesDeviceDesc) {
|
||||
// Emit the deprecation warning.
|
||||
dawn::WarningLog()
|
||||
<< "DawnTogglesDeviceDescriptor is deprecated and replaced by DawnTogglesDescriptor.";
|
||||
// Ensure that at most one toggles descriptor is used.
|
||||
DAWN_INVALID_IF(
|
||||
deviceTogglesDesc && deprecatedTogglesDeviceDesc,
|
||||
"DawnTogglesDeviceDescriptor should not be used together with DawnTogglesDescriptor.");
|
||||
|
||||
convertedDeviceTogglesDesc.enabledToggles =
|
||||
deprecatedTogglesDeviceDesc->forceEnabledToggles;
|
||||
convertedDeviceTogglesDesc.enabledTogglesCount =
|
||||
deprecatedTogglesDeviceDesc->forceEnabledTogglesCount;
|
||||
convertedDeviceTogglesDesc.disabledToggles =
|
||||
deprecatedTogglesDeviceDesc->forceDisabledToggles;
|
||||
convertedDeviceTogglesDesc.disabledTogglesCount =
|
||||
deprecatedTogglesDeviceDesc->forceDisabledTogglesCount;
|
||||
deviceTogglesDesc = &convertedDeviceTogglesDesc;
|
||||
}
|
||||
|
||||
TripleStateTogglesSet userProvidedToggles =
|
||||
TripleStateTogglesSet::CreateFromTogglesDeviceDescriptor(togglesDesc);
|
||||
TripleStateTogglesSet::CreateFromTogglesDescriptor(deviceTogglesDesc);
|
||||
|
||||
// Validate all required features are supported by the adapter and suitable under given toggles.
|
||||
for (uint32_t i = 0; i < descriptor->requiredFeaturesCount; ++i) {
|
||||
|
|
|
@ -38,10 +38,10 @@ struct ComboDeprecatedDawnDeviceDescriptor : DeviceDescriptor {
|
|||
|
||||
if (deviceDescriptor != nullptr) {
|
||||
desc->nextInChain = &mTogglesDesc;
|
||||
mTogglesDesc.forceEnabledToggles = deviceDescriptor->forceEnabledToggles.data();
|
||||
mTogglesDesc.forceEnabledTogglesCount = deviceDescriptor->forceEnabledToggles.size();
|
||||
mTogglesDesc.forceDisabledToggles = deviceDescriptor->forceDisabledToggles.data();
|
||||
mTogglesDesc.forceDisabledTogglesCount = deviceDescriptor->forceDisabledToggles.size();
|
||||
mTogglesDesc.enabledToggles = deviceDescriptor->forceEnabledToggles.data();
|
||||
mTogglesDesc.enabledTogglesCount = deviceDescriptor->forceEnabledToggles.size();
|
||||
mTogglesDesc.disabledToggles = deviceDescriptor->forceDisabledToggles.data();
|
||||
mTogglesDesc.disabledTogglesCount = deviceDescriptor->forceDisabledToggles.size();
|
||||
|
||||
desc->requiredLimits =
|
||||
reinterpret_cast<const RequiredLimits*>(deviceDescriptor->requiredLimits);
|
||||
|
@ -55,7 +55,7 @@ struct ComboDeprecatedDawnDeviceDescriptor : DeviceDescriptor {
|
|||
}
|
||||
}
|
||||
|
||||
DawnTogglesDeviceDescriptor mTogglesDesc = {};
|
||||
DawnTogglesDescriptor mTogglesDesc = {};
|
||||
std::vector<wgpu::FeatureName> mRequiredFeatures = {};
|
||||
};
|
||||
} // namespace
|
||||
|
|
|
@ -400,20 +400,20 @@ std::vector<const char*> TogglesSet::GetContainedToggleNames() const {
|
|||
return togglesNameInUse;
|
||||
}
|
||||
|
||||
TripleStateTogglesSet TripleStateTogglesSet::CreateFromTogglesDeviceDescriptor(
|
||||
const DawnTogglesDeviceDescriptor* togglesDesc) {
|
||||
TripleStateTogglesSet TripleStateTogglesSet::CreateFromTogglesDescriptor(
|
||||
const DawnTogglesDescriptor* togglesDesc) {
|
||||
TripleStateTogglesSet userToggles;
|
||||
if (togglesDesc != nullptr) {
|
||||
TogglesInfo togglesInfo;
|
||||
for (uint32_t i = 0; i < togglesDesc->forceEnabledTogglesCount; ++i) {
|
||||
Toggle toggle = togglesInfo.ToggleNameToEnum(togglesDesc->forceEnabledToggles[i]);
|
||||
for (uint32_t i = 0; i < togglesDesc->enabledTogglesCount; ++i) {
|
||||
Toggle toggle = togglesInfo.ToggleNameToEnum(togglesDesc->enabledToggles[i]);
|
||||
if (toggle != Toggle::InvalidEnum) {
|
||||
userToggles.togglesIsProvided.Set(toggle, true);
|
||||
userToggles.providedTogglesEnabled.Set(toggle, true);
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < togglesDesc->forceDisabledTogglesCount; ++i) {
|
||||
Toggle toggle = togglesInfo.ToggleNameToEnum(togglesDesc->forceDisabledToggles[i]);
|
||||
for (uint32_t i = 0; i < togglesDesc->disabledTogglesCount; ++i) {
|
||||
Toggle toggle = togglesInfo.ToggleNameToEnum(togglesDesc->disabledToggles[i]);
|
||||
if (toggle != Toggle::InvalidEnum) {
|
||||
userToggles.togglesIsProvided.Set(toggle, true);
|
||||
userToggles.providedTogglesEnabled.Set(toggle, false);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
namespace dawn::native {
|
||||
|
||||
struct DawnTogglesDeviceDescriptor;
|
||||
struct DawnTogglesDescriptor;
|
||||
|
||||
enum class Toggle {
|
||||
EmulateStoreAndMSAAResolve,
|
||||
|
@ -114,8 +114,8 @@ struct TripleStateTogglesSet {
|
|||
TogglesSet togglesIsProvided;
|
||||
TogglesSet providedTogglesEnabled;
|
||||
|
||||
static TripleStateTogglesSet CreateFromTogglesDeviceDescriptor(
|
||||
const DawnTogglesDeviceDescriptor* togglesDesc);
|
||||
static TripleStateTogglesSet CreateFromTogglesDescriptor(
|
||||
const DawnTogglesDescriptor* togglesDesc);
|
||||
// Provide a single toggle with given state.
|
||||
void Set(Toggle toggle, bool enabled);
|
||||
bool IsProvided(Toggle toggle) const;
|
||||
|
|
|
@ -162,23 +162,23 @@ interop::Promise<interop::Interface<interop::GPUDevice>> GPUAdapter::requestDevi
|
|||
}
|
||||
|
||||
// Propogate enabled/disabled dawn features
|
||||
// Note: DawnDeviceTogglesDescriptor::forceEnabledToggles and forceDisabledToggles are
|
||||
// vectors of 'const char*', so we make sure the parsed strings survive the CreateDevice()
|
||||
// call by storing them on the stack.
|
||||
std::vector<std::string> enabledToggles;
|
||||
std::vector<std::string> disabledToggles;
|
||||
std::vector<const char*> forceEnabledToggles;
|
||||
std::vector<const char*> forceDisabledToggles;
|
||||
// Note: DawnTogglesDescriptor::enabledToggles and disabledToggles are vectors of 'const char*',
|
||||
// so we make sure the parsed strings survive the CreateDevice() call by storing them on the
|
||||
// stack.
|
||||
std::vector<std::string> enabledTogglesString;
|
||||
std::vector<std::string> disabledTogglesString;
|
||||
std::vector<const char*> enabledToggles;
|
||||
std::vector<const char*> disabledToggles;
|
||||
if (auto values = flags_.Get("enable-dawn-features")) {
|
||||
enabledToggles = Split(*values, ',');
|
||||
for (auto& t : enabledToggles) {
|
||||
forceEnabledToggles.emplace_back(t.c_str());
|
||||
enabledTogglesString = Split(*values, ',');
|
||||
for (auto& t : enabledTogglesString) {
|
||||
enabledToggles.emplace_back(t.c_str());
|
||||
}
|
||||
}
|
||||
if (auto values = flags_.Get("disable-dawn-features")) {
|
||||
disabledToggles = Split(*values, ',');
|
||||
for (auto& t : disabledToggles) {
|
||||
forceDisabledToggles.emplace_back(t.c_str());
|
||||
disabledTogglesString = Split(*values, ',');
|
||||
for (auto& t : disabledTogglesString) {
|
||||
disabledToggles.emplace_back(t.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,12 +186,12 @@ interop::Promise<interop::Interface<interop::GPUDevice>> GPUAdapter::requestDevi
|
|||
desc.requiredFeatures = requiredFeatures.data();
|
||||
desc.requiredLimits = &limits;
|
||||
|
||||
DawnTogglesDeviceDescriptor togglesDesc = {};
|
||||
desc.nextInChain = &togglesDesc;
|
||||
togglesDesc.forceEnabledTogglesCount = forceEnabledToggles.size();
|
||||
togglesDesc.forceEnabledToggles = forceEnabledToggles.data();
|
||||
togglesDesc.forceDisabledTogglesCount = forceDisabledToggles.size();
|
||||
togglesDesc.forceDisabledToggles = forceDisabledToggles.data();
|
||||
DawnTogglesDescriptor deviceTogglesDesc = {};
|
||||
desc.nextInChain = &deviceTogglesDesc;
|
||||
deviceTogglesDesc.enabledTogglesCount = enabledToggles.size();
|
||||
deviceTogglesDesc.enabledToggles = enabledToggles.data();
|
||||
deviceTogglesDesc.disabledTogglesCount = disabledToggles.size();
|
||||
deviceTogglesDesc.disabledToggles = disabledToggles.data();
|
||||
|
||||
auto wgpu_device = adapter_.CreateDevice(&desc);
|
||||
if (wgpu_device) {
|
||||
|
|
|
@ -79,12 +79,12 @@ std::unique_ptr<dawn::platform::Platform> DawnNativeTest::CreateTestPlatform() {
|
|||
WGPUDevice DawnNativeTest::CreateTestDevice() {
|
||||
// Disabled disallowing unsafe APIs so we can test them.
|
||||
wgpu::DeviceDescriptor deviceDescriptor = {};
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc = {};
|
||||
deviceDescriptor.nextInChain = &togglesDesc;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc = {};
|
||||
deviceDescriptor.nextInChain = &deviceTogglesDesc;
|
||||
|
||||
const char* toggle = "disallow_unsafe_apis";
|
||||
togglesDesc.forceDisabledToggles = &toggle;
|
||||
togglesDesc.forceDisabledTogglesCount = 1;
|
||||
deviceTogglesDesc.disabledToggles = &toggle;
|
||||
deviceTogglesDesc.disabledTogglesCount = 1;
|
||||
|
||||
return adapter.CreateDevice(&deviceDescriptor);
|
||||
}
|
||||
|
|
|
@ -882,15 +882,15 @@ WGPUDevice DawnTestBase::CreateDeviceImpl(std::string isolationKey) {
|
|||
deviceDescriptor.requiredFeatures = requiredFeatures.data();
|
||||
deviceDescriptor.requiredFeaturesCount = requiredFeatures.size();
|
||||
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc = {};
|
||||
deviceDescriptor.nextInChain = &togglesDesc;
|
||||
togglesDesc.forceEnabledToggles = forceEnabledToggles.data();
|
||||
togglesDesc.forceEnabledTogglesCount = forceEnabledToggles.size();
|
||||
togglesDesc.forceDisabledToggles = forceDisabledToggles.data();
|
||||
togglesDesc.forceDisabledTogglesCount = forceDisabledToggles.size();
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc = {};
|
||||
deviceDescriptor.nextInChain = &deviceTogglesDesc;
|
||||
deviceTogglesDesc.enabledToggles = forceEnabledToggles.data();
|
||||
deviceTogglesDesc.enabledTogglesCount = forceEnabledToggles.size();
|
||||
deviceTogglesDesc.disabledToggles = forceDisabledToggles.data();
|
||||
deviceTogglesDesc.disabledTogglesCount = forceDisabledToggles.size();
|
||||
|
||||
wgpu::DawnCacheDeviceDescriptor cacheDesc = {};
|
||||
togglesDesc.nextInChain = &cacheDesc;
|
||||
deviceTogglesDesc.nextInChain = &cacheDesc;
|
||||
cacheDesc.isolationKey = isolationKey.c_str();
|
||||
|
||||
return mBackendAdapter.CreateDevice(&deviceDescriptor);
|
||||
|
|
|
@ -77,11 +77,11 @@ TEST_F(FeatureTests, AdapterWithRequiredFeatureDisabled) {
|
|||
unsafeDeviceDescriptor.requiredFeatures = &featureName;
|
||||
unsafeDeviceDescriptor.requiredFeaturesCount = 1;
|
||||
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc;
|
||||
unsafeDeviceDescriptor.nextInChain = &togglesDesc;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc;
|
||||
unsafeDeviceDescriptor.nextInChain = &deviceTogglesDesc;
|
||||
const char* toggle = "disallow_unsafe_apis";
|
||||
togglesDesc.forceDisabledToggles = &toggle;
|
||||
togglesDesc.forceDisabledTogglesCount = 1;
|
||||
deviceTogglesDesc.disabledToggles = &toggle;
|
||||
deviceTogglesDesc.disabledTogglesCount = 1;
|
||||
|
||||
WGPUDevice deviceWithFeature = adapterWithoutFeature.CreateDevice(
|
||||
reinterpret_cast<const WGPUDeviceDescriptor*>(&unsafeDeviceDescriptor));
|
||||
|
@ -133,9 +133,9 @@ TEST_F(FeatureTests, RequireAndGetEnabledFeatures) {
|
|||
unsafeDeviceDescriptor.requiredFeaturesCount = 1;
|
||||
|
||||
const char* const disableToggles[] = {"disallow_unsafe_apis"};
|
||||
wgpu::DawnTogglesDeviceDescriptor toggleDesc;
|
||||
toggleDesc.forceDisabledToggles = disableToggles;
|
||||
toggleDesc.forceDisabledTogglesCount = 1;
|
||||
wgpu::DawnTogglesDescriptor toggleDesc;
|
||||
toggleDesc.disabledToggles = disableToggles;
|
||||
toggleDesc.disabledTogglesCount = 1;
|
||||
unsafeDeviceDescriptor.nextInChain = &toggleDesc;
|
||||
|
||||
dawn::native::DeviceBase* deviceBase = dawn::native::FromAPI(adapter.CreateDevice(
|
||||
|
|
|
@ -77,12 +77,12 @@ TEST_F(DeviceCreationTest, CreateDeviceSuccess) {
|
|||
// Test successful call to CreateDevice with toggle descriptor.
|
||||
TEST_F(DeviceCreationTest, CreateDeviceWithTogglesSuccess) {
|
||||
wgpu::DeviceDescriptor desc = {};
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc = {};
|
||||
desc.nextInChain = &togglesDesc;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc = {};
|
||||
desc.nextInChain = &deviceTogglesDesc;
|
||||
|
||||
const char* toggle = "skip_validation";
|
||||
togglesDesc.forceEnabledToggles = &toggle;
|
||||
togglesDesc.forceEnabledTogglesCount = 1;
|
||||
deviceTogglesDesc.enabledToggles = &toggle;
|
||||
deviceTogglesDesc.enabledTogglesCount = 1;
|
||||
|
||||
wgpu::Device device = adapter.CreateDevice(&desc);
|
||||
EXPECT_NE(device, nullptr);
|
||||
|
@ -110,10 +110,10 @@ TEST_F(DeviceCreationTest, CreateDeviceRequiringFeaturesGuardedByToggle) {
|
|||
// Test creating device without DisallowUnsafeApis toggle disabled.
|
||||
{
|
||||
const char* const disableToggles[] = {"disallow_unsafe_apis"};
|
||||
wgpu::DawnTogglesDeviceDescriptor toggleDesc;
|
||||
toggleDesc.forceDisabledToggles = disableToggles;
|
||||
toggleDesc.forceDisabledTogglesCount = 1;
|
||||
deviceDescriptor.nextInChain = &toggleDesc;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc;
|
||||
deviceTogglesDesc.disabledToggles = disableToggles;
|
||||
deviceTogglesDesc.disabledTogglesCount = 1;
|
||||
deviceDescriptor.nextInChain = &deviceTogglesDesc;
|
||||
|
||||
wgpu::Device device = adapter.CreateDevice(&deviceDescriptor);
|
||||
EXPECT_NE(device, nullptr);
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
WGPUDevice DeprecationTests::CreateTestDevice(dawn::native::Adapter dawnAdapter) {
|
||||
wgpu::DeviceDescriptor descriptor = {};
|
||||
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc = {};
|
||||
const char* forceEnabledToggles[1] = {kDisallowDeprecatedAPIsToggleName};
|
||||
togglesDesc.forceEnabledToggles = forceEnabledToggles;
|
||||
togglesDesc.forceEnabledTogglesCount = 1;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc = {};
|
||||
const char* enabledToggles[1] = {kDisallowDeprecatedAPIsToggleName};
|
||||
deviceTogglesDesc.enabledToggles = enabledToggles;
|
||||
deviceTogglesDesc.enabledTogglesCount = 1;
|
||||
|
||||
if (GetParam()) {
|
||||
descriptor.nextInChain = &togglesDesc;
|
||||
descriptor.nextInChain = &deviceTogglesDesc;
|
||||
}
|
||||
return dawnAdapter.CreateDevice(&descriptor);
|
||||
}
|
||||
|
|
|
@ -279,11 +279,11 @@ class TimestampQueryValidationTest : public QuerySetValidationTest {
|
|||
descriptor.requiredFeatures = requiredFeatures;
|
||||
descriptor.requiredFeaturesCount = 1;
|
||||
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc;
|
||||
descriptor.nextInChain = &togglesDesc;
|
||||
const char* forceDisabledToggles[1] = {"disallow_unsafe_apis"};
|
||||
togglesDesc.forceDisabledToggles = forceDisabledToggles;
|
||||
togglesDesc.forceDisabledTogglesCount = 1;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc;
|
||||
descriptor.nextInChain = &deviceTogglesDesc;
|
||||
const char* disabledToggles[1] = {"disallow_unsafe_apis"};
|
||||
deviceTogglesDesc.disabledToggles = disabledToggles;
|
||||
deviceTogglesDesc.disabledTogglesCount = 1;
|
||||
|
||||
return dawnAdapter.CreateDevice(&descriptor);
|
||||
}
|
||||
|
@ -582,11 +582,11 @@ class TimestampQueryInsidePassesValidationTest : public QuerySetValidationTest {
|
|||
descriptor.requiredFeatures = requiredFeatures;
|
||||
descriptor.requiredFeaturesCount = 2;
|
||||
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc;
|
||||
descriptor.nextInChain = &togglesDesc;
|
||||
const char* forceDisabledToggles[1] = {"disallow_unsafe_apis"};
|
||||
togglesDesc.forceDisabledToggles = forceDisabledToggles;
|
||||
togglesDesc.forceDisabledTogglesCount = 1;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc;
|
||||
descriptor.nextInChain = &deviceTogglesDesc;
|
||||
const char* disabledToggles[1] = {"disallow_unsafe_apis"};
|
||||
deviceTogglesDesc.disabledToggles = disabledToggles;
|
||||
deviceTogglesDesc.disabledTogglesCount = 1;
|
||||
|
||||
return dawnAdapter.CreateDevice(&descriptor);
|
||||
}
|
||||
|
@ -729,11 +729,11 @@ class PipelineStatisticsQueryValidationTest : public QuerySetValidationTest {
|
|||
|
||||
// TODO(crbug.com/1177506): Pipeline statistic query is an unsafe API, disable disallowing
|
||||
// unsafe APIs to test it.
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc;
|
||||
descriptor.nextInChain = &togglesDesc;
|
||||
const char* forceDisabledToggles[1] = {"disallow_unsafe_apis"};
|
||||
togglesDesc.forceDisabledToggles = forceDisabledToggles;
|
||||
togglesDesc.forceDisabledTogglesCount = 1;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc;
|
||||
descriptor.nextInChain = &deviceTogglesDesc;
|
||||
const char* disabledToggles[1] = {"disallow_unsafe_apis"};
|
||||
deviceTogglesDesc.disabledToggles = disabledToggles;
|
||||
deviceTogglesDesc.disabledTogglesCount = 1;
|
||||
|
||||
return dawnAdapter.CreateDevice(&descriptor);
|
||||
}
|
||||
|
|
|
@ -27,20 +27,20 @@ class RenderPipelineValidationTest : public ValidationTest {
|
|||
protected:
|
||||
WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override {
|
||||
// Disabled disallowing unsafe APIs so we can test ShaderF16 feature.
|
||||
const char* forceDisabledToggle[] = {"disallow_unsafe_apis"};
|
||||
const char* disabledToggle[] = {"disallow_unsafe_apis"};
|
||||
|
||||
wgpu::DeviceDescriptor descriptor;
|
||||
wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::ShaderF16};
|
||||
descriptor.requiredFeatures = requiredFeatures;
|
||||
descriptor.requiredFeaturesCount = 1;
|
||||
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc;
|
||||
descriptor.nextInChain = &togglesDesc;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc;
|
||||
descriptor.nextInChain = &deviceTogglesDesc;
|
||||
|
||||
togglesDesc.forceEnabledToggles = nullptr;
|
||||
togglesDesc.forceEnabledTogglesCount = 0;
|
||||
togglesDesc.forceDisabledToggles = forceDisabledToggle;
|
||||
togglesDesc.forceDisabledTogglesCount = 1;
|
||||
deviceTogglesDesc.enabledToggles = nullptr;
|
||||
deviceTogglesDesc.enabledTogglesCount = 0;
|
||||
deviceTogglesDesc.disabledToggles = disabledToggle;
|
||||
deviceTogglesDesc.disabledTogglesCount = 1;
|
||||
|
||||
return dawnAdapter.CreateDevice(&descriptor);
|
||||
}
|
||||
|
|
|
@ -731,11 +731,11 @@ class CompressedTextureFormatsValidationTests : public TextureValidationTest {
|
|||
|
||||
// TODO(dawn:814): Remove when 1D texture support is complete.
|
||||
const char* kDisallowUnsafeApis = "disallow_unsafe_apis";
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc;
|
||||
togglesDesc.forceDisabledToggles = &kDisallowUnsafeApis;
|
||||
togglesDesc.forceDisabledTogglesCount = 1;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc;
|
||||
deviceTogglesDesc.disabledToggles = &kDisallowUnsafeApis;
|
||||
deviceTogglesDesc.disabledTogglesCount = 1;
|
||||
|
||||
descriptor.nextInChain = &togglesDesc;
|
||||
descriptor.nextInChain = &deviceTogglesDesc;
|
||||
|
||||
return dawnAdapter.CreateDevice(&descriptor);
|
||||
}
|
||||
|
|
|
@ -51,10 +51,10 @@ TEST_F(ToggleValidationTest, OverrideToggleUsage) {
|
|||
{
|
||||
const char* kValidToggleName = "emulate_store_and_msaa_resolve";
|
||||
wgpu::DeviceDescriptor descriptor;
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc;
|
||||
descriptor.nextInChain = &togglesDesc;
|
||||
togglesDesc.forceEnabledToggles = &kValidToggleName;
|
||||
togglesDesc.forceEnabledTogglesCount = 1;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc;
|
||||
descriptor.nextInChain = &deviceTogglesDesc;
|
||||
deviceTogglesDesc.enabledToggles = &kValidToggleName;
|
||||
deviceTogglesDesc.enabledTogglesCount = 1;
|
||||
|
||||
wgpu::Device deviceWithToggle =
|
||||
wgpu::Device::Acquire(GetBackendAdapter().CreateDevice(&descriptor));
|
||||
|
@ -72,10 +72,10 @@ TEST_F(ToggleValidationTest, OverrideToggleUsage) {
|
|||
{
|
||||
const char* kInvalidToggleName = "!@#$%^&*";
|
||||
wgpu::DeviceDescriptor descriptor;
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc;
|
||||
descriptor.nextInChain = &togglesDesc;
|
||||
togglesDesc.forceEnabledToggles = &kInvalidToggleName;
|
||||
togglesDesc.forceEnabledTogglesCount = 1;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc;
|
||||
descriptor.nextInChain = &deviceTogglesDesc;
|
||||
deviceTogglesDesc.enabledToggles = &kInvalidToggleName;
|
||||
deviceTogglesDesc.enabledTogglesCount = 1;
|
||||
|
||||
wgpu::Device deviceWithToggle =
|
||||
wgpu::Device::Acquire(GetBackendAdapter().CreateDevice(&descriptor));
|
||||
|
@ -93,10 +93,10 @@ TEST_F(ToggleValidationTest, OverrideToggleUsage) {
|
|||
TEST_F(ToggleValidationTest, TurnOffVsyncWithToggle) {
|
||||
const char* kValidToggleName = "turn_off_vsync";
|
||||
wgpu::DeviceDescriptor descriptor;
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc;
|
||||
descriptor.nextInChain = &togglesDesc;
|
||||
togglesDesc.forceEnabledToggles = &kValidToggleName;
|
||||
togglesDesc.forceEnabledTogglesCount = 1;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc;
|
||||
descriptor.nextInChain = &deviceTogglesDesc;
|
||||
deviceTogglesDesc.enabledToggles = &kValidToggleName;
|
||||
deviceTogglesDesc.enabledTogglesCount = 1;
|
||||
|
||||
wgpu::Device deviceWithToggle =
|
||||
wgpu::Device::Acquire(GetBackendAdapter().CreateDevice(&descriptor));
|
||||
|
|
|
@ -28,11 +28,11 @@ class UnsafeAPIValidationTest : public ValidationTest {
|
|||
protected:
|
||||
WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override {
|
||||
wgpu::DeviceDescriptor descriptor;
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc;
|
||||
descriptor.nextInChain = &togglesDesc;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc;
|
||||
descriptor.nextInChain = &deviceTogglesDesc;
|
||||
const char* toggle = "disallow_unsafe_apis";
|
||||
togglesDesc.forceEnabledToggles = &toggle;
|
||||
togglesDesc.forceEnabledTogglesCount = 1;
|
||||
deviceTogglesDesc.enabledToggles = &toggle;
|
||||
deviceTogglesDesc.enabledTogglesCount = 1;
|
||||
return dawnAdapter.CreateDevice(&descriptor);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -264,25 +264,25 @@ dawn::native::Adapter& ValidationTest::GetBackendAdapter() {
|
|||
|
||||
WGPUDevice ValidationTest::CreateTestDevice(dawn::native::Adapter dawnAdapter) {
|
||||
// Disabled disallowing unsafe APIs so we can test them.
|
||||
std::vector<const char*> forceEnabledToggles;
|
||||
std::vector<const char*> forceDisabledToggles = {"disallow_unsafe_apis"};
|
||||
std::vector<const char*> enabledToggles;
|
||||
std::vector<const char*> disabledToggles = {"disallow_unsafe_apis"};
|
||||
|
||||
for (const std::string& toggle : gToggleParser->GetEnabledToggles()) {
|
||||
forceEnabledToggles.push_back(toggle.c_str());
|
||||
enabledToggles.push_back(toggle.c_str());
|
||||
}
|
||||
|
||||
for (const std::string& toggle : gToggleParser->GetDisabledToggles()) {
|
||||
forceDisabledToggles.push_back(toggle.c_str());
|
||||
disabledToggles.push_back(toggle.c_str());
|
||||
}
|
||||
|
||||
wgpu::DeviceDescriptor deviceDescriptor;
|
||||
wgpu::DawnTogglesDeviceDescriptor togglesDesc;
|
||||
deviceDescriptor.nextInChain = &togglesDesc;
|
||||
wgpu::DawnTogglesDescriptor deviceTogglesDesc;
|
||||
deviceDescriptor.nextInChain = &deviceTogglesDesc;
|
||||
|
||||
togglesDesc.forceEnabledToggles = forceEnabledToggles.data();
|
||||
togglesDesc.forceEnabledTogglesCount = forceEnabledToggles.size();
|
||||
togglesDesc.forceDisabledToggles = forceDisabledToggles.data();
|
||||
togglesDesc.forceDisabledTogglesCount = forceDisabledToggles.size();
|
||||
deviceTogglesDesc.enabledToggles = enabledToggles.data();
|
||||
deviceTogglesDesc.enabledTogglesCount = enabledToggles.size();
|
||||
deviceTogglesDesc.disabledToggles = disabledToggles.data();
|
||||
deviceTogglesDesc.disabledTogglesCount = disabledToggles.size();
|
||||
|
||||
return dawnAdapter.CreateDevice(&deviceDescriptor);
|
||||
}
|
||||
|
|
|
@ -267,11 +267,11 @@ class VulkanImageWrappingUsageTests : public VulkanImageWrappingTestBase {
|
|||
// Create another device based on the original
|
||||
backendAdapter =
|
||||
dawn::native::vulkan::ToBackend(dawn::native::FromAPI(device.Get())->GetAdapter());
|
||||
deviceDescriptor.nextInChain = &togglesDesc;
|
||||
togglesDesc.forceEnabledToggles = GetParam().forceEnabledWorkarounds.data();
|
||||
togglesDesc.forceEnabledTogglesCount = GetParam().forceEnabledWorkarounds.size();
|
||||
togglesDesc.forceDisabledToggles = GetParam().forceDisabledWorkarounds.data();
|
||||
togglesDesc.forceDisabledTogglesCount = GetParam().forceDisabledWorkarounds.size();
|
||||
deviceDescriptor.nextInChain = &deviceTogglesDesc;
|
||||
deviceTogglesDesc.enabledToggles = GetParam().forceEnabledWorkarounds.data();
|
||||
deviceTogglesDesc.enabledTogglesCount = GetParam().forceEnabledWorkarounds.size();
|
||||
deviceTogglesDesc.disabledToggles = GetParam().forceDisabledWorkarounds.data();
|
||||
deviceTogglesDesc.disabledTogglesCount = GetParam().forceDisabledWorkarounds.size();
|
||||
|
||||
secondDeviceVk =
|
||||
dawn::native::vulkan::ToBackend(backendAdapter->APICreateDevice(&deviceDescriptor));
|
||||
|
@ -281,7 +281,7 @@ class VulkanImageWrappingUsageTests : public VulkanImageWrappingTestBase {
|
|||
protected:
|
||||
dawn::native::vulkan::Adapter* backendAdapter;
|
||||
dawn::native::DeviceDescriptor deviceDescriptor;
|
||||
dawn::native::DawnTogglesDeviceDescriptor togglesDesc;
|
||||
dawn::native::DawnTogglesDescriptor deviceTogglesDesc;
|
||||
|
||||
wgpu::Device secondDevice;
|
||||
dawn::native::vulkan::Device* secondDeviceVk;
|
||||
|
|
Loading…
Reference in New Issue