VideoBackends: add support to allow rendering to multiple output textures

This commit is contained in:
iwubcode
2023-05-28 20:59:02 -05:00
parent 252d3f353a
commit 834f8f7b5c
43 changed files with 713 additions and 327 deletions

View File

@ -7,13 +7,15 @@
#include <memory>
#include <string>
#include <string_view>
#include <vector>
#include "Common/CommonTypes.h"
#include "VideoBackends/D3D/D3DBase.h"
#include "VideoCommon/AbstractFramebuffer.h"
#include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/AbstractStagingTexture.h"
#include "VideoCommon/AbstractTexture.h"
#include "VideoCommon/RenderBase.h"
namespace DX11
{
@ -81,20 +83,28 @@ class DXFramebuffer final : public AbstractFramebuffer
{
public:
DXFramebuffer(AbstractTexture* color_attachment, AbstractTexture* depth_attachment,
std::vector<AbstractTexture*> additional_color_attachments,
AbstractTextureFormat color_format, AbstractTextureFormat depth_format, u32 width,
u32 height, u32 layers, u32 samples, ComPtr<ID3D11RenderTargetView> rtv,
ComPtr<ID3D11RenderTargetView> integer_rtv, ComPtr<ID3D11DepthStencilView> dsv);
ComPtr<ID3D11RenderTargetView> integer_rtv, ComPtr<ID3D11DepthStencilView> dsv,
std::vector<ComPtr<ID3D11RenderTargetView>> additional_rtvs);
~DXFramebuffer() override;
ID3D11RenderTargetView* const* GetRTVArray() const { return m_rtv.GetAddressOf(); }
ID3D11RenderTargetView* const* GetRTVArray() const { return m_render_targets_raw.data(); }
ID3D11RenderTargetView* const* GetIntegerRTVArray() const { return m_integer_rtv.GetAddressOf(); }
UINT GetNumRTVs() const { return m_rtv ? 1 : 0; }
UINT GetNumRTVs() const { return static_cast<UINT>(m_render_targets_raw.size()); }
ID3D11DepthStencilView* GetDSV() const { return m_dsv.Get(); }
static std::unique_ptr<DXFramebuffer> Create(DXTexture* color_attachment,
DXTexture* depth_attachment);
void Unbind();
void Clear(const ClearColor& color_value, float depth_value);
static std::unique_ptr<DXFramebuffer>
Create(DXTexture* color_attachment, DXTexture* depth_attachment,
std::vector<AbstractTexture*> additional_color_attachments);
protected:
ComPtr<ID3D11RenderTargetView> m_rtv;
std::vector<ComPtr<ID3D11RenderTargetView>> m_render_targets;
std::vector<ID3D11RenderTargetView*> m_render_targets_raw;
ComPtr<ID3D11RenderTargetView> m_integer_rtv;
ComPtr<ID3D11DepthStencilView> m_dsv;
};