From d936e5f039f3a8137594bd5f39ab46140ff3079b Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 6 Sep 2019 22:01:18 +0100 Subject: [PATCH] Always require glslang and spirv-tools to be present The prebuilt shader paths are no longer used. Just require both dependencies to be present and drop the !DEQP_HAVE_GLSLANG / !DEQP_HAVE_SPIRV_TOOLS paths. Mention of prebuilt binaries is removed from the Vulkan CTS readme. The machinery to actually build all the shaders upfront is left in place for now as it has value as a presubmit check. Components: Vulkan, OpenGL VK-GL-CTS Issue: 1951 Change-Id: I6a79766a07e5aeb3c9c43236a3a220f8b654511e --- external/glslang/CMakeLists.txt | 9 +- external/openglcts/modules/common/CMakeLists.txt | 30 +++---- .../openglcts/modules/common/glcSpirvUtils.cpp | 55 +----------- external/openglcts/modules/gl/CMakeLists.txt | 8 -- external/openglcts/modules/gl/gl4cGlSpirvTests.cpp | 97 ---------------------- external/spirv-tools/CMakeLists.txt | 6 +- external/vulkancts/README.md | 20 ----- external/vulkancts/framework/vulkan/CMakeLists.txt | 44 +++++----- external/vulkancts/framework/vulkan/vkPrograms.cpp | 28 +------ .../vulkancts/framework/vulkan/vkShaderToSpirV.cpp | 39 ++------- external/vulkancts/framework/vulkan/vkSpirVAsm.cpp | 25 +----- 11 files changed, 46 insertions(+), 315 deletions(-) diff --git a/external/glslang/CMakeLists.txt b/external/glslang/CMakeLists.txt index 8f86d5c..8066b61 100644 --- a/external/glslang/CMakeLists.txt +++ b/external/glslang/CMakeLists.txt @@ -19,7 +19,7 @@ else () endif () if (EXISTS ${GLSLANG_ABS_PATH}/glslang/GenericCodeGen/CodeGen.cpp) - message(STATUS "glslang found; building with DEQP_HAVE_GLSLANG") + message(STATUS "glslang found") # Disable glslang install as part of cmake install. set(SKIP_GLSLANG_INSTALL OFF CACHE BOOL "" FORCE) @@ -37,11 +37,6 @@ if (EXISTS ${GLSLANG_ABS_PATH}/glslang/GenericCodeGen/CodeGen.cpp) set(GLSLANG_INCLUDE_PATH ${GLSLANG_ABS_PATH} PARENT_SCOPE) set(GLSLANG_LIBRARIES glslang SPIRV SPVRemapper PARENT_SCOPE) - set(DEQP_HAVE_GLSLANG ON PARENT_SCOPE) - else () - message(STATUS "glslang not found; GLSL to SPIR-V compilation not available") - - set(DEQP_HAVE_GLSLANG OFF PARENT_SCOPE) - + message(FATAL_ERROR "glslang not found") endif () diff --git a/external/openglcts/modules/common/CMakeLists.txt b/external/openglcts/modules/common/CMakeLists.txt index abeff06..fa919fc 100644 --- a/external/openglcts/modules/common/CMakeLists.txt +++ b/external/openglcts/modules/common/CMakeLists.txt @@ -121,29 +121,23 @@ set(GLCTS_COMMON_LIBS ) # Add glslang -if (DEQP_HAVE_GLSLANG) - include_directories(${GLSLANG_INCLUDE_PATH}) - add_definitions(-DDEQP_HAVE_GLSLANG=1) +include_directories(${GLSLANG_INCLUDE_PATH}) - # \note Code interfacing with glslang needs to include third-party headers - # that cause all sorts of warnings to appear. - if (DE_COMPILER_IS_GCC OR DE_COMPILER_IS_CLANG) - set_source_files_properties( - FILES glcSpirvUtils.cpp - PROPERTIES COMPILE_FLAGS "${DE_3RD_PARTY_CXX_FLAGS}") - endif () - - set(GLCTS_COMMON_LIBS ${GLCTS_COMMON_LIBS} ${GLSLANG_LIBRARIES}) +# \note Code interfacing with glslang needs to include third-party headers +# that cause all sorts of warnings to appear. +if (DE_COMPILER_IS_GCC OR DE_COMPILER_IS_CLANG) + set_source_files_properties( + FILES glcSpirvUtils.cpp + PROPERTIES COMPILE_FLAGS "${DE_3RD_PARTY_CXX_FLAGS}") endif () +set(GLCTS_COMMON_LIBS ${GLCTS_COMMON_LIBS} ${GLSLANG_LIBRARIES}) + # Add spirv-tools -if(DEQP_HAVE_SPIRV_TOOLS) - include_directories(${spirv-tools_SOURCE_DIR}/include) - include_directories(${spirv-tools_SOURCE_DIR}/external/include) +include_directories(${spirv-tools_SOURCE_DIR}/include) +include_directories(${spirv-tools_SOURCE_DIR}/external/include) - add_definitions(-DDEQP_HAVE_SPIRV_TOOLS=1) - set(GLCTS_COMMON_LIBS ${GLCTS_COMMON_LIBS} SPIRV-Tools) -endif() +set(GLCTS_COMMON_LIBS ${GLCTS_COMMON_LIBS} SPIRV-Tools) PCH(GLCTS_COMMON_SRCS ../pch.cpp) diff --git a/external/openglcts/modules/common/glcSpirvUtils.cpp b/external/openglcts/modules/common/glcSpirvUtils.cpp index e510cea..ac2f9f8 100644 --- a/external/openglcts/modules/common/glcSpirvUtils.cpp +++ b/external/openglcts/modules/common/glcSpirvUtils.cpp @@ -29,18 +29,14 @@ #include "gluContextInfo.hpp" #include "tcuTestLog.hpp" -#if defined DEQP_HAVE_GLSLANG #include "SPIRV/GlslangToSpv.h" #include "SPIRV/disassemble.h" #include "SPIRV/doc.h" #include "glslang/MachineIndependent/localintermediate.h" #include "glslang/Public/ShaderLang.h" -#endif // DEQP_HAVE_GLSLANG -#if defined DEQP_HAVE_SPIRV_TOOLS #include "spirv-tools/libspirv.hpp" #include "spirv-tools/optimizer.hpp" -#endif // DEQP_HAVE_SPIRV_TOOLS using namespace glu; @@ -59,8 +55,6 @@ void checkGlSpirvSupported(deqp::Context& m_context) TCU_THROW(NotSupportedError, "GL 4.6 or GL_ARB_gl_spirv is not supported"); } -#if defined DEQP_HAVE_GLSLANG - EShLanguage getGlslangStage(glu::ShaderType type) { static const EShLanguage stageMap[] = { @@ -266,25 +260,6 @@ bool compileGlslToSpirV(tcu::TestLog& log, std::string source, glu::ShaderType t return false; } -#else // DEQP_HAVE_GLSLANG - -bool compileGlslToSpirV(tcu::TestLog& log, std::string source, glu::ShaderType type, ShaderBinaryDataType* dst, SpirvVersion version) -{ - DE_UNREF(log); - DE_UNREF(source); - DE_UNREF(type); - DE_UNREF(dst); - DE_UNREF(version); - - TCU_THROW(InternalError, "Glslang not available."); - - return false; -} - -#endif // DEQP_HAVE_GLSLANG - -#if defined DEQP_HAVE_SPIRV_TOOLS - void consumer(spv_message_level_t, const char*, const spv_position_t&, const char* m) { std::cerr << "error: " << m << std::endl; @@ -327,34 +302,6 @@ bool spirvValidate(ShaderBinaryDataType& dst, bool throwOnError) return true; } -#else //DEQP_HAVE_SPIRV_TOOLS - -void spirvAssemble(ShaderBinaryDataType& dst, const std::string& src) -{ - DE_UNREF(dst); - DE_UNREF(src); - - TCU_THROW(InternalError, "Spirv-tools not available."); -} - -void spirvDisassemble(std::string& dst, ShaderBinaryDataType& src) -{ - DE_UNREF(dst); - DE_UNREF(src); - - TCU_THROW(InternalError, "Spirv-tools not available."); -} - -bool spirvValidate(ShaderBinaryDataType& dst, bool throwOnError) -{ - DE_UNREF(dst); - DE_UNREF(throwOnError); - - TCU_THROW(InternalError, "Spirv-tools not available."); -} - -#endif // DEQP_HAVE_SPIRV_TOOLS - ShaderBinary makeSpirV(tcu::TestLog& log, ShaderSource source, SpirvVersion version) { ShaderBinary binary; @@ -441,4 +388,4 @@ bool verifyMappings(std::string glslSource, std::string spirVSource, SpirVMappin } // namespace spirvUtils -} // namespace glc \ No newline at end of file +} // namespace glc diff --git a/external/openglcts/modules/gl/CMakeLists.txt b/external/openglcts/modules/gl/CMakeLists.txt index 8c2268a..6ef9f79 100644 --- a/external/openglcts/modules/gl/CMakeLists.txt +++ b/external/openglcts/modules/gl/CMakeLists.txt @@ -130,14 +130,6 @@ set(GLCTS_GL_LIBS tcutil ) -if (DEQP_HAVE_GLSLANG) - add_definitions(-DDEQP_HAVE_GLSLANG=1) -endif () - -if(DEQP_HAVE_SPIRV_TOOLS) - add_definitions(-DDEQP_HAVE_SPIRV_TOOLS=1) -endif() - if (DEQP_GTF_AVAILABLE) list(APPEND GLCTS_GL_LIBS glcts-gtf) endif () diff --git a/external/openglcts/modules/gl/gl4cGlSpirvTests.cpp b/external/openglcts/modules/gl/gl4cGlSpirvTests.cpp index b0727e4..d885e90 100644 --- a/external/openglcts/modules/gl/gl4cGlSpirvTests.cpp +++ b/external/openglcts/modules/gl/gl4cGlSpirvTests.cpp @@ -335,7 +335,6 @@ tcu::TestNode::IterateResult SpirvModulesPositiveTest::iterate() } else if (it == ITERATE_SPIRV) { -#if defined DEQP_HAVE_GLSLANG ProgramBinaries binaries; binaries << spirvUtils::makeSpirV(m_context.getTestContext().getLog(), VertexSource(m_vertex)); binaries << spirvUtils::makeSpirV(m_context.getTestContext().getLog(), @@ -345,16 +344,6 @@ tcu::TestNode::IterateResult SpirvModulesPositiveTest::iterate() binaries << spirvUtils::makeSpirV(m_context.getTestContext().getLog(), GeometrySource(m_geometry)); binaries << spirvUtils::makeSpirV(m_context.getTestContext().getLog(), FragmentSource(m_fragment)); program = new ShaderProgram(gl, binaries); -#else // DEQP_HAVE_GLSLANG - tcu::Archive& archive = m_testCtx.getArchive(); - ProgramBinaries binaries; - binaries << commonUtils::readSpirV(archive.getResource("spirv/modules_positive/vertex.nspv")); - binaries << commonUtils::readSpirV(archive.getResource("spirv/modules_positive/tess_control.nspv")); - binaries << commonUtils::readSpirV(archive.getResource("spirv/modules_positive/tess_evaluation.nspv")); - binaries << commonUtils::readSpirV(archive.getResource("spirv/modules_positive/geometry.nspv")); - binaries << commonUtils::readSpirV(archive.getResource("spirv/modules_positive/fragment.nspv")); - program = new ShaderProgram(gl, binaries); -#endif // DEQP_HAVE_GLSLANG } if (!program->isOk()) @@ -565,18 +554,12 @@ tcu::TestNode::IterateResult SpirvShaderBinaryMultipleShaderObjectsTest::iterate gl.bufferData(GL_ARRAY_BUFFER, 9 * sizeof(GLfloat), (GLvoid*)vertices, GL_DYNAMIC_DRAW); GLU_EXPECT_NO_ERROR(gl.getError(), "glBufferData"); -#if defined DEQP_HAVE_SPIRV_TOOLS ShaderBinary binary; binary << SHADERTYPE_VERTEX << "mainv"; binary << SHADERTYPE_FRAGMENT << "mainf"; spirvUtils::spirvAssemble(binary.binary, m_spirv); spirvUtils::spirvValidate(binary.binary, true); -#else // DEQP_HAVE_SPIRV_TOOLS - tcu::Archive& archive = m_testCtx.getArchive(); - ShaderBinary binary = commonUtils::readSpirV( - archive.getResource("spirv/spirv_modules_shader_binary_multiple_shader_objects/binary.nspv")); -#endif // DEQP_HAVE_SPIRV_TOOLS ProgramBinaries binaries; binaries << binary; @@ -715,7 +698,6 @@ tcu::TestNode::IterateResult SpirvModulesStateQueriesTest::iterate() ProgramBinaries binaries; ShaderBinary vertexBinary; -#if defined DEQP_HAVE_GLSLANG && DEQP_HAVE_SPIRV_TOOLS { vertexBinary = spirvUtils::makeSpirV(m_context.getTestContext().getLog(), VertexSource(m_vertex)); @@ -742,10 +724,6 @@ tcu::TestNode::IterateResult SpirvModulesStateQueriesTest::iterate() spirvUtils::spirvAssemble(vertexBinary.binary, input); spirvUtils::spirvValidate(vertexBinary.binary, true); } -#else // DEQP_HAVE_GLSLANG && DEQP_HAVE_SPIRV_TOOLS - tcu::Archive& archive = m_testCtx.getArchive(); - vertexBinary = commonUtils::readSpirV(archive.getResource("spirv/modules_state_queries/vertex.nspv")); -#endif // DEQP_HAVE_GLSLANG && DEQP_HAVE_SPIRV_TOOLS binaries << vertexBinary; ShaderProgram program(gl, binaries); @@ -907,12 +885,7 @@ tcu::TestNode::IterateResult SpirvModulesErrorVerificationTest::iterate() ShaderBinary vertexBinary; -#if defined DEQP_HAVE_GLSLANG vertexBinary = spirvUtils::makeSpirV(m_context.getTestContext().getLog(), VertexSource(m_vertex)); -#else // DEQP_HAVE_GLSLANG - tcu::Archive& archive = m_testCtx.getArchive(); - vertexBinary = commonUtils::readSpirV(archive.getResource("spirv/modules_error_verification/vertex.nspv")); -#endif // DEQP_HAVE_GLSLANG gl.shaderSource(m_glslShaderId, 1, &shaderSrc, &shaderLen); GLU_EXPECT_NO_ERROR(gl.getError(), "shaderSource"); @@ -1130,7 +1103,6 @@ void SpirvGlslToSpirVEnableTest::deinit() tcu::TestNode::IterateResult SpirvGlslToSpirVEnableTest::iterate() { -#if defined DEQP_HAVE_GLSLANG && DEQP_HAVE_SPIRV_TOOLS { const Functions& gl = m_context.getRenderContext().getFunctions(); @@ -1164,11 +1136,6 @@ tcu::TestNode::IterateResult SpirvGlslToSpirVEnableTest::iterate() m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); } -#else // DEQP_HAVE_GLSLANG && DEQP_HAVE_SPIRV_TOOLS - - TCU_THROW(InternalError, "Either glslang or spirv-tools not available."); - -#endif // DEQP_HAVE_GLSLANG && DEQP_HAVE_SPIRV_TOOLS return STOP; } @@ -1703,13 +1670,7 @@ tcu::TestNode::IterateResult SpirvGlslToSpirVBuiltInFunctionsTest::iterate() sources << vertexSource; ShaderBinary vertexBinary; -#if defined DEQP_HAVE_GLSLANG vertexBinary = spirvUtils::makeSpirV(m_context.getTestContext().getLog(), vertexSource); -#else // DEQP_HAVE_GLSLANG - tcu::Archive& archive = m_testCtx.getArchive(); - vertexBinary = - commonUtils::readSpirV(archive.getResource("spirv/glsl_to_spirv_builtin_functions/common_vertex.nspv")); -#endif //DEQP_HAVE_GLSLANG binaries << vertexBinary; } @@ -1717,19 +1678,8 @@ tcu::TestNode::IterateResult SpirvGlslToSpirVBuiltInFunctionsTest::iterate() ShaderBinary shaderBinary; std::string spirvSource; -#if defined DEQP_HAVE_GLSLANG shaderBinary = spirvUtils::makeSpirV(m_context.getTestContext().getLog(), shaderSource); -#else // DEQP_HAVE_GLSLANG - { - std::stringstream ss; - ss << "spirv/glsl_to_spirv_builtin_functions/binary_" << i << ".nspv"; - tcu::Archive& archive = m_testCtx.getArchive(); - shaderBinary = commonUtils::readSpirV(archive.getResource(ss.str().c_str())); - } -#endif // DEQP_HAVE_GLSLANG - -#if defined DEQP_HAVE_SPIRV_TOOLS { spirvUtils::spirvDisassemble(spirvSource, shaderBinary.binary); @@ -1744,9 +1694,6 @@ tcu::TestNode::IterateResult SpirvGlslToSpirVBuiltInFunctionsTest::iterate() TCU_THROW(InternalError, "Mappings for shader failed."); } } -#else // DEQP_HAVE_SPIRV_TOOLS - spirvSource = "Could not disassemble Spir-V module. SPIRV-TOOLS not available."; -#endif // DEQP_HAVE_SPIRV_TOOLS binaries << shaderBinary; @@ -1756,13 +1703,7 @@ tcu::TestNode::IterateResult SpirvGlslToSpirVBuiltInFunctionsTest::iterate() sources << tessEvalSource; ShaderBinary tessEvalBinary; -#if defined DEQP_HAVE_GLSLANG tessEvalBinary = spirvUtils::makeSpirV(m_context.getTestContext().getLog(), tessEvalSource); -#else // DEQP_HAVE_GLSLANG - tcu::Archive& archive = m_testCtx.getArchive(); - tessEvalBinary = commonUtils::readSpirV( - archive.getResource("spirv/glsl_to_spirv_builtin_functions/common_tesseval.nspv")); -#endif // DEQP_HAVE_GLSLANG binaries << tessEvalBinary; } @@ -2068,20 +2009,10 @@ tcu::TestNode::IterateResult SpirvGlslToSpirVSpecializationConstantsTest::iterat ShaderBinary vertexBinary; ShaderBinary fragmentBinary; -#if defined DEQP_HAVE_GLSLANG { vertexBinary = spirvUtils::makeSpirV(m_context.getTestContext().getLog(), VertexSource(m_vertex)); fragmentBinary = spirvUtils::makeSpirV(m_context.getTestContext().getLog(), FragmentSource(m_fragment)); } -#else // DEQP_HAVE_GLSLANG - { - tcu::Archive& archive = m_testCtx.getArchive(); - vertexBinary = - commonUtils::readSpirV(archive.getResource("spirv/glsl_to_spirv_specialization_constants/vertex.nspv")); - fragmentBinary = - commonUtils::readSpirV(archive.getResource("spirv/glsl_to_spirv_specialization_constants/fragment.nspv")); - } -#endif // DEQP_HAVE_GLSLANG fragmentBinary << SpecializationData(10, 128); ProgramBinaries binaries; @@ -2450,7 +2381,6 @@ tcu::TestNode::IterateResult SpirvValidationBuiltInVariableDecorationsTest::iter { std::vector binariesVec; -#if defined DEQP_HAVE_GLSLANG ProgramBinaries binaries; for (int s = 0; s < (signed)m_validations[v].shaders.size(); ++s) { @@ -2459,22 +2389,8 @@ tcu::TestNode::IterateResult SpirvValidationBuiltInVariableDecorationsTest::iter binariesVec.push_back(shaderBinary); binaries << shaderBinary; } -#else // DEQP_HAVE_GLSLANG - tcu::Archive& archive = m_testCtx.getArchive(); - ProgramBinaries binaries; - for (int s = 0; s < (signed)m_validations[v].shaders.size(); ++s) - { - std::stringstream ss; - ss << "spirv/spirv_validation_builtin_variable_decorations/shader_" << v << "_" << s << ".nspv"; - - ShaderBinary shaderBinary = commonUtils::readSpirV(archive.getResource(ss.str().c_str())); - binariesVec.push_back(shaderBinary); - binaries << shaderBinary; - } -#endif // DEQP_HAVE_GLSLANG program = new ShaderProgram(gl, binaries); -#if defined DEQP_HAVE_SPIRV_TOOLS std::string spirvSource; for (int s = 0; s < (signed)m_validations[v].shaders.size(); ++s) @@ -2494,7 +2410,6 @@ tcu::TestNode::IterateResult SpirvValidationBuiltInVariableDecorationsTest::iter TCU_THROW(InternalError, "Mappings for shader failed."); } } -#endif // DEQP_HAVE_SPIRV_TOOLS } if (!program->isOk()) @@ -3458,7 +3373,6 @@ tcu::TestNode::IterateResult SpirvValidationCapabilitiesTest::iterate() for (int s = 0; s < (signed)pipeline.size(); ++s) { ShaderStage& stage = pipeline[s]; -#if defined DEQP_HAVE_GLSLANG stage.binary = spirvUtils::makeSpirV(m_context.getTestContext().getLog(), stage.source); std::stringstream ssw; if (stage.name.empty()) @@ -3466,15 +3380,6 @@ tcu::TestNode::IterateResult SpirvValidationCapabilitiesTest::iterate() else ssw << "gl_cts/data/spirv/spirv_validation_capabilities/" << stage.name << ".nspv"; commonUtils::writeSpirV(ssw.str().c_str(), stage.binary); -#else // DEQP_HAVE_GLSLANG - tcu::Archive& archive = m_testCtx.getArchive(); - std::stringstream ss; - if (stage.name.empty()) - ss << "spirv/spirv_validation_capabilities/binary_p" << p << "s" << s << ".nspv"; - else - ss << "spirv/spirv_validation_capabilities/" << stage.name << ".nspv"; - stage.binary = commonUtils::readSpirV(archive.getResource(ss.str().c_str())); -#endif // DEQP_HAVE_GLSLANG programBinaries << stage.binary; } @@ -3505,7 +3410,6 @@ tcu::TestNode::IterateResult SpirvValidationCapabilitiesTest::iterate() return STOP; } -#if defined DEQP_HAVE_SPIRV_TOOLS for (int s = 0; s < (signed)pipeline.size(); ++s) { ShaderStage stage = pipeline[s]; @@ -3541,7 +3445,6 @@ tcu::TestNode::IterateResult SpirvValidationCapabilitiesTest::iterate() } } } -#endif // DEQP_HAVE_SPIRV_TOOLS } m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); diff --git a/external/spirv-tools/CMakeLists.txt b/external/spirv-tools/CMakeLists.txt index 69064a1..215c0d3 100644 --- a/external/spirv-tools/CMakeLists.txt +++ b/external/spirv-tools/CMakeLists.txt @@ -26,17 +26,15 @@ endif () if (EXISTS ${SPIRV_TOOLS_ABS_PATH}/source/opcode.cpp AND EXISTS ${SPIRV_HEADERS_ABS_PATH}/include/spirv/1.0/spirv.h) - message(STATUS "spirv-tools found; building with DEQP_HAVE_SPIRV_TOOLS") + message(STATUS "spirv-tools found") set(CMAKE_C_FLAGS ${DE_3RD_PARTY_C_FLAGS}) set(CMAKE_CXX_FLAGS ${DE_3RD_PARTY_CXX_FLAGS}) # SPIR-V tools requires SPIRV-Headers set(SPIRV-Headers_SOURCE_DIR ${SPIRV_HEADERS_ABS_PATH}) - set(DEQP_HAVE_SPIRV_TOOLS ON PARENT_SCOPE) set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "" FORCE) add_subdirectory(${SPIRV_TOOLS_ABS_PATH} spirv-tools) else () - message(STATUS "spirv-tools not found; SPIR-V assembly not available") - set(DEQP_HAVE_SPIRV_TOOLS OFF PARENT_SCOPE) + message(FATAL_ERROR "spirv-tools not found") endif () diff --git a/external/vulkancts/README.md b/external/vulkancts/README.md index b717a59..b8f9c57 100644 --- a/external/vulkancts/README.md +++ b/external/vulkancts/README.md @@ -116,26 +116,6 @@ Vulkan CTS mustpass can be re-generated by running: python /external/vulkancts/scripts/build_mustpass.py -Pre-compiling SPIR-V binaries ------------------------------ - -For distribution, and platforms that don't support GLSL to SPIR-V compilation, -SPIR-V binaries can be pre-built with following command: - - python external/vulkancts/scripts/build_spirv_binaries.py - -By default the script builds SPIR-V binaries for Vulkan 1.1. -Binaries for other Vulkan versions can be requested by supplying -an extra command line option: - - python external/vulkancts/scripts/build_spirv_binaries.py --target-vulkan-version - -Binaries will be written to `external/vulkancts/data/vulkan/prebuilt/`. - -Test modules (or in case of Android, the APK) must be re-built after building -SPIR-V programs in order for the binaries to be available. - - Running CTS ----------- diff --git a/external/vulkancts/framework/vulkan/CMakeLists.txt b/external/vulkancts/framework/vulkan/CMakeLists.txt index d713f91..ee7c3fe 100644 --- a/external/vulkancts/framework/vulkan/CMakeLists.txt +++ b/external/vulkancts/framework/vulkan/CMakeLists.txt @@ -95,36 +95,30 @@ set(VKUTIL_LIBS vkutilnoshader ) -if (DEQP_HAVE_GLSLANG) - include_directories(${GLSLANG_INCLUDE_PATH}) - add_definitions(-DDEQP_HAVE_GLSLANG=1) +include_directories(${GLSLANG_INCLUDE_PATH}) - # \note Code interfacing with glslang needs to include third-party headers - # that cause all sorts of warnings to appear. - if (DE_COMPILER_IS_GCC OR DE_COMPILER_IS_CLANG) - set_source_files_properties( - FILES vkShaderToSpirV.cpp - PROPERTIES COMPILE_FLAGS "${DE_3RD_PARTY_CXX_FLAGS}") - endif () - - set(VKUTIL_LIBS ${VKUTIL_LIBS} ${GLSLANG_LIBRARIES}) +# \note Code interfacing with glslang needs to include third-party headers +# that cause all sorts of warnings to appear. +if (DE_COMPILER_IS_GCC OR DE_COMPILER_IS_CLANG) + set_source_files_properties( + FILES vkShaderToSpirV.cpp + PROPERTIES COMPILE_FLAGS "${DE_3RD_PARTY_CXX_FLAGS}") endif () -if(DEQP_HAVE_SPIRV_TOOLS) - include_directories(${spirv-tools_SOURCE_DIR}/include) - include_directories(${spirv-tools_SOURCE_DIR}/external/include) +set(VKUTIL_LIBS ${VKUTIL_LIBS} ${GLSLANG_LIBRARIES}) + +include_directories(${spirv-tools_SOURCE_DIR}/include) +include_directories(${spirv-tools_SOURCE_DIR}/external/include) - # \note Code interfacing with spirv-opt needs to include third-party headers - # that cause all sorts of warnings to appear. - if (DE_COMPILER_IS_GCC OR DE_COMPILER_IS_CLANG) - set_source_files_properties( - FILES vkPrograms.cpp - PROPERTIES COMPILE_FLAGS "${DE_3RD_PARTY_CXX_FLAGS}") - endif () +# \note Code interfacing with spirv-opt needs to include third-party headers +# that cause all sorts of warnings to appear. +if (DE_COMPILER_IS_GCC OR DE_COMPILER_IS_CLANG) + set_source_files_properties( + FILES vkPrograms.cpp + PROPERTIES COMPILE_FLAGS "${DE_3RD_PARTY_CXX_FLAGS}") +endif () - add_definitions(-DDEQP_HAVE_SPIRV_TOOLS=1) - set(VKUTIL_LIBS ${VKUTIL_LIBS} SPIRV-Tools SPIRV-Tools-opt) -endif() +set(VKUTIL_LIBS ${VKUTIL_LIBS} SPIRV-Tools SPIRV-Tools-opt) PCH(VKUTILNOSHADER_SRCS ../../modules/vulkan/pch.cpp) PCH(VKUTIL_SRCS ../../modules/vulkan/pch.cpp) diff --git a/external/vulkancts/framework/vulkan/vkPrograms.cpp b/external/vulkancts/framework/vulkan/vkPrograms.cpp index af0dac8..72e955a 100644 --- a/external/vulkancts/framework/vulkan/vkPrograms.cpp +++ b/external/vulkancts/framework/vulkan/vkPrograms.cpp @@ -21,9 +21,7 @@ * \brief Program utilities. *//*--------------------------------------------------------------------*/ -#if defined(DEQP_HAVE_SPIRV_TOOLS) #include "spirv-tools/optimizer.hpp" -#endif #include "qpInfo.h" @@ -49,7 +47,7 @@ using std::string; using std::vector; using std::map; -#if defined(DE_DEBUG) && defined(DEQP_HAVE_SPIRV_TOOLS) +#if defined(DE_DEBUG) # define VALIDATE_BINARIES true #else # define VALIDATE_BINARIES false @@ -100,8 +98,6 @@ bool isSaneSpirVBinary (const ProgramBinary& binary) return true; } -#if defined(DEQP_HAVE_SPIRV_TOOLS) - void optimizeCompiledBinary (vector& binary, int optimizationRecipe, const SpirvVersion spirvVersion) { spv_target_env targetEnv = SPV_ENV_VULKAN_1_0; @@ -149,12 +145,8 @@ ProgramBinary* createProgramBinaryFromSpirV (const vector& binary) TCU_THROW(InternalError, "SPIR-V endianness translation not supported"); } -#endif // defined(DEQP_HAVE_SPIRV_TOOLS) - } // anonymous -#if defined(DEQP_HAVE_SPIRV_TOOLS) - void validateCompiledBinary(const vector& binary, glu::ShaderProgramInfo* buildInfo, const SpirvValidatorOptions& options) { std::ostringstream validationLog; @@ -655,24 +647,6 @@ ProgramBinary* assembleProgram (const SpirVAsmSource& program, SpirVProgramInfo* return res; } -#else // !DEQP_HAVE_SPIRV_TOOLS - -ProgramBinary* buildProgram (const GlslSource&, glu::ShaderProgramInfo*, const tcu::CommandLine&) -{ - TCU_THROW(NotSupportedError, "GLSL to SPIR-V compilation not supported (DEQP_HAVE_GLSLANG not defined)"); -} - -ProgramBinary* buildProgram (const HlslSource&, glu::ShaderProgramInfo*, const tcu::CommandLine&) -{ - TCU_THROW(NotSupportedError, "HLSL to SPIR-V compilation not supported (DEQP_HAVE_GLSLANG not defined)"); -} - -ProgramBinary* assembleProgram (const SpirVAsmSource&, SpirVProgramInfo*, const tcu::CommandLine&) -{ - TCU_THROW(NotSupportedError, "SPIR-V assembly not supported (DEQP_HAVE_SPIRV_TOOLS not defined)"); -} -#endif - void disassembleProgram (const ProgramBinary& program, std::ostream* dst) { if (program.getFormat() == PROGRAM_FORMAT_SPIRV) diff --git a/external/vulkancts/framework/vulkan/vkShaderToSpirV.cpp b/external/vulkancts/framework/vulkan/vkShaderToSpirV.cpp index e078263..f0763b7 100644 --- a/external/vulkancts/framework/vulkan/vkShaderToSpirV.cpp +++ b/external/vulkancts/framework/vulkan/vkShaderToSpirV.cpp @@ -28,16 +28,14 @@ #include "deClock.h" #include "qpDebugOut.h" -#if defined(DEQP_HAVE_GLSLANG) -# include "SPIRV/GlslangToSpv.h" -# include "SPIRV/disassemble.h" -# include "SPIRV/SPVRemapper.h" -# include "SPIRV/doc.h" -# include "glslang/Include/InfoSink.h" -# include "glslang/Include/ShHandle.h" -# include "glslang/MachineIndependent/localintermediate.h" -# include "glslang/Public/ShaderLang.h" -#endif +#include "SPIRV/GlslangToSpv.h" +#include "SPIRV/disassemble.h" +#include "SPIRV/SPVRemapper.h" +#include "SPIRV/doc.h" +#include "glslang/Include/InfoSink.h" +#include "glslang/Include/ShHandle.h" +#include "glslang/MachineIndependent/localintermediate.h" +#include "glslang/Public/ShaderLang.h" namespace vk { @@ -45,8 +43,6 @@ namespace vk using std::string; using std::vector; -#if defined(DEQP_HAVE_GLSLANG) - namespace { @@ -361,23 +357,4 @@ void stripSpirVDebugInfo (const size_t numSrcInstrs, const deUint32* srcInstrs, remapper.remap(*dst, spv::spirvbin_base_t::STRIP); } -#else // defined(DEQP_HAVE_GLSLANG) - -bool compileGlslToSpirV (const GlslSource&, std::vector*, glu::ShaderProgramInfo*) -{ - TCU_THROW(NotSupportedError, "GLSL to SPIR-V compilation not supported (DEQP_HAVE_GLSLANG not defined)"); -} - -bool compileHlslToSpirV (const HlslSource&, std::vector*, glu::ShaderProgramInfo*) -{ - TCU_THROW(NotSupportedError, "HLSL to SPIR-V compilation not supported (DEQP_HAVE_GLSLANG not defined)"); -} - -void stripSpirVDebugInfo (const size_t, const deUint32*, std::vector*) -{ - TCU_THROW(NotSupportedError, "SPIR-V stripping not supported (DEQP_HAVE_GLSLANG not defined)"); -} - -#endif // defined(DEQP_HAVE_GLSLANG) - } // vk diff --git a/external/vulkancts/framework/vulkan/vkSpirVAsm.cpp b/external/vulkancts/framework/vulkan/vkSpirVAsm.cpp index 28b84bd..f2c9c58 100644 --- a/external/vulkancts/framework/vulkan/vkSpirVAsm.cpp +++ b/external/vulkancts/framework/vulkan/vkSpirVAsm.cpp @@ -27,9 +27,7 @@ #include -#if defined(DEQP_HAVE_SPIRV_TOOLS) -# include "spirv-tools/libspirv.h" -#endif +#include "spirv-tools/libspirv.h" namespace vk { @@ -37,8 +35,6 @@ namespace vk using std::string; using std::vector; -#if defined(DEQP_HAVE_SPIRV_TOOLS) - // Convert a Vulkan version number to a SPIRV-Tools target environment enum. static spv_target_env mapVulkanVersionToSpirvToolsEnv(deUint32 vulkanVersion) { @@ -223,23 +219,4 @@ bool validateSpirV (size_t binarySizeInWords, const deUint32* binary, std::ostre } } -#else // defined(DEQP_HAVE_SPIRV_TOOLS) - -bool assembleSpirV (const SpirVAsmSource*, std::vector*, SpirVProgramInfo*, SpirvVersion) -{ - TCU_THROW(NotSupportedError, "SPIR-V assembly not supported (DEQP_HAVE_SPIRV_TOOLS not defined)"); -} - -void disassembleSpirV (size_t, const deUint32*, std::ostream*, SpirvVersion) -{ - TCU_THROW(NotSupportedError, "SPIR-V disassembling not supported (DEQP_HAVE_SPIRV_TOOLS not defined)"); -} - -bool validateSpirV (size_t, const deUint32*, std::ostream*, const SpirvValidatorOptions&) -{ - TCU_THROW(NotSupportedError, "SPIR-V validation not supported (DEQP_HAVE_SPIRV_TOOLS not defined)"); -} - -#endif - } // vk -- 2.7.4