Multi-pass rendering, G-Buffer textures overlapped by strange color

Hello everyone! I’m sorry if I have duplicated an existing topic, I was able to find quite similar one, however it couldn’t solve my problem.

I’m trying to implement a renderer with multiple render passes using the Deferred Shading technique as an example (I find it more straightforward for a beginner to Vulkan). Went through a various articles and documentation I was able to implement a basic G-Buffer → Lighting renderer with two separate render passes, and it partially works - I can see what the first render pass has drawn to textures, however it appears overlapped by some color in the fragment shader of the second render pass. I suspect it’s happening because of wrong synchronization between the render passes or framebuffers misconfiguration, I’ve tried various parameters to subpass-dependencies and it didn’t work. The weird thing is the glitch is disappearing when I use just one texture in the G-Buffer instead of three.

I’m fighting it a couple of days already and would be very appriciated if you could help me to figure out.

I’ve put my code to Pastebin

Functions to create pipelines for G-Buffer and Lighting pass
Functions to create render passes for G-Buffer and Lighthing stages
Fragment shaders for each render pass
G-Buffer attachments and descriptors set creation
Pipelines and passes definition
draw() function

Thank you in advance!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.