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

@@ -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();
}