mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
Add Instance and CreateInstance to webgpu.h
This is the first step in making the API before WGPUDevice creation match webgpu.h and is necessary to implement WGPUSwapChain. BUG=dawn:269 Change-Id: If92ced42d7683d79e67c02738949ff8b483d22c4 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14061 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
e6441b604f
commit
5fc2c82c11
@@ -20,7 +20,10 @@
|
||||
|
||||
class ExtensionTests : public testing::Test {
|
||||
public:
|
||||
ExtensionTests() : testing::Test(), mInstanceBase(), mAdapterBase(&mInstanceBase) {
|
||||
ExtensionTests()
|
||||
: testing::Test(),
|
||||
mInstanceBase(dawn_native::InstanceBase::Create()),
|
||||
mAdapterBase(mInstanceBase.Get()) {
|
||||
}
|
||||
|
||||
std::vector<const char*> GetAllExtensionNames() {
|
||||
@@ -35,7 +38,7 @@ class ExtensionTests : public testing::Test {
|
||||
static_cast<size_t>(dawn_native::Extension::EnumCount);
|
||||
|
||||
protected:
|
||||
dawn_native::InstanceBase mInstanceBase;
|
||||
dawn_native::Ref<dawn_native::InstanceBase> mInstanceBase;
|
||||
dawn_native::null::Adapter mAdapterBase;
|
||||
};
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ namespace {
|
||||
public:
|
||||
GetProcAddressTests()
|
||||
: testing::TestWithParam<DawnFlavor>(),
|
||||
mNativeInstance(),
|
||||
mNativeAdapter(&mNativeInstance) {
|
||||
mNativeInstance(dawn_native::InstanceBase::Create()),
|
||||
mNativeAdapter(mNativeInstance.Get()) {
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
@@ -90,7 +90,7 @@ namespace {
|
||||
}
|
||||
|
||||
protected:
|
||||
dawn_native::InstanceBase mNativeInstance;
|
||||
dawn_native::Ref<dawn_native::InstanceBase> mNativeInstance;
|
||||
dawn_native::null::Adapter mNativeAdapter;
|
||||
|
||||
std::unique_ptr<utils::TerribleCommandBuffer> mC2sBuf;
|
||||
@@ -136,13 +136,17 @@ namespace {
|
||||
ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "0"), nullptr);
|
||||
}
|
||||
|
||||
// Test that GetProcAddress supports itself: it is handled specially because it is a
|
||||
// freestanding function and not a method on an object.
|
||||
TEST_P(GetProcAddressTests, GetProcAddressItself) {
|
||||
// Test that GetProcAddress supports freestanding function that are handled specially
|
||||
TEST_P(GetProcAddressTests, FreeStandingFunctions) {
|
||||
ASSERT_EQ(mProcs.getProcAddress(nullptr, "wgpuGetProcAddress"),
|
||||
reinterpret_cast<WGPUProc>(mProcs.getProcAddress));
|
||||
ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "wgpuGetProcAddress"),
|
||||
reinterpret_cast<WGPUProc>(mProcs.getProcAddress));
|
||||
|
||||
ASSERT_EQ(mProcs.getProcAddress(nullptr, "wgpuCreateInstance"),
|
||||
reinterpret_cast<WGPUProc>(mProcs.createInstance));
|
||||
ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "wgpuCreateInstance"),
|
||||
reinterpret_cast<WGPUProc>(mProcs.createInstance));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(,
|
||||
|
||||
Reference in New Issue
Block a user