Vulkan-ValidationLayers icon indicating copy to clipboard operation
Vulkan-ValidationLayers copied to clipboard

debugPrintfEXT doesn't support 64-bit signed integer with %ld

Open buzmeg opened this issue 1 year ago • 5 comments

Environment:

  • OS: Ubuntu 24.04.1 LTS
  • GPU and driver version: Intel UHD Graphics 620 (WHL GT2)
  • SDK or header version if building from repo: Vulkan Instance Version: 1.3.290
  • Options enabled (synchronization, best practices, etc.): Validation with Debug Printf preset
        apiVersion        = 1.3.274 (4206866)
        driverVersion     = 24.0.9 (100663305)

Describe the Issue debugPrintfEXT garbles values after a 64-bit value

The following compute shader code

    uint64_t idx_64 = 42;
    uint32_t idx_32 = 42;
    
    if (gl_LocalInvocationIndex == 0) {
        debugPrintfEXT(" BAD: %8ld  %8x  %8x  %8x  %8x\n", idx_64, rc.exclusion_left, rc.exclusion_right, rc.exclusion_top, rc.exclusion_bottom);  // This line is broken
        debugPrintfEXT("OKAY:           %8x  %8x  %8x  %8x  %8ld\n", rc.exclusion_left, rc.exclusion_right, rc.exclusion_top, rc.exclusion_bottom, idx_64);  // This line works
        debugPrintfEXT("GOOD: %8d  %8x  %8x  %8x  %8x\n", idx_32, rc.exclusion_left, rc.exclusion_right, rc.exclusion_top, rc.exclusion_bottom);  // This line works
        debugPrintfEXT("GOOD:           %8x  %8x  %8x  %8x  %8d\n", rc.exclusion_left, rc.exclusion_right, rc.exclusion_top, rc.exclusion_bottom, idx_32);  // This line works
    }

Produces the following output:

 BAD:       42         0     10000     10001     10002
OKAY:              10000     10001     10002     10003        42
GOOD:       42     10000     10001     10002     10003
GOOD:              10000     10001     10002     10003        42

Expected behavior The BAD/OKAY lines should match the GOOD/GOOD lines.

Thanks.

buzmeg avatar Oct 06 '24 02:10 buzmeg

So this "should" be fixed in the next SDK coming out this week, while making the fixes for float 64-bit I realized we had issues with how we handled no-32bit values and have tests

... if the SDK doesn't fix it, can look more

spencer-lunarg avatar Oct 06 '24 15:10 spencer-lunarg

hmm... ok, seems this might still be broken, will get tests and try to get a fix ASAP (unfortunately any fix will have to wait until the NEXT SDK :cry: )

For you example, is rc.exclusion_left just a uint32_t?

spencer-lunarg avatar Oct 06 '24 16:10 spencer-lunarg

ok, so I just figured out the issue, we don't currently support %ld

we have support for %ul, %lu and %lx but didn't support 64 signed Ints with %ld ... so yes, let me update this title and just actually add support for 64-bit signed floats :+1:

spencer-lunarg avatar Oct 06 '24 22:10 spencer-lunarg

(if you are using uint64_t then you can just get away with %lu though!)

spencer-lunarg avatar Oct 06 '24 22:10 spencer-lunarg

For you example, is rc.exclusion_left just a uint32_t?

Yes, everything except idx_64 are all uint32_t.

Thanks for the fixes.

buzmeg avatar Oct 06 '24 23:10 buzmeg