Device: Deprecated GetDefaultQueue in favor of ::GetQueue()

Bug: dawn:22

Change-Id: I103ea933ca5b93f20d8bf11c6671bd9f603d8ff3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40061
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2021-02-04 15:33:42 +00:00 committed by Commit Bot service account
parent d5a0728b67
commit 6d315daa5d
38 changed files with 133 additions and 102 deletions

View File

@ -751,6 +751,10 @@
{"name": "descriptor", "type": "texture descriptor", "annotation": "const*"}
]
},
{
"name": "get queue",
"returns": "queue"
},
{
"name": "get default queue",
"returns": "queue"

View File

@ -151,6 +151,7 @@
"BufferUnmap",
"DeviceCreateErrorBuffer",
"DeviceGetDefaultQueue",
"DeviceGetQueue",
"DeviceInjectError",
"DevicePushErrorScope",
"QueueCreateFence"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -287,8 +287,8 @@ namespace dawn_native {
}
std::unique_ptr<MapRequestTask> request =
std::make_unique<MapRequestTask>(this, mLastMapID);
GetDevice()->GetDefaultQueue()->TrackTask(std::move(request),
GetDevice()->GetPendingCommandSerial());
GetDevice()->GetQueue()->TrackTask(std::move(request),
GetDevice()->GetPendingCommandSerial());
}
void* BufferBase::GetMappedRange(size_t offset, size_t size) {

View File

@ -419,8 +419,8 @@ namespace dawn_native {
availabilityDesc.size = querySet->GetQueryCount() * sizeof(uint32_t);
Ref<BufferBase> availabilityBuffer =
AcquireRef(device->CreateBuffer(&availabilityDesc));
device->GetDefaultQueue()->WriteBuffer(availabilityBuffer.Get(), 0, availability.data(),
querySet->GetQueryCount() * sizeof(uint32_t));
device->GetQueue()->WriteBuffer(availabilityBuffer.Get(), 0, availability.data(),
querySet->GetQueryCount() * sizeof(uint32_t));
// Timestamp params uniform buffer
TimestampParams params = {queryCount, static_cast<uint32_t>(destinationOffset),
@ -429,7 +429,7 @@ namespace dawn_native {
parmsDesc.usage = wgpu::BufferUsage::Uniform | wgpu::BufferUsage::CopyDst;
parmsDesc.size = sizeof(params);
Ref<BufferBase> paramsBuffer = AcquireRef(device->CreateBuffer(&parmsDesc));
device->GetDefaultQueue()->WriteBuffer(paramsBuffer.Get(), 0, &params, sizeof(params));
device->GetQueue()->WriteBuffer(paramsBuffer.Get(), 0, &params, sizeof(params));
EncodeConvertTimestampsToNanoseconds(encoder, destination, availabilityBuffer.Get(),
paramsBuffer.Get());

View File

@ -243,8 +243,7 @@ namespace dawn_native {
uniformDesc.size = sizeof(uniformData);
Ref<BufferBase> uniformBuffer = AcquireRef(device->CreateBuffer(&uniformDesc));
device->GetDefaultQueue()->WriteBuffer(uniformBuffer.Get(), 0, uniformData,
sizeof(uniformData));
device->GetQueue()->WriteBuffer(uniformBuffer.Get(), 0, uniformData, sizeof(uniformData));
// Prepare binding 1 resource: sampler
// Use default configuration, filterMode set to Nearest for min and mag.
@ -306,7 +305,7 @@ namespace dawn_native {
CommandBufferBase* submitCommandBuffer = commandBuffer.Get();
// Submit command buffer.
Ref<QueueBase> queue = AcquireRef(device->GetDefaultQueue());
Ref<QueueBase> queue = AcquireRef(device->GetQueue());
queue->Submit(1, &submitCommandBuffer);
return {};

View File

@ -97,7 +97,7 @@ namespace dawn_native {
DeviceBase::~DeviceBase() = default;
MaybeError DeviceBase::Initialize(QueueBase* defaultQueue) {
mDefaultQueue = AcquireRef(defaultQueue);
mQueue = AcquireRef(defaultQueue);
mRootErrorScope = AcquireRef(new ErrorScope());
mCurrentErrorScope = mRootErrorScope.Get();
@ -178,7 +178,7 @@ namespace dawn_native {
// freed by backends in the ShutDownImpl() call. Still tick the ones that might have
// pending callbacks.
mErrorScopeTracker->Tick(GetCompletedCommandSerial());
GetDefaultQueue()->Tick(GetCompletedCommandSerial());
GetQueue()->Tick(GetCompletedCommandSerial());
mCreateReadyPipelineTracker->ClearForShutDown();
@ -240,7 +240,7 @@ namespace dawn_native {
// The device was lost, call the application callback.
if (type == InternalErrorType::DeviceLost && mDeviceLostCallback != nullptr) {
mDefaultQueue->HandleDeviceLoss();
mQueue->HandleDeviceLoss();
mDeviceLostCallback(message, mDeviceLostUserdata);
mDeviceLostCallback = nullptr;
@ -865,7 +865,7 @@ namespace dawn_native {
// reclaiming resources one tick earlier.
mDynamicUploader->Deallocate(mCompletedSerial);
mErrorScopeTracker->Tick(mCompletedSerial);
GetDefaultQueue()->Tick(mCompletedSerial);
GetQueue()->Tick(mCompletedSerial);
mCreateReadyPipelineTracker->Tick(mCompletedSerial);
}
@ -886,13 +886,19 @@ namespace dawn_native {
}
}
QueueBase* DeviceBase::GetDefaultQueue() {
// Backends gave the default queue during initialization.
ASSERT(mDefaultQueue != nullptr);
QueueBase* DeviceBase::GetQueue() {
// Backends gave the primary queue during initialization.
ASSERT(mQueue != nullptr);
// Returns a new reference to the queue.
mDefaultQueue->Reference();
return mDefaultQueue.Get();
mQueue->Reference();
return mQueue.Get();
}
QueueBase* DeviceBase::GetDefaultQueue() {
EmitDeprecationWarning(
"Device::GetDefaultQueue is deprecated, use Device::GetQueue() instead");
return GetQueue();
}
void DeviceBase::ApplyExtensions(const DeviceDescriptor* deviceDescriptor) {

View File

@ -169,7 +169,9 @@ namespace dawn_native {
// For Dawn Wire
BufferBase* CreateErrorBuffer();
// TODO(dawn:22): Remove once the deprecation period is finished.
QueueBase* GetDefaultQueue();
QueueBase* GetQueue();
void InjectError(wgpu::ErrorType type, const char* message);
bool Tick();
@ -384,7 +386,7 @@ namespace dawn_native {
std::unique_ptr<DynamicUploader> mDynamicUploader;
std::unique_ptr<ErrorScopeTracker> mErrorScopeTracker;
std::unique_ptr<CreateReadyPipelineTracker> mCreateReadyPipelineTracker;
Ref<QueueBase> mDefaultQueue;
Ref<QueueBase> mQueue;
struct DeprecationWarnings;
std::unique_ptr<DeprecationWarnings> mDeprecationWarnings;

View File

@ -136,8 +136,8 @@ namespace dawn_native {
std::make_unique<FenceInFlight>(fence, value);
// TODO: use GetLastSubmittedCommandSerial in the future for perforamnce
GetDevice()->GetDefaultQueue()->TrackTask(std::move(fenceInFlight),
GetDevice()->GetPendingCommandSerial());
GetDevice()->GetQueue()->TrackTask(std::move(fenceInFlight),
GetDevice()->GetPendingCommandSerial());
}
MaybeError Fence::ValidateOnCompletion(FenceAPISerial value,

View File

@ -196,25 +196,29 @@ namespace dawn_wire { namespace client {
return Buffer::CreateError(this);
}
WGPUQueue Device::GetDefaultQueue() {
WGPUQueue Device::GetQueue() {
// The queue is lazily created because if a Device is created by
// Reserve/Inject, we cannot send the getDefaultQueue message until
// Reserve/Inject, we cannot send the GetQueue message until
// it has been injected on the Server. It cannot happen immediately
// on construction.
if (mDefaultQueue == nullptr) {
// Get the default queue for this device.
if (mQueue == nullptr) {
// Get the primary queue for this device.
auto* allocation = client->QueueAllocator().New(client);
mDefaultQueue = allocation->object.get();
mQueue = allocation->object.get();
DeviceGetDefaultQueueCmd cmd;
DeviceGetQueueCmd cmd;
cmd.self = ToAPI(this);
cmd.result = ObjectHandle{allocation->object->id, allocation->generation};
client->SerializeCommand(cmd);
}
mDefaultQueue->refcount++;
return ToAPI(mDefaultQueue);
mQueue->refcount++;
return ToAPI(mQueue);
}
WGPUQueue Device::GetDefaultQueue() {
return GetQueue();
}
void Device::CreateReadyComputePipeline(WGPUComputePipelineDescriptor const* descriptor,

View File

@ -61,7 +61,9 @@ namespace dawn_wire { namespace client {
WGPUCreateReadyPipelineStatus status,
const char* message);
// TODO(dawn:22): Remove once the deprecation period is finished.
WGPUQueue GetDefaultQueue();
WGPUQueue GetQueue();
void CancelCallbacksForDisconnect() override;
@ -91,7 +93,7 @@ namespace dawn_wire { namespace client {
void* mErrorUserdata = nullptr;
void* mDeviceLostUserdata = nullptr;
Queue* mDefaultQueue = nullptr;
Queue* mQueue = nullptr;
std::shared_ptr<bool> mIsAlive;
};

View File

@ -163,7 +163,7 @@ int DawnWireServerFuzzer::Run(const uint8_t* data,
// Wait for all previous commands before destroying the server.
// TODO(enga): Improve this when we improve/finalize how processing events happens.
{
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
wgpu::Fence fence = queue.CreateFence();
queue.Signal(fence, 1u);
fence.OnCompletion(1u, CommandsCompleteCallback, 0);

View File

@ -828,7 +828,7 @@ void DawnTestBase::SetUp() {
"_" + ::testing::UnitTest::GetInstance()->current_test_info()->name();
mWireHelper->BeginWireTrace(traceName.c_str());
queue = device.GetDefaultQueue();
queue = device.GetQueue();
device.SetUncapturedErrorCallback(OnDeviceError, this);
device.SetDeviceLostCallback(OnDeviceLost, this);
@ -994,7 +994,7 @@ void DawnTestBase::FlushWire() {
}
void DawnTestBase::WaitForAllOperations() {
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
wgpu::Fence fence = queue.CreateFence();
// Force the currently submitted operations to completed.

View File

@ -105,9 +105,9 @@ class CopyTextureForBrowserTests : public DawnTest {
textureDataLayout.bytesPerRow = copyLayout.bytesPerRow;
textureDataLayout.rowsPerImage = copyLayout.rowsPerImage;
device.GetDefaultQueue().WriteTexture(&textureCopyView, textureArrayCopyData.data(),
textureArrayCopyData.size() * sizeof(RGBA8),
&textureDataLayout, &copyLayout.mipSize);
device.GetQueue().WriteTexture(&textureCopyView, textureArrayCopyData.data(),
textureArrayCopyData.size() * sizeof(RGBA8),
&textureDataLayout, &copyLayout.mipSize);
const wgpu::Extent3D copySizePerSlice = {copySize.width, copySize.height, 1};
// Perform the texture to texture copy
@ -120,8 +120,8 @@ class CopyTextureForBrowserTests : public DawnTest {
queue.Submit(1, &commands);
// Perform a copy here for testing.
device.GetDefaultQueue().CopyTextureForBrowser(&srcTextureCopyView, &dstTextureCopyView,
&copySize, options);
device.GetQueue().CopyTextureForBrowser(&srcTextureCopyView, &dstTextureCopyView, &copySize,
options);
// Texels in single slice.
const uint32_t texelCountInCopyRegion = utils::GetTexelCountInCopyRegion(

View File

@ -151,6 +151,19 @@ TEST_P(DeprecationTests, BindGroupLayoutEntryViewDimensionDefaulting) {
}
}
// Test Device::GetDefaultQueue deprecation.
TEST_P(DeprecationTests, GetDefaultQueueDeprecation) {
// Using GetDefaultQueue emits a warning.
wgpu::Queue deprecatedQueue;
EXPECT_DEPRECATION_WARNING(deprecatedQueue = device.GetDefaultQueue());
// Using GetQueue doesn't emit a warning.
wgpu::Queue queue = device.GetQueue();
// Both objects are the same, even with dawn_wire.
EXPECT_EQ(deprecatedQueue.Get(), queue.Get());
}
DAWN_INSTANTIATE_TEST(DeprecationTests,
D3D12Backend(),
MetalBackend(),

View File

@ -79,7 +79,7 @@ TEST_F(DeviceInitializationTest, DeviceOutlivesInstance) {
encoder.CopyBufferToBuffer(src, 0, dst, 0, 4 * sizeof(uint32_t));
wgpu::CommandBuffer commands = encoder.Finish();
device.GetDefaultQueue().Submit(1, &commands);
device.GetQueue().Submit(1, &commands);
bool done = false;
dst.MapAsync(

View File

@ -26,10 +26,10 @@
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();
// Test that GetQueue always returns the same object.
TEST_P(QueueTests, GetQueueSameObject) {
wgpu::Queue q1 = device.GetQueue();
wgpu::Queue q2 = device.GetQueue();
EXPECT_EQ(q1.Get(), q2.Get());
}

View File

@ -71,7 +71,7 @@ class BufferValidationTest : public ValidationTest {
ValidationTest::SetUp();
mockBufferMapAsyncCallback = std::make_unique<MockBufferMapAsyncCallback>();
queue = device.GetDefaultQueue();
queue = device.GetQueue();
}
void TearDown() override {

View File

@ -143,7 +143,7 @@ TEST_F(ErrorScopeValidationTest, PushPopBalanced) {
// Test that error scopes do not call their callbacks until after an enclosed Queue::Submit
// completes
TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmit) {
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
queue.Submit(0, nullptr);
@ -159,7 +159,7 @@ TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmit) {
// Test that parent error scopes do not call their callbacks until after an enclosed Queue::Submit
// completes
TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmitNested) {
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
@ -178,7 +178,7 @@ TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmitNested) {
// Test a callback that returns asynchronously followed by a synchronous one
TEST_F(ErrorScopeValidationTest, AsynchronousThenSynchronous) {
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
queue.Submit(0, nullptr);
@ -202,7 +202,7 @@ TEST_F(ErrorScopeValidationTest, DeviceDestroyedBeforeCallback) {
// TODO(crbug.com/dawn/652): This has different behavior on the wire and should be consistent.
DAWN_SKIP_TEST_IF(UsesWire());
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
queue.Submit(0, nullptr);

View File

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

View File

@ -133,7 +133,7 @@ TEST_F(OcclusionQueryValidationTest, InvalidOcclusionQuerySet) {
pass.EndOcclusionQuery();
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
occlusionQuerySet.Destroy();
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
}
@ -292,7 +292,7 @@ TEST_F(TimestampQueryValidationTest, WriteTimestampOnCommandEncoder) {
encoder.WriteTimestamp(timestampQuerySet, 0);
wgpu::CommandBuffer commands = encoder.Finish();
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
timestampQuerySet.Destroy();
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
}
@ -338,7 +338,7 @@ TEST_F(TimestampQueryValidationTest, WriteTimestampOnComputePassEncoder) {
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
timestampQuerySet.Destroy();
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
}
@ -419,7 +419,7 @@ TEST_F(TimestampQueryValidationTest, WriteTimestampOnRenderPassEncoder) {
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
timestampQuerySet.Destroy();
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
}
@ -517,7 +517,7 @@ TEST_F(ResolveQuerySetValidationTest, ResolveInvalidQuerySetAndIndexCount) {
encoder.ResolveQuerySet(querySet, 0, kQueryCount, destination, 0);
wgpu::CommandBuffer commands = encoder.Finish();
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
queue.Submit(1, &commands);
}
@ -542,7 +542,7 @@ TEST_F(ResolveQuerySetValidationTest, ResolveInvalidQuerySetAndIndexCount) {
encoder.ResolveQuerySet(querySet, 0, kQueryCount, destination, 0);
wgpu::CommandBuffer commands = encoder.Finish();
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
querySet.Destroy();
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
}
@ -562,7 +562,7 @@ TEST_F(ResolveQuerySetValidationTest, ResolveToInvalidBufferAndOffset) {
encoder.ResolveQuerySet(querySet, 1, kQueryCount - 1, destination, 8);
wgpu::CommandBuffer commands = encoder.Finish();
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
queue.Submit(1, &commands);
}
@ -611,7 +611,7 @@ TEST_F(ResolveQuerySetValidationTest, ResolveToInvalidBufferAndOffset) {
encoder.ResolveQuerySet(querySet, 0, kQueryCount, destination, 0);
wgpu::CommandBuffer commands = encoder.Finish();
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
destination.Destroy();
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
}

View File

@ -41,7 +41,7 @@ namespace {
commands = encoder.Finish();
}
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
// Submitting when the buffer has never been mapped should succeed
queue.Submit(1, &commands);
@ -84,7 +84,7 @@ namespace {
private:
void SetUp() override {
ValidationTest::SetUp();
queue = device.GetDefaultQueue();
queue = device.GetQueue();
}
protected:
@ -193,7 +193,7 @@ namespace {
// Test it is invalid to submit a command buffer twice
TEST_F(QueueSubmitValidationTest, CommandBufferSubmittedTwice) {
wgpu::CommandBuffer commandBuffer = device.CreateCommandEncoder().Finish();
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
// Should succeed
queue.Submit(1, &commandBuffer);
@ -224,7 +224,7 @@ namespace {
commands = encoder.Finish();
}
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
// Map the source buffer to force a failure
buffer.MapAsync(wgpu::MapMode::Write, 0, kBufferSize, nullptr, nullptr);

View File

@ -25,7 +25,7 @@ namespace {
private:
void SetUp() override {
ValidationTest::SetUp();
queue = device.GetDefaultQueue();
queue = device.GetQueue();
}
protected:

View File

@ -26,7 +26,7 @@ namespace {
void SetUp() override {
ValidationTest::SetUp();
queue = device.GetDefaultQueue();
queue = device.GetQueue();
}
wgpu::TextureDescriptor CreateDefaultTextureDescriptor() {

View File

@ -123,7 +123,7 @@ void ValidationTest::FlushWire() {
}
void ValidationTest::WaitForAllOperations(const wgpu::Device& device) {
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Queue queue = device.GetQueue();
wgpu::Fence fence = queue.CreateFence();
// Force the currently submitted operations to completed.

View File

@ -231,9 +231,9 @@ TEST_F(WireFenceTests, DestroyBeforeOnCompletionEnd) {
// Test that signaling a fence on a wrong queue is invalid
// DISABLED until we have support for multiple queues.
TEST_F(WireFenceTests, DISABLED_SignalWrongQueue) {
WGPUQueue queue2 = wgpuDeviceGetDefaultQueue(device);
WGPUQueue queue2 = wgpuDeviceGetQueue(device);
WGPUQueue apiQueue2 = api.GetNewQueue();
EXPECT_CALL(api, DeviceGetDefaultQueue(apiDevice)).WillOnce(Return(apiQueue2));
EXPECT_CALL(api, DeviceGetQueue(apiDevice)).WillOnce(Return(apiQueue2));
FlushClient();
wgpuQueueSignal(queue2, fence, 2u); // error
@ -245,9 +245,9 @@ TEST_F(WireFenceTests, DISABLED_SignalWrongQueue) {
// Test that signaling a fence on a wrong queue does not update fence signaled value
// DISABLED until we have support for multiple queues.
TEST_F(WireFenceTests, DISABLED_SignalWrongQueueDoesNotUpdateValue) {
WGPUQueue queue2 = wgpuDeviceGetDefaultQueue(device);
WGPUQueue queue2 = wgpuDeviceGetQueue(device);
WGPUQueue apiQueue2 = api.GetNewQueue();
EXPECT_CALL(api, DeviceGetDefaultQueue(apiDevice)).WillOnce(Return(apiQueue2));
EXPECT_CALL(api, DeviceGetQueue(apiDevice)).WillOnce(Return(apiQueue2));
FlushClient();
wgpuQueueSignal(queue2, fence, 2u); // error

View File

@ -107,16 +107,16 @@ TEST_F(WireInjectDeviceTests, InjectedDeviceLifetime) {
Mock::VerifyAndClearExpectations(&api);
}
// Test that it is an error to get the default queue of a device before it has been
// Test that it is an error to get the primary queue of a device before it has been
// injected on the server.
TEST_F(WireInjectDeviceTests, GetQueueBeforeInject) {
ReservedDevice reservation = GetWireClient()->ReserveDevice();
wgpuDeviceGetDefaultQueue(reservation.device);
wgpuDeviceGetQueue(reservation.device);
FlushClient(false);
}
// Test that it is valid to get the default queue of a device after it has been
// Test that it is valid to get the primary queue of a device after it has been
// injected on the server.
TEST_F(WireInjectDeviceTests, GetQueueAfterInject) {
ReservedDevice reservation = GetWireClient()->ReserveDevice();
@ -128,10 +128,10 @@ TEST_F(WireInjectDeviceTests, GetQueueAfterInject) {
ASSERT_TRUE(
GetWireServer()->InjectDevice(serverDevice, reservation.id, reservation.generation));
wgpuDeviceGetDefaultQueue(reservation.device);
wgpuDeviceGetQueue(reservation.device);
WGPUQueue apiQueue = api.GetNewQueue();
EXPECT_CALL(api, DeviceGetDefaultQueue(serverDevice)).WillOnce(Return(apiQueue));
EXPECT_CALL(api, DeviceGetQueue(serverDevice)).WillOnce(Return(apiQueue));
FlushClient();
// Called on shutdown.
@ -187,7 +187,7 @@ TEST_F(WireInjectDeviceTests, ReflectLiveDevices) {
// KnownObjects std::vector of devices. The fix was to store pointers to heap allocated
// objects instead.
TEST_F(WireInjectDeviceTests, TrackChildObjectsWithTwoReservedDevices) {
// Reserve one device, inject it, and get the default queue.
// Reserve one device, inject it, and get the primary queue.
ReservedDevice reservation1 = GetWireClient()->ReserveDevice();
WGPUDevice serverDevice1 = api.GetNewDevice();

View File

@ -70,10 +70,10 @@ class WireMultipleDeviceTests : public testing::Test {
mClientDevice = mWireClient->GetDevice();
// The GetDefaultQueue is done on WireClient startup so we expect it now.
mClientQueue = wgpuDeviceGetDefaultQueue(mClientDevice);
// The GetQueue is done on WireClient startup so we expect it now.
mClientQueue = wgpuDeviceGetQueue(mClientDevice);
mServerQueue = mApi.GetNewQueue();
EXPECT_CALL(mApi, DeviceGetDefaultQueue(mServerDevice)).WillOnce(Return(mServerQueue));
EXPECT_CALL(mApi, DeviceGetQueue(mServerDevice)).WillOnce(Return(mServerQueue));
FlushClient();
}

View File

@ -71,10 +71,10 @@ void WireTest::SetUp() {
apiDevice = mockDevice;
// The GetDefaultQueue is done on WireClient startup so we expect it now.
queue = wgpuDeviceGetDefaultQueue(device);
// The GetQueue is done on WireClient startup so we expect it now.
queue = wgpuDeviceGetQueue(device);
apiQueue = api.GetNewQueue();
EXPECT_CALL(api, DeviceGetDefaultQueue(apiDevice)).WillOnce(Return(apiQueue));
EXPECT_CALL(api, DeviceGetQueue(apiDevice)).WillOnce(Return(apiQueue));
FlushClient();
}

View File

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

View File

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

View File

@ -129,7 +129,7 @@ namespace utils {
wgpu::Extent3D copyExtent = {1, 1, 1};
// WriteTexture with exactly 1 byte of data.
device.GetDefaultQueue().WriteTexture(&textureCopyView, data.data(), 1, &textureDataLayout,
&copyExtent);
device.GetQueue().WriteTexture(&textureCopyView, data.data(), 1, &textureDataLayout,
&copyExtent);
}
} // namespace utils

View File

@ -170,7 +170,7 @@ namespace utils {
descriptor.usage = usage | wgpu::BufferUsage::CopyDst;
wgpu::Buffer buffer = device.CreateBuffer(&descriptor);
device.GetDefaultQueue().WriteBuffer(buffer, 0, data, size);
device.GetQueue().WriteBuffer(buffer, 0, data, size);
return buffer;
}