0
$\begingroup$

Under OpenGL 4.5 on AMD RENOIR (DRM 3.40.0, 5.10.56-1-lts, LLVM 12.0.1), running

glCreateBuffers(1, &result_buffer);
glNamedBufferData(result_buffer, count * 4, NULL, GL_STATIC_DRAW);
glClearNamedBufferData(result_buffer, GL_R32UI, GL_RED, GL_UNSIGNED_INT, NULL);

results in GL_INVALID_OPERATION in glClearNamedBufferData(integer vs non-integer).

It works fine if I use GL_R32Finstead, but that is not the format I want here.

The spec states that GL_INVALID_OPERATION can only occur if result_buffer were mapped or not the name of an existing buffer object; neither seems to be the case.

What am I doing wrong? What is "integer vs non-integer" getting at?

$\endgroup$
1
$\begingroup$

Buffer clears are defined as a form of pixel transfer operation. Essentially, you are specifying data as if you were specifying packed pixel data to be copied. So you must specify the pixel transfer format and type parameters, as well as the "internal format" equivalent to be used in the buffer.

But this means that all of the rules of pixel transfers apply, including the fact that transferring data to an integer internal format must use the *_INTEGER pixel transfer formats. That's the mismatch: you have to use GL_RED_INTEGER because you're writing to an integer internal format.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.