Split the libdawn target in components with a single purpose.

The functionality of the dawn_headers and libdawn targets are split into
the following targets:

 - dawn_headers: the new version only exposes the "dawn.h" C API and no
   longer includes the C++ API.
 - dawncpp: the header and implementation of the C++ API that wraps the
   C API. This is unbundled from the rest so the C++ API can be used
   with libdawn_proc or other libraries implementing the C API.
 - libdawn_proc: A DawnProcTable-backend implementation of the C API.

This is needed because in follow-up commit there will be three libraries
implementing the C API: libdawn_proc that trampolines where we want, and
libdawn_native/wire that don't have trampolines for better perf.

BUG=dawn:22

Change-Id: I5d941f0d98e5a4b633e14d67eb5269f7924f0647
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12160
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Corentin Wallez
2019-10-15 11:44:38 +00:00
committed by Commit Bot service account
parent 1093c4de2c
commit 96496828a0
22 changed files with 159 additions and 58 deletions

View File

@@ -18,6 +18,7 @@
#include "common/Constants.h"
#include "common/Math.h"
#include "common/Platform.h"
#include "dawn/dawn_proc.h"
#include "dawn_native/DawnNative.h"
#include "dawn_wire/WireClient.h"
#include "dawn_wire/WireServer.h"
@@ -262,7 +263,7 @@ DawnTestBase::~DawnTestBase() {
backendProcs.deviceRelease(backendDevice);
}
dawnSetProcs(nullptr);
dawnProcSetProcs(nullptr);
}
bool DawnTestBase::IsD3D12() const {
@@ -452,7 +453,7 @@ void DawnTestBase::SetUp() {
// Set up the device and queue because all tests need them, and DawnTestBase needs them too for
// the deferred expectations.
dawnSetProcs(&procs);
dawnProcSetProcs(&procs);
device = dawn::Device::Acquire(cDevice);
queue = device.CreateQueue();

View File

@@ -15,6 +15,7 @@
#ifndef TESTS_DAWNTEST_H_
#define TESTS_DAWNTEST_H_
#include "dawn/dawn_proc_table.h"
#include "dawn/dawncpp.h"
#include "dawn_native/DawnNative.h"

View File

@@ -16,6 +16,7 @@
#include "common/Assert.h"
#include "dawn/dawn.h"
#include "dawn/dawn_proc.h"
#include "dawn_native/NullBackend.h"
ValidationTest::ValidationTest() {
@@ -37,7 +38,7 @@ ValidationTest::ValidationTest() {
ASSERT(foundNullAdapter);
DawnProcTable procs = dawn_native::GetProcs();
dawnSetProcs(&procs);
dawnProcSetProcs(&procs);
device = CreateDeviceFromAdapter(adapter, std::vector<const char*>());
}
@@ -64,7 +65,7 @@ ValidationTest::~ValidationTest() {
// We need to destroy Dawn objects before setting the procs to null otherwise the dawn*Release
// will call a nullptr
device = dawn::Device();
dawnSetProcs(nullptr);
dawnProcSetProcs(nullptr);
}
void ValidationTest::TearDown() {

View File

@@ -14,6 +14,7 @@
#include "tests/unittests/wire/WireTest.h"
#include "dawn/dawn_proc.h"
#include "dawn_wire/WireClient.h"
#include "dawn_wire/WireServer.h"
#include "utils/TerribleCommandBuffer.h"
@@ -65,13 +66,13 @@ void WireTest::SetUp() {
device = mWireClient->GetDevice();
DawnProcTable clientProcs = mWireClient->GetProcs();
dawnSetProcs(&clientProcs);
dawnProcSetProcs(&clientProcs);
apiDevice = mockDevice;
}
void WireTest::TearDown() {
dawnSetProcs(nullptr);
dawnProcSetProcs(nullptr);
// Derived classes should call the base TearDown() first. The client must
// be reset before any mocks are deleted.