How to clear unsigned int texture?

I tried using glClearBuffer and glClearTexImage, and both got the same error: Integer fast clear not enabled for ISL_FORMAT_R32_UINT. The texture data consists of a single unsigned int per vertex.

Here is how I declare and attach the buffer:

glGenTextures(1, &_vertex_backbuffer_color);
glBindTexture(GL_TEXTURE_2D, _vertex_backbuffer_color);
glTexImage2D(
    GL_TEXTURE_2D,
    0,
    GL_R32UI,
    _width,
    _height,
    0,
    GL_RED_INTEGER,
    GL_UNSIGNED_INT,
    nullptr
);
glTexParameteri(
    GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST
);
glTexParameteri(
    GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST
);
glBindTexture(GL_TEXTURE_2D, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _vertex_backbuffer_color, 0);

And here is how I try to clear the texture with glClearTexImage

GLuint val = 0;
glClearTexImage(_vertex_backbuffer_color, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, &val);

and with glClearBuffer:

glClearBufferuiv(GL_COLOR, 0, &val);

Any help would be appreciated.

I am not 100% sure but I believe Integer fast clear not enabled for ISL_FORMAT_R32_UINT is not an error this is a warning.

However if you believe that the texture is not clearing and that warning is the cause of the issue have you tried actually looking at the data of the texture in a graphics debugger such as nsight or renderdoc? Also if you set the texture as a draw buffer to your framebuffer you can simply bind the framebuffer and call glClearColor and it will do it for you.

Some more tips is to use glDebugMessageCallback and set breakpoints on warning and high level errors. Consider this glDebugMessageCallback - OpenGL 4 - docs.gl and enable it after you initialize opengl.

Right.

As for what a “fast clear” is, see:

So basically when you see:

Integer fast clear not enabled for ISL_FORMAT_R32_UINT 

You know that the Mesa3D Intel driver couldn’t take the fast route of storing “this thing is clear” bits and had to go write a bunch of clear color values to the physical color buffer. This works, but when you’re using slow CPU DRAM, it’s much slower.