From 8d9d132f7cd1fe22c4ca88d580195951ca49c276 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Tue, 5 Apr 2022 22:09:43 +0000 Subject: [PATCH] Revert "Enable Queue, Device labels to be set." This reverts commit 0126761de8c586099a65dd19edee8e219de51739. Reason for revert: Causing Dawn->Chromium roll to fail BUG=dawn:1346 Original change's description: > Enable Queue, Device labels to be set. > > Queue labels can be set by the defaultQueue.label member of the device > descriptor or the setQueue method. > > Device labels can be set label member of the device > descriptor or the setQueue method. > > D3D12 and VK backend label support included. > > Change-Id: Id12dd6e1fc8f1519c55e4efb35e1ead67c085e46 > Bug: dawn:1323 > Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85540 > Reviewed-by: Kai Ninomiya > Commit-Queue: Brandon Jones # Not skipping CQ checks because original CL landed > 1 day ago. Bug: dawn:1323 Change-Id: I62e4b508d2c55fd89f2f4c5cbe5d04d22681aeef Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85700 Reviewed-by: Brandon Jones Auto-Submit: Ryan Harrison Reviewed-by: Austin Eng Commit-Queue: Austin Eng --- dawn.json | 21 ++------------------- src/dawn/native/Device.cpp | 12 +----------- src/dawn/native/Device.h | 2 +- src/dawn/native/d3d12/DeviceD3D12.cpp | 12 +++--------- src/dawn/native/d3d12/DeviceD3D12.h | 5 +---- src/dawn/native/d3d12/QueueD3D12.cpp | 9 --------- src/dawn/native/d3d12/QueueD3D12.h | 3 --- src/dawn/native/metal/DeviceMTL.h | 2 +- src/dawn/native/metal/DeviceMTL.mm | 6 +++--- src/dawn/native/null/DeviceNull.cpp | 6 +++--- src/dawn/native/null/DeviceNull.h | 2 +- src/dawn/native/opengl/DeviceGL.cpp | 6 +++--- src/dawn/native/opengl/DeviceGL.h | 2 +- src/dawn/native/vulkan/DeviceVk.cpp | 13 +++---------- src/dawn/native/vulkan/DeviceVk.h | 4 +--- src/dawn/native/vulkan/QueueVk.cpp | 11 ----------- src/dawn/native/vulkan/QueueVk.h | 3 --- 17 files changed, 24 insertions(+), 95 deletions(-) diff --git a/dawn.json b/dawn.json index ccdad15b8c..3578858ab3 100644 --- a/dawn.json +++ b/dawn.json @@ -153,7 +153,7 @@ {"name": "required features count", "type": "uint32_t", "default": 0}, {"name": "required features", "type": "feature name", "annotation": "const*", "length": "required features count", "default": "nullptr"}, {"name": "required limits", "type": "required limits", "annotation": "const*", "optional": true}, - {"name": "default queue", "type": "queue descriptor"} + {"name": "default queue", "type": "queue descriptor", "tags": ["upstream"]} ] }, "dawn toggles device descriptor": { @@ -1152,15 +1152,6 @@ {"name": "callback", "type": "error callback"}, {"name": "userdata", "type": "void", "annotation": "*"} ] - }, - { - "name": "set label", - "returns": "void", - "tags": ["dawn"], - "_TODO": "needs an upstream equivalent", - "args": [ - {"name": "label", "type": "char", "annotation": "const*", "length": "strlen"} - ] } ] }, @@ -1672,21 +1663,13 @@ {"name": "copy size", "type": "extent 3D", "annotation": "const*"}, {"name": "options", "type": "copy texture for browser options", "annotation": "const*"} ] - }, - { - "name": "set label", - "returns": "void", - "tags": ["dawn"], - "_TODO": "needs an upstream equivalent", - "args": [ - {"name": "label", "type": "char", "annotation": "const*", "length": "strlen"} - ] } ] }, "queue descriptor": { "category": "structure", "extensible": "in", + "tags": ["upstream"], "members": [ {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true} ] diff --git a/src/dawn/native/Device.cpp b/src/dawn/native/Device.cpp index 479a685c5d..f79ead5717 100644 --- a/src/dawn/native/Device.cpp +++ b/src/dawn/native/Device.cpp @@ -198,10 +198,6 @@ namespace dawn::native { mFormatTable = BuildFormatTable(this); SetDefaultToggles(); - - if (descriptor->label != nullptr && strlen(descriptor->label) != 0) { - mLabel = descriptor->label; - } } DeviceBase::DeviceBase() : mState(State::Alive) { @@ -214,15 +210,9 @@ namespace dawn::native { mQueue = nullptr; } - MaybeError DeviceBase::Initialize(QueueBase* defaultQueue, const DeviceDescriptor* descriptor) { + MaybeError DeviceBase::Initialize(QueueBase* defaultQueue) { mQueue = AcquireRef(defaultQueue); - // If an label was specified for the default queue in the device descriptor, set it now. - if (descriptor->defaultQueue.label != nullptr && - strlen(descriptor->defaultQueue.label) != 0) { - mQueue->APISetLabel(descriptor->defaultQueue.label); - } - #if defined(DAWN_ENABLE_ASSERTS) mUncapturedErrorCallback = [](WGPUErrorType, char const*, void*) { static bool calledOnce = false; diff --git a/src/dawn/native/Device.h b/src/dawn/native/Device.h index 0193df33eb..db13e093dd 100644 --- a/src/dawn/native/Device.h +++ b/src/dawn/native/Device.h @@ -382,7 +382,7 @@ namespace dawn::native { void SetToggle(Toggle toggle, bool isEnabled); void ForceSetToggle(Toggle toggle, bool isEnabled); - MaybeError Initialize(QueueBase* defaultQueue, const DeviceDescriptor* descriptor); + MaybeError Initialize(QueueBase* defaultQueue); void DestroyObjects(); void Destroy(); diff --git a/src/dawn/native/d3d12/DeviceD3D12.cpp b/src/dawn/native/d3d12/DeviceD3D12.cpp index b9e7f24dce..415b486534 100644 --- a/src/dawn/native/d3d12/DeviceD3D12.cpp +++ b/src/dawn/native/d3d12/DeviceD3D12.cpp @@ -59,11 +59,11 @@ namespace dawn::native::d3d12 { ResultOrError> Device::Create(Adapter* adapter, const DeviceDescriptor* descriptor) { Ref device = AcquireRef(new Device(adapter, descriptor)); - DAWN_TRY(device->Initialize(descriptor)); + DAWN_TRY(device->Initialize()); return device; } - MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { + MaybeError Device::Initialize() { InitTogglesFromDriver(); mD3d12Device = ToBackend(GetAdapter())->GetDevice(); @@ -163,7 +163,7 @@ namespace dawn::native::d3d12 { GetD3D12Device()->CreateCommandSignature(&programDesc, NULL, IID_PPV_ARGS(&mDrawIndexedIndirectSignature)); - DAWN_TRY(DeviceBase::Initialize(new Queue(this), descriptor)); + DAWN_TRY(DeviceBase::Initialize(new Queue(this))); // Device shouldn't be used until after DeviceBase::Initialize so we must wait until after // device initialization to call NextSerial DAWN_TRY(NextSerial()); @@ -174,8 +174,6 @@ namespace dawn::native::d3d12 { DAWN_TRY(CreateZeroBuffer()); - SetLabelImpl(); - return {}; } @@ -743,8 +741,4 @@ namespace dawn::native::d3d12 { return ToBackend(computePipeline)->UsesNumWorkgroups(); } - void Device::SetLabelImpl() { - SetDebugName(this, mD3d12Device.Get(), "Dawn_Device", GetLabel()); - } - } // namespace dawn::native::d3d12 diff --git a/src/dawn/native/d3d12/DeviceD3D12.h b/src/dawn/native/d3d12/DeviceD3D12.h index 7ed408e1a1..1a837929a3 100644 --- a/src/dawn/native/d3d12/DeviceD3D12.h +++ b/src/dawn/native/d3d12/DeviceD3D12.h @@ -45,7 +45,7 @@ namespace dawn::native::d3d12 { const DeviceDescriptor* descriptor); ~Device() override; - MaybeError Initialize(const DeviceDescriptor* descriptor); + MaybeError Initialize(); ResultOrError> CreateCommandBuffer( CommandEncoder* encoder, @@ -147,9 +147,6 @@ namespace dawn::native::d3d12 { bool ShouldDuplicateNumWorkgroupsForDispatchIndirect( ComputePipelineBase* computePipeline) const override; - // Dawn API - void SetLabelImpl() override; - private: using DeviceBase::DeviceBase; diff --git a/src/dawn/native/d3d12/QueueD3D12.cpp b/src/dawn/native/d3d12/QueueD3D12.cpp index a638736059..cb92f2160b 100644 --- a/src/dawn/native/d3d12/QueueD3D12.cpp +++ b/src/dawn/native/d3d12/QueueD3D12.cpp @@ -21,14 +21,12 @@ #include "dawn/native/d3d12/CommandBufferD3D12.h" #include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" -#include "dawn/native/d3d12/UtilsD3D12.h" #include "dawn/platform/DawnPlatform.h" #include "dawn/platform/tracing/TraceEvent.h" namespace dawn::native::d3d12 { Queue::Queue(Device* device) : QueueBase(device) { - SetLabelImpl(); } MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) { @@ -53,11 +51,4 @@ namespace dawn::native::d3d12 { return {}; } - void Queue::SetLabelImpl() { - Device* device = ToBackend(GetDevice()); - // TODO(crbug.com/dawn/1344): When we start using multiple queues this needs to be adjusted - // so it doesn't always change the default queue's label. - SetDebugName(device, device->GetCommandQueue().Get(), "Dawn_Queue", GetLabel()); - } - } // namespace dawn::native::d3d12 diff --git a/src/dawn/native/d3d12/QueueD3D12.h b/src/dawn/native/d3d12/QueueD3D12.h index c6e5f39226..6f15a7dfbd 100644 --- a/src/dawn/native/d3d12/QueueD3D12.h +++ b/src/dawn/native/d3d12/QueueD3D12.h @@ -30,9 +30,6 @@ namespace dawn::native::d3d12 { private: MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override; - - // Dawn API - void SetLabelImpl() override; }; } // namespace dawn::native::d3d12 diff --git a/src/dawn/native/metal/DeviceMTL.h b/src/dawn/native/metal/DeviceMTL.h index c42b01b2ce..a6b6592e73 100644 --- a/src/dawn/native/metal/DeviceMTL.h +++ b/src/dawn/native/metal/DeviceMTL.h @@ -43,7 +43,7 @@ namespace dawn::native::metal { const DeviceDescriptor* descriptor); ~Device() override; - MaybeError Initialize(const DeviceDescriptor* descriptor); + MaybeError Initialize(); MaybeError TickImpl() override; diff --git a/src/dawn/native/metal/DeviceMTL.mm b/src/dawn/native/metal/DeviceMTL.mm index 652edaf686..e2e784e770 100644 --- a/src/dawn/native/metal/DeviceMTL.mm +++ b/src/dawn/native/metal/DeviceMTL.mm @@ -110,7 +110,7 @@ namespace dawn::native::metal { NSPRef> mtlDevice, const DeviceDescriptor* descriptor) { Ref device = AcquireRef(new Device(adapter, std::move(mtlDevice), descriptor)); - DAWN_TRY(device->Initialize(descriptor)); + DAWN_TRY(device->Initialize()); return device; } @@ -124,7 +124,7 @@ namespace dawn::native::metal { Destroy(); } - MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { + MaybeError Device::Initialize() { InitTogglesFromDriver(); mCommandQueue.Acquire([*mMtlDevice newCommandQueue]); @@ -155,7 +155,7 @@ namespace dawn::native::metal { } } - return DeviceBase::Initialize(new Queue(this), descriptor); + return DeviceBase::Initialize(new Queue(this)); } void Device::InitTogglesFromDriver() { diff --git a/src/dawn/native/null/DeviceNull.cpp b/src/dawn/native/null/DeviceNull.cpp index c7a22a6ef5..bb1d2f2899 100644 --- a/src/dawn/native/null/DeviceNull.cpp +++ b/src/dawn/native/null/DeviceNull.cpp @@ -103,7 +103,7 @@ namespace dawn::native::null { ResultOrError> Device::Create(Adapter* adapter, const DeviceDescriptor* descriptor) { Ref device = AcquireRef(new Device(adapter, descriptor)); - DAWN_TRY(device->Initialize(descriptor)); + DAWN_TRY(device->Initialize()); return device; } @@ -111,8 +111,8 @@ namespace dawn::native::null { Destroy(); } - MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { - return DeviceBase::Initialize(new Queue(this), descriptor); + MaybeError Device::Initialize() { + return DeviceBase::Initialize(new Queue(this)); } ResultOrError> Device::CreateBindGroupImpl( diff --git a/src/dawn/native/null/DeviceNull.h b/src/dawn/native/null/DeviceNull.h index 4f04645dd3..d810c066ea 100644 --- a/src/dawn/native/null/DeviceNull.h +++ b/src/dawn/native/null/DeviceNull.h @@ -90,7 +90,7 @@ namespace dawn::native::null { const DeviceDescriptor* descriptor); ~Device() override; - MaybeError Initialize(const DeviceDescriptor* descriptor); + MaybeError Initialize(); ResultOrError> CreateCommandBuffer( CommandEncoder* encoder, diff --git a/src/dawn/native/opengl/DeviceGL.cpp b/src/dawn/native/opengl/DeviceGL.cpp index 9ce84d2779..00222d1a3c 100644 --- a/src/dawn/native/opengl/DeviceGL.cpp +++ b/src/dawn/native/opengl/DeviceGL.cpp @@ -39,7 +39,7 @@ namespace dawn::native::opengl { const DeviceDescriptor* descriptor, const OpenGLFunctions& functions) { Ref device = AcquireRef(new Device(adapter, descriptor, functions)); - DAWN_TRY(device->Initialize(descriptor)); + DAWN_TRY(device->Initialize()); return device; } @@ -53,11 +53,11 @@ namespace dawn::native::opengl { Destroy(); } - MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { + MaybeError Device::Initialize() { InitTogglesFromDriver(); mFormatTable = BuildGLFormatTable(); - return DeviceBase::Initialize(new Queue(this), descriptor); + return DeviceBase::Initialize(new Queue(this)); } void Device::InitTogglesFromDriver() { diff --git a/src/dawn/native/opengl/DeviceGL.h b/src/dawn/native/opengl/DeviceGL.h index 08a3c9ff5d..f6c673c0cb 100644 --- a/src/dawn/native/opengl/DeviceGL.h +++ b/src/dawn/native/opengl/DeviceGL.h @@ -42,7 +42,7 @@ namespace dawn::native::opengl { const OpenGLFunctions& functions); ~Device() override; - MaybeError Initialize(const DeviceDescriptor* descriptor); + MaybeError Initialize(); // Contains all the OpenGL entry points, glDoFoo is called via device->gl.DoFoo. const OpenGLFunctions gl; diff --git a/src/dawn/native/vulkan/DeviceVk.cpp b/src/dawn/native/vulkan/DeviceVk.cpp index 110951f54c..7660f4c1bc 100644 --- a/src/dawn/native/vulkan/DeviceVk.cpp +++ b/src/dawn/native/vulkan/DeviceVk.cpp @@ -48,7 +48,7 @@ namespace dawn::native::vulkan { ResultOrError> Device::Create(Adapter* adapter, const DeviceDescriptor* descriptor) { Ref device = AcquireRef(new Device(adapter, descriptor)); - DAWN_TRY(device->Initialize(descriptor)); + DAWN_TRY(device->Initialize()); return device; } @@ -57,7 +57,7 @@ namespace dawn::native::vulkan { InitTogglesFromDriver(); } - MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { + MaybeError Device::Initialize() { // Copy the adapter's device info to the device so that we can change the "knobs" mDeviceInfo = ToBackend(GetAdapter())->GetDeviceInfo(); @@ -101,9 +101,7 @@ namespace dawn::native::vulkan { // extension is available. Override the decision if it is no applicable. ApplyUseZeroInitializeWorkgroupMemoryExtensionToggle(); - SetLabelImpl(); - - return DeviceBase::Initialize(Queue::Create(this), descriptor); + return DeviceBase::Initialize(Queue::Create(this)); } Device::~Device() { @@ -1052,9 +1050,4 @@ namespace dawn::native::vulkan { return mDeviceInfo.properties.limits.timestampPeriod; } - void Device::SetLabelImpl() { - SetDebugName(this, VK_OBJECT_TYPE_DEVICE, reinterpret_cast(mVkDevice), - "Dawn_Device", GetLabel()); - } - } // namespace dawn::native::vulkan diff --git a/src/dawn/native/vulkan/DeviceVk.h b/src/dawn/native/vulkan/DeviceVk.h index fc5757cdea..55697efeec 100644 --- a/src/dawn/native/vulkan/DeviceVk.h +++ b/src/dawn/native/vulkan/DeviceVk.h @@ -47,7 +47,7 @@ namespace dawn::native::vulkan { const DeviceDescriptor* descriptor); ~Device() override; - MaybeError Initialize(const DeviceDescriptor* descriptor); + MaybeError Initialize(); // Contains all the Vulkan entry points, vkDoFoo is called via device->fn.DoFoo. const VulkanFunctions fn; @@ -105,8 +105,6 @@ namespace dawn::native::vulkan { float GetTimestampPeriodInNS() const override; - void SetLabelImpl() override; - private: Device(Adapter* adapter, const DeviceDescriptor* descriptor); diff --git a/src/dawn/native/vulkan/QueueVk.cpp b/src/dawn/native/vulkan/QueueVk.cpp index c8645fe824..875b771b0d 100644 --- a/src/dawn/native/vulkan/QueueVk.cpp +++ b/src/dawn/native/vulkan/QueueVk.cpp @@ -22,7 +22,6 @@ #include "dawn/native/vulkan/CommandBufferVk.h" #include "dawn/native/vulkan/CommandRecordingContext.h" #include "dawn/native/vulkan/DeviceVk.h" -#include "dawn/native/vulkan/UtilsVulkan.h" #include "dawn/platform/DawnPlatform.h" #include "dawn/platform/tracing/TraceEvent.h" @@ -34,7 +33,6 @@ namespace dawn::native::vulkan { } Queue::Queue(Device* device) : QueueBase(device) { - SetLabelImpl(); } Queue::~Queue() { @@ -58,13 +56,4 @@ namespace dawn::native::vulkan { return {}; } - void Queue::SetLabelImpl() { - Device* device = ToBackend(GetDevice()); - VkQueue handle = device->GetQueue(); - // TODO(crbug.com/dawn/1344): When we start using multiple queues this needs to be adjusted - // so it doesn't always change the default queue's label. - SetDebugName(device, VK_OBJECT_TYPE_QUEUE, reinterpret_cast(handle), - "Dawn_Queue", GetLabel()); - } - } // namespace dawn::native::vulkan diff --git a/src/dawn/native/vulkan/QueueVk.h b/src/dawn/native/vulkan/QueueVk.h index 1e7f69e173..a80b875ec6 100644 --- a/src/dawn/native/vulkan/QueueVk.h +++ b/src/dawn/native/vulkan/QueueVk.h @@ -25,9 +25,6 @@ namespace dawn::native::vulkan { public: static Queue* Create(Device* device); - // Dawn API - void SetLabelImpl() override; - private: Queue(Device* device); ~Queue() override;