home *** CD-ROM | disk | FTP | other *** search
- //***************************************************************************************
- // RenderTarget.h by Frank Luna (C) 2015 All Rights Reserved.
- //***************************************************************************************
-
- #pragma once
-
- #include "../../Common/d3dUtil.h"
-
- class RenderTarget
- {
- public:
- ///<summary>
- /// The width and height should match the dimensions of the input texture to blur.
- /// Recreate when the screen is resized.
- ///</summary>
- RenderTarget(ID3D12Device* device,
- UINT width, UINT height,
- DXGI_FORMAT format);
-
- RenderTarget(const RenderTarget& rhs)=delete;
- RenderTarget& operator=(const RenderTarget& rhs)=delete;
- ~RenderTarget()=default;
-
- ID3D12Resource* Resource();
- CD3DX12_GPU_DESCRIPTOR_HANDLE Srv();
- CD3DX12_CPU_DESCRIPTOR_HANDLE Rtv();
-
- void BuildDescriptors(
- CD3DX12_CPU_DESCRIPTOR_HANDLE hCpuSrv,
- CD3DX12_GPU_DESCRIPTOR_HANDLE hGpuSrv,
- CD3DX12_CPU_DESCRIPTOR_HANDLE hCpuRtv);
-
- void OnResize(UINT newWidth, UINT newHeight);
-
- private:
- void BuildDescriptors();
- void BuildResource();
-
- private:
-
- ID3D12Device* md3dDevice = nullptr;
-
- UINT mWidth = 0;
- UINT mHeight = 0;
- DXGI_FORMAT mFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
-
- CD3DX12_CPU_DESCRIPTOR_HANDLE mhCpuSrv;
- CD3DX12_GPU_DESCRIPTOR_HANDLE mhGpuSrv;
- CD3DX12_CPU_DESCRIPTOR_HANDLE mhCpuRtv;
-
- // Two for ping-ponging the textures.
- Microsoft::WRL::ComPtr<ID3D12Resource> mOffscreenTex = nullptr;
- };
-
-