Sign in to follow this  
Raycast

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);
glUseProgramStages(ProgramPipeline, GL_COMPUTE_SHADER_BIT, ComputeShader);
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this