@@ -94,7 +94,7 @@ void D3D12::Init(HWND hwnd) {
9494 this ->CreateTexture (this ->m_nWidth , this ->m_nHeight , 8 , D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, this ->m_positionBuff );
9595
9696 this ->m_albedoBuff ->SetName (L" Albedo" );
97- this ->m_uvBuff ->SetName (L" UV " );
97+ this ->m_uvBuff ->SetName (L" Normal " );
9898 this ->m_positionBuff ->SetName (L" Position" );
9999
100100 this ->m_nAlbedoIndex = this ->m_rtvHeap ->GetDescriptorCount ();
@@ -202,20 +202,21 @@ void D3D12::Update() {
202202 Descriptor albedoDesc = this ->m_rtvHeap ->GetDescriptor (this ->m_nAlbedoIndex );
203203 Descriptor UVDesc = this ->m_rtvHeap ->GetDescriptor (this ->m_nUVIndex );
204204 Descriptor positionDesc = this ->m_rtvHeap ->GetDescriptor (this ->m_nPositionIndex );
205+ Descriptor dsvDesc = this ->m_dsvHeap ->GetDescriptor (0 );
205206 this ->m_list ->ClearRenderTargetView (albedoDesc.cpuHandle , RGBA{ 0 .f , 0 .f , 0 .f , 1 .f }, 0 , nullptr );
206207 this ->m_list ->ClearRenderTargetView (UVDesc.cpuHandle , RGBA{ 0 .f , 0 .f , 0 .f , 1 .f }, 0 , nullptr );
207208 this ->m_list ->ClearRenderTargetView (positionDesc.cpuHandle , RGBA{ 0 .f , 0 .f , 0 .f , 1 .f }, 0 , nullptr );
209+ this ->m_list ->ClearDepthStencilView (dsvDesc.cpuHandle , D3D12_CLEAR_FLAG_DEPTH, 1 .f , 0 .f , 0 , nullptr );
208210
209211 this ->m_list ->RSSetViewports (1 , &this ->m_viewport );
210212 this ->m_list ->RSSetScissorRects (1 , &this ->m_scissor );
211213
212- Descriptor dsv = this ->m_dsvHeap ->GetDescriptor (0 );
213214 D3D12_CPU_DESCRIPTOR_HANDLE gbuffers[] = {
214215 albedoDesc.cpuHandle ,
215216 UVDesc.cpuHandle ,
216217 positionDesc.cpuHandle
217218 };
218- this ->m_list ->OMSetRenderTargets (_countof (gbuffers), gbuffers, FALSE , &dsv .cpuHandle );
219+ this ->m_list ->OMSetRenderTargets (_countof (gbuffers), gbuffers, FALSE , &dsvDesc .cpuHandle );
219220
220221 this ->sceneMgr ->Render ();
221222
0 commit comments