D3D12: Remove ComPtr from d3d12::Device::GetD3D12Device()

Accessing the d3d device using COM needlessly
refcounts. This is a particular issue in areas
that frequently access the d3d device like
Populate().

BUG=dawn:155

Change-Id: I24e83093623afd02fa592d8ec0c404b4571c374b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19703
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
This commit is contained in:
Bryan Bernhart 2020-04-16 18:59:53 +00:00 committed by Commit Bot service account
parent 3741f7373c
commit 319672791e
4 changed files with 6 additions and 6 deletions

View File

@ -44,7 +44,7 @@ namespace dawn_native { namespace d3d12 {
const auto& bindingOffsets = bgl->GetBindingOffsets(); const auto& bindingOffsets = bgl->GetBindingOffsets();
ID3D12Device* d3d12Device = device->GetD3D12Device().Get(); ID3D12Device* d3d12Device = device->GetD3D12Device();
// It's not necessary to create descriptors in the descriptor heap for dynamic resources. // It's not necessary to create descriptors in the descriptor heap for dynamic resources.
// This is because they are created as root descriptors which are never heap allocated. // This is because they are created as root descriptors which are never heap allocated.
@ -162,7 +162,7 @@ namespace dawn_native { namespace d3d12 {
const BindGroupLayout* bgl = ToBackend(GetLayout()); const BindGroupLayout* bgl = ToBackend(GetLayout());
const Serial pendingSerial = device->GetPendingCommandSerial(); const Serial pendingSerial = device->GetPendingCommandSerial();
ID3D12Device* d3d12Device = device->GetD3D12Device().Get(); ID3D12Device* d3d12Device = device->GetD3D12Device();
// CPU bindgroups are sparsely allocated across CPU heaps. Instead of doing // CPU bindgroups are sparsely allocated across CPU heaps. Instead of doing
// simple copies per bindgroup, a single non-simple copy could be issued. // simple copies per bindgroup, a single non-simple copy could be issued.

View File

@ -309,7 +309,7 @@ namespace dawn_native { namespace d3d12 {
DAWN_TRY_ASSIGN(rtvHeap, DAWN_TRY_ASSIGN(rtvHeap,
allocator->AllocateCPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE_RTV, rtvCount)); allocator->AllocateCPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE_RTV, rtvCount));
ASSERT(rtvHeap.Get() != nullptr); ASSERT(rtvHeap.Get() != nullptr);
ID3D12Device* d3dDevice = device->GetD3D12Device().Get(); ID3D12Device* d3dDevice = device->GetD3D12Device();
unsigned int rtvIndex = 0; unsigned int rtvIndex = 0;
for (uint32_t i : for (uint32_t i :
IterateBitSet(renderPass->attachmentState->GetColorAttachmentsMask())) { IterateBitSet(renderPass->attachmentState->GetColorAttachmentsMask())) {

View File

@ -135,8 +135,8 @@ namespace dawn_native { namespace d3d12 {
ShutDownBase(); ShutDownBase();
} }
ComPtr<ID3D12Device> Device::GetD3D12Device() const { ID3D12Device* Device::GetD3D12Device() const {
return mD3d12Device; return mD3d12Device.Get();
} }
ComPtr<ID3D12CommandQueue> Device::GetCommandQueue() const { ComPtr<ID3D12CommandQueue> Device::GetCommandQueue() const {

View File

@ -59,7 +59,7 @@ namespace dawn_native { namespace d3d12 {
Serial GetLastSubmittedCommandSerial() const final override; Serial GetLastSubmittedCommandSerial() const final override;
MaybeError TickImpl() override; MaybeError TickImpl() override;
ComPtr<ID3D12Device> GetD3D12Device() const; ID3D12Device* GetD3D12Device() const;
ComPtr<ID3D12CommandQueue> GetCommandQueue() const; ComPtr<ID3D12CommandQueue> GetCommandQueue() const;
ID3D12SharingContract* GetSharingContract() const; ID3D12SharingContract* GetSharingContract() const;