| 10 | #include "Engine/Profiler/ProfilerMemory.h" |
| 11 | |
| 12 | void BackBufferDX12::Setup(GPUSwapChainDX12* window, ID3D12Resource* backbuffer) |
| 13 | { |
| 14 | // Cache handle and set default initial state for the backbuffers |
| 15 | initResource(backbuffer, D3D12_RESOURCE_STATE_PRESENT, 1); |
| 16 | |
| 17 | Handle.Init(window, window->GetDevice(), this, GPU_BACK_BUFFER_PIXEL_FORMAT, MSAALevel::None); |
| 18 | |
| 19 | // Create RTV |
| 20 | { |
| 21 | D3D12_RENDER_TARGET_VIEW_DESC rtDesc; |
| 22 | rtDesc.Format = (DXGI_FORMAT)GPU_BACK_BUFFER_PIXEL_FORMAT; |
| 23 | rtDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; |
| 24 | rtDesc.Texture2D.MipSlice = 0; |
| 25 | rtDesc.Texture2D.PlaneSlice = 0; |
| 26 | Handle.SetRTV(rtDesc); |
| 27 | } |
| 28 | |
| 29 | #if GPU_USE_WINDOW_SRV |
| 30 | // Create SRV |
| 31 | { |
| 32 | D3D12_SHADER_RESOURCE_VIEW_DESC srDesc; |
| 33 | srDesc.Format = (DXGI_FORMAT)GPU_BACK_BUFFER_PIXEL_FORMAT; |
| 34 | srDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; |
| 35 | srDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; |
| 36 | srDesc.Texture2D.MostDetailedMip = 0; |
| 37 | srDesc.Texture2D.MipLevels = 1; |
| 38 | srDesc.Texture2D.ResourceMinLODClamp = 0; |
| 39 | srDesc.Texture2D.PlaneSlice = 0; |
| 40 | Handle.SetSRV(srDesc); |
| 41 | } |
| 42 | #endif |
| 43 | } |
| 44 | |
| 45 | void BackBufferDX12::Release() |
| 46 | { |
no test coverage detected