Improve GLSL source program support

Old GLSL source program support in Vulkan framework was built on top
of glu::ProgramSources. This had two problems:

1) There was no obvious way to extend/annotate sources with SPIR-V
-specific information such as target SPIR-V version.

2) Most of glu::ProgramSources, such as attribute bindings or TF
configuration, was completely ignored.

This change introduces new vk::GlslSource type that replaces
glu::ProgramSources in vk::SourceCollections. vk::GlslSource contains
shader source strings as well as build options (vk::GlslBuildOptions).

vk::GlslBuildOptions doesn't currently contain anything useful but can
be later extended to support selecting target SPIR-V version for
example.

The change is mostly transparent to existing code, except:

 * vkSpirvProgram.hpp was somewhat unnecessarily including
tcuTestLog.hpp and changing that to a forward declaration required
fixing includes in several test code files.

  * vktShaderExecutor.cpp has been extended to allow specifying build
options.

Components: Vulkan

Change-Id: I69a6cd55ea91215585515b9d41860d818cbc97ae
diff --git a/AndroidGen.mk b/AndroidGen.mk
index ef0772e..d84fbf6 100644
--- a/AndroidGen.mk
+++ b/AndroidGen.mk
@@ -34,6 +34,7 @@
 	external/vulkancts/framework/vulkan/vkDebugReportUtil.cpp \
 	external/vulkancts/framework/vulkan/vkDefs.cpp \
 	external/vulkancts/framework/vulkan/vkDeviceUtil.cpp \
+	external/vulkancts/framework/vulkan/vkGlslProgram.cpp \
 	external/vulkancts/framework/vulkan/vkGlslToSpirV.cpp \
 	external/vulkancts/framework/vulkan/vkImageUtil.cpp \
 	external/vulkancts/framework/vulkan/vkImageWithMemory.cpp \
diff --git a/external/vulkancts/framework/vulkan/CMakeLists.txt b/external/vulkancts/framework/vulkan/CMakeLists.txt
index 94277bc..72b162a 100644
--- a/external/vulkancts/framework/vulkan/CMakeLists.txt
+++ b/external/vulkancts/framework/vulkan/CMakeLists.txt
@@ -49,6 +49,8 @@
 	vkBufferWithMemory.hpp
 	vkImageWithMemory.cpp
 	vkImageWithMemory.hpp
+	vkGlslProgram.cpp
+	vkGlslProgram.hpp
 	)
 
 set(VKUTIL_LIBS
diff --git a/external/vulkancts/framework/vulkan/vkBinaryRegistry.cpp b/external/vulkancts/framework/vulkan/vkBinaryRegistry.cpp
index 54a74e8..6ad9d60 100644
--- a/external/vulkancts/framework/vulkan/vkBinaryRegistry.cpp
+++ b/external/vulkancts/framework/vulkan/vkBinaryRegistry.cpp
@@ -30,6 +30,7 @@
 #include "deString.h"
 #include "deInt32.h"
 #include "deFile.h"
+#include "deMemory.h"
 
 #include <sstream>
 #include <fstream>
diff --git a/external/vulkancts/framework/vulkan/vkDefs.hpp b/external/vulkancts/framework/vulkan/vkDefs.hpp
index cb46b0e..20350a9 100644
--- a/external/vulkancts/framework/vulkan/vkDefs.hpp
+++ b/external/vulkancts/framework/vulkan/vkDefs.hpp
@@ -95,6 +95,13 @@
 
 #define VK_CORE_FORMAT_LAST		((vk::VkFormat)(vk::VK_FORMAT_ASTC_12x12_SRGB_BLOCK+1))
 
+enum SpirvVersion
+{
+	SPIRV_VERSION_1_0	= 0,	//!< SPIR-V 1.0
+
+	SPIRV_VERSION_LAST
+};
+
 namespace wsi
 {
 
diff --git a/external/vulkancts/framework/vulkan/vkGlslProgram.cpp b/external/vulkancts/framework/vulkan/vkGlslProgram.cpp
new file mode 100644
index 0000000..377f95b
--- /dev/null
+++ b/external/vulkancts/framework/vulkan/vkGlslProgram.cpp
@@ -0,0 +1,58 @@
+/*-------------------------------------------------------------------------
+ * Vulkan CTS Framework
+ * --------------------
+ *
+ * Copyright (c) 2017 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief GLSL source program.
+ *//*--------------------------------------------------------------------*/
+
+#include "vkGlslProgram.hpp"
+
+#include "tcuTestLog.hpp"
+
+namespace vk
+{
+
+tcu::TestLog& operator<< (tcu::TestLog& log, const GlslSource& glslSource)
+{
+	log << tcu::TestLog::ShaderProgram(false, "(Source only)");
+
+	try
+	{
+		for (int shaderType = 0; shaderType < glu::SHADERTYPE_LAST; shaderType++)
+		{
+			for (size_t shaderNdx = 0; shaderNdx < glslSource.sources[shaderType].size(); shaderNdx++)
+			{
+				log << tcu::TestLog::Shader(glu::getLogShaderType((glu::ShaderType)shaderType),
+											glslSource.sources[shaderType][shaderNdx],
+											false, "");
+			}
+		}
+	}
+	catch (...)
+	{
+		log << tcu::TestLog::EndShaderProgram;
+		throw;
+	}
+
+	log << tcu::TestLog::EndShaderProgram;
+
+	return log;
+}
+
+} // vk
diff --git a/external/vulkancts/framework/vulkan/vkGlslProgram.hpp b/external/vulkancts/framework/vulkan/vkGlslProgram.hpp
new file mode 100644
index 0000000..1afa5a3
--- /dev/null
+++ b/external/vulkancts/framework/vulkan/vkGlslProgram.hpp
@@ -0,0 +1,70 @@
+#ifndef _VKGLSLPROGRAM_HPP
+#define _VKGLSLPROGRAM_HPP
+/*-------------------------------------------------------------------------
+ * Vulkan CTS Framework
+ * --------------------
+ *
+ * Copyright (c) 2017 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief GLSL source program.
+ *//*--------------------------------------------------------------------*/
+
+#include "vkDefs.hpp"
+#include "gluShaderProgram.hpp"
+
+#include <string>
+
+namespace tcu
+{
+class TestLog;
+} // tcu
+
+namespace vk
+{
+
+struct GlslBuildOptions
+{
+	SpirvVersion	targetVersion;
+	deUint32		flags;
+
+	GlslBuildOptions (SpirvVersion targetVersion_, deUint32 flags_)
+		: targetVersion	(targetVersion_)
+		, flags			(flags_)
+	{}
+
+	GlslBuildOptions (void)
+		: targetVersion	(SPIRV_VERSION_1_0)
+		, flags			(0u)
+	{}
+};
+
+struct GlslSource
+{
+	std::vector<std::string>	sources[glu::SHADERTYPE_LAST];
+	GlslBuildOptions			buildOptions;
+
+								GlslSource (void) {}
+
+	GlslSource&					operator<<			(const glu::ShaderSource& shaderSource)	{ sources[shaderSource.shaderType].push_back(shaderSource.source);	return *this;	}
+	GlslSource&					operator<<			(const GlslBuildOptions& buildOptions_)	{ buildOptions = buildOptions_;										return *this;	}
+};
+
+tcu::TestLog&	operator<<		(tcu::TestLog& log, const GlslSource& glslSource);
+
+} // vk
+
+#endif // _VKGLSLPROGRAM_HPP
diff --git a/external/vulkancts/framework/vulkan/vkGlslToSpirV.cpp b/external/vulkancts/framework/vulkan/vkGlslToSpirV.cpp
index 4202ddd..a8f5502 100644
--- a/external/vulkancts/framework/vulkan/vkGlslToSpirV.cpp
+++ b/external/vulkancts/framework/vulkan/vkGlslToSpirV.cpp
@@ -191,9 +191,7 @@
 	builtin->maxSamples									= 4;
 };
 
-} // anonymous
-
-int getNumShaderStages (const glu::ProgramSources& program)
+int getNumShaderStages (const GlslSource& program)
 {
 	int numShaderStages = 0;
 
@@ -206,10 +204,23 @@
 	return numShaderStages;
 }
 
-bool compileGlslToSpirV (const glu::ProgramSources& program, std::vector<deUint32>* dst, glu::ShaderProgramInfo* buildInfo)
+std::string getShaderStageSource (const GlslSource& program, glu::ShaderType shaderType)
+{
+	if (program.sources[shaderType].size() != 1)
+		TCU_THROW(InternalError, "Linking multiple compilation units is not supported");
+
+	return program.sources[shaderType][0];
+}
+
+} // anonymous
+
+bool compileGlslToSpirV (const GlslSource& program, std::vector<deUint32>* dst, glu::ShaderProgramInfo* buildInfo)
 {
 	TBuiltInResource	builtinRes;
 
+	if (program.buildOptions.targetVersion != SPIRV_VERSION_1_0)
+		TCU_THROW(InternalError, "Unsupported SPIR-V target version");
+
 	if (getNumShaderStages(program) > 1)
 		TCU_THROW(InternalError, "Linking multiple shader stages into a single SPIR-V binary is not supported");
 
@@ -221,7 +232,7 @@
 	{
 		if (!program.sources[shaderType].empty())
 		{
-			const std::string&		srcText				= program.sources[shaderType][0];
+			const std::string&		srcText				= getShaderStageSource(program, (glu::ShaderType)shaderType);
 			const char*				srcPtrs[]			= { srcText.c_str() };
 			const int				srcLengths[]		= { (int)srcText.size() };
 			const EShLanguage		shaderStage			= getGlslangStage(glu::ShaderType(shaderType));
@@ -281,7 +292,7 @@
 
 #else // defined(DEQP_HAVE_GLSLANG)
 
-bool compileGlslToSpirV (const glu::ProgramSources&, std::vector<deUint32>*, glu::ShaderProgramInfo*)
+bool compileGlslToSpirV (const GlslSource&, std::vector<deUint32>*, glu::ShaderProgramInfo*)
 {
 	TCU_THROW(NotSupportedError, "GLSL to SPIR-V compilation not supported (DEQP_HAVE_GLSLANG not defined)");
 }
diff --git a/external/vulkancts/framework/vulkan/vkGlslToSpirV.hpp b/external/vulkancts/framework/vulkan/vkGlslToSpirV.hpp
index a32ace9..1d91712 100644
--- a/external/vulkancts/framework/vulkan/vkGlslToSpirV.hpp
+++ b/external/vulkancts/framework/vulkan/vkGlslToSpirV.hpp
@@ -45,7 +45,7 @@
  * \note No linking is currently supported so src may contain source
  *       for only one shader stage.
  *//*--------------------------------------------------------------------*/
-bool	compileGlslToSpirV		(const glu::ProgramSources& src, std::vector<deUint32>* dst, glu::ShaderProgramInfo* buildInfo);
+bool	compileGlslToSpirV		(const GlslSource& src, std::vector<deUint32>* dst, glu::ShaderProgramInfo* buildInfo);
 
 /*--------------------------------------------------------------------*//*!
  * \brief Strip SPIR-V binary
diff --git a/external/vulkancts/framework/vulkan/vkPrograms.cpp b/external/vulkancts/framework/vulkan/vkPrograms.cpp
index 007efff..8d398b1 100644
--- a/external/vulkancts/framework/vulkan/vkPrograms.cpp
+++ b/external/vulkancts/framework/vulkan/vkPrograms.cpp
@@ -26,8 +26,6 @@
 #include "vkSpirVAsm.hpp"
 #include "vkRefUtil.hpp"
 
-#include "tcuTestLog.hpp"
-
 #include "deArrayUtil.hpp"
 #include "deMemory.h"
 #include "deInt32.h"
@@ -37,7 +35,6 @@
 
 using std::string;
 using std::vector;
-using tcu::TestLog;
 
 #if defined(DE_DEBUG) && defined(DEQP_HAVE_SPIRV_TOOLS)
 #	define VALIDATE_BINARIES	true
@@ -102,42 +99,36 @@
 
 } // anonymous
 
-ProgramBinary* buildProgram (const glu::ProgramSources& program, ProgramFormat binaryFormat, glu::ShaderProgramInfo* buildInfo)
+ProgramBinary* buildProgram (const GlslSource& program, glu::ShaderProgramInfo* buildInfo)
 {
-	const bool	validateBinary	= VALIDATE_BINARIES;
+	const bool			validateBinary	= VALIDATE_BINARIES;
+	vector<deUint32>	binary;
 
-	if (binaryFormat == PROGRAM_FORMAT_SPIRV)
 	{
-		vector<deUint32> binary;
+		vector<deUint32> nonStrippedBinary;
 
-		{
-			vector<deUint32> nonStrippedBinary;
+		if (!compileGlslToSpirV(program, &nonStrippedBinary, buildInfo))
+			TCU_THROW(InternalError, "Compiling GLSL to SPIR-V failed");
 
-			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)
-		{
-			std::ostringstream validationLog;
-
-			if (!validateSpirV(binary.size(), &binary[0], &validationLog))
-			{
-				buildInfo->program.linkOk	 = false;
-				buildInfo->program.infoLog	+= "\n" + validationLog.str();
-
-				TCU_THROW(InternalError, "Validation failed for compiled SPIR-V binary");
-			}
-		}
-
-		return createProgramBinaryFromSpirV(binary);
+		TCU_CHECK_INTERNAL(!nonStrippedBinary.empty());
+		stripSpirVDebugInfo(nonStrippedBinary.size(), &nonStrippedBinary[0], &binary);
+		TCU_CHECK_INTERNAL(!binary.empty());
 	}
-	else
-		TCU_THROW(NotSupportedError, "Unsupported program format");
+
+	if (validateBinary)
+	{
+		std::ostringstream validationLog;
+
+		if (!validateSpirV(binary.size(), &binary[0], &validationLog))
+		{
+			buildInfo->program.linkOk	 = false;
+			buildInfo->program.infoLog	+= "\n" + validationLog.str();
+
+			TCU_THROW(InternalError, "Validation failed for compiled SPIR-V binary");
+		}
+	}
+
+	return createProgramBinaryFromSpirV(binary);
 }
 
 ProgramBinary* assembleProgram (const SpirVAsmSource& program, SpirVProgramInfo* buildInfo)
diff --git a/external/vulkancts/framework/vulkan/vkPrograms.hpp b/external/vulkancts/framework/vulkan/vkPrograms.hpp
index 4a2a52d..3e54428 100644
--- a/external/vulkancts/framework/vulkan/vkPrograms.hpp
+++ b/external/vulkancts/framework/vulkan/vkPrograms.hpp
@@ -26,18 +26,14 @@
 #include "vkDefs.hpp"
 #include "vkRef.hpp"
 #include "vkSpirVProgram.hpp"
-#include "gluShaderProgram.hpp"
+#include "vkGlslProgram.hpp"
+
 #include "deUniquePtr.hpp"
 #include "deSTLUtil.hpp"
 
 #include <vector>
 #include <map>
 
-namespace tcu
-{
-class TestLog;
-} // tcu
-
 namespace vk
 {
 
@@ -158,8 +154,8 @@
 	return *m_programs.find(name)->second;
 }
 
-typedef vk::ProgramCollection<glu::ProgramSources>	GlslSourceCollection;
-typedef vk::ProgramCollection<vk::SpirVAsmSource>	SpirVAsmCollection;
+typedef ProgramCollection<GlslSource>		GlslSourceCollection;
+typedef ProgramCollection<SpirVAsmSource>	SpirVAsmCollection;
 
 struct SourceCollections
 {
@@ -169,7 +165,7 @@
 
 typedef ProgramCollection<ProgramBinary>		BinaryCollection;
 
-ProgramBinary*			buildProgram		(const glu::ProgramSources& program, ProgramFormat binaryFormat, glu::ShaderProgramInfo* buildInfo);
+ProgramBinary*			buildProgram		(const GlslSource& program, glu::ShaderProgramInfo* buildInfo);
 ProgramBinary*			assembleProgram		(const vk::SpirVAsmSource& program, SpirVProgramInfo* buildInfo);
 void					disassembleProgram	(const ProgramBinary& program, std::ostream* dst);
 bool					validateProgram		(const ProgramBinary& program, std::ostream* dst);
diff --git a/external/vulkancts/framework/vulkan/vkSpirVProgram.hpp b/external/vulkancts/framework/vulkan/vkSpirVProgram.hpp
index 6370a63..5c5244a 100644
--- a/external/vulkancts/framework/vulkan/vkSpirVProgram.hpp
+++ b/external/vulkancts/framework/vulkan/vkSpirVProgram.hpp
@@ -24,11 +24,15 @@
  *//*--------------------------------------------------------------------*/
 
 #include "vkDefs.hpp"
-#include "tcuTestLog.hpp"
 #include "deStringUtil.hpp"
 
 #include <string>
 
+namespace tcu
+{
+class TestLog;
+} // tcu
+
 namespace vk
 {
 
diff --git a/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp
index 8b93c33..81db0e7 100644
--- a/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp
+++ b/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp
@@ -33,6 +33,7 @@
 #include "tcuVectorType.hpp"
 #include "tcuVectorUtil.hpp"
 #include "tcuTexLookupVerifier.hpp"
+#include "tcuTestLog.hpp"
 
 #include "vkImageUtil.hpp"
 #include "vkMemUtil.hpp"
diff --git a/external/vulkancts/modules/vulkan/api/vktApiGetMemoryCommitment.cpp b/external/vulkancts/modules/vulkan/api/vktApiGetMemoryCommitment.cpp
index a86b0f9..7dd59a9 100644
--- a/external/vulkancts/modules/vulkan/api/vktApiGetMemoryCommitment.cpp
+++ b/external/vulkancts/modules/vulkan/api/vktApiGetMemoryCommitment.cpp
@@ -33,6 +33,8 @@
 #include "vktTestCase.hpp"
 #include "vkTypeUtil.cpp"
 
+#include "tcuTestLog.hpp"
+
 using namespace vk;
 using tcu::TestLog;
 
diff --git a/external/vulkancts/modules/vulkan/clipping/vktClippingTests.cpp b/external/vulkancts/modules/vulkan/clipping/vktClippingTests.cpp
index 8bb6878..68b406a 100644
--- a/external/vulkancts/modules/vulkan/clipping/vktClippingTests.cpp
+++ b/external/vulkancts/modules/vulkan/clipping/vktClippingTests.cpp
@@ -29,6 +29,7 @@
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "tcuTestLog.hpp"
 #include "deUniquePtr.hpp"
 #include "deStringUtil.hpp"
 #include "deRandom.hpp"
diff --git a/external/vulkancts/modules/vulkan/draw/vktDrawNegativeViewportHeightTests.cpp b/external/vulkancts/modules/vulkan/draw/vktDrawNegativeViewportHeightTests.cpp
index efd98db..1d4db2c 100644
--- a/external/vulkancts/modules/vulkan/draw/vktDrawNegativeViewportHeightTests.cpp
+++ b/external/vulkancts/modules/vulkan/draw/vktDrawNegativeViewportHeightTests.cpp
@@ -35,6 +35,7 @@
 #include "tcuVector.hpp"
 #include "tcuTextureUtil.hpp"
 #include "tcuImageCompare.hpp"
+#include "tcuTestLog.hpp"
 
 #include "deSharedPtr.hpp"
 
diff --git a/external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsEarlyFragmentTests.cpp b/external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsEarlyFragmentTests.cpp
index f26209b..23246ad 100644
--- a/external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsEarlyFragmentTests.cpp
+++ b/external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsEarlyFragmentTests.cpp
@@ -38,6 +38,8 @@
 #include "vkQueryUtil.hpp"
 #include "vkImageUtil.hpp"
 
+#include "tcuTestLog.hpp"
+
 #include "deUniquePtr.hpp"
 #include "deStringUtil.hpp"
 
diff --git a/external/vulkancts/modules/vulkan/geometry/vktGeometryInstancedRenderingTests.cpp b/external/vulkancts/modules/vulkan/geometry/vktGeometryInstancedRenderingTests.cpp
index 4cd0c29..750040c 100644
--- a/external/vulkancts/modules/vulkan/geometry/vktGeometryInstancedRenderingTests.cpp
+++ b/external/vulkancts/modules/vulkan/geometry/vktGeometryInstancedRenderingTests.cpp
@@ -36,6 +36,7 @@
 
 #include "tcuTextureUtil.hpp"
 #include "tcuImageCompare.hpp"
+#include "tcuTestLog.hpp"
 
 #include "deRandom.hpp"
 #include "deMath.h"
diff --git a/external/vulkancts/modules/vulkan/geometry/vktGeometryLayeredRenderingTests.cpp b/external/vulkancts/modules/vulkan/geometry/vktGeometryLayeredRenderingTests.cpp
index b6790c4..35dc84f 100644
--- a/external/vulkancts/modules/vulkan/geometry/vktGeometryLayeredRenderingTests.cpp
+++ b/external/vulkancts/modules/vulkan/geometry/vktGeometryLayeredRenderingTests.cpp
@@ -40,6 +40,7 @@
 
 #include "tcuTextureUtil.hpp"
 #include "tcuVectorUtil.hpp"
+#include "tcuTestLog.hpp"
 
 namespace vkt
 {
diff --git a/external/vulkancts/modules/vulkan/geometry/vktGeometryTestsUtil.hpp b/external/vulkancts/modules/vulkan/geometry/vktGeometryTestsUtil.hpp
index 179cd50..853bb2a 100644
--- a/external/vulkancts/modules/vulkan/geometry/vktGeometryTestsUtil.hpp
+++ b/external/vulkancts/modules/vulkan/geometry/vktGeometryTestsUtil.hpp
@@ -33,6 +33,7 @@
 #include "vktTestCase.hpp"
 
 #include "tcuVector.hpp"
+#include "tcuTexture.hpp"
 
 #include "deStringUtil.hpp"
 #include "deUniquePtr.hpp"
diff --git a/external/vulkancts/modules/vulkan/image/vktImageMultisampleLoadStoreTests.cpp b/external/vulkancts/modules/vulkan/image/vktImageMultisampleLoadStoreTests.cpp
index 77b0334..df0b144 100644
--- a/external/vulkancts/modules/vulkan/image/vktImageMultisampleLoadStoreTests.cpp
+++ b/external/vulkancts/modules/vulkan/image/vktImageMultisampleLoadStoreTests.cpp
@@ -41,6 +41,7 @@
 #include "deUniquePtr.hpp"
 
 #include "tcuTextureUtil.hpp"
+#include "tcuTestLog.hpp"
 
 #include <string>
 #include <vector>
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp
index f9b9933..e02fca0 100644
--- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp
+++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp
@@ -32,6 +32,7 @@
 #include "vkRefUtil.hpp"
 #include "tcuTexLookupVerifier.hpp"
 #include "tcuTextureUtil.hpp"
+#include "tcuTestLog.hpp"
 #include "deSTLUtil.hpp"
 
 namespace vkt
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleBaseResolve.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleBaseResolve.cpp
index c1fb1cf..fb1f667 100644
--- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleBaseResolve.cpp
+++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleBaseResolve.cpp
@@ -25,6 +25,7 @@
 #include "vktPipelineMakeUtil.hpp"
 #include "vkBuilderUtil.hpp"
 #include "vkQueryUtil.hpp"
+#include "tcuTestLog.hpp"
 #include <vector>
 
 namespace vkt
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleBaseResolveAndPerSampleFetch.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleBaseResolveAndPerSampleFetch.cpp
index 8d8099b..809945a 100644
--- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleBaseResolveAndPerSampleFetch.cpp
+++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleBaseResolveAndPerSampleFetch.cpp
@@ -26,6 +26,7 @@
 #include "vktPipelineMakeUtil.hpp"
 #include "vkBuilderUtil.hpp"
 #include "vkQueryUtil.hpp"
+#include "tcuTestLog.hpp"
 #include <vector>
 
 namespace vkt
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleImageTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleImageTests.cpp
index 85dc81e..324b286 100644
--- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleImageTests.cpp
+++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleImageTests.cpp
@@ -37,6 +37,7 @@
 #include "vkImageUtil.hpp"
 
 #include "tcuTextureUtil.hpp"
+#include "tcuTestLog.hpp"
 
 #include "deUniquePtr.hpp"
 #include "deSharedPtr.hpp"
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleInterpolationTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleInterpolationTests.cpp
index 7a6174b..d10e0d6 100644
--- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleInterpolationTests.cpp
+++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleInterpolationTests.cpp
@@ -26,6 +26,7 @@
 #include "vktPipelineMultisampleTestsUtil.hpp"
 #include "vktPipelineMakeUtil.hpp"
 #include "vkQueryUtil.hpp"
+#include "tcuTestLog.hpp"
 #include <vector>
 
 namespace vkt
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleShaderBuiltInTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleShaderBuiltInTests.cpp
index 344cf9e..937c490 100644
--- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleShaderBuiltInTests.cpp
+++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleShaderBuiltInTests.cpp
@@ -27,6 +27,7 @@
 #include "vkBuilderUtil.hpp"
 #include "vkQueryUtil.hpp"
 #include "tcuVectorUtil.hpp"
+#include "tcuTestLog.hpp"
 
 namespace vkt
 {
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleTests.cpp
index e4a9042..7a0e980 100644
--- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleTests.cpp
+++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleTests.cpp
@@ -37,6 +37,7 @@
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
 #include "tcuImageCompare.hpp"
+#include "tcuTestLog.hpp"
 #include "deUniquePtr.hpp"
 #include "deSharedPtr.hpp"
 #include "deStringUtil.hpp"
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineRenderToImageTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineRenderToImageTests.cpp
index 63e2070..c9d6d84 100644
--- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineRenderToImageTests.cpp
+++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineRenderToImageTests.cpp
@@ -38,6 +38,7 @@
 
 #include "tcuTextureUtil.hpp"
 #include "tcuImageCompare.hpp"
+#include "tcuTestLog.hpp"
 
 #include "deUniquePtr.hpp"
 #include "deSharedPtr.hpp"
diff --git a/external/vulkancts/modules/vulkan/robustness/vktRobustnessVertexAccessTests.cpp b/external/vulkancts/modules/vulkan/robustness/vktRobustnessVertexAccessTests.cpp
index 7f21861..0f15ba1 100644
--- a/external/vulkancts/modules/vulkan/robustness/vktRobustnessVertexAccessTests.cpp
+++ b/external/vulkancts/modules/vulkan/robustness/vktRobustnessVertexAccessTests.cpp
@@ -33,6 +33,7 @@
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "tcuTestLog.hpp"
 #include "deMath.h"
 #include "deUniquePtr.hpp"
 #include <vector>
diff --git a/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.cpp b/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.cpp
index 5a4cbef..56b0659 100644
--- a/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.cpp
+++ b/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.cpp
@@ -1423,9 +1423,9 @@
 {
 	const FragmentOutputLayout	outputLayout	(computeFragmentOutputLayout(shaderSpec.outputs));
 
-	programCollection.glslSources.add("vert") << glu::VertexSource(generateVertexShader(shaderSpec, "a_", "vtx_out_"));
+	programCollection.glslSources.add("vert") << glu::VertexSource(generateVertexShader(shaderSpec, "a_", "vtx_out_")) << shaderSpec.buildOptions;
 	/* \todo [2015-09-11 hegedusd] set useIntOutputs parameter if needed. */
-	programCollection.glslSources.add("frag") << glu::FragmentSource(generatePassthroughFragmentShader(shaderSpec, false, outputLayout.locationMap, "vtx_out_", "o_"));
+	programCollection.glslSources.add("frag") << glu::FragmentSource(generatePassthroughFragmentShader(shaderSpec, false, outputLayout.locationMap, "vtx_out_", "o_")) << shaderSpec.buildOptions;
 }
 
 // GeometryShaderExecutor
@@ -1457,12 +1457,12 @@
 {
 	const FragmentOutputLayout	outputLayout	(computeFragmentOutputLayout(shaderSpec.outputs));
 
-	programCollection.glslSources.add("vert") << glu::VertexSource(generatePassthroughVertexShader(shaderSpec.inputs, "a_", "vtx_out_"));
+	programCollection.glslSources.add("vert") << glu::VertexSource(generatePassthroughVertexShader(shaderSpec.inputs, "a_", "vtx_out_")) << shaderSpec.buildOptions;
 
-	programCollection.glslSources.add("geom") << glu::GeometrySource(generateGeometryShader(shaderSpec, "vtx_out_", "geom_out_"));
+	programCollection.glslSources.add("geom") << glu::GeometrySource(generateGeometryShader(shaderSpec, "vtx_out_", "geom_out_")) << shaderSpec.buildOptions;
 
 	/* \todo [2015-09-18 rsipka] set useIntOutputs parameter if needed. */
-	programCollection.glslSources.add("frag") << glu::FragmentSource(generatePassthroughFragmentShader(shaderSpec, false, outputLayout.locationMap, "geom_out_", "o_"));
+	programCollection.glslSources.add("frag") << glu::FragmentSource(generatePassthroughFragmentShader(shaderSpec, false, outputLayout.locationMap, "geom_out_", "o_")) << shaderSpec.buildOptions;
 
 }
 
@@ -1491,9 +1491,9 @@
 {
 	const FragmentOutputLayout	outputLayout	(computeFragmentOutputLayout(shaderSpec.outputs));
 
-	programCollection.glslSources.add("vert") << glu::VertexSource(generatePassthroughVertexShader(shaderSpec.inputs, "a_", "vtx_out_"));
+	programCollection.glslSources.add("vert") << glu::VertexSource(generatePassthroughVertexShader(shaderSpec.inputs, "a_", "vtx_out_")) << shaderSpec.buildOptions;
 	/* \todo [2015-09-11 hegedusd] set useIntOutputs parameter if needed. */
-	programCollection.glslSources.add("frag") << glu::FragmentSource(generateFragmentShader(shaderSpec, false, outputLayout.locationMap, "vtx_out_", "o_"));
+	programCollection.glslSources.add("frag") << glu::FragmentSource(generateFragmentShader(shaderSpec, false, outputLayout.locationMap, "vtx_out_", "o_")) << shaderSpec.buildOptions;
 }
 
 // Shared utilities for compute and tess executors
@@ -1897,7 +1897,7 @@
 
 void ComputeShaderExecutor::generateSources (const ShaderSpec& shaderSpec, SourceCollections& programCollection)
 {
-	programCollection.glslSources.add("compute") << glu::ComputeSource(generateComputeShader(shaderSpec));
+	programCollection.glslSources.add("compute") << glu::ComputeSource(generateComputeShader(shaderSpec)) << shaderSpec.buildOptions;
 }
 
 void ComputeShaderExecutor::execute (int numValues, const void* const* inputs, void* const* outputs, VkDescriptorSet extraResources)
@@ -2715,10 +2715,10 @@
 
 void TessControlExecutor::generateSources (const ShaderSpec& shaderSpec, SourceCollections& programCollection)
 {
-	programCollection.glslSources.add("vert") << glu::VertexSource(generateVertexShaderForTess());
-	programCollection.glslSources.add("tess_control") << glu::TessellationControlSource(generateTessControlShader(shaderSpec));
-	programCollection.glslSources.add("tess_eval") << glu::TessellationEvaluationSource(generateEmptyTessEvalShader());
-	programCollection.glslSources.add("frag") << glu::FragmentSource(generateEmptyFragmentSource());
+	programCollection.glslSources.add("vert") << glu::VertexSource(generateVertexShaderForTess()) << shaderSpec.buildOptions;
+	programCollection.glslSources.add("tess_control") << glu::TessellationControlSource(generateTessControlShader(shaderSpec)) << shaderSpec.buildOptions;
+	programCollection.glslSources.add("tess_eval") << glu::TessellationEvaluationSource(generateEmptyTessEvalShader()) << shaderSpec.buildOptions;
+	programCollection.glslSources.add("frag") << glu::FragmentSource(generateEmptyFragmentSource()) << shaderSpec.buildOptions;
 }
 
 void TessControlExecutor::execute (int numValues, const void* const* inputs, void* const* outputs, VkDescriptorSet extraResources)
@@ -2812,10 +2812,10 @@
 
 void TessEvaluationExecutor::generateSources (const ShaderSpec& shaderSpec, SourceCollections& programCollection)
 {
-	programCollection.glslSources.add("vert") << glu::VertexSource(generateVertexShaderForTess());
-	programCollection.glslSources.add("tess_control") << glu::TessellationControlSource(generatePassthroughTessControlShader());
-	programCollection.glslSources.add("tess_eval") << glu::TessellationEvaluationSource(generateTessEvalShader(shaderSpec));
-	programCollection.glslSources.add("frag") << glu::FragmentSource(generateEmptyFragmentSource());
+	programCollection.glslSources.add("vert") << glu::VertexSource(generateVertexShaderForTess()) << shaderSpec.buildOptions;
+	programCollection.glslSources.add("tess_control") << glu::TessellationControlSource(generatePassthroughTessControlShader()) << shaderSpec.buildOptions;
+	programCollection.glslSources.add("tess_eval") << glu::TessellationEvaluationSource(generateTessEvalShader(shaderSpec)) << shaderSpec.buildOptions;
+	programCollection.glslSources.add("frag") << glu::FragmentSource(generateEmptyFragmentSource()) << shaderSpec.buildOptions;
 }
 
 void TessEvaluationExecutor::execute (int numValues, const void* const* inputs, void* const* outputs, VkDescriptorSet extraResources)
diff --git a/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.hpp b/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.hpp
index 126bb44..454513b 100644
--- a/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.hpp
+++ b/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.hpp
@@ -27,6 +27,7 @@
 #include "tcuDefs.hpp"
 #include "vktTestCase.hpp"
 #include "gluVarType.hpp"
+#include "vkGlslProgram.hpp"
 
 #include <vector>
 #include <string>
@@ -53,6 +54,7 @@
 	std::vector<Symbol>		outputs;
 	std::string				globalDeclarations;	//!< These are placed into global scope. Can contain uniform declarations for example.
 	std::string				source;				//!< Source snippet to be executed.
+	vk::GlslBuildOptions	buildOptions;
 
 	ShaderSpec (void) {}
 };
diff --git a/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderBuiltinVarTests.cpp b/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderBuiltinVarTests.cpp
index de84add..ab887b2 100644
--- a/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderBuiltinVarTests.cpp
+++ b/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderBuiltinVarTests.cpp
@@ -33,6 +33,7 @@
 #include "tcuImageCompare.hpp"
 #include "tcuStringTemplate.hpp"
 #include "tcuTextureUtil.hpp"
+#include "tcuTestLog.hpp"
 #include "vktDrawUtil.hpp"
 #include "vkImageUtil.hpp"
 #include "vkTypeUtil.hpp"
diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferTests.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferTests.cpp
index 67a055d..22a0381 100644
--- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferTests.cpp
+++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferTests.cpp
@@ -39,6 +39,8 @@
 #include "vkQueryUtil.hpp"
 #include "vkTypeUtil.hpp"
 
+#include "tcuTestLog.hpp"
+
 #include "deUniquePtr.hpp"
 #include "deSharedPtr.hpp"
 #include "deMath.h"
diff --git a/external/vulkancts/modules/vulkan/ssbo/vktSSBOLayoutTests.cpp b/external/vulkancts/modules/vulkan/ssbo/vktSSBOLayoutTests.cpp
index 2735342..61f12e9 100644
--- a/external/vulkancts/modules/vulkan/ssbo/vktSSBOLayoutTests.cpp
+++ b/external/vulkancts/modules/vulkan/ssbo/vktSSBOLayoutTests.cpp
@@ -28,6 +28,7 @@
 
 #include "deUniquePtr.hpp"
 #include "tcuCommandLine.hpp"
+#include "tcuTestLog.hpp"
 #include "deRandom.hpp"
 #include "deStringUtil.hpp"
 #include "deString.h"
diff --git a/external/vulkancts/modules/vulkan/vktBuildPrograms.cpp b/external/vulkancts/modules/vulkan/vktBuildPrograms.cpp
index 9d3bf35..4eda4a6 100644
--- a/external/vulkancts/modules/vulkan/vktBuildPrograms.cpp
+++ b/external/vulkancts/modules/vulkan/vktBuildPrograms.cpp
@@ -240,7 +240,7 @@
 {
 public:
 
-	BuildGlslTask (const glu::ProgramSources& source, Program* program)
+	BuildGlslTask (const vk::GlslSource& source, Program* program)
 		: m_source	(source)
 		, m_program	(program)
 	{}
@@ -253,7 +253,7 @@
 
 		try
 		{
-			m_program->binary		= ProgramBinarySp(vk::buildProgram(m_source, vk::PROGRAM_FORMAT_SPIRV, &buildInfo));
+			m_program->binary		= ProgramBinarySp(vk::buildProgram(m_source, &buildInfo));
 			m_program->buildStatus	= Program::STATUS_PASSED;
 		}
 		catch (const tcu::Exception&)
@@ -269,8 +269,8 @@
 	}
 
 private:
-	glu::ProgramSources	m_source;
-	Program*			m_program;
+	vk::GlslSource	m_source;
+	Program*		m_program;
 };
 
 void writeBuildLogs (const vk::SpirVProgramInfo& buildInfo, std::ostream& dst)
diff --git a/external/vulkancts/modules/vulkan/vktDrawUtil.cpp b/external/vulkancts/modules/vulkan/vktDrawUtil.cpp
index 31546c7..aea9b9e 100644
--- a/external/vulkancts/modules/vulkan/vktDrawUtil.cpp
+++ b/external/vulkancts/modules/vulkan/vktDrawUtil.cpp
@@ -31,6 +31,7 @@
 #include "rrRenderState.hpp"
 #include "rrPrimitiveTypes.hpp"
 #include "tcuTextureUtil.hpp"
+#include "tcuTestLog.hpp"
 #include "deArrayUtil.hpp"
 #include "vkBuilderUtil.hpp"
 
diff --git a/external/vulkancts/modules/vulkan/vktShaderLibrary.cpp b/external/vulkancts/modules/vulkan/vktShaderLibrary.cpp
index 15ca3b1..15d4830 100644
--- a/external/vulkancts/modules/vulkan/vktShaderLibrary.cpp
+++ b/external/vulkancts/modules/vulkan/vktShaderLibrary.cpp
@@ -1757,7 +1757,7 @@
 		{
 			if (!specializedSources[progNdx].sources[shaderType].empty())
 			{
-				glu::ProgramSources& curSrc	= sourceCollection.glslSources.add(getShaderName((glu::ShaderType)shaderType, progNdx));
+				vk::GlslSource& curSrc	= sourceCollection.glslSources.add(getShaderName((glu::ShaderType)shaderType, progNdx));
 				curSrc.sources[shaderType] = specializedSources[progNdx].sources[shaderType];
 			}
 		}
diff --git a/external/vulkancts/modules/vulkan/vktTestPackage.cpp b/external/vulkancts/modules/vulkan/vktTestPackage.cpp
index a55cc06..4614abe 100644
--- a/external/vulkancts/modules/vulkan/vktTestPackage.cpp
+++ b/external/vulkancts/modules/vulkan/vktTestPackage.cpp
@@ -84,9 +84,9 @@
 namespace // compilation
 {
 
-vk::ProgramBinary* compileProgram (const glu::ProgramSources& source, glu::ShaderProgramInfo* buildInfo)
+vk::ProgramBinary* compileProgram (const vk::GlslSource& source, glu::ShaderProgramInfo* buildInfo)
 {
-	return vk::buildProgram(source, vk::PROGRAM_FORMAT_SPIRV, buildInfo);
+	return vk::buildProgram(source, buildInfo);
 }
 
 vk::ProgramBinary* compileProgram (const vk::SpirVAsmSource& source, vk::SpirVProgramInfo* buildInfo)
diff --git a/external/vulkancts/modules/vulkan/wsi/vktWsiDisplayTimingTests.cpp b/external/vulkancts/modules/vulkan/wsi/vktWsiDisplayTimingTests.cpp
index 7cc45e4..8c2c405 100644
--- a/external/vulkancts/modules/vulkan/wsi/vktWsiDisplayTimingTests.cpp
+++ b/external/vulkancts/modules/vulkan/wsi/vktWsiDisplayTimingTests.cpp
@@ -38,6 +38,7 @@
 
 #include "tcuPlatform.hpp"
 #include "tcuResultCollector.hpp"
+#include "tcuTestLog.hpp"
 #include "deClock.h"
 
 #include <vector>
diff --git a/external/vulkancts/modules/vulkan/wsi/vktWsiIncrementalPresentTests.cpp b/external/vulkancts/modules/vulkan/wsi/vktWsiIncrementalPresentTests.cpp
index 2df4f3f..2079577 100644
--- a/external/vulkancts/modules/vulkan/wsi/vktWsiIncrementalPresentTests.cpp
+++ b/external/vulkancts/modules/vulkan/wsi/vktWsiIncrementalPresentTests.cpp
@@ -38,6 +38,7 @@
 
 #include "tcuPlatform.hpp"
 #include "tcuResultCollector.hpp"
+#include "tcuTestLog.hpp"
 
 #include <vector>
 #include <string>