Data transfered to shader in SSBO are all set to zero in vulkan on ubuntu 18.04

when building path tracer demo, I pass materials data in ssbo to shader named raytrace.rgen

struct Material
    vec4 AlbedoColor;
    vec4 MRSColor;
    vec4 EmissiveColor;
    vec4 AlbedoTex;
    vec4 MetallicTex;

    vec4 RoughnessTex;
    vec4 SpecularTex;
    vec4 NormalTex;
    vec4 EmissiveTex;

layout(binding = 0, set=3) readonly buffer MaterialArray { Material[] materials; };
layout(binding = 0, set=0) readonly uniform UniformBufferObject { CameraUniform ubo; };

void main() {
        if (Material[0].AlbedoColor.x== 0) {
                imageStore(outputImage, ivec2(gl_LaunchIDEXT.xy), vec4(1,1,1,1));
        } else {
                imageStore(outputImage, ivec2(gl_LaunchIDEXT.xy), vec4(1,0,1,1));

data accessed in Material is always 0, otherwise ubo data accessed is as expected as set in cpu pipeline, does any one know what is the problems?? appreciate any response.

The shader looks fine, so I expect a problem with the buffer setup in the application. You could run your Application through RenderDoc and check the buffer data that gets passed to the shaders with it. If that already shows zero values for the first entry, the problem lies within how you setup/upload your buffer from the host.

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