[Piglit] [PATCH 5/8] framework: Add a Vulkan platform

Neil Roberts nroberts at igalia.com
Wed Apr 4 22:56:52 UTC 2018


This defaults to building only on Linux as with the GLES platforms
because later patches add code using fork/exec which will need porting
to compile on Windows.
---
 CMakeLists.txt                         |  7 +++++++
 cmake/piglit_util.cmake                |  2 +-
 cmake/target_api/CMakeLists.txt        |  4 ++++
 cmake/target_api/vulkan/CMakeLists.txt | 10 ++++++++++
 tests/CMakeLists.txt                   |  4 ++++
 tests/vulkan/CMakeLists.txt            |  0
 6 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 cmake/target_api/vulkan/CMakeLists.txt
 create mode 100644 tests/vulkan/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4259ec832..8de61fa13 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,8 +35,10 @@ endif()
 
 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
 	set(PIGLIT_BUILD_GLES_TESTS_DEFAULT ON)
+	set(PIGLIT_BUILD_VULKAN_TESTS_DEFAULT ON)
 else()
 	set(PIGLIT_BUILD_GLES_TESTS_DEFAULT OFF)
+	set(PIGLIT_BUILD_VULKAN_TESTS_DEFAULT OFF)
 endif()
 
 option(PIGLIT_BUILD_GL_TESTS "Build tests for OpenGL" ON)
@@ -44,6 +46,7 @@ option(PIGLIT_BUILD_GLES1_TESTS "Build tests for OpenGL ES1" ${PIGLIT_BUILD_GLES
 option(PIGLIT_BUILD_GLES2_TESTS "Build tests for OpenGL ES2" ${PIGLIT_BUILD_GLES_TESTS_DEFAULT})
 option(PIGLIT_BUILD_GLES3_TESTS "Build tests for OpenGL ES3" ${PIGLIT_BUILD_GLES_TESTS_DEFAULT})
 option(PIGLIT_BUILD_CL_TESTS "Build tests for OpenCL" OFF)
+option(PIGLIT_BUILD_VULKAN_TESTS "Build tests for Vulkan" ${PIGLIT_BUILD_VULKAN_TESTS_DEFAULT})
 
 if(PIGLIT_BUILD_GL_TESTS)
 	find_package(OpenGL REQUIRED)
@@ -128,6 +131,10 @@ if(PIGLIT_BUILD_CL_TESTS)
 	find_package(OpenCL REQUIRED)
 endif(PIGLIT_BUILD_CL_TESTS)
 
+if(PIGLIT_BUILD_VULKAN_TESTS)
+	pkg_check_modules(VULKAN REQUIRED vulkan)
+endif(PIGLIT_BUILD_VULKAN_TESTS)
+
 IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
 	if(X11_FOUND AND OPENGL_gl_LIBRARY)
 		# Assume the system has GLX. In the future, systems may exist
diff --git a/cmake/piglit_util.cmake b/cmake/piglit_util.cmake
index 918ea8421..1f9501b66 100644
--- a/cmake/piglit_util.cmake
+++ b/cmake/piglit_util.cmake
@@ -29,7 +29,7 @@ function(piglit_include_target_api)
     # Verify that the value of `piglit_target_api` is valid.
     set(valid_api FALSE)
 
-    foreach(api "gl" "gles1" "gles2" "gles3" "cl" "no_api")
+    foreach(api "gl" "gles1" "gles2" "gles3" "cl" "vulkan" "no_api")
         if(piglit_target_api STREQUAL ${api})
             set(valid_api TRUE)
             break()
diff --git a/cmake/target_api/CMakeLists.txt b/cmake/target_api/CMakeLists.txt
index 3a0b67f6b..2c89d28bc 100644
--- a/cmake/target_api/CMakeLists.txt
+++ b/cmake/target_api/CMakeLists.txt
@@ -42,3 +42,7 @@ endif(PIGLIT_BUILD_GLES3_TESTS)
 if(PIGLIT_BUILD_CL_TESTS)
 	add_subdirectory(cl)
 endif(PIGLIT_BUILD_CL_TESTS)
+
+if(PIGLIT_BUILD_VULKAN_TESTS)
+	add_subdirectory(vulkan)
+endif(PIGLIT_BUILD_VULKAN_TESTS)
diff --git a/cmake/target_api/vulkan/CMakeLists.txt b/cmake/target_api/vulkan/CMakeLists.txt
new file mode 100644
index 000000000..ce5d2c1f3
--- /dev/null
+++ b/cmake/target_api/vulkan/CMakeLists.txt
@@ -0,0 +1,10 @@
+set(piglit_target_api "vulkan")
+
+add_definitions(
+	-DUSE_VULKAN
+	)
+
+add_subdirectory(${piglit_SOURCE_DIR}/tests
+	${piglit_BINARY_DIR}/target_api/${piglit_target_api}/tests
+	)
+
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c588dfca5..58c4a39ff 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -25,3 +25,7 @@ ENDIF(EGL_FOUND)
 IF(PIGLIT_BUILD_CL_TESTS)
 	add_subdirectory (cl)
 ENDIF(PIGLIT_BUILD_CL_TESTS)
+
+IF(PIGLIT_BUILD_VULKAN_TESTS)
+	add_subdirectory (vulkan)
+ENDIF(PIGLIT_BUILD_VULKAN_TESTS)
diff --git a/tests/vulkan/CMakeLists.txt b/tests/vulkan/CMakeLists.txt
new file mode 100644
index 000000000..e69de29bb
-- 
2.14.3



More information about the Piglit mailing list