diff --git a/src/dawn/native/d3d11/ComputePipelineD3D11.cpp b/src/dawn/native/d3d11/ComputePipelineD3D11.cpp index 8744a0f662..1d50d59d76 100644 --- a/src/dawn/native/d3d11/ComputePipelineD3D11.cpp +++ b/src/dawn/native/d3d11/ComputePipelineD3D11.cpp @@ -21,6 +21,7 @@ #include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d11/DeviceD3D11.h" #include "dawn/native/d3d11/ShaderModuleD3D11.h" +#include "dawn/native/d3d11/UtilsD3D11.h" namespace dawn::native::d3d11 { @@ -33,10 +34,6 @@ Ref ComputePipeline::CreateUninitialized( ComputePipeline::~ComputePipeline() = default; -void ComputePipeline::DestroyImpl() { - ComputePipelineBase::DestroyImpl(); -} - MaybeError ComputePipeline::Initialize() { Device* device = ToBackend(GetDevice()); uint32_t compileFlags = 0; @@ -68,9 +65,15 @@ MaybeError ComputePipeline::Initialize() { nullptr, &mComputeShader), "D3D11 create compute shader")); + SetLabelImpl(); + return {}; } +void ComputePipeline::SetLabelImpl() { + SetDebugName(ToBackend(GetDevice()), mComputeShader.Get(), "Dawn_ComputePipeline", GetLabel()); +} + void ComputePipeline::ApplyNow(CommandRecordingContext* commandContext) { ID3D11DeviceContext1* d3dDeviceContext1 = commandContext->GetD3D11DeviceContext1(); d3dDeviceContext1->CSSetShader(mComputeShader.Get(), nullptr, 0); diff --git a/src/dawn/native/d3d11/ComputePipelineD3D11.h b/src/dawn/native/d3d11/ComputePipelineD3D11.h index 7da11e8ae7..fe4713f72f 100644 --- a/src/dawn/native/d3d11/ComputePipelineD3D11.h +++ b/src/dawn/native/d3d11/ComputePipelineD3D11.h @@ -39,7 +39,7 @@ class ComputePipeline final : public ComputePipelineBase { private: using ComputePipelineBase::ComputePipelineBase; ~ComputePipeline() override; - void DestroyImpl() override; + void SetLabelImpl() override; ComPtr mComputeShader; }; diff --git a/src/dawn/native/d3d11/RenderPipelineD3D11.cpp b/src/dawn/native/d3d11/RenderPipelineD3D11.cpp index 408b5b49d3..8a4621fab2 100644 --- a/src/dawn/native/d3d11/RenderPipelineD3D11.cpp +++ b/src/dawn/native/d3d11/RenderPipelineD3D11.cpp @@ -183,6 +183,7 @@ MaybeError RenderPipeline::Initialize() { DAWN_TRY(InitializeShaders()); DAWN_TRY(InitializeDepthStencilState()); + SetLabelImpl(); return {}; } @@ -207,8 +208,14 @@ bool RenderPipeline::GetUsesVertexOrInstanceIndex() const { return mUsesVertexOrInstanceIndex; } -void RenderPipeline::DestroyImpl() { - RenderPipelineBase::DestroyImpl(); +void RenderPipeline::SetLabelImpl() { + SetDebugName(ToBackend(GetDevice()), mRasterizerState.Get(), "Dawn_RenderPipeline", GetLabel()); + SetDebugName(ToBackend(GetDevice()), mInputLayout.Get(), "Dawn_RenderPipeline", GetLabel()); + SetDebugName(ToBackend(GetDevice()), mVertexShader.Get(), "Dawn_RenderPipeline", GetLabel()); + SetDebugName(ToBackend(GetDevice()), mPixelShader.Get(), "Dawn_RenderPipeline", GetLabel()); + SetDebugName(ToBackend(GetDevice()), mBlendState.Get(), "Dawn_RenderPipeline", GetLabel()); + SetDebugName(ToBackend(GetDevice()), mDepthStencilState.Get(), "Dawn_RenderPipeline", + GetLabel()); } MaybeError RenderPipeline::InitializeRasterizerState() { diff --git a/src/dawn/native/d3d11/RenderPipelineD3D11.h b/src/dawn/native/d3d11/RenderPipelineD3D11.h index 9f69c53e6d..79729f71fb 100644 --- a/src/dawn/native/d3d11/RenderPipelineD3D11.h +++ b/src/dawn/native/d3d11/RenderPipelineD3D11.h @@ -47,7 +47,7 @@ class RenderPipeline final : public RenderPipelineBase { ~RenderPipeline() override; MaybeError Initialize() override; - void DestroyImpl() override; + void SetLabelImpl() override; MaybeError InitializeRasterizerState(); MaybeError InitializeInputLayout(const Blob& vertexShader); diff --git a/src/dawn/native/d3d11/SamplerD3D11.cpp b/src/dawn/native/d3d11/SamplerD3D11.cpp index 15ecfa0701..6c374f1cfc 100644 --- a/src/dawn/native/d3d11/SamplerD3D11.cpp +++ b/src/dawn/native/d3d11/SamplerD3D11.cpp @@ -92,6 +92,7 @@ MaybeError Sampler::Initialize(const SamplerDescriptor* descriptor) { ->CreateSamplerState(&samplerDesc, &mD3d11SamplerState), "ID3D11Device::CreateSamplerState")); + SetLabelImpl(); return {}; } @@ -99,4 +100,8 @@ ID3D11SamplerState* Sampler::GetD3D11SamplerState() const { return mD3d11SamplerState.Get(); } +void Sampler::SetLabelImpl() { + SetDebugName(ToBackend(GetDevice()), mD3d11SamplerState.Get(), "Dawn_Sampler", GetLabel()); +} + } // namespace dawn::native::d3d11 diff --git a/src/dawn/native/d3d11/SamplerD3D11.h b/src/dawn/native/d3d11/SamplerD3D11.h index 3626e51bcb..360aabbabc 100644 --- a/src/dawn/native/d3d11/SamplerD3D11.h +++ b/src/dawn/native/d3d11/SamplerD3D11.h @@ -29,6 +29,8 @@ class Sampler final : public SamplerBase { ID3D11SamplerState* GetD3D11SamplerState() const; + void SetLabelImpl() override; + private: using SamplerBase::SamplerBase; diff --git a/src/dawn/native/d3d11/TextureD3D11.cpp b/src/dawn/native/d3d11/TextureD3D11.cpp index b65a21aa9c..cd36cd5322 100644 --- a/src/dawn/native/d3d11/TextureD3D11.cpp +++ b/src/dawn/native/d3d11/TextureD3D11.cpp @@ -134,20 +134,21 @@ MaybeError Texture::InitializeAsInternalTexture() { } } - SetLabelImpl(); - if (device->IsToggleEnabled(Toggle::NonzeroClearResourcesOnCreationForTesting)) { CommandRecordingContext* commandContext = device->GetPendingCommandContext(); DAWN_TRY( ClearTexture(commandContext, GetAllSubresources(), TextureBase::ClearValue::NonZero)); } + SetLabelImpl(); + return {}; } MaybeError Texture::InitializeAsSwapChainTexture(ComPtr d3d11Texture) { mD3d11Resource = std::move(d3d11Texture); SetLabelHelper("Dawn_SwapChainTexture"); + return {}; } @@ -499,6 +500,9 @@ ResultOrError> TextureView::GetD3D11UnorderedA ->CreateUnorderedAccessView( ToBackend(GetTexture())->GetD3D11Resource(), &uavDesc, &uav), "CreateUnorderedAccessView")); + + SetDebugName(ToBackend(GetDevice()), uav.Get(), "Dawn_TextureView", GetLabel()); + return uav; }