diff --git a/src/libANGLE/renderer/vulkan/FramebufferVk.cpp b/src/libANGLE/renderer/vulkan/FramebufferVk.cpp index 0deef0df8a..239f87e933 100644 --- a/src/libANGLE/renderer/vulkan/FramebufferVk.cpp +++ b/src/libANGLE/renderer/vulkan/FramebufferVk.cpp @@ -2934,8 +2934,12 @@ void FramebufferVk::updateRenderPassDesc(ContextVk *contextVk) if (contextVk->getFeatures().enableMultisampledRenderToTexture.enabled) { // Update descriptions regarding multisampled-render-to-texture use. + // Iterate all color attachments (not just enabled draw buffers) so that + // an MSRTT attachment with glDrawBuffers(GL_NONE) is still detected as + // render-to-texture; this must stay consistent with the unfiltered + // attachment iteration above and with getSamplesImpl(). bool isRenderToTexture = false; - for (size_t colorIndexGL : mState.getEnabledDrawBuffers()) + for (size_t colorIndexGL : mState.getColorAttachmentsMask()) { const gl::FramebufferAttachment *color = mState.getColorAttachment(colorIndexGL); ASSERT(color); @@ -4100,7 +4104,14 @@ GLint FramebufferVk::getSamplesImpl() const { const gl::FramebufferAttachment *lastAttachment = nullptr; - for (size_t colorIndexGL : mState.getEnabledDrawBuffers() & mState.getColorAttachmentsMask()) + // Iterate all color attachments, not just enabled draw buffers. This must + // stay consistent with updateRenderPassDesc()/updateAttachmentsAndRenderTargets() + // (which iterate the unfiltered getColorAttachmentsMask()) so that the + // VkRenderPass attachment sample count matches the VkImageView actually bound + // in vkCreateFramebuffer. Otherwise glDrawBuffers(GL_NONE) on an MSRTT FBO + // yields RenderPassDesc.samples()=1 while a multisampled VkImage is bound, + // violating VUID-VkFramebufferCreateInfo-pAttachments-00881. + for (size_t colorIndexGL : mState.getColorAttachmentsMask()) { const gl::FramebufferAttachment *color = mState.getColorAttachment(colorIndexGL); ASSERT(color);