[Piglit] [PATCH 54/63] CMake: Add PIGLIT_GENERATE_GL_SPIRV_TESTS option
Alejandro PiƱeiro
apinheiro at igalia.com
Sat Feb 23 23:45:42 UTC 2019
From: Antia Puentes <apuentes at igalia.com>
Adds an option to CMake which can be enabled to generate additional
shader_tests for ARB_gl_spirv by translating shader_tests written for
other specifications to SPIR-V. Specifically, uses the gen_gl_spirv.py
script to translate the shader_tests under the 'tests' directory,
excluding those pertaining to unsupported extensions or listed in the
tests/gl_spirv.exclude file.
---
CMakeLists.txt | 3 +++
generated_tests/CMakeLists.txt | 31 +++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b416cacb2..435c40ea5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,6 +49,9 @@ option(PIGLIT_BUILD_GLES2_TESTS "Build tests for OpenGL ES2" ${PIGLIT_BUILD_GLES
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_GENERATE_GL_SPIRV_TESTS
+ "Generate ARB_gl_spirv tests by converting GLSL shader_tests to SPIR-V" OFF)
+
if(PIGLIT_BUILD_GL_TESTS)
find_package(OpenGL REQUIRED)
endif()
diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index adec9b4cb..3242885b9 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -18,6 +18,14 @@ function(piglit_make_generated_tests file_list generator_script)
VERBATIM)
endfunction(piglit_make_generated_tests custom_target generator_script)
+function(piglit_make_generated_tests_for_gl_spirv file_list generator_script source_prefix source_tests)
+ add_custom_command(
+ OUTPUT ${file_list}
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${generator_script} ${source_tests} --prefix=${source_prefix} ${ARGN}
+ DEPENDS ${generator_script} ${source_prefix}/${source_tests}
+ VERBATIM)
+endfunction(piglit_make_generated_tests_for_gl_spirv)
+
# Generators for OpenGL tests
piglit_make_generated_tests(
builtin_packing_tests.list
@@ -202,6 +210,17 @@ piglit_make_generated_tests(
piglit_make_generated_tests(
shader_framebuffer_fetch_tests.list
gen_shader_framebuffer_fetch_tests.py)
+piglit_make_generated_tests_for_gl_spirv(
+ gl_spirv_tests.list
+ gen_gl_spirv_tests.py
+ ${CMAKE_SOURCE_DIR}
+ tests
+ --excludes-from-file=${CMAKE_SOURCE_DIR}/tests/gl_spirv.exclude
+ --success-list-file=gl_spirv_tests.list
+ --mirror=spec/arb_gl_spirv/translated
+ --keep-going
+ --strip-names
+ --jobs=4)
# OpenCL Test generators
piglit_make_generated_tests(
@@ -285,6 +304,12 @@ add_custom_target(gen-cl-tests
cl_vload_tests.list
)
+# Create a custom target for generating ARB_gl_spirv shader_tests
+# This is not added to the default target, instead it is added
+# as a dependency of gen-tests if the generation of the
+# ARB_gl_spirv shader_tests is enabled
+add_custom_target(gen-gl-spirv-tests DEPENDS gl_spirv_tests.list)
+
# Add a "gen-tests" target that can be used to generate all the
# tests without doing any other compilation.
add_custom_target(gen-tests ALL COMMENT "meta-target for other test generators")
@@ -299,3 +324,9 @@ endif(${PIGLIT_BUILD_GL_TESTS} OR ${PIGLIT_BUILD_GLES2_TESTS} OR ${PIGLIT_BUILD_
if(${PIGLIT_BUILD_CL_TESTS})
add_dependencies(gen-tests gen-cl-tests)
endif(${PIGLIT_BUILD_CL_TESTS})
+
+# Add gen-gl-spirv-tests as a dependency of the gen-tests if they are
+# requested.
+if(${PIGLIT_GENERATE_GL_SPIRV_TESTS})
+ add_dependencies(gen-tests gen-gl-spirv-tests)
+endif(${PIGLIT_GENERATE_GL_SPIRV_TESTS})
--
2.19.1
More information about the Piglit
mailing list