Jump to content
  • Advertisement
Sign in to follow this  
d0nuts

OpenGL glValidateProgram causing GL_OUT_OF_MEMORY error?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi opengl experts,

I am trying out a compute shader for the first time to generate some terrain but I am getting GL_OUT_OF_MEMORY (error 1285) when trying to validate the shader.

std::string compute_source = R"(
        #version 430 core


        layout(local_size_x = 64, local_size_y = 64) in;


        struct TerrainPatch {
            vec2 pos;
            vec2 dim;
        };


        layout (std430, binding = 0) buffer InputBuffer {
            TerrainPatch patches[];
        };


        struct TerrainVertex {
            vec4 pos;
            vec4 nor;
        };


        layout (std430, binding = 1) buffer OutputBuffer {
            TerrainVertex vertexes[];
        };


        void main() {
            vertexes[0].pos = vec4(patches[0].pos, 0.0f, 0.0f);
        }
    )";


    const char* compute_source_chars = compute_source.c_str();


    GLuint shader = glCreateShader(GL_COMPUTE_SHADER);
    glShaderSource(shader, 1, &compute_source_chars, NULL);
    glCompileShader(shader);


    GLint shader_status = GL_FALSE;
    glGetShaderiv(shader, GL_COMPILE_STATUS, &shader_status);
    assert(shader_status != GL_FALSE);


    GLuint program = glCreateProgram();
    glAttachShader(program, shader);
    glLinkProgram(program);


    GLint link_status = GL_FALSE;
    glGetProgramiv(program, GL_LINK_STATUS, &link_status);
    assert(link_status != GL_FALSE);


    {
        GLenum error = GL_NO_ERROR;
        while ((error = glGetError()) != GL_NO_ERROR) { // <-- this doesn't have an error
            printf("OpenGL ERROR: %s\n", gluErrorString(error));
            assert(false);
        }
    }


    glValidateProgram(program);


    {
        GLenum error = GL_NO_ERROR;
        while ((error = glGetError()) != GL_NO_ERROR) { // <-- this is giving error 1285
            printf("OpenGL ERROR: %s\n", gluErrorString(error));
            assert(false);
        }
    }
 

Am I missing something obvious?

 

 

Share this post


Link to post
Share on other sites
Advertisement

I was able to re-run this on a different computer which gave me an error during linking:

error: Total number of invocations specified by GROUP_SIZE exceeds implementation limit
 
So the problem was that my work group size of 64x64x1 was larger than the value of GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS which was 1536. 
 
Still strange that it links successfully on the first computer with a GL_OUT_OF_MEMORY error during validation...

Share this post


Link to post
Share on other sites

Still strange that it links successfully on the first computer with a GL_OUT_OF_MEMORY error during validation...


Welcome to the world of bad GL drivers and inconsistent behaviour across different hardware, I'm afraid.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!