diff --git a/dawn.json b/dawn.json index ec91cd2849..050af44f3f 100644 --- a/dawn.json +++ b/dawn.json @@ -751,6 +751,10 @@ {"name": "descriptor", "type": "texture descriptor", "annotation": "const*"} ] }, + { + "name": "get queue", + "returns": "queue" + }, { "name": "get default queue", "returns": "queue" diff --git a/dawn_wire.json b/dawn_wire.json index 8693bd0a15..295cfc57bb 100644 --- a/dawn_wire.json +++ b/dawn_wire.json @@ -151,6 +151,7 @@ "BufferUnmap", "DeviceCreateErrorBuffer", "DeviceGetDefaultQueue", + "DeviceGetQueue", "DeviceInjectError", "DevicePushErrorScope", "QueueCreateFence" diff --git a/examples/Animometer.cpp b/examples/Animometer.cpp index f8bacd1f89..35b0d9277c 100644 --- a/examples/Animometer.cpp +++ b/examples/Animometer.cpp @@ -50,7 +50,7 @@ static std::vector shaderData; void init() { device = CreateCppDawnDevice(); - queue = device.GetDefaultQueue(); + queue = device.GetQueue(); swapchain = GetSwapChain(device); swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment, 640, 480); diff --git a/examples/CHelloTriangle.cpp b/examples/CHelloTriangle.cpp index 935c6617a0..107ba59cc0 100644 --- a/examples/CHelloTriangle.cpp +++ b/examples/CHelloTriangle.cpp @@ -26,7 +26,7 @@ WGPUTextureFormat swapChainFormat; void init() { device = CreateCppDawnDevice().Release(); - queue = wgpuDeviceGetDefaultQueue(device); + queue = wgpuDeviceGetQueue(device); { WGPUSwapChainDescriptor descriptor = {}; diff --git a/examples/ComputeBoids.cpp b/examples/ComputeBoids.cpp index a90d9e3694..c8f4f9d55f 100644 --- a/examples/ComputeBoids.cpp +++ b/examples/ComputeBoids.cpp @@ -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); diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp index fdaa22100a..9c608c8fc1 100644 --- a/examples/CppHelloTriangle.cpp +++ b/examples/CppHelloTriangle.cpp @@ -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); diff --git a/examples/CubeReflection.cpp b/examples/CubeReflection.cpp index eab5071f1c..34691bff9e 100644 --- a/examples/CubeReflection.cpp +++ b/examples/CubeReflection.cpp @@ -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); diff --git a/examples/ManualSwapChainTest.cpp b/examples/ManualSwapChainTest.cpp index eb7864ea17..771bb95f76 100644 --- a/examples/ManualSwapChainTest.cpp +++ b/examples/ManualSwapChainTest.cpp @@ -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); diff --git a/src/dawn_native/Buffer.cpp b/src/dawn_native/Buffer.cpp index 4f89724bdd..7c8dea9c05 100644 --- a/src/dawn_native/Buffer.cpp +++ b/src/dawn_native/Buffer.cpp @@ -287,8 +287,8 @@ namespace dawn_native { } std::unique_ptr request = std::make_unique(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) { diff --git a/src/dawn_native/CommandEncoder.cpp b/src/dawn_native/CommandEncoder.cpp index 635b722ba7..7ffa1cd7f1 100644 --- a/src/dawn_native/CommandEncoder.cpp +++ b/src/dawn_native/CommandEncoder.cpp @@ -419,8 +419,8 @@ namespace dawn_native { availabilityDesc.size = querySet->GetQueryCount() * sizeof(uint32_t); Ref 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(destinationOffset), @@ -429,7 +429,7 @@ namespace dawn_native { parmsDesc.usage = wgpu::BufferUsage::Uniform | wgpu::BufferUsage::CopyDst; parmsDesc.size = sizeof(params); Ref paramsBuffer = AcquireRef(device->CreateBuffer(&parmsDesc)); - device->GetDefaultQueue()->WriteBuffer(paramsBuffer.Get(), 0, ¶ms, sizeof(params)); + device->GetQueue()->WriteBuffer(paramsBuffer.Get(), 0, ¶ms, sizeof(params)); EncodeConvertTimestampsToNanoseconds(encoder, destination, availabilityBuffer.Get(), paramsBuffer.Get()); diff --git a/src/dawn_native/CopyTextureForBrowserHelper.cpp b/src/dawn_native/CopyTextureForBrowserHelper.cpp index 6f65389a1d..9df133c761 100644 --- a/src/dawn_native/CopyTextureForBrowserHelper.cpp +++ b/src/dawn_native/CopyTextureForBrowserHelper.cpp @@ -243,8 +243,7 @@ namespace dawn_native { uniformDesc.size = sizeof(uniformData); Ref 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 queue = AcquireRef(device->GetDefaultQueue()); + Ref queue = AcquireRef(device->GetQueue()); queue->Submit(1, &submitCommandBuffer); return {}; diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp index f451795ff0..1dc72d5b70 100644 --- a/src/dawn_native/Device.cpp +++ b/src/dawn_native/Device.cpp @@ -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) { diff --git a/src/dawn_native/Device.h b/src/dawn_native/Device.h index 04d1bb01af..413a9d899a 100644 --- a/src/dawn_native/Device.h +++ b/src/dawn_native/Device.h @@ -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 mDynamicUploader; std::unique_ptr mErrorScopeTracker; std::unique_ptr mCreateReadyPipelineTracker; - Ref mDefaultQueue; + Ref mQueue; struct DeprecationWarnings; std::unique_ptr mDeprecationWarnings; diff --git a/src/dawn_native/Fence.cpp b/src/dawn_native/Fence.cpp index 8069149922..88e03c8e61 100644 --- a/src/dawn_native/Fence.cpp +++ b/src/dawn_native/Fence.cpp @@ -136,8 +136,8 @@ namespace dawn_native { std::make_unique(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, diff --git a/src/dawn_wire/client/Device.cpp b/src/dawn_wire/client/Device.cpp index 9ce73d5a89..cbd661da3c 100644 --- a/src/dawn_wire/client/Device.cpp +++ b/src/dawn_wire/client/Device.cpp @@ -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, diff --git a/src/dawn_wire/client/Device.h b/src/dawn_wire/client/Device.h index add25c27c7..6e86dbe9be 100644 --- a/src/dawn_wire/client/Device.h +++ b/src/dawn_wire/client/Device.h @@ -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 mIsAlive; }; diff --git a/src/fuzzers/DawnWireServerFuzzer.cpp b/src/fuzzers/DawnWireServerFuzzer.cpp index 4561c42661..bee8bd1cff 100644 --- a/src/fuzzers/DawnWireServerFuzzer.cpp +++ b/src/fuzzers/DawnWireServerFuzzer.cpp @@ -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); diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index a6ce3e5da8..1a483ddfe6 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -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. diff --git a/src/tests/end2end/CopyTextureForBrowserTests.cpp b/src/tests/end2end/CopyTextureForBrowserTests.cpp index dcb425eab3..cca92c29ed 100644 --- a/src/tests/end2end/CopyTextureForBrowserTests.cpp +++ b/src/tests/end2end/CopyTextureForBrowserTests.cpp @@ -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, ©Layout.mipSize); + device.GetQueue().WriteTexture(&textureCopyView, textureArrayCopyData.data(), + textureArrayCopyData.size() * sizeof(RGBA8), + &textureDataLayout, ©Layout.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, - ©Size, options); + device.GetQueue().CopyTextureForBrowser(&srcTextureCopyView, &dstTextureCopyView, ©Size, + options); // Texels in single slice. const uint32_t texelCountInCopyRegion = utils::GetTexelCountInCopyRegion( diff --git a/src/tests/end2end/DeprecatedAPITests.cpp b/src/tests/end2end/DeprecatedAPITests.cpp index f66126dbf7..78a39da9d9 100644 --- a/src/tests/end2end/DeprecatedAPITests.cpp +++ b/src/tests/end2end/DeprecatedAPITests.cpp @@ -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(), diff --git a/src/tests/end2end/DeviceInitializationTests.cpp b/src/tests/end2end/DeviceInitializationTests.cpp index b90da97e28..11b73d1b3e 100644 --- a/src/tests/end2end/DeviceInitializationTests.cpp +++ b/src/tests/end2end/DeviceInitializationTests.cpp @@ -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( diff --git a/src/tests/end2end/QueueTests.cpp b/src/tests/end2end/QueueTests.cpp index 1f6708258b..02cfad0751 100644 --- a/src/tests/end2end/QueueTests.cpp +++ b/src/tests/end2end/QueueTests.cpp @@ -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()); } diff --git a/src/tests/unittests/validation/BufferValidationTests.cpp b/src/tests/unittests/validation/BufferValidationTests.cpp index 0aa5953569..0cc595bde2 100644 --- a/src/tests/unittests/validation/BufferValidationTests.cpp +++ b/src/tests/unittests/validation/BufferValidationTests.cpp @@ -71,7 +71,7 @@ class BufferValidationTest : public ValidationTest { ValidationTest::SetUp(); mockBufferMapAsyncCallback = std::make_unique(); - queue = device.GetDefaultQueue(); + queue = device.GetQueue(); } void TearDown() override { diff --git a/src/tests/unittests/validation/ErrorScopeValidationTests.cpp b/src/tests/unittests/validation/ErrorScopeValidationTests.cpp index 177856565c..f6dbf4616f 100644 --- a/src/tests/unittests/validation/ErrorScopeValidationTests.cpp +++ b/src/tests/unittests/validation/ErrorScopeValidationTests.cpp @@ -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); diff --git a/src/tests/unittests/validation/FenceValidationTests.cpp b/src/tests/unittests/validation/FenceValidationTests.cpp index 0e680b5ed0..f01a8558a8 100644 --- a/src/tests/unittests/validation/FenceValidationTests.cpp +++ b/src/tests/unittests/validation/FenceValidationTests.cpp @@ -53,7 +53,7 @@ class FenceValidationTest : public ValidationTest { ValidationTest::SetUp(); mockFenceOnCompletionCallback = std::make_unique(); - 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; diff --git a/src/tests/unittests/validation/QueryValidationTests.cpp b/src/tests/unittests/validation/QueryValidationTests.cpp index 257cc72304..1ee0134765 100644 --- a/src/tests/unittests/validation/QueryValidationTests.cpp +++ b/src/tests/unittests/validation/QueryValidationTests.cpp @@ -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)); } diff --git a/src/tests/unittests/validation/QueueSubmitValidationTests.cpp b/src/tests/unittests/validation/QueueSubmitValidationTests.cpp index 3eb2d7e08e..d6280ba548 100644 --- a/src/tests/unittests/validation/QueueSubmitValidationTests.cpp +++ b/src/tests/unittests/validation/QueueSubmitValidationTests.cpp @@ -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); diff --git a/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp b/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp index 26d92e424b..d464761331 100644 --- a/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp +++ b/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp @@ -25,7 +25,7 @@ namespace { private: void SetUp() override { ValidationTest::SetUp(); - queue = device.GetDefaultQueue(); + queue = device.GetQueue(); } protected: diff --git a/src/tests/unittests/validation/TextureValidationTests.cpp b/src/tests/unittests/validation/TextureValidationTests.cpp index 1a5eb96b09..f5c0de5430 100644 --- a/src/tests/unittests/validation/TextureValidationTests.cpp +++ b/src/tests/unittests/validation/TextureValidationTests.cpp @@ -26,7 +26,7 @@ namespace { void SetUp() override { ValidationTest::SetUp(); - queue = device.GetDefaultQueue(); + queue = device.GetQueue(); } wgpu::TextureDescriptor CreateDefaultTextureDescriptor() { diff --git a/src/tests/unittests/validation/ValidationTest.cpp b/src/tests/unittests/validation/ValidationTest.cpp index 5fe6946d22..7960583429 100644 --- a/src/tests/unittests/validation/ValidationTest.cpp +++ b/src/tests/unittests/validation/ValidationTest.cpp @@ -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. diff --git a/src/tests/unittests/wire/WireFenceTests.cpp b/src/tests/unittests/wire/WireFenceTests.cpp index fb4b2e84ff..b573345093 100644 --- a/src/tests/unittests/wire/WireFenceTests.cpp +++ b/src/tests/unittests/wire/WireFenceTests.cpp @@ -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 diff --git a/src/tests/unittests/wire/WireInjectDeviceTests.cpp b/src/tests/unittests/wire/WireInjectDeviceTests.cpp index f1cad6dc6f..28d7a2002a 100644 --- a/src/tests/unittests/wire/WireInjectDeviceTests.cpp +++ b/src/tests/unittests/wire/WireInjectDeviceTests.cpp @@ -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(); diff --git a/src/tests/unittests/wire/WireMultipleDeviceTests.cpp b/src/tests/unittests/wire/WireMultipleDeviceTests.cpp index 216c122848..0dac80aded 100644 --- a/src/tests/unittests/wire/WireMultipleDeviceTests.cpp +++ b/src/tests/unittests/wire/WireMultipleDeviceTests.cpp @@ -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(); } diff --git a/src/tests/unittests/wire/WireTest.cpp b/src/tests/unittests/wire/WireTest.cpp index d3f17c3ad6..db27f8cd88 100644 --- a/src/tests/unittests/wire/WireTest.cpp +++ b/src/tests/unittests/wire/WireTest.cpp @@ -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(); } diff --git a/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp b/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp index 6f68696577..3c90859207 100644 --- a/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp +++ b/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp @@ -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(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 */); diff --git a/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp b/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp index 5eb1eb6da0..b209ca7b04 100644 --- a/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp +++ b/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp @@ -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(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; diff --git a/src/utils/TestUtils.cpp b/src/utils/TestUtils.cpp index 73a86b5fb7..6cbaa8766e 100644 --- a/src/utils/TestUtils.cpp +++ b/src/utils/TestUtils.cpp @@ -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, - ©Extent); + device.GetQueue().WriteTexture(&textureCopyView, data.data(), 1, &textureDataLayout, + ©Extent); } } // namespace utils diff --git a/src/utils/WGPUHelpers.cpp b/src/utils/WGPUHelpers.cpp index 68372c4e5d..b470dfc484 100644 --- a/src/utils/WGPUHelpers.cpp +++ b/src/utils/WGPUHelpers.cpp @@ -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; }