GL: Subpass transition fix with GPU_ATTACHEMENT_IGNORE

GPU_ATTACHEMENT_IGNORE should work on slots that
contain no attachments.
This commit is contained in:
Clément Foucault
2023-10-01 18:00:40 +02:00
parent 8b7bbee14f
commit 8fe0ffed4e
2 changed files with 3 additions and 4 deletions

View File

@@ -193,6 +193,8 @@ void GPU_framebuffer_bind_loadstore(GPUFrameBuffer *framebuffer,
* GPU_ATTACHEMENT_WRITE} // Color attachment 2
* })
* \endcode
*
* \note Excess attachments will have no effect as long as they are GPU_ATTACHEMENT_IGNORE.
*/
void GPU_framebuffer_subpass_transition_array(GPUFrameBuffer *framebuffer,
const GPUAttachmentState *attachment_states,

View File

@@ -287,12 +287,9 @@ void GLFrameBuffer::subpass_transition(const GPUAttachmentState depth_attachment
tmp_detached_[type] = GPU_ATTACHMENT_NONE;
}
}
else {
else if (color_attachment_states[i] == GPU_ATTACHEMENT_READ) {
tmp_detached_[type] = this->attachments_[type];
unwrap(tmp_detached_[type].tex)->detach_from(this);
}
if (color_attachment_states[i] == GPU_ATTACHEMENT_READ) {
GPU_texture_bind_ex(tmp_detached_[type].tex, GPUSamplerState::default_sampler(), i);
}
}