mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 20:52:10 +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++) {
|
||||
if (m_renderTargets.color[i].view != nullptr) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_renderTargets.depth.view != nullptr) {
|
||||
views[m_attachmentCount] = m_renderTargets.depth.view->handle();
|
||||
m_attachments[m_attachmentCount] = &m_renderTargets.depth;
|
||||
m_attachments[m_attachmentCount] = -1;
|
||||
m_attachmentCount += 1;
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ namespace dxvk {
|
||||
|
||||
int32_t DxvkFramebuffer::findAttachment(const Rc<DxvkImageView>& view) const {
|
||||
for (uint32_t i = 0; i < m_attachmentCount; i++) {
|
||||
if (m_attachments[i]->view == view)
|
||||
if (getAttachment(i).view == view)
|
||||
return int32_t(i);
|
||||
}
|
||||
|
||||
|
@ -159,6 +159,14 @@ namespace dxvk {
|
||||
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
|
||||
*
|
||||
@ -166,9 +174,10 @@ namespace dxvk {
|
||||
* \returns The framebuffer attachment
|
||||
*/
|
||||
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];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Finds attachment index by view
|
||||
*
|
||||
@ -217,8 +226,8 @@ namespace dxvk {
|
||||
const DxvkRenderTargets m_renderTargets;
|
||||
const DxvkFramebufferSize m_renderSize;
|
||||
|
||||
uint32_t m_attachmentCount = 0;
|
||||
std::array<const DxvkAttachment*, MaxNumRenderTargets + 1> m_attachments;
|
||||
uint32_t m_attachmentCount = 0;
|
||||
std::array<int32_t, MaxNumRenderTargets + 1> m_attachments;
|
||||
|
||||
VkFramebuffer m_handle = VK_NULL_HANDLE;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user