Bug report: clamp(x, 0.0, 1.0) on bindless buffer element not working with driver 411.63

After updating the video driver from 399.* to 411.63, we noticed that some objects in our commercial visualization application using OpenGL are no longer rendered correctly. After some investigation, we could isolate the culprit, which is the clamp between zero and one of an element directly fetched from a bindless buffer. The clamp returns arbitrary values, which also vary by invocation for the same input value. This is true for float and vec* buffers independent of memory qualifiers such as restrict or readonly.

I made a compute shader to demonstrate the issue:

#version 450

#extension GL_NV_gpu_shader5 : enable
#extension GL_NV_shader_buffer_load : enable

layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

uniform float* inputBuffer; // { 0.31415f }
uniform float* outputBuffer; // initialized as { 0.5, ... , 0.5 }

void main()
{
    outputBuffer[0] = clamp(inputBuffer[0], 0.0, 1.0);
    outputBuffer[1] = min(max(inputBuffer[0], 0.0), 1.0);
    outputBuffer[2] = max(min(inputBuffer[0], 1.0), 0.0);

    outputBuffer[3] = inputBuffer[0];
    outputBuffer[4] = clamp(0.31415, 0.0, 1.0);

    outputBuffer[5] = clamp(inputBuffer[0], 0.0, 1.01);
    outputBuffer[6] = clamp(inputBuffer[0], 0.01, 1.0);
    outputBuffer[7] = min(inputBuffer[0], 1.0);
    outputBuffer[8] = max(inputBuffer[0], 0.0);
    outputBuffer[9] = abs(inputBuffer[0]);
    outputBuffer[10] = -inputBuffer[0];
}

The output is

outputBuffer[0]: 1
outputBuffer[1]: 1
outputBuffer[2]: 1
outputBuffer[3]: 0.31415
outputBuffer[4]: 0.31415
outputBuffer[5]: 0.31415
outputBuffer[6]: 0.31415
outputBuffer[7]: 0.31415
outputBuffer[8]: 0.31415
outputBuffer[9]: 0.31415
outputBuffer[10]: -0.31415

It can be seen that the clamp of the bindless buffer element inputBuffer[0] between zero and one fails (by returning 1 instead of 0.31415), while clamping the stored value itself is working correctly. Replacing clamp by min+max is also not working, which I guess the compiler optimizes to clamp. Other clamp ranges and input modifiers can be applied without a problem and work as expected.

As this is affecting our shipped application, we hope this issue is escalated this to the driver developers quickly. I have already submitted this issue in the knowledgebase (reference number 180921-000236), but I thought it might be useful for other developers to read about the issue.

Has anyone responsible looked into this bug? It’s been almost half a year and this bug still exists in driver 418.81.

Hello,

I searched for your issue, but the number you provided is not from our bug tracking system.
Please submit bugs here:https://developer.nvidia.com/nvidia_bug/add

Let me know if you have any questions.

Best,
Tom

The bug was submitted to the knowledgebase at nvidia.custhelp.com in September. I now resubmitted it to the tracker mentioned by you under #2515905. Thanks for looking into it!

Great! Please update back here if and when you get more information so others watching can stay updated.

Thanks,
Tom