[dxvk] Added render target queries for framebuffers

This commit is contained in:
Philip Rebohle 2017-12-04 13:39:14 +01:00
parent 9fa6592b7d
commit 60992143b1
2 changed files with 40 additions and 0 deletions

View File

@ -53,6 +53,26 @@ namespace dxvk {
}
int32_t DxvkRenderTargets::getAttachmentId(
const Rc<DxvkImageView>& 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<DxvkImageView>& renderTarget) const {
auto extent = renderTarget->image()->info().extent;

View File

@ -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<DxvkImageView>& view) const;
private:
std::array<Rc<DxvkImageView>, 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<vk::DeviceFn> m_vkd;