Sampling array of depth2d shows artifact

I have encountered a problem sampling the array of depth2d like this code.


fragment half4 shadow_preview_frag(pv_out v [[stage_in]], array<depth2d,2> shadowMap [[texture(0)]]) {
    half4 color = half4(1.0, 1.0, 1.0, 1.0);
    float depth = shadowMap[0].sample(s, v.uv);
    color = color * depth;
    color.a = 1.0;
    return color;
}


The depth textures are shadow map. (depth-only pass) I use array of depth textures in the deferred lighting.

When I run the application on Intel UHD Graphics 630, I get an weird color output.

The black background appears, some kind of afterimages and noises appears on the rendered area.

Intel HD Graphics 4000, Geforce GT 650M, Radeon Pro 5500M works very fine.


Does anyone experience the similar problem? I tried to find the solution for few days but I couldn't figure it out :-(


MacBook Pro 16 inch, Core i9 2.4GHz, Intel UHD Graphics 630/Radeon Pro 5500M, macOS 10.15.2, Xcode 11.3.1

Replies

I added color texture (R16) in the shadow pass and used color textures in the shading pass. It works well but it has some extra performance cost...

I asked Apple through TSI 6 days ago but I haven't received any response yet! 😠