diff --git a/src/dxvk/dxvk_framebuffer.cpp b/src/dxvk/dxvk_framebuffer.cpp index b1d7a46bd..21376294f 100644 --- a/src/dxvk/dxvk_framebuffer.cpp +++ b/src/dxvk/dxvk_framebuffer.cpp @@ -53,6 +53,26 @@ namespace dxvk { } + int32_t DxvkRenderTargets::getAttachmentId( + const Rc& view) const { + if (view == nullptr) + return -1; + + if (m_depthTarget == view) + return 0; + + uint32_t colorAttachmentBaseId = + m_depthTarget == nullptr ? 0 : 1; + + for (uint32_t i = 0; i < MaxNumRenderTargets; i++) { + if (m_colorTargets.at(i) == view) + return i + colorAttachmentBaseId; + } + + return -1; + } + + DxvkFramebufferSize DxvkRenderTargets::renderTargetSize( const Rc& renderTarget) const { auto extent = renderTarget->image()->info().extent; diff --git a/src/dxvk/dxvk_framebuffer.h b/src/dxvk/dxvk_framebuffer.h index fb5f5c356..a644e2d34 100644 --- a/src/dxvk/dxvk_framebuffer.h +++ b/src/dxvk/dxvk_framebuffer.h @@ -94,6 +94,18 @@ namespace dxvk { */ DxvkFramebufferSize getImageSize() const; + /** + * \brief Retrieves the ID of an attachment + * + * This can be used to locate a color attachment + * or the depth-stencil attachment. Returns -1 + * if the given view is not an attachment. + * \param [in] view View to find + * \returns Attachment ID, or \c -1 + */ + int32_t getAttachmentId( + const Rc& view) const; + private: std::array, MaxNumRenderTargets> m_colorTargets; @@ -147,6 +159,14 @@ namespace dxvk { return m_framebufferSize; } + /** + * \brief Render target info + * \returns Render target info + */ + const DxvkRenderTargets& renderTargets() const { + return m_renderTargets; + } + private: Rc m_vkd;