Jump to content

View more

Image of the Day

Trying out some of Pickle Jar compositions in @SketchUp and Unity, for a late #screenshotsaturday #gamedev https://t.co/HU0kZAnQtD
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

glValidateProgram causing GL_OUT_OF_MEMORY error?

2: Adsense
  • You cannot reply to this topic
2 replies to this topic

#1 d0nuts   Members   

192
Like
0Likes
Like

Posted 06 March 2017 - 10:14 PM

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?

 

 



#2 d0nuts   Members   

192
Like
2Likes
Like

Posted 08 March 2017 - 01:35 AM

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


#3 mhagain   Members   

13022
Like
0Likes
Like

Posted 08 March 2017 - 04:09 AM

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.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.