AnsweredAssumed Answered

Can anyone explain why glDrawArrays() causes high CPU utilization?

Question asked by Dominic Walkes on Jul 28, 2016
Latest reply on Aug 8, 2016 by Ben Beckwith



We have noticed high utilization of the main CPU while glDrawArrays() is executing. Our expectation is that glDrawArrays() should primarily cause high GPU utilization with minimal impact on the main CPU.




Our environment is linux/Qt. We are rendering the screen on a timer at 20fps. We have 60+ VBOs in GPU RAM. The VBOs are GL_TRIANGLE type. We are not using VAOs or index buffers. Each VBO contains 2000 triangles/6000 vertices. Each frame we invoke glDrawArrays() for each VBO. All calls use the same shader programs:


    QString vertexShader =
        "uniform float useUniformColor;"
        "uniform highp vec4 uniformColor;"
        "uniform highp mat4 ortho;"
        "attribute highp vec3 a_position;"
        "attribute highp vec4 a_color;"
        "varying highp vec4 v_color;"
        "void main()\
           gl_Position = vec4(a_position,1) * ortho;\
           if(useUniformColor != 0.0)\
               v_color = uniformColor;\
               v_color = a_color;\

    QString fragmentShader =
        "varying highp vec4 v_color;"
        "void main()"
        "    gl_FragColor = v_color;"