# glDispatchCompute fails after calling glClear

## 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.

## Create an account

Register a new account

• 10
• 11
• 11
• 11
• 9