Task gpu015: GPU benchmark (C++)

The task is to implement verious methods of sending (vertex) data to GPU and rendering massive triangle scene. Measure the times (in FPS) in reasonable normalized views and compare individual approaches, best on a couple of different GPUs. Benchmark/test variability is the key: turning on/off textures, shaders, instancing, VBO/VAO buffers, stencil access/test, and so on.

Test scene

You should design such scene, which can remain constant during all the tests - The number of rasterized triangles and fragments should remain the same. On the other hand (to test instancing), please consider some form of modularity/repeatability. For example: the scene could be rendered as one huge batch of triangles or could be divided into identical instances and take advantage of instancing (or manually: use multiple batches with different transform matrices..).


1. related to data transfer, primitive assembly, data types:

  • immediate mode (obsolete but still functional: glVertex) versus vertex-buffer (glDrawArrays) versus index-buffer (glDrawElements, glDrawElement, glDrawRangeElements), ..
  • server-side buffers (VBO-buffers) versus client-side buffers
  • using general buffer objects as an alternative to VBOs (glGenBuffers, glBufferData, ..)
  • instancing (glDrawArraysInstanced. glDrawElementsInstanced)
  • relative indexed rendering (glDrawElementsBaseVertex, glDrawRangeElementsBaseVertex, glDrawElementsInstancedBaseVertex)
  • indirect rendering (glDrawArraysIndirect, glMultiDrawArraysIndirect, glMultiDrawElementsIndirect)
  • separate vertex-attribute buffers (glVertexPointer, glColorPointer, ..) versus interlaced buffers (glInterleavedArrays)
  • types: GLfloat versus GLdouble (and maybe versus GLhalf?)
  • geometry and tesselation shaders: try to generate the same scene using GPU-generated primitives)

Consider using very elementar scene shapes - which can be easily adapted to an on-the-fly generation (geometric & tesselation shaders).

2. related to rendering quality:

  • flat shading (GL_FLAT) versus color interpolation (GL_SMOOTH)
  • texturing, using single vs. multiple textures (different texture formats, different texture resolutions, MIP-maps, ...)
  • alpha blending (opaque triangles vs. semitransparent triangles (GL_BLEND)
  • various fragment-shader experimants, moving some computation between CPU (texture) and GPU (direct color computing in a fragment shader)
  • using environment map or HDR environment map (e.g. using GLhalf)

Project template

One possible C++ project to start with is sample08 (basic rendering, optional texture, time measurements and logging). But you have to extend it very much and make several obligatory modifications: fixed window size, no scene animation, ..

The second C++ project is sample15 (GLFW-based, basic rendering, optional texture, time measurements, Vertex-array, Vertex buffer, GLSL shaders).

Your solution

Send your benchmark as a complete Visual Studio 2017 project, including shader files and perhaps larger data files (textures). Don't include generated/not needed files, you can consult some .gitignore example before ZIPping the solution directory.

Documentation and report

You must measure all your variants on at least one GPU (CPU+GPU). Results have to be presented in a nice document (a shared Google-drive document will be preferred). I'd be glad if you exchanged your binaries with your friends/schoolmates to get more benchmark results.


Hand in before: 13. 5. 2018


Basis: 25 points
Bonuses: up to 20 additional points


Recommended starting point: Visual Studio project sample08 (SDL) or sample15 (GLFW) from the ogl repository (C++).

Copyright (C) 2012-2018 J. Pelikán, last change: 2019-05-09 17:52:59 +0200 (Thu, 09 May 2019)