-
Make vk-unittests use VulkanWrapper · 9d35d544Antonio Maiorano authored
This change moves the VulkanBenchmark and DrawBenchmark classes to VulkanWrapper so that they can be used from other unit tests -- namely, vk-unittests. In doing so, it became clear that using these as base classes wasn't great for writing googletests, as text fixtures are classes themselves, and this resulted in messy multiple inheritance. So I modified the two classes to use callback registration instead of virtual functions. Apart from reworking existing tests (e.g. see TriangleBenchmark.cpp), I also added a new DrawTests.cpp to vk-unittests with a unit test to make sure we don't crash when leaving out "gl_Position", a bug that sugoi@ fixed in swiftshader-cl/51808. This is a good example of how easy it can be to write such unit tests now. List of changes: * Moved VulkanBenchmark and DrawBenchmark to VulkanWrapper, and renamed VulkanTester and DrawTester respectively. * ClearImageBenchmark refactored to aggregate a VulkanTester. This is an example where using a class is fine as we can still use the testers via aggregation. * TriangleBenchmark tests refactored to use DrawTester and register callbacks. * Moved compute tests to a ComputeTests.cpp. * Moved the other tests to BasicTests.cpp. * Added DrawTests.cpp with new DrawTests.VertexShaderNoPositionOutput test. * CMake: add VulkanWrapper target for unittests as well as benchmarks. * CMake: change FOLDER to better organize the tests and benchmarks for VS. Bug: b/176981107 Change-Id: Ib1a0b85b3df787d2e39da08930414f9a14954a73 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/52348 Kokoro-Result: kokoro <noreply+kokoro@google.com> Reviewed-by:
Alexis Hétu <sugoi@google.com> Tested-by:
Antonio Maiorano <amaiorano@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
9d35d544
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| CMakeLists.txt | Loading commit data... | |
| LRUCacheBenchmarks.cpp | Loading commit data... | |
| main.cpp | Loading commit data... |