Support BC formats as the first extension in Dawn

This patch refactors the current implementation of BC formats to treat
it as the first extension in Dawn and adds all the related tests.

Note that in Dawn all the extensions are disabled unless we enable them
when we create the device, which means the BC formats can only be used
when we enable the related extension on the creation of the device, and
the creation of the device will fail if the adapter does not support the
extension

BUG=dawn:42
TEST=dawn_end2end_tests
TEST=dawn_unittests

Change-Id: I04d818b0218ebb3b1b7a70a4fea71779f308f85f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9520
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Jiawei Shao
2019-08-02 00:06:38 +00:00
committed by Commit Bot service account
parent 56f3a7b90d
commit 574b951188
28 changed files with 566 additions and 43 deletions

View File

@@ -35,12 +35,29 @@ ValidationTest::ValidationTest() {
}
ASSERT(foundNullAdapter);
device = dawn::Device::Acquire(adapter.CreateDevice());
DawnProcTable procs = dawn_native::GetProcs();
dawnSetProcs(&procs);
device.SetErrorCallback(ValidationTest::OnDeviceError, this);
device = CreateDeviceFromAdapter(adapter, std::vector<const char*>());
}
dawn::Device ValidationTest::CreateDeviceFromAdapter(
dawn_native::Adapter adapterToTest,
const std::vector<const char*>& requiredExtensions) {
dawn::Device deviceToTest;
// Always keep the code path to test creating a device without a device descriptor.
if (requiredExtensions.empty()) {
deviceToTest = dawn::Device::Acquire(adapterToTest.CreateDevice());
} else {
dawn_native::DeviceDescriptor descriptor;
descriptor.requiredExtensions = requiredExtensions;
deviceToTest = dawn::Device::Acquire(adapterToTest.CreateDevice(&descriptor));
}
deviceToTest.SetErrorCallback(ValidationTest::OnDeviceError, this);
return deviceToTest;
}
ValidationTest::~ValidationTest() {