Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Vulkan Shader Debugging] texelFetch R32_UINT/R16_UINT usampleBuffer always returns 0. #3152

Closed
wumo opened this issue Nov 26, 2023 · 2 comments
Labels
Bug A crash, misbehaviour, or other problem Unresolved Waiting for a fix or implementation

Comments

@wumo
Copy link

wumo commented Nov 26, 2023

Description

When debugging in vulkan, texelFetch a R32_UINT/R16_UINT usampleBuffer in compute shader will always return 0 while the actual value shown in buffer window isn't 0. If I change the resource from usampleBuffer to storage buffer, then the result seems correct.

Actual buffer value:

Debugging value:
image

Result:
image

Steps to reproduce

The compute shader is:

#version 450
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;

layout(set = 0, binding = 0) uniform writeonly image3D ResultTex;
layout(set = 0, binding = 1) uniform usamplerBuffer IdxBuffer;
// layout(set = 0, binding = 1) buffer IdxBuffer {
//     uint Indices[];
// };

void main() {
    // uint Idx = Indices[int(gl_GlobalInvocationID.x)];
    uint Idx = texelFetch(IdxBuffer, int(gl_GlobalInvocationID.x)).x;
    imageStore(ResultTex, ivec3(gl_GlobalInvocationID.xyz), uvec4(Idx) / 64.0);
}

Capture file: capture.zip

Environment

  • RenderDoc version: 1.29.0
  • Operating System: Windows 10
  • Graphics API: Vulkan 1.1.0
  • Graphics Card: NVIDIA GeForce RTX 3080
  • Graphics Driver: 537.52.0
@wumo
Copy link
Author

wumo commented Nov 26, 2023

For now, I'll have to use buffer instead of samplerBuffer to debug.

@baldurk baldurk added Bug A crash, misbehaviour, or other problem Unresolved Waiting for a fix or implementation labels Nov 27, 2023
@baldurk baldurk closed this as completed in 77d06d6 Dec 5, 2023
@baldurk
Copy link
Owner

baldurk commented Dec 5, 2023

That commit should fix the issue, return values from samples in int/uint weren't being properly processed according to their type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A crash, misbehaviour, or other problem Unresolved Waiting for a fix or implementation
Projects
None yet
Development

No branches or pull requests

2 participants