From 00349e6e36242ec77e40ac451435dc1e2c4fdca9 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Mon, 17 Jul 2017 15:14:01 -0400 Subject: [PATCH] Default-initialize descriptor heaps to null (#82) --- src/backend/d3d12/CommandBufferD3D12.cpp | 8 ++++---- src/backend/d3d12/DescriptorHeapAllocator.cpp | 5 +++-- src/backend/d3d12/DescriptorHeapAllocator.h | 1 - src/backend/d3d12/FramebufferD3D12.h | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/backend/d3d12/CommandBufferD3D12.cpp b/src/backend/d3d12/CommandBufferD3D12.cpp index 01f8ed10c8..3a5c1feba0 100644 --- a/src/backend/d3d12/CommandBufferD3D12.cpp +++ b/src/backend/d3d12/CommandBufferD3D12.cpp @@ -47,10 +47,10 @@ namespace d3d12 { struct BindGroupStateTracker { uint32_t cbvSrvUavDescriptorIndex = 0; uint32_t samplerDescriptorIndex = 0; - DescriptorHeapHandle cbvSrvUavCPUDescriptorHeap; - DescriptorHeapHandle samplerCPUDescriptorHeap; - DescriptorHeapHandle cbvSrvUavGPUDescriptorHeap; - DescriptorHeapHandle samplerGPUDescriptorHeap; + DescriptorHeapHandle cbvSrvUavCPUDescriptorHeap = {}; + DescriptorHeapHandle samplerCPUDescriptorHeap = {}; + DescriptorHeapHandle cbvSrvUavGPUDescriptorHeap = {}; + DescriptorHeapHandle samplerGPUDescriptorHeap = {}; std::array bindGroups = {}; Device* device; diff --git a/src/backend/d3d12/DescriptorHeapAllocator.cpp b/src/backend/d3d12/DescriptorHeapAllocator.cpp index 1eb1e3af5d..3d0bdf011f 100644 --- a/src/backend/d3d12/DescriptorHeapAllocator.cpp +++ b/src/backend/d3d12/DescriptorHeapAllocator.cpp @@ -20,11 +20,12 @@ namespace backend { namespace d3d12 { - DescriptorHeapHandle::DescriptorHeapHandle() { + DescriptorHeapHandle::DescriptorHeapHandle() + : descriptorHeap(nullptr), sizeIncrement(0), offset(0) { } DescriptorHeapHandle::DescriptorHeapHandle(ComPtr descriptorHeap, uint32_t sizeIncrement, uint32_t offset) - : device(device), descriptorHeap(descriptorHeap), sizeIncrement(sizeIncrement), offset(offset) { + : descriptorHeap(descriptorHeap), sizeIncrement(sizeIncrement), offset(offset) { } ID3D12DescriptorHeap* DescriptorHeapHandle::Get() const { diff --git a/src/backend/d3d12/DescriptorHeapAllocator.h b/src/backend/d3d12/DescriptorHeapAllocator.h index 1c5ad2e15a..9de0dd7396 100644 --- a/src/backend/d3d12/DescriptorHeapAllocator.h +++ b/src/backend/d3d12/DescriptorHeapAllocator.h @@ -37,7 +37,6 @@ namespace d3d12 { D3D12_GPU_DESCRIPTOR_HANDLE GetGPUHandle(uint32_t index) const; private: - Device* device; ComPtr descriptorHeap; uint32_t sizeIncrement; uint32_t offset; diff --git a/src/backend/d3d12/FramebufferD3D12.h b/src/backend/d3d12/FramebufferD3D12.h index a2a2888be0..9f3c7c4868 100644 --- a/src/backend/d3d12/FramebufferD3D12.h +++ b/src/backend/d3d12/FramebufferD3D12.h @@ -40,9 +40,9 @@ namespace d3d12 { OMSetRenderTargetArgs GetSubpassOMSetRenderTargetArgs(uint32_t subpassIndex); private: - Device* device; - DescriptorHeapHandle rtvHeap; - DescriptorHeapHandle dsvHeap; + Device* device = nullptr; + DescriptorHeapHandle rtvHeap = {}; + DescriptorHeapHandle dsvHeap = {}; // Indices into either the RTV or DSV heap, depending on texture format. std::vector attachmentHeapIndices;