Search code examples
c++renderingvulkanrenderdoc

Vulkan dynamic rendering, nothing seems to be getting rasterized


I am trying to render using the dynamic rendering extension, to this effect I am trying to render just a triangle with these 2 shaders:

#version 450

layout(location = 0) in vec2 inPosition;
layout(location = 1) in vec3 inColor;

layout(location = 0) out vec3 fragColor;

void main() {
    gl_Position = vec4(inPosition, 0.5, 1.0);
    fragColor = inColor;
}
#version 450

layout(location = 0) in vec3 fragColor;

layout(location = 0) out vec4 outColor;

void main() {
    outColor = vec4(vec3(1), 1.0);
}

I am testing my first frame with renderdoc, the vertices seem fine:

enter image description here

So does the output of the vertex shader:

enter image description here

These are the rasterization settings:

enter image description here

As you can see there is no culling, so no matter what the triangle should be rasterized.

But when I go onto the FB both the swapchain image and depth attachment are unaffected. The depth is 1 everywhere and the color attachment is 0 everywhere.

I don't understand why this is not rendering.


Solution

  • In case someone runs into this problem in the future.

    I was trying to render just a single frame (rather than on a loop) so I was not synchronizing objects because I thought it would not be necessary.

    Turns out it very much is, so if you are rendering to the swacphain images even if just once, things won't work unless you use the appropriate fences and semaphores.