class
OpenGLTesterBase class for OpenGL tests and benchmarks.
Contents
Extends Corrade::
This class is available on platforms with corresponding Platform::Windowless*Application
implementation, which currently means all platforms. It is built into a separate static library and only if WITH_OPENGLTESTER
is enabled when building Magnum. To use it with CMake, you need to request the OpenGLTester
component of the Magnum
package. Derive your test class from this class instead of Corrade::Magnum::OpenGLTester
target or add it to the LIBRARIES
section of the corrade_
find_package(Magnum REQUIRED OpenGLTester) # ... corrade_add_test(YourTest YourTest.cpp LIBRARIES Magnum::OpenGLTester)
See Downloading and building, Usage with CMake and Testing and benchmarking for more information.
Running the test executables
Implicitly, running the test executables requires presence of a GPU with OpenGL drivers. In addition, on desktop, unless Magnum is built with MAGNUM_TARGET_HEADLESS
, OpenGL context creation requires a graphical desktop to be running. On embedded systems (and iOS, Android in particular) running the tests has no special requirements. On Emscripten the tests have to be running in a browser, as Node.js environment doesn't provide a WebGL context.
On virtualized systems and systems without a GPU (e.g. CI servers) it's possible to link against e.g. Mesa softpipe or SwiftShader, but be prepared to expect reduced performance, reduced feature set and possible non-comformant behavior on such drivers.
See Compiling and running tests for more information about running the tests on particular platforms.
OpenGL context creation
Upon construction the class creates an OpenGL context, meaning you don't have to worry about OpenGL context being available during the tests. If the context creation fails, the test executable exits with non-zero return code. The tester uses a single OpenGL context for all test cases, meaning you can share precalculated state among test cases, but on the other hand potential OpenGL misuses will propagate to following test cases. See command-line option overview for a way to run single isolated test cases.
Debug context and error checking
On platforms that support it, the OpenGL context is created with synchronous debug output, meaning that every OpenGL error is directly reported to standard output. While it is possible, the tester class doesn't abort the test cases upon encountering a GL error — this should be done explicitly with MAGNUM_
GPU time benchmarks
This class adds BenchmarkType::
Public types
Constructors, destructors, conversion operators
- OpenGLTester() explicit
- Constructor.
Public functions
-
template<class Derived>void addBenchmarks(std::
initializer_list<void(Derived::*)()> benchmarks, std:: size_t batchCount, BenchmarkType benchmarkType = BenchmarkType:: Default) - Add benchmarks.
-
template<class Derived>void addBenchmarks(std::
initializer_list<void(Derived::*)()> benchmarks, std:: size_t batchCount, void(Derived::*)() setup, void(Derived::*)() teardown, BenchmarkType benchmarkType = BenchmarkType:: Default) - Add benchmarks with explicit setup and teardown functions.
-
template<class Derived>void addInstancedBenchmarks(std::
initializer_list<void(Derived::*)()> benchmarks, std:: size_t batchCount, std:: size_t instanceCount, BenchmarkType benchmarkType = BenchmarkType:: Default) - Add instanced benchmarks.
-
template<class Derived>void addInstancedBenchmarks(std::
initializer_list<void(Derived::*)()> benchmarks, std:: size_t batchCount, std:: size_t instanceCount, void(Derived::*)() setup, void(Derived::*)() teardown, BenchmarkType benchmarkType = BenchmarkType:: Default) - Add instanced benchmarks with explicit setup and teardown functions.
Enum documentation
enum class Magnum:: GL:: OpenGLTester:: BenchmarkType
Benchmark type.
Extends Corrade::
Enumerators | |
---|---|
Default |
See Corrade:: |
WallTime |
See Corrade:: |
CpuTime |
See Corrade:: |
CpuCycles |
See Corrade:: |
GpuTime |
GPU time, measured using TimeQuery:: |
Function documentation
template<class Derived>
void Magnum:: GL:: OpenGLTester:: addBenchmarks(std:: initializer_list<void(Derived::*)()> benchmarks,
std:: size_t batchCount,
BenchmarkType benchmarkType = BenchmarkType:: Default)
Add benchmarks.
Extends Corrade::
template<class Derived>
void Magnum:: GL:: OpenGLTester:: addBenchmarks(std:: initializer_list<void(Derived::*)()> benchmarks,
std:: size_t batchCount,
void(Derived::*)() setup,
void(Derived::*)() teardown,
BenchmarkType benchmarkType = BenchmarkType:: Default)
Add benchmarks with explicit setup and teardown functions.
Extends Corrade::
template<class Derived>
void Magnum:: GL:: OpenGLTester:: addInstancedBenchmarks(std:: initializer_list<void(Derived::*)()> benchmarks,
std:: size_t batchCount,
std:: size_t instanceCount,
BenchmarkType benchmarkType = BenchmarkType:: Default)
Add instanced benchmarks.
Extends Corrade::
template<class Derived>
void Magnum:: GL:: OpenGLTester:: addInstancedBenchmarks(std:: initializer_list<void(Derived::*)()> benchmarks,
std:: size_t batchCount,
std:: size_t instanceCount,
void(Derived::*)() setup,
void(Derived::*)() teardown,
BenchmarkType benchmarkType = BenchmarkType:: Default)
Add instanced benchmarks with explicit setup and teardown functions.
Extends Corrade::