drawcall with no data possible ?

I’m coding an instance-culling shader, which works in 2 passes.
In the first pass, I compute the instance position with the VertexID, perform a visibility test, and get the visible IDs back with Transform Feedback. So, I don’t need any vertex attribute data. The vertex Shader compiles fine and the program links. Now, how do I feed the pipeline from the client’s perspective ? Binding an empty VAO crashes the application, and I don’t want (unless I really have to) create a dummy VBO for the process… Any suggestions on how I could do this ?
Here’s the vertex-shader code

#version 400 core

// patch parameters
layout(std140) uniform PatchParams
    int cst_patchCountSqrt; ///< Square root of the total number of patches
    int cst_patchSize;      ///< Patch Side Length

// camera view
layout(std140) uniform View
    mat4 cst_view;      ///< View Matrix

// projection matrix
uniform mat4 cst_projection;

// output
out vec4 var_pos;
flat out int var_isCulled;

void main()
    // compute position in the grid
    vec2 gridpos = vec2(gl_VertexID/cst_patchCountSqrt, gl_VertexID%cst_patchCountSqrt);
    // mulitply offset by patch Size to get proper position
    float offset = float(cst_patchCountSqrt)/2.0;
    vec2 pos = (gridpos-vec2(offset))*vec2(cst_patchSize);
    var_pos = vec4(pos,0.0,1.0);

    // project
    vec4 clipPos = cst_projection * (cst_view * var_pos);

    // check visibility
    if(clipPos.x < -clipPos.w)  var_isCulled = 1;
    else if(clipPos.x >  clipPos.w)  var_isCulled = 1;
    else if(clipPos.y < -clipPos.w)  var_isCulled = 1;
    else if(clipPos.y >  clipPos.w)  var_isCulled = 1;
    else if(clipPos.z < -clipPos.w)  var_isCulled = 1;
    else if(clipPos.z >  clipPos.w)  var_isCulled = 1;
    else    var_isCulled = 0;


And the draw call

        glBindVertexArray(vertexArray[VERTEX_ARRAY_CULL]); // empty, crashes the app
        glDrawArrays(GL_POINTS, 0, SAMPLE_PATCH_COUNT);

I experienced the same issue… Creating a dummy VBO with 1 byte per vertex now - not a big deal.

There is no current mechanism to do this in OpenGL. You always have to have at least one active attribute.

How can binding empty VAO crash the app? What with first binding then? This is not the case on NVIDIA. My app draws with ALL vertex arrays disabled (no buffers attached) and it works perfectly well (I haven’t checked ATI though).

This is my Vertex Shader:

N  "#version 150"
N  "uniform int R = 60;"
N  "void main() {"
N  "    vec2 p = vec2(gl_VertexID % R, gl_VertexID / R) / R;"
N  "    gl_Position = vec4(p, 0, 1);"
N  "}";

Ok well I suppose I’ll have to go with the dummy array then. Strange that a vertex shader can compile with no ‘in’ variables if it crashes a client trying to feed it…

That’s a very simple bug of the ATI Catalyst that is still not fixed for the unknown reason. Maybe we should report it directly to them? Anyway, there are ATI guys on this forum, I hope they’ll visit the thread some day.