Introduce Device::GetDefaultQueue and deprecate CreateQueue

This makes all backends register the default queue at device
initialization time, so that the same queue is returned by
each call to GetDefaultQueue.

All usages of CreateQueue are replaced by GetDefaultQueue
except a couple ones that could use the queue initialized by
DawnTest::SetUp.

A deprecation warning mechanism is added so that users of Dawn
can now that they should upgrade their usage of the API. It also
comes with a backdoor so we can test that they are emitted.

New DeprecatedAPITests are added that will contain tests for
deprecated APIs, and will also check that deprecation warnings
are produced.

The special casing of GetDefaultQueue in the wire will be done
in a follow-up CL to ease the review. It happens to work through
the regular wire mechanisms at the moment but returns a different
object on each GetDefaultQueue call.

Bug: dawn:22

Change-Id: I78dc1fa474769674278d30040e8d05c658b88360
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19724
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-04-17 16:45:17 +00:00 committed by Commit Bot service account
parent 9f5a1c5141
commit 8a437947a8
40 changed files with 206 additions and 106 deletions

View File

@ -593,6 +593,10 @@
{"name": "descriptor", "type": "texture descriptor", "annotation": "const*"} {"name": "descriptor", "type": "texture descriptor", "annotation": "const*"}
] ]
}, },
{
"name": "get default queue",
"returns": "queue"
},
{ {
"name": "inject error", "name": "inject error",
"args": [ "args": [

View File

@ -50,7 +50,7 @@ static std::vector<ShaderData> shaderData;
void init() { void init() {
device = CreateCppDawnDevice(); device = CreateCppDawnDevice();
queue = device.CreateQueue(); queue = device.GetDefaultQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment, swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment,
640, 480); 640, 480);

View File

@ -26,7 +26,7 @@ WGPUTextureFormat swapChainFormat;
void init() { void init() {
device = CreateCppDawnDevice().Release(); device = CreateCppDawnDevice().Release();
queue = wgpuDeviceCreateQueue(device); queue = wgpuDeviceGetDefaultQueue(device);
{ {
WGPUSwapChainDescriptor descriptor = {}; WGPUSwapChainDescriptor descriptor = {};

View File

@ -289,7 +289,7 @@ wgpu::CommandBuffer createCommandBuffer(const wgpu::TextureView backbufferView,
void init() { void init() {
device = CreateCppDawnDevice(); device = CreateCppDawnDevice();
queue = device.CreateQueue(); queue = device.GetDefaultQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment, swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment,
640, 480); 640, 480);

View File

@ -88,7 +88,7 @@ void initTextures() {
void init() { void init() {
device = CreateCppDawnDevice(); device = CreateCppDawnDevice();
queue = device.CreateQueue(); queue = device.GetDefaultQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment, swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment,
640, 480); 640, 480);

View File

@ -117,7 +117,7 @@ struct CameraData {
void init() { void init() {
device = CreateCppDawnDevice(); device = CreateCppDawnDevice();
queue = device.CreateQueue(); queue = device.GetDefaultQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment, swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment,
640, 480); 640, 480);

View File

@ -307,7 +307,7 @@ int main(int argc, const char* argv[]) {
dawn::ErrorLog() << errorTypeName << " error: " << message; dawn::ErrorLog() << errorTypeName << " error: " << message;
}, },
nullptr); nullptr);
queue = device.CreateQueue(); queue = device.GetDefaultQueue();
// The hacky pipeline to render a triangle. // The hacky pipeline to render a triangle.
utils::ComboRenderPipelineDescriptor pipelineDesc(device); utils::ComboRenderPipelineDescriptor pipelineDesc(device);

View File

@ -166,6 +166,11 @@ namespace dawn_native {
return deviceBase->GetLazyClearCountForTesting(); return deviceBase->GetLazyClearCountForTesting();
} }
size_t GetDeprecationWarningCountForTesting(WGPUDevice device) {
dawn_native::DeviceBase* deviceBase = reinterpret_cast<dawn_native::DeviceBase*>(device);
return deviceBase->GetDeprecationWarningCountForTesting();
}
bool IsTextureSubresourceInitialized(WGPUTexture texture, bool IsTextureSubresourceInitialized(WGPUTexture texture,
uint32_t baseMipLevel, uint32_t baseMipLevel,
uint32_t levelCount, uint32_t levelCount,

View File

@ -45,7 +45,7 @@
namespace dawn_native { namespace dawn_native {
// DeviceBase::Caches // DeviceBase sub-structures
// The caches are unordered_sets of pointers with special hash and compare functions // The caches are unordered_sets of pointers with special hash and compare functions
// to compare the value of the objects, instead of the pointers. // to compare the value of the objects, instead of the pointers.
@ -73,6 +73,11 @@ namespace dawn_native {
ContentLessObjectCache<ShaderModuleBase> shaderModules; ContentLessObjectCache<ShaderModuleBase> shaderModules;
}; };
struct DeviceBase::DeprecationWarnings {
std::unordered_set<const char*> emitted;
size_t count = 0;
};
// DeviceBase // DeviceBase
DeviceBase::DeviceBase(AdapterBase* adapter, const DeviceDescriptor* descriptor) DeviceBase::DeviceBase(AdapterBase* adapter, const DeviceDescriptor* descriptor)
@ -89,7 +94,8 @@ namespace dawn_native {
DeviceBase::~DeviceBase() { DeviceBase::~DeviceBase() {
} }
MaybeError DeviceBase::Initialize() { MaybeError DeviceBase::Initialize(QueueBase* defaultQueue) {
mDefaultQueue = AcquireRef(defaultQueue);
mRootErrorScope = AcquireRef(new ErrorScope()); mRootErrorScope = AcquireRef(new ErrorScope());
mCurrentErrorScope = mRootErrorScope.Get(); mCurrentErrorScope = mRootErrorScope.Get();
@ -97,6 +103,7 @@ namespace dawn_native {
mErrorScopeTracker = std::make_unique<ErrorScopeTracker>(this); mErrorScopeTracker = std::make_unique<ErrorScopeTracker>(this);
mFenceSignalTracker = std::make_unique<FenceSignalTracker>(this); mFenceSignalTracker = std::make_unique<FenceSignalTracker>(this);
mDynamicUploader = std::make_unique<DynamicUploader>(this); mDynamicUploader = std::make_unique<DynamicUploader>(this);
mDeprecationWarnings = std::make_unique<DeprecationWarnings>();
// Starting from now the backend can start doing reentrant calls so the device is marked as // Starting from now the backend can start doing reentrant calls so the device is marked as
// alive. // alive.
@ -567,13 +574,10 @@ namespace dawn_native {
return result; return result;
} }
QueueBase* DeviceBase::CreateQueue() { QueueBase* DeviceBase::CreateQueue() {
QueueBase* result = nullptr; // TODO(dawn:22): Remove this once users use GetDefaultQueue
EmitDeprecationWarning(
if (ConsumedError(CreateQueueInternal(&result))) { "Device::CreateQueue is deprecated, use Device::GetDefaultQueue instead");
return QueueBase::MakeError(this); return GetDefaultQueue();
}
return result;
} }
SamplerBase* DeviceBase::CreateSampler(const SamplerDescriptor* descriptor) { SamplerBase* DeviceBase::CreateSampler(const SamplerDescriptor* descriptor) {
SamplerBase* result = nullptr; SamplerBase* result = nullptr;
@ -674,6 +678,15 @@ namespace dawn_native {
} }
} }
QueueBase* DeviceBase::GetDefaultQueue() {
// Backends gave the default queue during initialization.
ASSERT(mDefaultQueue.Get() != nullptr);
// Returns a new reference to the queue.
mDefaultQueue->Reference();
return mDefaultQueue.Get();
}
void DeviceBase::ApplyExtensions(const DeviceDescriptor* deviceDescriptor) { void DeviceBase::ApplyExtensions(const DeviceDescriptor* deviceDescriptor) {
ASSERT(deviceDescriptor); ASSERT(deviceDescriptor);
ASSERT(GetAdapter()->SupportsAllRequestedExtensions(deviceDescriptor->requiredExtensions)); ASSERT(GetAdapter()->SupportsAllRequestedExtensions(deviceDescriptor->requiredExtensions));
@ -702,6 +715,17 @@ namespace dawn_native {
++mLazyClearCountForTesting; ++mLazyClearCountForTesting;
} }
size_t DeviceBase::GetDeprecationWarningCountForTesting() {
return mDeprecationWarnings->count;
}
void DeviceBase::EmitDeprecationWarning(const char* warning) {
mDeprecationWarnings->count++;
if (mDeprecationWarnings->emitted.insert(warning).second) {
dawn::WarningLog() << warning;
}
}
// Implementation details of object creation // Implementation details of object creation
MaybeError DeviceBase::CreateBindGroupInternal(BindGroupBase** result, MaybeError DeviceBase::CreateBindGroupInternal(BindGroupBase** result,
@ -770,12 +794,6 @@ namespace dawn_native {
return {}; return {};
} }
MaybeError DeviceBase::CreateQueueInternal(QueueBase** result) {
DAWN_TRY(ValidateIsAlive());
DAWN_TRY_ASSIGN(*result, CreateQueueImpl());
return {};
}
MaybeError DeviceBase::CreateRenderBundleEncoderInternal( MaybeError DeviceBase::CreateRenderBundleEncoderInternal(
RenderBundleEncoder** result, RenderBundleEncoder** result,
const RenderBundleEncoderDescriptor* descriptor) { const RenderBundleEncoderDescriptor* descriptor) {

View File

@ -154,6 +154,8 @@ namespace dawn_native {
TextureViewBase* CreateTextureView(TextureBase* texture, TextureViewBase* CreateTextureView(TextureBase* texture,
const TextureViewDescriptor* descriptor); const TextureViewDescriptor* descriptor);
QueueBase* GetDefaultQueue();
void InjectError(wgpu::ErrorType type, const char* message); void InjectError(wgpu::ErrorType type, const char* message);
void Tick(); void Tick();
@ -207,13 +209,15 @@ namespace dawn_native {
bool IsValidationEnabled() const; bool IsValidationEnabled() const;
size_t GetLazyClearCountForTesting(); size_t GetLazyClearCountForTesting();
void IncrementLazyClearCountForTesting(); void IncrementLazyClearCountForTesting();
size_t GetDeprecationWarningCountForTesting();
void EmitDeprecationWarning(const char* warning);
void LoseForTesting(); void LoseForTesting();
protected: protected:
void SetToggle(Toggle toggle, bool isEnabled); void SetToggle(Toggle toggle, bool isEnabled);
void ForceSetToggle(Toggle toggle, bool isEnabled); void ForceSetToggle(Toggle toggle, bool isEnabled);
MaybeError Initialize(); MaybeError Initialize(QueueBase* defaultQueue);
void ShutDownBase(); void ShutDownBase();
private: private:
@ -226,7 +230,6 @@ namespace dawn_native {
const ComputePipelineDescriptor* descriptor) = 0; const ComputePipelineDescriptor* descriptor) = 0;
virtual ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl( virtual ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
const PipelineLayoutDescriptor* descriptor) = 0; const PipelineLayoutDescriptor* descriptor) = 0;
virtual ResultOrError<QueueBase*> CreateQueueImpl() = 0;
virtual ResultOrError<RenderPipelineBase*> CreateRenderPipelineImpl( virtual ResultOrError<RenderPipelineBase*> CreateRenderPipelineImpl(
const RenderPipelineDescriptor* descriptor) = 0; const RenderPipelineDescriptor* descriptor) = 0;
virtual ResultOrError<SamplerBase*> CreateSamplerImpl( virtual ResultOrError<SamplerBase*> CreateSamplerImpl(
@ -255,7 +258,6 @@ namespace dawn_native {
const ComputePipelineDescriptor* descriptor); const ComputePipelineDescriptor* descriptor);
MaybeError CreatePipelineLayoutInternal(PipelineLayoutBase** result, MaybeError CreatePipelineLayoutInternal(PipelineLayoutBase** result,
const PipelineLayoutDescriptor* descriptor); const PipelineLayoutDescriptor* descriptor);
MaybeError CreateQueueInternal(QueueBase** result);
MaybeError CreateRenderBundleEncoderInternal( MaybeError CreateRenderBundleEncoderInternal(
RenderBundleEncoder** result, RenderBundleEncoder** result,
const RenderBundleEncoderDescriptor* descriptor); const RenderBundleEncoderDescriptor* descriptor);
@ -305,6 +307,10 @@ namespace dawn_native {
std::unique_ptr<DynamicUploader> mDynamicUploader; std::unique_ptr<DynamicUploader> mDynamicUploader;
std::unique_ptr<ErrorScopeTracker> mErrorScopeTracker; std::unique_ptr<ErrorScopeTracker> mErrorScopeTracker;
std::unique_ptr<FenceSignalTracker> mFenceSignalTracker; std::unique_ptr<FenceSignalTracker> mFenceSignalTracker;
Ref<QueueBase> mDefaultQueue;
struct DeprecationWarnings;
std::unique_ptr<DeprecationWarnings> mDeprecationWarnings;
uint32_t mRefCount = 1; uint32_t mRefCount = 1;
State mState = State::BeingCreated; State mState = State::BeingCreated;

View File

@ -128,7 +128,7 @@ namespace dawn_native { namespace d3d12 {
GetD3D12Device()->CreateCommandSignature(&programDesc, NULL, GetD3D12Device()->CreateCommandSignature(&programDesc, NULL,
IID_PPV_ARGS(&mDrawIndexedIndirectSignature)); IID_PPV_ARGS(&mDrawIndexedIndirectSignature));
return DeviceBase::Initialize(); return DeviceBase::Initialize(new Queue(this));
} }
Device::~Device() { Device::~Device() {
@ -267,9 +267,6 @@ namespace dawn_native { namespace d3d12 {
const PipelineLayoutDescriptor* descriptor) { const PipelineLayoutDescriptor* descriptor) {
return PipelineLayout::Create(this, descriptor); return PipelineLayout::Create(this, descriptor);
} }
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
return new Queue(this);
}
ResultOrError<RenderPipelineBase*> Device::CreateRenderPipelineImpl( ResultOrError<RenderPipelineBase*> Device::CreateRenderPipelineImpl(
const RenderPipelineDescriptor* descriptor) { const RenderPipelineDescriptor* descriptor) {
return RenderPipeline::Create(this, descriptor); return RenderPipeline::Create(this, descriptor);

View File

@ -132,7 +132,6 @@ namespace dawn_native { namespace d3d12 {
const ComputePipelineDescriptor* descriptor) override; const ComputePipelineDescriptor* descriptor) override;
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl( ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
const PipelineLayoutDescriptor* descriptor) override; const PipelineLayoutDescriptor* descriptor) override;
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<RenderPipelineBase*> CreateRenderPipelineImpl( ResultOrError<RenderPipelineBase*> CreateRenderPipelineImpl(
const RenderPipelineDescriptor* descriptor) override; const RenderPipelineDescriptor* descriptor) override;
ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override; ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override;

View File

@ -83,7 +83,6 @@ namespace dawn_native { namespace metal {
const ComputePipelineDescriptor* descriptor) override; const ComputePipelineDescriptor* descriptor) override;
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl( ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
const PipelineLayoutDescriptor* descriptor) override; const PipelineLayoutDescriptor* descriptor) override;
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<RenderPipelineBase*> CreateRenderPipelineImpl( ResultOrError<RenderPipelineBase*> CreateRenderPipelineImpl(
const RenderPipelineDescriptor* descriptor) override; const RenderPipelineDescriptor* descriptor) override;
ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override; ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override;

View File

@ -64,7 +64,7 @@ namespace dawn_native { namespace metal {
InitTogglesFromDriver(); InitTogglesFromDriver();
mCommandQueue = [mMtlDevice newCommandQueue]; mCommandQueue = [mMtlDevice newCommandQueue];
return DeviceBase::Initialize(); return DeviceBase::Initialize(new Queue(this));
} }
void Device::InitTogglesFromDriver() { void Device::InitTogglesFromDriver() {
@ -124,9 +124,6 @@ namespace dawn_native { namespace metal {
const PipelineLayoutDescriptor* descriptor) { const PipelineLayoutDescriptor* descriptor) {
return new PipelineLayout(this, descriptor); return new PipelineLayout(this, descriptor);
} }
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
return new Queue(this);
}
ResultOrError<RenderPipelineBase*> Device::CreateRenderPipelineImpl( ResultOrError<RenderPipelineBase*> Device::CreateRenderPipelineImpl(
const RenderPipelineDescriptor* descriptor) { const RenderPipelineDescriptor* descriptor) {
return RenderPipeline::Create(this, descriptor); return RenderPipeline::Create(this, descriptor);

View File

@ -89,7 +89,7 @@ namespace dawn_native { namespace null {
} }
MaybeError Device::Initialize() { MaybeError Device::Initialize() {
return DeviceBase::Initialize(); return DeviceBase::Initialize(new Queue(this));
} }
ResultOrError<BindGroupBase*> Device::CreateBindGroupImpl( ResultOrError<BindGroupBase*> Device::CreateBindGroupImpl(
@ -116,9 +116,6 @@ namespace dawn_native { namespace null {
const PipelineLayoutDescriptor* descriptor) { const PipelineLayoutDescriptor* descriptor) {
return new PipelineLayout(this, descriptor); return new PipelineLayout(this, descriptor);
} }
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
return new Queue(this);
}
ResultOrError<RenderPipelineBase*> Device::CreateRenderPipelineImpl( ResultOrError<RenderPipelineBase*> Device::CreateRenderPipelineImpl(
const RenderPipelineDescriptor* descriptor) { const RenderPipelineDescriptor* descriptor) {
return new RenderPipeline(this, descriptor); return new RenderPipeline(this, descriptor);

View File

@ -121,7 +121,6 @@ namespace dawn_native { namespace null {
const ComputePipelineDescriptor* descriptor) override; const ComputePipelineDescriptor* descriptor) override;
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl( ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
const PipelineLayoutDescriptor* descriptor) override; const PipelineLayoutDescriptor* descriptor) override;
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<RenderPipelineBase*> CreateRenderPipelineImpl( ResultOrError<RenderPipelineBase*> CreateRenderPipelineImpl(
const RenderPipelineDescriptor* descriptor) override; const RenderPipelineDescriptor* descriptor) override;
ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override; ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override;

View File

@ -56,7 +56,7 @@ namespace dawn_native { namespace opengl {
InitTogglesFromDriver(); InitTogglesFromDriver();
mFormatTable = BuildGLFormatTable(); mFormatTable = BuildGLFormatTable();
return DeviceBase::Initialize(); return DeviceBase::Initialize(new Queue(this));
} }
void Device::InitTogglesFromDriver() { void Device::InitTogglesFromDriver() {
@ -115,9 +115,6 @@ namespace dawn_native { namespace opengl {
const PipelineLayoutDescriptor* descriptor) { const PipelineLayoutDescriptor* descriptor) {
return new PipelineLayout(this, descriptor); return new PipelineLayout(this, descriptor);
} }
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
return new Queue(this);
}
ResultOrError<RenderPipelineBase*> Device::CreateRenderPipelineImpl( ResultOrError<RenderPipelineBase*> Device::CreateRenderPipelineImpl(
const RenderPipelineDescriptor* descriptor) { const RenderPipelineDescriptor* descriptor) {
return new RenderPipeline(this, descriptor); return new RenderPipeline(this, descriptor);

View File

@ -78,7 +78,6 @@ namespace dawn_native { namespace opengl {
const ComputePipelineDescriptor* descriptor) override; const ComputePipelineDescriptor* descriptor) override;
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl( ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
const PipelineLayoutDescriptor* descriptor) override; const PipelineLayoutDescriptor* descriptor) override;
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<RenderPipelineBase*> CreateRenderPipelineImpl( ResultOrError<RenderPipelineBase*> CreateRenderPipelineImpl(
const RenderPipelineDescriptor* descriptor) override; const RenderPipelineDescriptor* descriptor) override;
ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override; ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override;

View File

@ -97,7 +97,7 @@ namespace dawn_native { namespace vulkan {
// the decision if it is not applicable. // the decision if it is not applicable.
ApplyDepth24PlusS8Toggle(); ApplyDepth24PlusS8Toggle();
return DeviceBase::Initialize(); return DeviceBase::Initialize(new Queue(this));
} }
Device::~Device() { Device::~Device() {
@ -127,9 +127,6 @@ namespace dawn_native { namespace vulkan {
const PipelineLayoutDescriptor* descriptor) { const PipelineLayoutDescriptor* descriptor) {
return PipelineLayout::Create(this, descriptor); return PipelineLayout::Create(this, descriptor);
} }
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
return Queue::Create(this);
}
ResultOrError<RenderPipelineBase*> Device::CreateRenderPipelineImpl( ResultOrError<RenderPipelineBase*> Device::CreateRenderPipelineImpl(
const RenderPipelineDescriptor* descriptor) { const RenderPipelineDescriptor* descriptor) {
return RenderPipeline::Create(this, descriptor); return RenderPipeline::Create(this, descriptor);

View File

@ -112,7 +112,6 @@ namespace dawn_native { namespace vulkan {
const ComputePipelineDescriptor* descriptor) override; const ComputePipelineDescriptor* descriptor) override;
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl( ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
const PipelineLayoutDescriptor* descriptor) override; const PipelineLayoutDescriptor* descriptor) override;
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<RenderPipelineBase*> CreateRenderPipelineImpl( ResultOrError<RenderPipelineBase*> CreateRenderPipelineImpl(
const RenderPipelineDescriptor* descriptor) override; const RenderPipelineDescriptor* descriptor) override;
ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override; ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override;

View File

@ -175,6 +175,9 @@ namespace dawn_native {
// Backdoor to get the number of lazy clears for testing // Backdoor to get the number of lazy clears for testing
DAWN_NATIVE_EXPORT size_t GetLazyClearCountForTesting(WGPUDevice device); DAWN_NATIVE_EXPORT size_t GetLazyClearCountForTesting(WGPUDevice device);
// Backdoor to get the number of deprecation warnings for testing
DAWN_NATIVE_EXPORT size_t GetDeprecationWarningCountForTesting(WGPUDevice device);
// Query if texture has been initialized // Query if texture has been initialized
DAWN_NATIVE_EXPORT bool IsTextureSubresourceInitialized(WGPUTexture texture, DAWN_NATIVE_EXPORT bool IsTextureSubresourceInitialized(WGPUTexture texture,
uint32_t baseMipLevel, uint32_t baseMipLevel,

View File

@ -50,9 +50,7 @@ if (!build_with_chromium) {
static_library("gtest") { static_library("gtest") {
testonly = true testonly = true
sources = [ sources = [ "${googletest_dir}/googletest/src/gtest-all.cc" ]
"${googletest_dir}/googletest/src/gtest-all.cc",
]
public_configs = [ ":gtest_config" ] public_configs = [ ":gtest_config" ]
} }
@ -66,9 +64,7 @@ if (!build_with_chromium) {
static_library("gmock") { static_library("gmock") {
testonly = true testonly = true
sources = [ sources = [ "${googletest_dir}/googlemock/src/gmock-all.cc" ]
"${googletest_dir}/googlemock/src/gmock-all.cc",
]
public_configs = [ ":gmock_config" ] public_configs = [ ":gmock_config" ]
} }
@ -241,6 +237,7 @@ source_set("dawn_end2end_tests_sources") {
"end2end/CopyTests.cpp", "end2end/CopyTests.cpp",
"end2end/CullingTests.cpp", "end2end/CullingTests.cpp",
"end2end/DebugMarkerTests.cpp", "end2end/DebugMarkerTests.cpp",
"end2end/DeprecatedAPITests.cpp",
"end2end/DepthStencilStateTests.cpp", "end2end/DepthStencilStateTests.cpp",
"end2end/DestroyTests.cpp", "end2end/DestroyTests.cpp",
"end2end/DeviceLostTests.cpp", "end2end/DeviceLostTests.cpp",
@ -257,6 +254,7 @@ source_set("dawn_end2end_tests_sources") {
"end2end/ObjectCachingTests.cpp", "end2end/ObjectCachingTests.cpp",
"end2end/OpArrayLengthTests.cpp", "end2end/OpArrayLengthTests.cpp",
"end2end/PrimitiveTopologyTests.cpp", "end2end/PrimitiveTopologyTests.cpp",
"end2end/QueueTests.cpp",
"end2end/RenderBundleTests.cpp", "end2end/RenderBundleTests.cpp",
"end2end/RenderPassLoadOpTests.cpp", "end2end/RenderPassLoadOpTests.cpp",
"end2end/RenderPassTests.cpp", "end2end/RenderPassTests.cpp",
@ -325,9 +323,7 @@ source_set("dawn_white_box_tests_sources") {
"${dawn_root}/src/dawn_native:dawn_native_static", "${dawn_root}/src/dawn_native:dawn_native_static",
] ]
sources = [ sources = [ "DawnTest.h" ]
"DawnTest.h",
]
if (dawn_enable_vulkan) { if (dawn_enable_vulkan) {
deps += [ "${dawn_root}/third_party/khronos:vulkan_headers" ] deps += [ "${dawn_root}/third_party/khronos:vulkan_headers" ]

View File

@ -729,7 +729,7 @@ void DawnTestBase::SetUp() {
// the deferred expectations. // the deferred expectations.
dawnProcSetProcs(&procs); dawnProcSetProcs(&procs);
device = wgpu::Device::Acquire(cDevice); device = wgpu::Device::Acquire(cDevice);
queue = device.CreateQueue(); queue = device.GetDefaultQueue();
device.SetUncapturedErrorCallback(OnDeviceError, this); device.SetUncapturedErrorCallback(OnDeviceError, this);
device.SetDeviceLostCallback(OnDeviceLost, this); device.SetDeviceLostCallback(OnDeviceLost, this);

View File

@ -92,7 +92,6 @@ TEST_P(ClipSpaceTest, ClipSpace) {
renderPass.Draw(6); renderPass.Draw(6);
renderPass.EndPass(); renderPass.EndPass();
wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); wgpu::CommandBuffer commandBuffer = commandEncoder.Finish();
wgpu::Queue queue = device.CreateQueue();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, colorTexture, kSize - 1, kSize - 1); EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, colorTexture, kSize - 1, kSize - 1);

View File

@ -87,7 +87,6 @@ class CullingTest : public DawnTest {
renderPass.Draw(6); renderPass.Draw(6);
renderPass.EndPass(); renderPass.EndPass();
wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); wgpu::CommandBuffer commandBuffer = commandEncoder.Finish();
wgpu::Queue queue = device.CreateQueue();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);
const RGBA8 kBackgroundColor = RGBA8::kBlue; const RGBA8 kBackgroundColor = RGBA8::kBlue;

View File

@ -0,0 +1,58 @@
// Copyright 2020 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// This file contains test for deprecated parts of Dawn's API while following WebGPU's evolution.
// It contains test for the "old" behavior that will be deleted once users are migrated, tests that
// a deprecation warning is emitted when the "old" behavior is used, and tests that an error is
// emitted when both the old and the new behavior are used (when applicable).
#include "tests/DawnTest.h"
class DeprecationTests : public DawnTest {};
#define EXPECT_DEPRECATION_WARNING(statement) \
do { \
if (UsesWire()) { \
statement; \
} else { \
size_t warningsBefore = \
dawn_native::GetDeprecationWarningCountForTesting(device.Get()); \
statement; \
size_t warningsAfter = \
dawn_native::GetDeprecationWarningCountForTesting(device.Get()); \
EXPECT_EQ(warningsAfter, warningsBefore + 1); \
} \
} while (0)
// Tests for Device::CreateQueue -> Device::GetDefaultQueue.
// Test that using CreateQueue produces a deprecation warning
TEST_P(DeprecationTests, CreateQueueIsDeprecated) {
EXPECT_DEPRECATION_WARNING(device.CreateQueue());
}
// Test that queues created from CreateQueue can be used for things
TEST_P(DeprecationTests, CreateQueueReturnsFunctionalQueue) {
wgpu::Queue q;
EXPECT_DEPRECATION_WARNING(q = device.CreateQueue());
q.Submit(0, nullptr);
}
DAWN_INSTANTIATE_TEST(DeprecationTests,
D3D12Backend(),
MetalBackend(),
NullBackend(),
OpenGLBackend(),
VulkanBackend());

View File

@ -238,7 +238,6 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTexture) {
} }
wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); wgpu::CommandBuffer commandBuffer = commandEncoder.Finish();
wgpu::Queue queue = device.CreateQueue();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);
VerifyResolveTarget(kGreen, mResolveTexture); VerifyResolveTarget(kGreen, mResolveTexture);
@ -279,7 +278,6 @@ TEST_P(MultisampledRenderingTest, MultisampledRenderingWithDepthTest) {
} }
wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); wgpu::CommandBuffer commandBuffer = commandEncoder.Finish();
wgpu::Queue queue = device.CreateQueue();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);
// The color of the pixel in the middle of mResolveTexture should be green if MSAA resolve runs // The color of the pixel in the middle of mResolveTexture should be green if MSAA resolve runs
@ -317,7 +315,6 @@ TEST_P(MultisampledRenderingTest, ResolveInAnotherRenderPass) {
} }
wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); wgpu::CommandBuffer commandBuffer = commandEncoder.Finish();
wgpu::Queue queue = device.CreateQueue();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);
VerifyResolveTarget(kGreen, mResolveTexture); VerifyResolveTarget(kGreen, mResolveTexture);
@ -351,7 +348,6 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargets) {
} }
wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); wgpu::CommandBuffer commandBuffer = commandEncoder.Finish();
wgpu::Queue queue = device.CreateQueue();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);
VerifyResolveTarget(kRed, mResolveTexture); VerifyResolveTarget(kRed, mResolveTexture);
@ -390,7 +386,6 @@ TEST_P(MultisampledRenderingTest, ResolveOneMultisampledTextureTwice) {
} }
wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); wgpu::CommandBuffer commandBuffer = commandEncoder.Finish();
wgpu::Queue queue = device.CreateQueue();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);
VerifyResolveTarget(kGreen, mResolveTexture); VerifyResolveTarget(kGreen, mResolveTexture);
@ -429,7 +424,6 @@ TEST_P(MultisampledRenderingTest, ResolveIntoOneMipmapLevelOf2DTexture) {
} }
wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); wgpu::CommandBuffer commandBuffer = commandEncoder.Finish();
wgpu::Queue queue = device.CreateQueue();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);
VerifyResolveTarget(kGreen, resolveTexture, kBaseMipLevel, 0); VerifyResolveTarget(kGreen, resolveTexture, kBaseMipLevel, 0);
@ -488,7 +482,6 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DArrayTexture) {
} }
wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); wgpu::CommandBuffer commandBuffer = commandEncoder.Finish();
wgpu::Queue queue = device.CreateQueue();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);
VerifyResolveTarget(kRed, resolveTexture1, kBaseMipLevel1, kBaseArrayLayer1); VerifyResolveTarget(kRed, resolveTexture1, kBaseMipLevel1, kBaseArrayLayer1);

View File

@ -0,0 +1,36 @@
// Copyright 2020 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// This file contains test for deprecated parts of Dawn's API while following WebGPU's evolution.
// It contains test for the "old" behavior that will be deleted once users are migrated, tests that
// a deprecation warning is emitted when the "old" behavior is used, and tests that an error is
// emitted when both the old and the new behavior are used (when applicable).
#include "tests/DawnTest.h"
class QueueTests : public DawnTest {};
// Test that GetDefaultQueue always returns the same object.
TEST_P(QueueTests, GetDefaultQueueSameObject) {
wgpu::Queue q1 = device.GetDefaultQueue();
wgpu::Queue q2 = device.GetDefaultQueue();
EXPECT_EQ(q1.Get() == q2.Get(), !UsesWire());
}
DAWN_INSTANTIATE_TEST(QueueTests,
D3D12Backend(),
MetalBackend(),
NullBackend(),
OpenGLBackend(),
VulkanBackend());

View File

@ -86,7 +86,6 @@ class SwapChainValidationTests : public DawnTest {
pass.EndPass(); pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
wgpu::Queue queue = device.CreateQueue();
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands)); ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
} }
}; };
@ -244,7 +243,6 @@ TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) {
pass.EndPass(); pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
wgpu::Queue queue = device.CreateQueue();
queue.Submit(1, &commands); queue.Submit(1, &commands);
// Check that view doesn't have extra formats like Sampled. // Check that view doesn't have extra formats like Sampled.

View File

@ -152,7 +152,6 @@ class ViewportTest : public DawnTest {
} }
wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); wgpu::CommandBuffer commandBuffer = commandEncoder.Finish();
wgpu::Queue queue = device.CreateQueue();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);
const RGBA8 kColor[ColorTypeCount] = { const RGBA8 kColor[ColorTypeCount] = {

View File

@ -98,7 +98,7 @@ class BufferValidationTest : public ValidationTest {
mockBufferMapReadCallback = std::make_unique<MockBufferMapReadCallback>(); mockBufferMapReadCallback = std::make_unique<MockBufferMapReadCallback>();
mockBufferMapWriteCallback = std::make_unique<MockBufferMapWriteCallback>(); mockBufferMapWriteCallback = std::make_unique<MockBufferMapWriteCallback>();
queue = device.CreateQueue(); queue = device.GetDefaultQueue();
} }
void TearDown() override { void TearDown() override {

View File

@ -134,7 +134,7 @@ TEST_F(ErrorScopeValidationTest, PushPopBalanced) {
// Test that error scopes do not call their callbacks until after an enclosed Queue::Submit // Test that error scopes do not call their callbacks until after an enclosed Queue::Submit
// completes // completes
TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmit) { TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmit) {
wgpu::Queue queue = device.CreateQueue(); wgpu::Queue queue = device.GetDefaultQueue();
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory); device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
queue.Submit(0, nullptr); queue.Submit(0, nullptr);
@ -149,7 +149,7 @@ TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmit) {
// Test that parent error scopes do not call their callbacks until after an enclosed Queue::Submit // Test that parent error scopes do not call their callbacks until after an enclosed Queue::Submit
// completes // completes
TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmitNested) { TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmitNested) {
wgpu::Queue queue = device.CreateQueue(); wgpu::Queue queue = device.GetDefaultQueue();
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory); device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory); device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
@ -167,7 +167,7 @@ TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmitNested) {
// Test a callback that returns asynchronously followed by a synchronous one // Test a callback that returns asynchronously followed by a synchronous one
TEST_F(ErrorScopeValidationTest, AsynchronousThenSynchronous) { TEST_F(ErrorScopeValidationTest, AsynchronousThenSynchronous) {
wgpu::Queue queue = device.CreateQueue(); wgpu::Queue queue = device.GetDefaultQueue();
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory); device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
queue.Submit(0, nullptr); queue.Submit(0, nullptr);
@ -187,7 +187,7 @@ TEST_F(ErrorScopeValidationTest, AsynchronousThenSynchronous) {
// Test that if the device is destroyed before the callback occurs, it is called with NoError // Test that if the device is destroyed before the callback occurs, it is called with NoError
// because all previous operations are waited upon before the destruction returns. // because all previous operations are waited upon before the destruction returns.
TEST_F(ErrorScopeValidationTest, DeviceDestroyedBeforeCallback) { TEST_F(ErrorScopeValidationTest, DeviceDestroyedBeforeCallback) {
wgpu::Queue queue = device.CreateQueue(); wgpu::Queue queue = device.GetDefaultQueue();
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory); device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
queue.Submit(0, nullptr); queue.Submit(0, nullptr);

View File

@ -57,7 +57,7 @@ class FenceValidationTest : public ValidationTest {
ValidationTest::SetUp(); ValidationTest::SetUp();
mockFenceOnCompletionCallback = std::make_unique<MockFenceOnCompletionCallback>(); mockFenceOnCompletionCallback = std::make_unique<MockFenceOnCompletionCallback>();
queue = device.CreateQueue(); queue = device.GetDefaultQueue();
} }
void TearDown() override { void TearDown() override {
@ -182,8 +182,9 @@ TEST_F(FenceValidationTest, SignalSuccess) {
} }
// Test it is invalid to signal a fence on a different queue than it was created on // Test it is invalid to signal a fence on a different queue than it was created on
TEST_F(FenceValidationTest, SignalWrongQueue) { // DISABLED until we have support for multiple queues
wgpu::Queue queue2 = device.CreateQueue(); TEST_F(FenceValidationTest, DISABLED_SignalWrongQueue) {
wgpu::Queue queue2 = device.GetDefaultQueue();
wgpu::FenceDescriptor descriptor; wgpu::FenceDescriptor descriptor;
descriptor.initialValue = 1; descriptor.initialValue = 1;
@ -193,8 +194,9 @@ TEST_F(FenceValidationTest, SignalWrongQueue) {
} }
// Test that signaling a fence on a wrong queue does not update fence signaled value // Test that signaling a fence on a wrong queue does not update fence signaled value
TEST_F(FenceValidationTest, SignalWrongQueueDoesNotUpdateValue) { // DISABLED until we have support for multiple queues
wgpu::Queue queue2 = device.CreateQueue(); TEST_F(FenceValidationTest, DISABLED_SignalWrongQueueDoesNotUpdateValue) {
wgpu::Queue queue2 = device.GetDefaultQueue();
wgpu::FenceDescriptor descriptor; wgpu::FenceDescriptor descriptor;
descriptor.initialValue = 1; descriptor.initialValue = 1;

View File

@ -48,7 +48,7 @@ TEST_F(QueueSubmitValidationTest, SubmitWithMappedBuffer) {
commands = encoder.Finish(); commands = encoder.Finish();
} }
wgpu::Queue queue = device.CreateQueue(); wgpu::Queue queue = device.GetDefaultQueue();
// Submitting when the buffer has never been mapped should succeed // Submitting when the buffer has never been mapped should succeed
queue.Submit(1, &commands); queue.Submit(1, &commands);

View File

@ -23,6 +23,10 @@ namespace {
class TextureValidationTest : public ValidationTest { class TextureValidationTest : public ValidationTest {
protected: protected:
void SetUp() override {
queue = device.GetDefaultQueue();
}
wgpu::TextureDescriptor CreateDefaultTextureDescriptor() { wgpu::TextureDescriptor CreateDefaultTextureDescriptor() {
wgpu::TextureDescriptor descriptor; wgpu::TextureDescriptor descriptor;
descriptor.size.width = kWidth; descriptor.size.width = kWidth;
@ -37,7 +41,7 @@ class TextureValidationTest : public ValidationTest {
return descriptor; return descriptor;
} }
wgpu::Queue queue = device.CreateQueue(); wgpu::Queue queue;
private: private:
static constexpr uint32_t kWidth = 32; static constexpr uint32_t kWidth = 32;

View File

@ -233,9 +233,9 @@ TEST_F(WireArgumentTests, ObjectsAsPointerArgument) {
} }
// Create queue // Create queue
WGPUQueue queue = wgpuDeviceCreateQueue(device); WGPUQueue queue = wgpuDeviceGetDefaultQueue(device);
WGPUQueue apiQueue = api.GetNewQueue(); WGPUQueue apiQueue = api.GetNewQueue();
EXPECT_CALL(api, DeviceCreateQueue(apiDevice)).WillOnce(Return(apiQueue)); EXPECT_CALL(api, DeviceGetDefaultQueue(apiDevice)).WillOnce(Return(apiQueue));
// Submit command buffer and check we got a call with both API-side command buffers // Submit command buffer and check we got a call with both API-side command buffers
wgpuQueueSubmit(queue, 2, cmdBufs); wgpuQueueSubmit(queue, 2, cmdBufs);

View File

@ -44,9 +44,9 @@ class WireFenceTests : public WireTest {
std::make_unique<StrictMock<MockFenceOnCompletionCallback>>(); std::make_unique<StrictMock<MockFenceOnCompletionCallback>>();
{ {
queue = wgpuDeviceCreateQueue(device); queue = wgpuDeviceGetDefaultQueue(device);
apiQueue = api.GetNewQueue(); apiQueue = api.GetNewQueue();
EXPECT_CALL(api, DeviceCreateQueue(apiDevice)).WillOnce(Return(apiQueue)); EXPECT_CALL(api, DeviceGetDefaultQueue(apiDevice)).WillOnce(Return(apiQueue));
FlushClient(); FlushClient();
} }
{ {
@ -228,9 +228,9 @@ TEST_F(WireFenceTests, DestroyBeforeOnCompletionEnd) {
// Test that signaling a fence on a wrong queue is invalid // Test that signaling a fence on a wrong queue is invalid
TEST_F(WireFenceTests, SignalWrongQueue) { TEST_F(WireFenceTests, SignalWrongQueue) {
WGPUQueue queue2 = wgpuDeviceCreateQueue(device); WGPUQueue queue2 = wgpuDeviceGetDefaultQueue(device);
WGPUQueue apiQueue2 = api.GetNewQueue(); WGPUQueue apiQueue2 = api.GetNewQueue();
EXPECT_CALL(api, DeviceCreateQueue(apiDevice)).WillOnce(Return(apiQueue2)); EXPECT_CALL(api, DeviceGetDefaultQueue(apiDevice)).WillOnce(Return(apiQueue2));
FlushClient(); FlushClient();
wgpuQueueSignal(queue2, fence, 2u); // error wgpuQueueSignal(queue2, fence, 2u); // error
@ -241,9 +241,9 @@ TEST_F(WireFenceTests, SignalWrongQueue) {
// Test that signaling a fence on a wrong queue does not update fence signaled value // Test that signaling a fence on a wrong queue does not update fence signaled value
TEST_F(WireFenceTests, SignalWrongQueueDoesNotUpdateValue) { TEST_F(WireFenceTests, SignalWrongQueueDoesNotUpdateValue) {
WGPUQueue queue2 = wgpuDeviceCreateQueue(device); WGPUQueue queue2 = wgpuDeviceGetDefaultQueue(device);
WGPUQueue apiQueue2 = api.GetNewQueue(); WGPUQueue apiQueue2 = api.GetNewQueue();
EXPECT_CALL(api, DeviceCreateQueue(apiDevice)).WillOnce(Return(apiQueue2)); EXPECT_CALL(api, DeviceGetDefaultQueue(apiDevice)).WillOnce(Return(apiQueue2));
FlushClient(); FlushClient();
wgpuQueueSignal(queue2, fence, 2u); // error wgpuQueueSignal(queue2, fence, 2u); // error

View File

@ -135,14 +135,14 @@ TEST_F(WireMultipleDeviceTests, ValidatesSameDevice) {
WireHolder wireB; WireHolder wireB;
// Create the objects // Create the objects
WGPUQueue queueA = wgpuDeviceCreateQueue(wireA.ClientDevice()); WGPUQueue queueA = wgpuDeviceGetDefaultQueue(wireA.ClientDevice());
WGPUQueue queueB = wgpuDeviceCreateQueue(wireB.ClientDevice()); WGPUQueue queueB = wgpuDeviceGetDefaultQueue(wireB.ClientDevice());
WGPUFenceDescriptor desc = {}; WGPUFenceDescriptor desc = {};
WGPUFence fenceA = wgpuQueueCreateFence(queueA, &desc); WGPUFence fenceA = wgpuQueueCreateFence(queueA, &desc);
// Flush on wire B. We should see the queue created. // Flush on wire B. We should see the queue created.
EXPECT_CALL(*wireB.Api(), DeviceCreateQueue(wireB.ServerDevice())) EXPECT_CALL(*wireB.Api(), DeviceGetDefaultQueue(wireB.ServerDevice()))
.WillOnce(Return(wireB.Api()->GetNewQueue())); .WillOnce(Return(wireB.Api()->GetNewQueue()));
wireB.FlushClient(); wireB.FlushClient();

View File

@ -305,7 +305,7 @@ namespace dawn_native { namespace vulkan {
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
wgpu::Queue queue = dawnDevice.CreateQueue(); wgpu::Queue queue = dawnDevice.GetDefaultQueue();
queue.Submit(1, &commands); queue.Submit(1, &commands);
} }
@ -482,7 +482,7 @@ namespace dawn_native { namespace vulkan {
ClearImage(secondDevice, copySrcTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f}); ClearImage(secondDevice, copySrcTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f});
// Copy color B on |secondDevice| // Copy color B on |secondDevice|
wgpu::Queue secondDeviceQueue = secondDevice.CreateQueue(); wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
SimpleCopyTextureToTexture(secondDevice, secondDeviceQueue, copySrcTexture, SimpleCopyTextureToTexture(secondDevice, secondDeviceQueue, copySrcTexture,
secondDeviceWrappedTexture); secondDeviceWrappedTexture);
@ -578,7 +578,7 @@ namespace dawn_native { namespace vulkan {
secondDevice, &defaultDescriptor, nextFd, defaultStride, defaultModifier, {signalFd}); secondDevice, &defaultDescriptor, nextFd, defaultStride, defaultModifier, {signalFd});
// Copy color B on |secondDevice| // Copy color B on |secondDevice|
wgpu::Queue secondDeviceQueue = secondDevice.CreateQueue(); wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
// Create a buffer on |secondDevice| // Create a buffer on |secondDevice|
wgpu::Buffer copySrcBuffer = wgpu::Buffer copySrcBuffer =
@ -681,8 +681,8 @@ namespace dawn_native { namespace vulkan {
wgpu::Device::Acquire(reinterpret_cast<WGPUDevice>(thirdDeviceVk)); wgpu::Device::Acquire(reinterpret_cast<WGPUDevice>(thirdDeviceVk));
// Make queue for device 2 and 3 // Make queue for device 2 and 3
wgpu::Queue secondDeviceQueue = secondDevice.CreateQueue(); wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
wgpu::Queue thirdDeviceQueue = thirdDevice.CreateQueue(); wgpu::Queue thirdDeviceQueue = thirdDevice.GetDefaultQueue();
// Create BOs for A, B, C // Create BOs for A, B, C
gbm_bo* gbmBoA = CreateGbmBo(1, 1, true /* linear */); gbm_bo* gbmBoA = CreateGbmBo(1, 1, true /* linear */);
@ -773,7 +773,7 @@ namespace dawn_native { namespace vulkan {
textures.push_back(device.CreateTexture(&descriptor)); textures.push_back(device.CreateTexture(&descriptor));
} }
wgpu::Queue secondDeviceQueue = secondDevice.CreateQueue(); wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
// Make an image on |secondDevice| // Make an image on |secondDevice|
gbm_bo* gbmBo = CreateGbmBo(640, 480, false /* linear */); gbm_bo* gbmBo = CreateGbmBo(640, 480, false /* linear */);

View File

@ -422,7 +422,7 @@ namespace dawn_native { namespace vulkan {
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
wgpu::Queue queue = dawnDevice.CreateQueue(); wgpu::Queue queue = dawnDevice.GetDefaultQueue();
queue.Submit(1, &commands); queue.Submit(1, &commands);
} }
@ -618,7 +618,7 @@ namespace dawn_native { namespace vulkan {
ClearImage(secondDevice, copySrcTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f}); ClearImage(secondDevice, copySrcTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f});
// Copy color B on |secondDevice| // Copy color B on |secondDevice|
wgpu::Queue secondDeviceQueue = secondDevice.CreateQueue(); wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
SimpleCopyTextureToTexture(secondDevice, secondDeviceQueue, copySrcTexture, SimpleCopyTextureToTexture(secondDevice, secondDeviceQueue, copySrcTexture,
secondDeviceWrappedTexture); secondDeviceWrappedTexture);
@ -722,7 +722,7 @@ namespace dawn_native { namespace vulkan {
defaultMemoryTypeIndex, {signalFd}); defaultMemoryTypeIndex, {signalFd});
// Copy color B on |secondDevice| // Copy color B on |secondDevice|
wgpu::Queue secondDeviceQueue = secondDevice.CreateQueue(); wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
// Create a buffer on |secondDevice| // Create a buffer on |secondDevice|
wgpu::Buffer copySrcBuffer = wgpu::Buffer copySrcBuffer =
@ -831,8 +831,8 @@ namespace dawn_native { namespace vulkan {
wgpu::Device::Acquire(reinterpret_cast<WGPUDevice>(thirdDeviceVk)); wgpu::Device::Acquire(reinterpret_cast<WGPUDevice>(thirdDeviceVk));
// Make queue for device 2 and 3 // Make queue for device 2 and 3
wgpu::Queue secondDeviceQueue = secondDevice.CreateQueue(); wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
wgpu::Queue thirdDeviceQueue = thirdDevice.CreateQueue(); wgpu::Queue thirdDeviceQueue = thirdDevice.GetDefaultQueue();
// Allocate memory for A, B, C // Allocate memory for A, B, C
VkImage imageA; VkImage imageA;
@ -944,7 +944,7 @@ namespace dawn_native { namespace vulkan {
textures.push_back(device.CreateTexture(&descriptor)); textures.push_back(device.CreateTexture(&descriptor));
} }
wgpu::Queue secondDeviceQueue = secondDevice.CreateQueue(); wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
// Make an image on |secondDevice| // Make an image on |secondDevice|
VkImage imageA; VkImage imageA;