mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[dxvk] Add method to query color attachment index from attachment index
This commit is contained in:
parent
0956050db6
commit
436820d233
@ -16,14 +16,14 @@ namespace dxvk {
|
|||||||
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
|
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
|
||||||
if (m_renderTargets.color[i].view != nullptr) {
|
if (m_renderTargets.color[i].view != nullptr) {
|
||||||
views[m_attachmentCount] = m_renderTargets.color[i].view->handle();
|
views[m_attachmentCount] = m_renderTargets.color[i].view->handle();
|
||||||
m_attachments[m_attachmentCount] = &m_renderTargets.color[i];
|
m_attachments[m_attachmentCount] = i;
|
||||||
m_attachmentCount += 1;
|
m_attachmentCount += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_renderTargets.depth.view != nullptr) {
|
if (m_renderTargets.depth.view != nullptr) {
|
||||||
views[m_attachmentCount] = m_renderTargets.depth.view->handle();
|
views[m_attachmentCount] = m_renderTargets.depth.view->handle();
|
||||||
m_attachments[m_attachmentCount] = &m_renderTargets.depth;
|
m_attachments[m_attachmentCount] = -1;
|
||||||
m_attachmentCount += 1;
|
m_attachmentCount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
int32_t DxvkFramebuffer::findAttachment(const Rc<DxvkImageView>& view) const {
|
int32_t DxvkFramebuffer::findAttachment(const Rc<DxvkImageView>& view) const {
|
||||||
for (uint32_t i = 0; i < m_attachmentCount; i++) {
|
for (uint32_t i = 0; i < m_attachmentCount; i++) {
|
||||||
if (m_attachments[i]->view == view)
|
if (getAttachment(i).view == view)
|
||||||
return int32_t(i);
|
return int32_t(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,6 +159,14 @@ namespace dxvk {
|
|||||||
return m_attachmentCount;
|
return m_attachmentCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Queries color attachment index of a given attachment
|
||||||
|
* \returns The index, or -1 if the given attachment is the depth attachment
|
||||||
|
*/
|
||||||
|
const int32_t getColorAttachmentIndex(uint32_t id) const {
|
||||||
|
return m_attachments[id];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retrieves attachment by index
|
* \brief Retrieves attachment by index
|
||||||
*
|
*
|
||||||
@ -166,7 +174,8 @@ namespace dxvk {
|
|||||||
* \returns The framebuffer attachment
|
* \returns The framebuffer attachment
|
||||||
*/
|
*/
|
||||||
const DxvkAttachment& getAttachment(uint32_t id) const {
|
const DxvkAttachment& getAttachment(uint32_t id) const {
|
||||||
return *m_attachments[id];
|
int32_t idx = getColorAttachmentIndex(id);
|
||||||
|
return idx < 0 ? m_renderTargets.depth : m_renderTargets.color[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -217,8 +226,8 @@ namespace dxvk {
|
|||||||
const DxvkRenderTargets m_renderTargets;
|
const DxvkRenderTargets m_renderTargets;
|
||||||
const DxvkFramebufferSize m_renderSize;
|
const DxvkFramebufferSize m_renderSize;
|
||||||
|
|
||||||
uint32_t m_attachmentCount = 0;
|
uint32_t m_attachmentCount = 0;
|
||||||
std::array<const DxvkAttachment*, MaxNumRenderTargets + 1> m_attachments;
|
std::array<int32_t, MaxNumRenderTargets + 1> m_attachments;
|
||||||
|
|
||||||
VkFramebuffer m_handle = VK_NULL_HANDLE;
|
VkFramebuffer m_handle = VK_NULL_HANDLE;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user