Advertisement

Input attachment reads as black.

Started by May 23, 2018 07:28 PM
1 comment, last by tanzanite7 6 years, 8 months ago

Trying to figure out why input attachment reads as black with NSight VS plugin - and failing.

This is what i can see at the invocation point of the shader:

* attachment is filled with correct data (just a clear to bright red in previous renderpass) and used by the fragment shader:


// SPIR-V decompiled to GLSL
#version 450

layout(binding = 0) uniform sampler2D accum;
// originally: layout(input_attachment_index=0, set=0, binding=0) uniform subpassInput accum;

layout(location = 0) out vec4 fbFinal;

void main(){
    fbFinal = vec4(texelFetch(accum, ivec2(gl_FragCoord.xy), 0).xyz + vec3(0.0, 0.0, 1.0), 1.0);
    // originally: fbFinal = vec4(subpassLoad(accum).rgb + vec3(0.0, 0.0, 1.0), 1.0);
}

* the resulting image is bright blue - instead of the expected bright purple (red+blue)

How can this happen?

'fbFinal' format is B8G8R8A8_UNORM and 'accum' format is R16G16B16A16_UNORM - ie. nothing weird.

New day, new ideas.

My VulkanSDK was a bit outdated and since i use the validation layers it provides i though to be worth updating - maybe it sees what i do not.

And it did. Found a few seemingly minor things. After fixing thous - everything started working as intended again. Apparently not as minor as i though. Hard to tell which one or combination of caused this.

So, all i can really recommend is to check your validation layers are the latest and greatest when facing bizarre problems with vulkan.

This topic is closed to new replies.

Advertisement