//-------------------------------------------------------------------------------------- // File: RenderTexture.h // // Helper for managing offscreen render targets // // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. //------------------------------------------------------------------------------------- #pragma once #include #include #include namespace DX { class RenderTexture { public: explicit RenderTexture(DXGI_FORMAT format) noexcept; RenderTexture(RenderTexture&&) = default; RenderTexture& operator= (RenderTexture&&) = default; RenderTexture(RenderTexture const&) = delete; RenderTexture& operator= (RenderTexture const&) = delete; void SetDevice(_In_ ID3D11Device* device); void SizeResources(size_t width, size_t height); void ReleaseDevice() noexcept; void SetWindow(const RECT& rect); ID3D11Texture2D* GetRenderTarget() const noexcept { return m_renderTarget.Get(); } ID3D11RenderTargetView* GetRenderTargetView() const noexcept { return m_renderTargetView.Get(); } ID3D11ShaderResourceView* GetShaderResourceView() const noexcept { return m_shaderResourceView.Get(); } DXGI_FORMAT GetFormat() const noexcept { return m_format; } private: Microsoft::WRL::ComPtr m_device; Microsoft::WRL::ComPtr m_renderTarget; Microsoft::WRL::ComPtr m_renderTargetView; Microsoft::WRL::ComPtr m_shaderResourceView; DXGI_FORMAT m_format; size_t m_width; size_t m_height; }; }