"spirv-tools"),
GitRepo(
"https://github.com/KhronosGroup/glslang.git",
- "d02dc5d05ad1f63db8d37fda9928a4d59e3c132d",
+ "b8d2a006d1688a8590b5ae2a8df1aba1e6fbed0b",
"glslang"),
]
#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"
TCU_THROW(InternalError, "Can't compile empty program");
}
+void stripSpirVDebugInfo (const size_t numSrcInstrs, const deUint32* srcInstrs, std::vector<deUint32>* dst)
+{
+ spv::spirvbin_t remapper;
+
+ // glslang operates in-place
+ dst->resize(numSrcInstrs);
+ std::copy(srcInstrs, srcInstrs+numSrcInstrs, dst->begin());
+ remapper.remap(*dst, spv::spirvbin_base_t::STRIP);
+}
+
#else // defined(DEQP_HAVE_GLSLANG)
bool compileGlslToSpirV (const glu::ProgramSources&, std::vector<deUint32>*, glu::ShaderProgramInfo*)
TCU_THROW(NotSupportedError, "GLSL to SPIR-V compilation not supported (DEQP_HAVE_GLSLANG not defined)");
}
+void stripSpirVDebugInfo (const size_t, const deUint32*, std::vector<deUint32>*)
+{
+ TCU_THROW(NotSupportedError, "SPIR-V stripping not supported (DEQP_HAVE_GLSLANG not defined)");
+}
+
#endif // defined(DEQP_HAVE_GLSLANG)
} // vk
*//*--------------------------------------------------------------------*/
bool compileGlslToSpirV (const glu::ProgramSources& src, std::vector<deUint32>* dst, glu::ShaderProgramInfo* buildInfo);
+/*--------------------------------------------------------------------*//*!
+ * \brief Strip SPIR-V binary
+ * \param src
+ * \param dst
+ *
+ * Removes OpName and OpMemberName opcodes from SPIR-V binary
+ *
+ * If deqp was built without glslang (and thus compiler is not available)
+ * tcu::NotSupportedError will be thrown instead.
+ *//*--------------------------------------------------------------------*/
+void stripSpirVDebugInfo (const size_t numSrcInstrs, const deUint32* srcInstrs, std::vector<deUint32>* dst);
+
} // vk
#endif // _VKGLSLTOSPIRV_HPP
{
vector<deUint32> binary;
- if (!compileGlslToSpirV(program, &binary, buildInfo))
- TCU_THROW(InternalError, "Compiling GLSL to SPIR-V failed");
+ {
+ vector<deUint32> nonStrippedBinary;
+
+ if (!compileGlslToSpirV(program, &nonStrippedBinary, buildInfo))
+ TCU_THROW(InternalError, "Compiling GLSL to SPIR-V failed");
+
+ TCU_CHECK_INTERNAL(!nonStrippedBinary.empty());
+ stripSpirVDebugInfo(nonStrippedBinary.size(), &nonStrippedBinary[0], &binary);
+ TCU_CHECK_INTERNAL(!binary.empty());
+ }
if (validateBinary)
{