• 10
• 12
• 12
• 14
• 15

# glDispatchCompute fails after calling glClear

This topic is 397 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello,

I'm experiencing a weird error and I have absolutely no idea what could possibly cause it.

When calling glDispatchCompute I get the following error message: GL_INVALID_OPERATION error generated. State(s) are invalid: program pipeline config.

The code looks like this:

glClear(GL_COLOR_BUFFER_BIT);
glDispatchCompute(1, 1, 1);


The specification states that GL_INVALID_OPERATION is generated by glDispatchCompute when there is no valid compute program bound. The thing is that there is no error when i create my compute program.

Actually just swapping the first two calls "solves" the problem:

glUseProgramStages(ProgramPipeline, GL_COMPUTE_SHADER_BIT, ComputeShader);
glClear(GL_COLOR_BUFFER_BIT);
glDispatchCompute(1, 1, 1);


Now the error message is gone everything works as intended. Am I missing something? I really don't see why the first code would cause this error. There also shouldn't be any hidden state or something like that because I just load the shader, create the program and the pipeline, bind everything and that's it.