d3d11: set object labels

Change-Id: I26b7accf973b03cef7ba113b0ee3672b99e41338
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126861
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
This commit is contained in:
Peng Huang 2023-04-19 23:26:15 +00:00 committed by Dawn LUCI CQ
parent 5faf59d81d
commit ff75ab9a87
7 changed files with 31 additions and 10 deletions

View File

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

View File

@ -39,7 +39,7 @@ class ComputePipeline final : public ComputePipelineBase {
private:
using ComputePipelineBase::ComputePipelineBase;
~ComputePipeline() override;
void DestroyImpl() override;
void SetLabelImpl() override;
ComPtr<ID3D11ComputeShader> mComputeShader;
};

View File

@ -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() {

View File

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

View File

@ -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

View File

@ -29,6 +29,8 @@ class Sampler final : public SamplerBase {
ID3D11SamplerState* GetD3D11SamplerState() const;
void SetLabelImpl() override;
private:
using SamplerBase::SamplerBase;

View File

@ -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<ID3D11Resource> d3d11Texture) {
mD3d11Resource = std::move(d3d11Texture);
SetLabelHelper("Dawn_SwapChainTexture");
return {};
}
@ -499,6 +500,9 @@ ResultOrError<ComPtr<ID3D11UnorderedAccessView>> TextureView::GetD3D11UnorderedA
->CreateUnorderedAccessView(
ToBackend(GetTexture())->GetD3D11Resource(), &uavDesc, &uav),
"CreateUnorderedAccessView"));
SetDebugName(ToBackend(GetDevice()), uav.Get(), "Dawn_TextureView", GetLabel());
return uav;
}