NVidia driver 320.86 texture buffer bug leads to crash

The following code crashes really quickly ( way before the max buffer size of 2^27 texels )

I stripped every useless line of code, to make it easier to read.

const int MAX_LAYER_DEPTH = 5;

#include "vapp.h"

#include "vmath.h"

#include <stdio.h>

BEGIN_APP_DECLARATION(OITDemo)
    // Override functions from base class
   virtual void Initialize(const char * title);
    virtual void Display(bool auto_redraw);
    virtual void Finalize(void);
    virtual void Reshape(int width, int height);

    GLuint  linked_list_buffer;
    GLuint  linked_list_texture;
    GLint current_width;
    GLint current_height;
END_APP_DECLARATION()
    
DEFINE_APP(OITDemo, "Order Independent Transparency")

void OITDemo::Initialize(const char * title)
{
    base::Initialize(title);
    glGenBuffers(1, &linked_list_buffer);
    glGenTextures(1, &linked_list_texture);
    Reshape(100,100);
    return;
}

void OITDemo::Display(bool auto_redraw)
{

    glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
    glBindImageTexture(1, linked_list_texture, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA32UI);
    glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);

    base::Display();

    return;
}

void OITDemo::Reshape(int width, int height)
{
    current_width = width;
    current_height = height;

    glBindImageTexture(1, 0, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA32UI);
    static GLuint texBufferSize = 2047;
    ++texBufferSize;
    printf("%d : texBufferSize\n",texBufferSize);
    glBindBuffer(GL_TEXTURE_BUFFER, linked_list_buffer);
    glBufferData(GL_TEXTURE_BUFFER, texBufferSize * texBufferSize * MAX_LAYER_DEPTH * sizeof(vmath::vec4), NULL, GL_DYNAMIC_DRAW);
    glBindBuffer(GL_TEXTURE_BUFFER, 0);

    // Bind it to a texture (for use as a TBO)
    glBindTexture(GL_TEXTURE_BUFFER, linked_list_texture);
    glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32UI, linked_list_buffer);
    glBindTexture(GL_TEXTURE_BUFFER, 0);

    glViewport(0, 0, current_width, current_height);
    return;
}

void OITDemo::Finalize(void)
{
    glDeleteTextures(1, &linked_list_texture);
    glDeleteBuffers(1, &linked_list_buffer);
}

The driver most probably can’t handle fragmentation
It crashes between reallocation of 21694445 ( 2083 x 2083 x 5 ) and 23587920 elements. The maximum buffer size ( number of texels ) returned by the graphic card is 2^27 ( 134 millions texels )

It seems to work better if we allocate one big buffer at the start of the application and never change it.
But fails miserably if we try to reallocate it during the life of the application.

Originally the code binds the image texture then trace using a shader that uses that image texture with imageStore but I discovered that I don’t need any shader to make the driver crash.

Any clue to predict/prevent the driver crash would be appreciated.
Thank you,
Jean-Simon Brochu

Hi Jean-Simon,

could you please add some more system details to be able to match a reproducing system?
My generic bugreport checklist is pasted below.
Please answer the applicable points with the necessary details to be able to start analysis of the issue.

  1. Operating system version and bitness.
    On Linux, an nvidia-bug-report.log generated by running nvidia-bug-report.sh as root.
  2. Graphics hardware.
  3. Graphics driver version.
  4. Display Control Panel settings for screen resolution, monitor configs, and driver settings.
    Under Windows: NVIDIA Control Panel → Help → System Information → Save.
  5. Reproducer project.
    At least an executable which shows the problem. The simpler, the better.
    Make sure all necessary files to run this standalone are included (manifests, runtimes). Assume a clean test system!
    Source code in failing state highly appreciated.
    For GLSL compiler failures (C9999), the minimal set of shader sources reproducing the problem.
  6. Description of single steps to reproduce the problem.
  7. Description of the expected result (screenshots if possible).
    Performance issues require absolute measurement data and a description of how to reproduce them.
  8. If there is a crash in an NVIDIA module, the exact crash offset.

Thank you for your reply:

I’ve send the info you needed in a personal message.