am 08719f3b: am c80353d7: am ca5d0d73: Enable clang compilation for mips.

* commit '08719f3bc61c19183e7d92dfd10c4084eb7ec44a':
  Enable clang compilation for mips.
diff --git a/Android.mk b/Android.mk
index f436453..bafe558 100644
--- a/Android.mk
+++ b/Android.mk
@@ -246,6 +246,7 @@
 	framework/referencerenderer/rrVertexPacket.cpp \
 	modules/egl/teglAndroidUtil.cpp \
 	modules/egl/teglApiCase.cpp \
+	modules/egl/teglBufferAgeTests.cpp \
 	modules/egl/teglChooseConfigReference.cpp \
 	modules/egl/teglChooseConfigTests.cpp \
 	modules/egl/teglClientExtensionTests.cpp \
@@ -271,7 +272,9 @@
 	modules/egl/teglNativeColorMappingTests.cpp \
 	modules/egl/teglNativeCoordMappingTests.cpp \
 	modules/egl/teglNegativeApiTests.cpp \
+	modules/egl/teglNegativePartialUpdateTests.cpp \
 	modules/egl/teglPreservingSwapTests.cpp \
+	modules/egl/teglPartialUpdateTests.cpp \
 	modules/egl/teglQueryConfigTests.cpp \
 	modules/egl/teglQueryContextTests.cpp \
 	modules/egl/teglQuerySurfaceTests.cpp \
@@ -281,6 +284,7 @@
 	modules/egl/teglSimpleConfigCase.cpp \
 	modules/egl/teglSurfacelessContextTests.cpp \
 	modules/egl/teglSwapBuffersTests.cpp \
+	modules/egl/teglSwapBuffersWithDamageTests.cpp \
 	modules/egl/teglSyncTests.cpp \
 	modules/egl/teglTestCase.cpp \
 	modules/egl/teglTestPackage.cpp \
@@ -713,7 +717,9 @@
 	-DDEQP_TARGET_NAME=\"android\" \
 	-DDEQP_GLES3_RUNTIME_LOAD=1 \
 	-DDEQP_GLES2_RUNTIME_LOAD=1 \
-	-DQP_SUPPORT_PNG=1
+	-DQP_SUPPORT_PNG=1 \
+	-Wconversion \
+	-Wno-sign-conversion
 
 LOCAL_SHARED_LIBRARIES := \
 		libEGL \
diff --git a/android/cts/master/com.drawelements.deqp.gles3.xml b/android/cts/master/com.drawelements.deqp.gles3.xml
index cb4584c..c7ef7ec 100644
--- a/android/cts/master/com.drawelements.deqp.gles3.xml
+++ b/android/cts/master/com.drawelements.deqp.gles3.xml
@@ -62178,9 +62178,6 @@
 							<Test name="54">
 								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
 							</Test>
-							<Test name="56">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
 							<Test name="57">
 								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
 							</Test>
diff --git a/android/cts/master/com.drawelements.deqp.gles31.xml b/android/cts/master/com.drawelements.deqp.gles31.xml
index 6a6772c..6a788a2 100644
--- a/android/cts/master/com.drawelements.deqp.gles31.xml
+++ b/android/cts/master/com.drawelements.deqp.gles31.xml
@@ -12750,573 +12750,218 @@
 					<TestCase name="value">
 						<Test name="triangles">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_lines">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_4_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_4_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_lines_4_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_4_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_4_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_8_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_8_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_lines_8_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_8_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_8_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_max_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_max_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_lines_max_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_max_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_max_samples">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 					</TestCase>
 					<TestCase name="derivate">
 						<Test name="triangles_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_lines_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_lines_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_lines_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_4_samples_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_4_samples_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_4_samples_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_4_samples_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_4_samples_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_4_samples_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_4_samples_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_4_samples_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_4_samples_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_4_samples_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_4_samples_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_4_samples_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_8_samples_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_8_samples_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_8_samples_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_8_samples_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_8_samples_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_8_samples_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_8_samples_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_8_samples_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_8_samples_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_8_samples_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_8_samples_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_8_samples_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_max_samples_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_max_samples_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="triangles_max_samples_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_max_samples_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_max_samples_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="lines_max_samples_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_max_samples_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_max_samples_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="points_max_samples_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_max_samples_dfdx">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_max_samples_dfdy">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 						<Test name="wide_points_max_samples_fwidth">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="0" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="90" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="180" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="270" surfacetype="window"/>
-							<TestInstance glconfig="rgba8888d24s8ms4" rotation="unspecified" surfacetype="window"/>
 						</Test>
 					</TestCase>
 				</TestSuite>
diff --git a/android/cts/master/gles3-master.txt b/android/cts/master/gles3-master.txt
index 8423f6e..6e7797b 100644
--- a/android/cts/master/gles3-master.txt
+++ b/android/cts/master/gles3-master.txt
@@ -19613,7 +19613,6 @@
 dEQP-GLES3.functional.shaders.random.all_features.fragment.51
 dEQP-GLES3.functional.shaders.random.all_features.fragment.52
 dEQP-GLES3.functional.shaders.random.all_features.fragment.54
-dEQP-GLES3.functional.shaders.random.all_features.fragment.56
 dEQP-GLES3.functional.shaders.random.all_features.fragment.57
 dEQP-GLES3.functional.shaders.random.all_features.fragment.58
 dEQP-GLES3.functional.shaders.random.all_features.fragment.59
diff --git a/android/cts/master/gles31-multisample.txt b/android/cts/master/gles31-multisample.txt
index ed5f795..44d4428 100644
--- a/android/cts/master/gles31-multisample.txt
+++ b/android/cts/master/gles31-multisample.txt
@@ -29,77 +29,6 @@
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.sample_qualifier.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.array_element.default_framebuffer
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines
-dEQP-GLES31.functional.shaders.helper_invocation.value.points
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_fwidth
 dEQP-GLES31.functional.draw_indirect.compute_interop.large.drawelements_separate_grid_100x100_drawcount_1
 dEQP-GLES31.functional.draw_indirect.compute_interop.large.drawelements_separate_grid_200x200_drawcount_1
 dEQP-GLES31.functional.draw_indirect.compute_interop.large.drawelements_separate_grid_500x500_drawcount_1
diff --git a/android/cts/master/gles31-rotate-landscape.txt b/android/cts/master/gles31-rotate-landscape.txt
index 9ba1215..c98268f 100644
--- a/android/cts/master/gles31-rotate-landscape.txt
+++ b/android/cts/master/gles31-rotate-landscape.txt
@@ -29,77 +29,6 @@
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.sample_qualifier.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.array_element.default_framebuffer
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines
-dEQP-GLES31.functional.shaders.helper_invocation.value.points
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_fwidth
 dEQP-GLES31.functional.primitive_bounding_box.triangles.global_state.vertex_fragment.default_framebuffer_bbox_equal
 dEQP-GLES31.functional.primitive_bounding_box.triangles.global_state.vertex_fragment.default_framebuffer_bbox_larger
 dEQP-GLES31.functional.primitive_bounding_box.triangles.global_state.vertex_fragment.default_framebuffer_bbox_smaller
diff --git a/android/cts/master/gles31-rotate-portrait.txt b/android/cts/master/gles31-rotate-portrait.txt
index 9ba1215..c98268f 100644
--- a/android/cts/master/gles31-rotate-portrait.txt
+++ b/android/cts/master/gles31-rotate-portrait.txt
@@ -29,77 +29,6 @@
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.sample_qualifier.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.array_element.default_framebuffer
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines
-dEQP-GLES31.functional.shaders.helper_invocation.value.points
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_fwidth
 dEQP-GLES31.functional.primitive_bounding_box.triangles.global_state.vertex_fragment.default_framebuffer_bbox_equal
 dEQP-GLES31.functional.primitive_bounding_box.triangles.global_state.vertex_fragment.default_framebuffer_bbox_larger
 dEQP-GLES31.functional.primitive_bounding_box.triangles.global_state.vertex_fragment.default_framebuffer_bbox_smaller
diff --git a/android/cts/master/gles31-rotate-reverse-landscape.txt b/android/cts/master/gles31-rotate-reverse-landscape.txt
index 9ba1215..c98268f 100644
--- a/android/cts/master/gles31-rotate-reverse-landscape.txt
+++ b/android/cts/master/gles31-rotate-reverse-landscape.txt
@@ -29,77 +29,6 @@
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.sample_qualifier.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.array_element.default_framebuffer
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines
-dEQP-GLES31.functional.shaders.helper_invocation.value.points
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_fwidth
 dEQP-GLES31.functional.primitive_bounding_box.triangles.global_state.vertex_fragment.default_framebuffer_bbox_equal
 dEQP-GLES31.functional.primitive_bounding_box.triangles.global_state.vertex_fragment.default_framebuffer_bbox_larger
 dEQP-GLES31.functional.primitive_bounding_box.triangles.global_state.vertex_fragment.default_framebuffer_bbox_smaller
diff --git a/android/cts/master/gles31-rotate-reverse-portrait.txt b/android/cts/master/gles31-rotate-reverse-portrait.txt
index 9ba1215..c98268f 100644
--- a/android/cts/master/gles31-rotate-reverse-portrait.txt
+++ b/android/cts/master/gles31-rotate-reverse-portrait.txt
@@ -29,77 +29,6 @@
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.sample_qualifier.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.array_element.default_framebuffer
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines
-dEQP-GLES31.functional.shaders.helper_invocation.value.points
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_4_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_8_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_lines_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.points_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_max_samples
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_4_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_8_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.lines_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_points_max_samples_fwidth
 dEQP-GLES31.functional.primitive_bounding_box.triangles.global_state.vertex_fragment.default_framebuffer_bbox_equal
 dEQP-GLES31.functional.primitive_bounding_box.triangles.global_state.vertex_fragment.default_framebuffer_bbox_larger
 dEQP-GLES31.functional.primitive_bounding_box.triangles.global_state.vertex_fragment.default_framebuffer_bbox_smaller
diff --git a/android/cts/master/src/egl-new-tests.txt b/android/cts/master/src/egl-new-tests.txt
new file mode 100644
index 0000000..e3c1538
--- /dev/null
+++ b/android/cts/master/src/egl-new-tests.txt
@@ -0,0 +1,5 @@
+# Feature Request 20761474
+dEQP-EGL.functional.buffer_age.*
+dEQP-EGL.functional.partial_update.*
+dEQP-EGL.functional.negative_partial_update.*
+dEQP-EGL.functional.swap_buffers_with_damage.*
diff --git a/android/cts/master/src/gles2-failures.txt b/android/cts/master/src/gles2-failures.txt
index d25bd84..581d81b 100644
--- a/android/cts/master/src/gles2-failures.txt
+++ b/android/cts/master/src/gles2-failures.txt
@@ -2603,9 +2603,7 @@
 dEQP-GLES2.functional.texture.size.cube.15x15_rgba4444
 dEQP-GLES2.functional.texture.size.cube.15x15_rgba8888
 dEQP-GLES2.functional.texture.size.cube.16x16_l8_mipmap
-dEQP-GLES2.functional.texture.size.cube.256x256_rgba4444
 dEQP-GLES2.functional.texture.size.cube.256x256_rgba4444_mipmap
-dEQP-GLES2.functional.texture.size.cube.512x512_rgba4444
 dEQP-GLES2.functional.texture.size.cube.512x512_rgba4444_mipmap
 dEQP-GLES2.functional.texture.specification.teximage2d_align.cube_l8_63_1
 dEQP-GLES2.functional.texture.specification.teximage2d_align.cube_l8_63_2
diff --git a/android/cts/master/src/gles2-test-issues.txt b/android/cts/master/src/gles2-test-issues.txt
index 64c31d8..7553b1a 100644
--- a/android/cts/master/src/gles2-test-issues.txt
+++ b/android/cts/master/src/gles2-test-issues.txt
@@ -1,3 +1,6 @@
+# Bug 21526557
+dEQP-GLES2.functional.texture.size.cube.256x256_rgba4444
+dEQP-GLES2.functional.texture.size.cube.512x512_rgba4444
 # Bug 22665757
 dEQP-GLES2.functional.fbo.completeness.renderable.renderbuffer.color0.rgb16f
 dEQP-GLES2.functional.fbo.completeness.renderable.texture.color0.rgb16f
diff --git a/android/cts/master/src/gles3-test-issues.txt b/android/cts/master/src/gles3-test-issues.txt
index a7333c0..eb533b5 100644
--- a/android/cts/master/src/gles3-test-issues.txt
+++ b/android/cts/master/src/gles3-test-issues.txt
@@ -41,6 +41,9 @@
 # Bug 18323060
 dEQP-GLES3.functional.shaders.random.all_features.fragment.16
 
+# Bug 21851700
+dEQP-GLES3.functional.shaders.random.all_features.fragment.56
+
 # Bug 18093986
 dEQP-GLES3.functional.shaders.texture_functions.texturelodoffset.usampler3d_vertex
 
diff --git a/android/cts/master/src/gles31-multisample.txt b/android/cts/master/src/gles31-multisample.txt
index a50b6ac..ebfde24 100644
--- a/android/cts/master/src/gles31-multisample.txt
+++ b/android/cts/master/src/gles31-multisample.txt
@@ -3,7 +3,6 @@
 dEQP-GLES31.info.*
 dEQP-GLES31.functional.shaders.sample_variables.*.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.*.default_framebuffer
-dEQP-GLES31.functional.shaders.helper_invocation.*
 dEQP-GLES31.functional.image_load_store.early_fragment_tests.no_early_fragment_tests_depth
 dEQP-GLES31.functional.image_load_store.early_fragment_tests.no_early_fragment_tests_stencil
 dEQP-GLES31.functional.image_load_store.early_fragment_tests.early_fragment_tests_depth
diff --git a/android/cts/master/src/gles31-new-tests.txt b/android/cts/master/src/gles31-new-tests.txt
new file mode 100644
index 0000000..85003ca
--- /dev/null
+++ b/android/cts/master/src/gles31-new-tests.txt
@@ -0,0 +1,5 @@
+# Feature Request 21737242
+dEQP-GLES31.functional.tessellation.user_defined_io.negative.per_vertex_incorrect_control_explicit_output_array_size_1
+dEQP-GLES31.functional.tessellation.user_defined_io.negative.per_vertex_incorrect_control_explicit_output_array_size_2
+dEQP-GLES31.functional.tessellation.user_defined_io.negative.per_vertex_incorrect_control_explicit_output_array_size_3
+dEQP-GLES31.functional.tessellation.user_defined_io.negative.per_vertex_incorrect_eval_explicit_input_array_size
diff --git a/android/cts/master/src/gles31-rotation.txt b/android/cts/master/src/gles31-rotation.txt
index 044bc2d..4874f72 100644
--- a/android/cts/master/src/gles31-rotation.txt
+++ b/android/cts/master/src/gles31-rotation.txt
@@ -3,7 +3,6 @@
 dEQP-GLES31.info.*
 dEQP-GLES31.functional.shaders.sample_variables.*.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.*.default_framebuffer
-dEQP-GLES31.functional.shaders.helper_invocation.*
 dEQP-GLES31.functional.primitive_bounding_box.*.default_framebuffer_*
 dEQP-GLES31.functional.primitive_bounding_box.blit_fbo.*default*
 dEQP-GLES31.functional.primitive_bounding_box.clear.*
diff --git a/android/scripts/common.py b/android/scripts/common.py
index 241cecf..f9d36b5 100644
--- a/android/scripts/common.py
+++ b/android/scripts/common.py
@@ -121,7 +121,7 @@
 
 	process = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 	stdoutJob = threading.Thread(target=readApplyPrefixAndPrint, args=(process.stdout, linePrefix, sys.stdout))
-	stderrJob = threading.Thread(target=readApplyPrefixAndPrint, args=(process.stdout, linePrefix, sys.stderr))
+	stderrJob = threading.Thread(target=readApplyPrefixAndPrint, args=(process.stderr, linePrefix, sys.stderr))
 	stdoutJob.start()
 	stderrJob.start()
 	retcode = process.wait()
@@ -241,8 +241,8 @@
 
 def selectNDKPath ():
 	candidates =  [
-		os.path.expanduser("~/android-ndk-r10c"),
-		"C:/android/android-ndk-r10c",
+		os.path.expanduser("~/android-ndk-r10e"),
+		"C:/android/android-ndk-r10e",
 		os.environ.get("ANDROID_NDK_PATH", None), # If not defined, return None
 	]
 
@@ -262,7 +262,7 @@
 # NDK paths
 ANDROID_NDK_PATH				= selectNDKPath()
 ANDROID_NDK_HOST_OS				= getNDKHostOsName(ANDROID_NDK_PATH)
-ANDROID_NDK_TOOLCHAIN_VERSION	= "r10c" # Toolchain file is selected based on this
+ANDROID_NDK_TOOLCHAIN_VERSION	= "r10e" # Toolchain file is selected based on this
 
 # Native code build settings
 CMAKE_GENERATOR			= selectByOS({
diff --git a/data/gles31/shaders/tessellation_negative_user_defined_io.test b/data/gles31/shaders/tessellation_negative_user_defined_io.test
index 36bd5e7..32ae315 100644
--- a/data/gles31/shaders/tessellation_negative_user_defined_io.test
+++ b/data/gles31/shaders/tessellation_negative_user_defined_io.test
@@ -114,3 +114,187 @@
 		}
 	""
 end
+
+case per_vertex_incorrect_control_explicit_output_array_size_1
+	version 310 es
+	desc "Incorrectly sized tessellation control output array"
+	expect compile_or_link_fail
+	require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
+	vertex ""
+		#version 310 es
+		${VERTEX_DECLARATIONS}
+		void main()
+		{
+			${VERTEX_OUTPUT}
+		}
+	""
+	tessellation_control ""
+		#version 310 es
+		${TESSELLATION_CONTROL_DECLARATIONS}
+		out highp float varyingArray[3]; // size is not equal to gl_MaxPatchVertices
+		void main()
+		{
+			varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID];
+			${TESSELLATION_CONTROL_OUTPUT}
+		}
+	""
+	tessellation_evaluation ""
+		#version 310 es
+		${TESSELLATION_EVALUATION_DECLARATIONS}
+		in highp float varyingArray[gl_MaxPatchVertices]; // size is correct
+		out mediump float te_out;
+		void main()
+		{
+			te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2];
+			${TESSELLATION_EVALUATION_OUTPUT}
+		}
+	""
+	fragment ""
+		#version 310 es
+		precision mediump float;
+		${FRAGMENT_DECLARATIONS}
+		in mediump float te_out;
+		void main()
+		{
+			${FRAG_COLOR} = vec4(te_out);
+		}
+	""
+end
+
+case per_vertex_incorrect_control_explicit_output_array_size_2
+	version 310 es
+	desc "Incorrectly sized tessellation control output array"
+	expect compile_or_link_fail
+	require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
+	vertex ""
+		#version 310 es
+		${VERTEX_DECLARATIONS}
+		void main()
+		{
+			${VERTEX_OUTPUT}
+		}
+	""
+	tessellation_control ""
+		#version 310 es
+		${TESSELLATION_CONTROL_DECLARATIONS}
+		out highp float varyingArray[gl_MaxPatchVertices]; // size does not match layout declaration
+		void main()
+		{
+			varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID];
+			${TESSELLATION_CONTROL_OUTPUT}
+		}
+	""
+	tessellation_evaluation ""
+		#version 310 es
+		${TESSELLATION_EVALUATION_DECLARATIONS}
+		in highp float varyingArray[gl_MaxPatchVertices]; // size is correct
+		out mediump float te_out;
+		void main()
+		{
+			te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2];
+			${TESSELLATION_EVALUATION_OUTPUT}
+		}
+	""
+	fragment ""
+		#version 310 es
+		precision mediump float;
+		${FRAGMENT_DECLARATIONS}
+		in mediump float te_out;
+		void main()
+		{
+			${FRAG_COLOR} = vec4(te_out);
+		}
+	""
+end
+
+case per_vertex_incorrect_control_explicit_output_array_size_3
+	version 310 es
+	desc "Incorrectly sized tessellation control output array"
+	expect compile_or_link_fail
+	require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
+	vertex ""
+		#version 310 es
+		${VERTEX_DECLARATIONS}
+		void main()
+		{
+			${VERTEX_OUTPUT}
+		}
+	""
+	tessellation_control ""
+		#version 310 es
+		${TESSELLATION_CONTROL_DECLARATIONS}
+		out highp float varyingArray[${GL_MAX_PATCH_VERTICES}]; // size does not match layout declaration
+		void main()
+		{
+			varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID];
+			${TESSELLATION_CONTROL_OUTPUT}
+		}
+	""
+	tessellation_evaluation ""
+		#version 310 es
+		${TESSELLATION_EVALUATION_DECLARATIONS}
+		in highp float varyingArray[gl_MaxPatchVertices]; // size is correct
+		out mediump float te_out;
+		void main()
+		{
+			te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2];
+			${TESSELLATION_EVALUATION_OUTPUT}
+		}
+	""
+	fragment ""
+		#version 310 es
+		precision mediump float;
+		${FRAGMENT_DECLARATIONS}
+		in mediump float te_out;
+		void main()
+		{
+			${FRAG_COLOR} = vec4(te_out);
+		}
+	""
+end
+
+case per_vertex_incorrect_eval_explicit_input_array_size
+	version 310 es
+	desc "Incorrectly sized tessellation control output array"
+	expect compile_or_link_fail
+	require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
+	vertex ""
+		#version 310 es
+		${VERTEX_DECLARATIONS}
+		void main()
+		{
+			${VERTEX_OUTPUT}
+		}
+	""
+	tessellation_control ""
+		#version 310 es
+		${TESSELLATION_CONTROL_DECLARATIONS}
+		out highp float varyingArray[];
+		void main()
+		{
+			varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID];
+			${TESSELLATION_CONTROL_OUTPUT}
+		}
+	""
+	tessellation_evaluation ""
+		#version 310 es
+		${TESSELLATION_EVALUATION_DECLARATIONS}
+		in highp float varyingArray[3]; // size is not equal to gl_MaxPatchVertices
+		out mediump float te_out;
+		void main()
+		{
+			te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2];
+			${TESSELLATION_EVALUATION_OUTPUT}
+		}
+	""
+	fragment ""
+		#version 310 es
+		precision mediump float;
+		${FRAGMENT_DECLARATIONS}
+		in mediump float te_out;
+		void main()
+		{
+			${FRAG_COLOR} = vec4(te_out);
+		}
+	""
+end
diff --git a/doc/testlog-stylesheet/testlog.xsl b/doc/testlog-stylesheet/testlog.xsl
index b691945..e2225a3 100644
--- a/doc/testlog-stylesheet/testlog.xsl
+++ b/doc/testlog-stylesheet/testlog.xsl
@@ -1,4 +1,24 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+-->
 <xsl:stylesheet
 	version="1.0"
 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
diff --git a/execserver/tools/xsClient.cpp b/execserver/tools/xsClient.cpp
index eb71fe6..e680fc9 100644
--- a/execserver/tools/xsClient.cpp
+++ b/execserver/tools/xsClient.cpp
@@ -67,11 +67,11 @@
 	message.write(buf);
 
 	// Write to socket.
-	int pos = 0;
-	while (pos < (int)buf.size())
+	size_t pos = 0;
+	while (pos < buf.size())
 	{
-		int				numLeft		= (int)buf.size() - pos;
-		int				numSent		= 0;
+		size_t			numLeft		= buf.size() - pos;
+		size_t			numSent		= 0;
 		deSocketResult	result		= socket.send(&buf[pos], numLeft, &numSent);
 
 		if (result != DE_SOCKETRESULT_SUCCESS)
@@ -81,14 +81,14 @@
 	}
 }
 
-void readBytes (de::Socket& socket, vector<deUint8>& dst, int numBytes)
+void readBytes (de::Socket& socket, vector<deUint8>& dst, size_t numBytes)
 {
-	int numRead = 0;
+	size_t numRead = 0;
 	dst.resize(numBytes);
 	while (numRead < numBytes)
 	{
-		int				numLeft		= numBytes - numRead;
-		int				curNumRead	= 0;
+		size_t			numLeft		= numBytes - numRead;
+		size_t			curNumRead	= 0;
 		deSocketResult	result		= socket.receive(&dst[numRead], numLeft, &curNumRead);
 
 		if (result != DE_SOCKETRESULT_SUCCESS)
@@ -105,7 +105,7 @@
 	readBytes(socket, header, MESSAGE_HEADER_SIZE);
 
 	MessageType	type;
-	int			messageSize;
+	size_t		messageSize;
 	Message::parseHeader(&header[0], (int)header.size(), type, messageSize);
 
 	// Simple messages without any data.
diff --git a/execserver/tools/xsTest.cpp b/execserver/tools/xsTest.cpp
index 38b6120..5e47377 100644
--- a/execserver/tools/xsTest.cpp
+++ b/execserver/tools/xsTest.cpp
@@ -73,11 +73,11 @@
 	message.write(buf);
 
 	// Write to socket.
-	int pos = 0;
-	while (pos < (int)buf.size())
+	size_t pos = 0;
+	while (pos < buf.size())
 	{
-		int				numLeft		= (int)buf.size() - pos;
-		int				numSent		= 0;
+		size_t			numLeft		= buf.size() - pos;
+		size_t			numSent		= 0;
 		deSocketResult	result		= socket.send(&buf[pos], numLeft, &numSent);
 
 		if (result != DE_SOCKETRESULT_SUCCESS)
@@ -87,14 +87,14 @@
 	}
 }
 
-void readBytes (de::Socket& socket, vector<deUint8>& dst, int numBytes)
+void readBytes (de::Socket& socket, vector<deUint8>& dst, size_t numBytes)
 {
-	int numRead = 0;
+	size_t numRead = 0;
 	dst.resize(numBytes);
 	while (numRead < numBytes)
 	{
-		int				numLeft		= numBytes - numRead;
-		int				curNumRead	= 0;
+		size_t			numLeft		= numBytes - numRead;
+		size_t			curNumRead	= 0;
 		deSocketResult	result		= socket.receive(&dst[numRead], numLeft, &curNumRead);
 
 		if (result != DE_SOCKETRESULT_SUCCESS)
@@ -111,7 +111,7 @@
 	readBytes(socket, header, MESSAGE_HEADER_SIZE);
 
 	MessageType	type;
-	int			messageSize;
+	size_t		messageSize;
 	Message::parseHeader(&header[0], (int)header.size(), type, messageSize);
 
 	// Simple messages without any data.
diff --git a/execserver/xsExecutionServer.cpp b/execserver/xsExecutionServer.cpp
index 5a8a592..d99c805 100644
--- a/execserver/xsExecutionServer.cpp
+++ b/execserver/xsExecutionServer.cpp
@@ -43,7 +43,7 @@
 	if (m_buffer.size() < MESSAGE_HEADER_SIZE)
 		return false;
 	else
-		return (int)m_buffer.size() == getMessageSize();
+		return m_buffer.size() == getMessageSize();
 }
 
 const deUint8* MessageBuilder::getMessageData (void) const
@@ -51,10 +51,10 @@
 	return m_buffer.size() > MESSAGE_HEADER_SIZE ? &m_buffer[MESSAGE_HEADER_SIZE] : DE_NULL;
 }
 
-int MessageBuilder::getMessageDataSize (void) const
+size_t MessageBuilder::getMessageDataSize (void) const
 {
 	DE_ASSERT(isComplete());
-	return (int)m_buffer.size() - MESSAGE_HEADER_SIZE;
+	return m_buffer.size() - MESSAGE_HEADER_SIZE;
 }
 
 void MessageBuilder::read (ByteBuffer& src)
@@ -78,15 +78,15 @@
 	if (m_buffer.size() >= MESSAGE_HEADER_SIZE)
 	{
 		// We have header.
-		int msgSize			= getMessageSize();
-		int numBytesLeft	= msgSize - (int)m_buffer.size();
-		int	numToRead		= de::min(src.getNumElements(), numBytesLeft);
+		size_t msgSize			= getMessageSize();
+		size_t numBytesLeft		= msgSize - m_buffer.size();
+		size_t numToRead		= (size_t)de::min(src.getNumElements(), (int)numBytesLeft);
 
 		if (numToRead > 0)
 		{
 			int curBufPos = (int)m_buffer.size();
 			m_buffer.resize(curBufPos+numToRead);
-			src.popBack(&m_buffer[curBufPos], numToRead);
+			src.popBack(&m_buffer[curBufPos], (int)numToRead);
 		}
 	}
 }
@@ -257,7 +257,7 @@
 	}
 }
 
-void ExecutionRequestHandler::processMessage (MessageType type, const deUint8* data, int dataSize)
+void ExecutionRequestHandler::processMessage (MessageType type, const deUint8* data, size_t dataSize)
 {
 	switch (type)
 	{
@@ -341,17 +341,17 @@
 
 bool ExecutionRequestHandler::receive (void)
 {
-	int maxLen = de::min<int>((int)m_sendRecvTmpBuf.size(), m_bufferIn.getNumFree());
+	size_t maxLen = de::min(m_sendRecvTmpBuf.size(), (size_t)m_bufferIn.getNumFree());
 
 	if (maxLen > 0)
 	{
-		int				numRecv;
+		size_t			numRecv;
 		deSocketResult	result	= m_socket->receive(&m_sendRecvTmpBuf[0], maxLen, &numRecv);
 
 		if (result == DE_SOCKETRESULT_SUCCESS)
 		{
 			DE_ASSERT(numRecv > 0);
-			m_bufferIn.pushFront(&m_sendRecvTmpBuf[0], numRecv);
+			m_bufferIn.pushFront(&m_sendRecvTmpBuf[0], (int)numRecv);
 			return true;
 		}
 		else if (result == DE_SOCKETRESULT_CONNECTION_CLOSED)
@@ -372,19 +372,19 @@
 
 bool ExecutionRequestHandler::send (void)
 {
-	int maxLen = de::min<int>((int)m_sendRecvTmpBuf.size(), m_bufferOut.getNumElements());
+	size_t maxLen = de::min(m_sendRecvTmpBuf.size(), (size_t)m_bufferOut.getNumElements());
 
 	if (maxLen > 0)
 	{
-		m_bufferOut.peekBack(&m_sendRecvTmpBuf[0], maxLen);
+		m_bufferOut.peekBack(&m_sendRecvTmpBuf[0], (int)maxLen);
 
-		int				numSent;
+		size_t			numSent;
 		deSocketResult	result	= m_socket->send(&m_sendRecvTmpBuf[0], maxLen, &numSent);
 
 		if (result == DE_SOCKETRESULT_SUCCESS)
 		{
 			DE_ASSERT(numSent > 0);
-			m_bufferOut.popBack(numSent);
+			m_bufferOut.popBack((int)numSent);
 			return true;
 		}
 		else if (result == DE_SOCKETRESULT_CONNECTION_CLOSED)
diff --git a/execserver/xsExecutionServer.hpp b/execserver/xsExecutionServer.hpp
index c9ad1ae..8e5cd8e 100644
--- a/execserver/xsExecutionServer.hpp
+++ b/execserver/xsExecutionServer.hpp
@@ -72,14 +72,14 @@
 
 	bool					isComplete			(void) const;
 	MessageType				getMessageType		(void) const	{ return m_messageType;	}
-	int						getMessageSize		(void) const	{ return m_messageSize; }
+	size_t					getMessageSize		(void) const	{ return m_messageSize; }
 	const deUint8*			getMessageData		(void) const;
-	int						getMessageDataSize	(void) const;
+	size_t					getMessageDataSize	(void) const;
 
 private:
 	std::vector<deUint8>	m_buffer;
 	MessageType				m_messageType;
-	int						m_messageSize;
+	size_t					m_messageSize;
 };
 
 class ExecutionRequestHandler : public ConnectionHandler
@@ -96,7 +96,7 @@
 	ExecutionRequestHandler&	operator=						(const ExecutionRequestHandler& handler);
 
 	void						processSession					(void);
-	void						processMessage					(MessageType type, const deUint8* data, int dataSize);
+	void						processMessage					(MessageType type, const deUint8* data, size_t dataSize);
 
 	inline TestDriver*			getTestDriver					(void) { if (!m_testDriver) acquireTestDriver(); return m_testDriver; }
 	void						acquireTestDriver				(void);
diff --git a/execserver/xsProtocol.cpp b/execserver/xsProtocol.cpp
index e2471fa..53a1a35 100644
--- a/execserver/xsProtocol.cpp
+++ b/execserver/xsProtocol.cpp
@@ -47,7 +47,7 @@
 class MessageParser
 {
 public:
-	MessageParser (const deUint8* data, int dataSize)
+	MessageParser (const deUint8* data, size_t dataSize)
 		: m_data	(data)
 		, m_size	(dataSize)
 		, m_pos		(0)
@@ -57,7 +57,7 @@
 	template <typename T>
 	T get (void)
 	{
-		XS_CHECK_MSG(m_pos + (int)sizeof(T) <= m_size, "Invalid payload size");
+		XS_CHECK_MSG(m_pos + sizeof(T) <= m_size, "Invalid payload size");
 		T netValue;
 		deMemcpy(&netValue, &m_data[m_pos], sizeof(T));
 		m_pos += sizeof(T);
@@ -84,8 +84,8 @@
 
 private:
 	const deUint8*	m_data;
-	int				m_size;
-	int				m_pos;
+	size_t			m_size;
+	size_t			m_pos;
 };
 
 class MessageWriter
@@ -138,18 +138,18 @@
 	deMemcpy(&m_buf[curPos], &value[0], strLen+1);
 }
 
-void Message::parseHeader (const deUint8* data, int dataSize, MessageType& type, int& size)
+void Message::parseHeader (const deUint8* data, size_t dataSize, MessageType& type, size_t& size)
 {
 	XS_CHECK_MSG(dataSize >= MESSAGE_HEADER_SIZE, "Incomplete header");
 	MessageParser parser(data, dataSize);
-	size	= (MessageType)parser.get<int>();
+	size	= (size_t)(MessageType)parser.get<int>();
 	type	= (MessageType)parser.get<int>();
 }
 
-void Message::writeHeader (MessageType type, int messageSize, deUint8* dst, int bufSize)
+void Message::writeHeader (MessageType type, size_t messageSize, deUint8* dst, size_t bufSize)
 {
 	XS_CHECK_MSG(bufSize >= MESSAGE_HEADER_SIZE, "Incomplete header");
-	int netSize = hostToNetwork(messageSize);
+	int netSize = hostToNetwork((int)messageSize);
 	int netType = hostToNetwork((int)type);
 	deMemcpy(dst+0, &netSize, sizeof(netSize));
 	deMemcpy(dst+4, &netType, sizeof(netType));
@@ -160,7 +160,7 @@
 	MessageWriter writer(type, buf);
 }
 
-HelloMessage::HelloMessage (const deUint8* data, int dataSize)
+HelloMessage::HelloMessage (const deUint8* data, size_t dataSize)
 	: Message(MESSAGETYPE_HELLO)
 {
 	MessageParser parser(data, dataSize);
@@ -174,7 +174,7 @@
 	writer.put(version);
 }
 
-TestMessage::TestMessage (const deUint8* data, int dataSize)
+TestMessage::TestMessage (const deUint8* data, size_t dataSize)
 	: Message(MESSAGETYPE_TEST)
 {
 	MessageParser parser(data, dataSize);
@@ -188,7 +188,7 @@
 	writer.put(test.c_str());
 }
 
-ExecuteBinaryMessage::ExecuteBinaryMessage (const deUint8* data, int dataSize)
+ExecuteBinaryMessage::ExecuteBinaryMessage (const deUint8* data, size_t dataSize)
 	: Message(MESSAGETYPE_EXECUTE_BINARY)
 {
 	MessageParser parser(data, dataSize);
@@ -208,7 +208,7 @@
 	writer.put(caseList.c_str());
 }
 
-ProcessLogDataMessage::ProcessLogDataMessage (const deUint8* data, int dataSize)
+ProcessLogDataMessage::ProcessLogDataMessage (const deUint8* data, size_t dataSize)
 	: Message(MESSAGETYPE_PROCESS_LOG_DATA)
 {
 	MessageParser parser(data, dataSize);
@@ -222,7 +222,7 @@
 	writer.put(logData.c_str());
 }
 
-ProcessLaunchFailedMessage::ProcessLaunchFailedMessage (const deUint8* data, int dataSize)
+ProcessLaunchFailedMessage::ProcessLaunchFailedMessage (const deUint8* data, size_t dataSize)
 	: Message(MESSAGETYPE_PROCESS_LAUNCH_FAILED)
 {
 	MessageParser parser(data, dataSize);
@@ -236,7 +236,7 @@
 	writer.put(reason.c_str());
 }
 
-ProcessFinishedMessage::ProcessFinishedMessage (const deUint8* data, int dataSize)
+ProcessFinishedMessage::ProcessFinishedMessage (const deUint8* data, size_t dataSize)
 	: Message(MESSAGETYPE_PROCESS_FINISHED)
 {
 	MessageParser parser(data, dataSize);
@@ -250,7 +250,7 @@
 	writer.put(exitCode);
 }
 
-InfoMessage::InfoMessage (const deUint8* data, int dataSize)
+InfoMessage::InfoMessage (const deUint8* data, size_t dataSize)
 	: Message(MESSAGETYPE_INFO)
 {
 	MessageParser parser(data, dataSize);
diff --git a/execserver/xsProtocol.hpp b/execserver/xsProtocol.hpp
index 369ee92..e8ce3d2 100644
--- a/execserver/xsProtocol.hpp
+++ b/execserver/xsProtocol.hpp
@@ -74,8 +74,8 @@
 
 	virtual void	write			(std::vector<deUint8>& buf) const = DE_NULL;
 
-	static void		parseHeader		(const deUint8* data, int dataSize, MessageType& type, int& messageSize);
-	static void		writeHeader		(MessageType type, int messageSize, deUint8* dst, int bufSize);
+	static void		parseHeader		(const deUint8* data, size_t dataSize, MessageType& type, size_t& messageSize);
+	static void		writeHeader		(MessageType type, size_t messageSize, deUint8* dst, size_t bufSize);
 
 protected:
 	void			writeNoData		(std::vector<deUint8>& buf) const;
@@ -89,7 +89,7 @@
 class SimpleMessage : public Message
 {
 public:
-					SimpleMessage	(const deUint8* data, int dataSize) : Message((MessageType)MsgType) { DE_UNREF(data); XS_CHECK_MSG(dataSize == 0, "No payload expected"); }
+					SimpleMessage	(const deUint8* data, size_t dataSize) : Message((MessageType)MsgType) { DE_UNREF(data); XS_CHECK_MSG(dataSize == 0, "No payload expected"); }
 					SimpleMessage	(void) : Message((MessageType)MsgType) {}
 					~SimpleMessage	(void) {}
 
@@ -105,7 +105,7 @@
 public:
 	int				version;
 
-					HelloMessage	(const deUint8* data, int dataSize);
+					HelloMessage	(const deUint8* data, size_t dataSize);
 					HelloMessage	(void) : Message(MESSAGETYPE_HELLO), version(PROTOCOL_VERSION) {}
 					~HelloMessage	(void) {}
 
@@ -120,7 +120,7 @@
 	std::string		workDir;
 	std::string		caseList;
 
-					ExecuteBinaryMessage	(const deUint8* data, int dataSize);
+					ExecuteBinaryMessage	(const deUint8* data, size_t dataSize);
 					ExecuteBinaryMessage	(void) : Message(MESSAGETYPE_EXECUTE_BINARY) {}
 					~ExecuteBinaryMessage	(void) {};
 
@@ -132,7 +132,7 @@
 public:
 	std::string		logData;
 
-					ProcessLogDataMessage		(const deUint8* data, int dataSize);
+					ProcessLogDataMessage		(const deUint8* data, size_t dataSize);
 					~ProcessLogDataMessage		(void) {}
 
 	void			write						(std::vector<deUint8>& buf) const;
@@ -143,7 +143,7 @@
 public:
 	std::string		reason;
 
-					ProcessLaunchFailedMessage			(const deUint8* data, int dataSize);
+					ProcessLaunchFailedMessage			(const deUint8* data, size_t dataSize);
 					ProcessLaunchFailedMessage			(const char* reason_) : Message(MESSAGETYPE_PROCESS_LAUNCH_FAILED), reason(reason_) {}
 					~ProcessLaunchFailedMessage			(void) {}
 
@@ -155,7 +155,7 @@
 public:
 	int				exitCode;
 
-					ProcessFinishedMessage			(const deUint8* data, int dataSize);
+					ProcessFinishedMessage			(const deUint8* data, size_t dataSize);
 					ProcessFinishedMessage			(int exitCode_) : Message(MESSAGETYPE_PROCESS_FINISHED), exitCode(exitCode_) {}
 					~ProcessFinishedMessage			(void) {}
 
@@ -167,7 +167,7 @@
 public:
 	std::string		info;
 
-					InfoMessage			(const deUint8* data, int dataSize);
+					InfoMessage			(const deUint8* data, size_t dataSize);
 					~InfoMessage		(void) {}
 
 	void			write				(std::vector<deUint8>& buf) const;
@@ -179,7 +179,7 @@
 public:
 	std::string		test;
 
-					TestMessage		(const deUint8* data, int dataSize);
+					TestMessage		(const deUint8* data, size_t dataSize);
 					~TestMessage	(void) {}
 
 	void			write			(std::vector<deUint8>& buf) const;
diff --git a/executor/tools/xeCommandLineExecutor.cpp b/executor/tools/xeCommandLineExecutor.cpp
index 730dfc3..cc7788b 100644
--- a/executor/tools/xeCommandLineExecutor.cpp
+++ b/executor/tools/xeCommandLineExecutor.cpp
@@ -22,49 +22,62 @@
  *//*--------------------------------------------------------------------*/
 
 #include "xeBatchExecutor.hpp"
-#include "xeTestCaseListParser.hpp"
-#include "xeTcpIpLink.hpp"
 #include "xeLocalTcpIpLink.hpp"
-#include "xeTestResultParser.hpp"
+#include "xeTcpIpLink.hpp"
+#include "xeTestCaseListParser.hpp"
 #include "xeTestLogWriter.hpp"
-#include "deDirectoryIterator.hpp"
+#include "xeTestResultParser.hpp"
+
 #include "deCommandLine.hpp"
+#include "deDirectoryIterator.hpp"
+#include "deStringUtil.hpp"
+
 #include "deString.h"
 
-#include <vector>
-#include <string>
+#include <algorithm>
 #include <cstdio>
 #include <cstdlib>
 #include <fstream>
-#include <memory>
-#include <algorithm>
 #include <iostream>
+#include <memory>
 #include <sstream>
+#include <string>
+#include <vector>
+
+#if (DE_OS == DE_OS_UNIX) || (DE_OS == DE_OS_ANDROID) || (DE_OS == DE_OS_WIN32)
+#	include <signal.h>
+#endif
+
+using std::vector;
+using std::string;
+
+namespace
+{
 
 // Command line arguments.
 namespace opt
 {
 
-DE_DECLARE_COMMAND_LINE_OPT(StartServer,	std::string);
-DE_DECLARE_COMMAND_LINE_OPT(Host,			std::string);
+DE_DECLARE_COMMAND_LINE_OPT(StartServer,	string);
+DE_DECLARE_COMMAND_LINE_OPT(Host,			string);
 DE_DECLARE_COMMAND_LINE_OPT(Port,			int);
-DE_DECLARE_COMMAND_LINE_OPT(CaseListDir,	std::string);
-DE_DECLARE_COMMAND_LINE_OPT(TestSet,		std::vector<std::string>);
-DE_DECLARE_COMMAND_LINE_OPT(ExcludeSet,		std::vector<std::string>);
-DE_DECLARE_COMMAND_LINE_OPT(ContinueFile,	std::string);
-DE_DECLARE_COMMAND_LINE_OPT(TestLogFile,	std::string);
-DE_DECLARE_COMMAND_LINE_OPT(InfoLogFile,	std::string);
+DE_DECLARE_COMMAND_LINE_OPT(CaseListDir,	string);
+DE_DECLARE_COMMAND_LINE_OPT(TestSet,		vector<string>);
+DE_DECLARE_COMMAND_LINE_OPT(ExcludeSet,		vector<string>);
+DE_DECLARE_COMMAND_LINE_OPT(ContinueFile,	string);
+DE_DECLARE_COMMAND_LINE_OPT(TestLogFile,	string);
+DE_DECLARE_COMMAND_LINE_OPT(InfoLogFile,	string);
 DE_DECLARE_COMMAND_LINE_OPT(Summary,		bool);
 
 // TargetConfiguration
-DE_DECLARE_COMMAND_LINE_OPT(BinaryName,		std::string);
-DE_DECLARE_COMMAND_LINE_OPT(WorkingDir,		std::string);
-DE_DECLARE_COMMAND_LINE_OPT(CmdLineArgs,	std::string);
+DE_DECLARE_COMMAND_LINE_OPT(BinaryName,		string);
+DE_DECLARE_COMMAND_LINE_OPT(WorkingDir,		string);
+DE_DECLARE_COMMAND_LINE_OPT(CmdLineArgs,	string);
 
-static void parseCommaSeparatedList (const char* src, std::vector<std::string>* dst)
+void parseCommaSeparatedList (const char* src, vector<string>* dst)
 {
 	std::istringstream	inStr	(src);
-	std::string			comp;
+	string			comp;
 
 	while (std::getline(inStr, comp, ','))
 		dst->push_back(comp);
@@ -81,25 +94,28 @@
 		{ "no",		false	}
 	};
 
-	parser << Option<StartServer>	("s",		"start-server",	"Start local execserver",								"")
-		   << Option<Host>			("c",		"connect",		"Connect to host",										"127.0.0.1")
-		   << Option<Port>			("p",		"port",			"Select TCP port to use",								"50016")
-		   << Option<CaseListDir>	("cd",		"caselistdir",	"Path to test case XML files",							".")
-		   << Option<TestSet>		("t",		"testset",		"Test set",												parseCommaSeparatedList,	"")
-		   << Option<ExcludeSet>	("e",		"exclude",		"Comma-separated list of exclude filters",				parseCommaSeparatedList,	"")
-		   << Option<ContinueFile>	(DE_NULL,	"continue",		"Continue execution by initializing results from existing test log", "")
-		   << Option<TestLogFile>	("o",		"out",			"Output test log filename",								"")
-		   << Option<InfoLogFile>	("i",		"info",			"Output info log filename",								"")
-		   << Option<Summary>		(DE_NULL,	"summary",		"Print summary at the end",								s_yesNo,	"yes")
-		   << Option<BinaryName>	("b",		"binaryname",	"Test binary path, relative to working directory",		"")
-		   << Option<WorkingDir>	("wd",		"workdir",		"Working directory for test execution",					"")
-		   << Option<CmdLineArgs>	(DE_NULL,	"cmdline",		"Additional command line arguments for test binary",	"");
+	parser << Option<StartServer>	("s",		"start-server",	"Start local execserver. Path to the execserver binary.")
+		   << Option<Host>			("c",		"connect",		"Connect to host. Address of the execserver.")
+		   << Option<Port>			("p",		"port",			"TCP port of the execserver.",											"50016")
+		   << Option<CaseListDir>	("cd",		"caselistdir",	"Path to the directory containing test case XML files.",				".")
+		   << Option<TestSet>		("t",		"testset",		"Comma-separated list of include filters.",								parseCommaSeparatedList)
+		   << Option<ExcludeSet>	("e",		"exclude",		"Comma-separated list of exclude filters.",								parseCommaSeparatedList, "")
+		   << Option<ContinueFile>	(DE_NULL,	"continue",		"Continue execution by initializing results from existing test log.")
+		   << Option<TestLogFile>	("o",		"out",			"Output test log filename.",											"TestLog.qpa")
+		   << Option<InfoLogFile>	("i",		"info",			"Output info log filename.",											"InfoLog.txt")
+		   << Option<Summary>		(DE_NULL,	"summary",		"Print summary after running tests.",									s_yesNo, "yes")
+		   << Option<BinaryName>	("b",		"binaryname",	"Test binary path. Relative to working directory.",						"<Unused>")
+		   << Option<WorkingDir>	("wd",		"workdir",		"Working directory for the test execution.",							".")
+		   << Option<CmdLineArgs>	(DE_NULL,	"cmdline",		"Additional command line arguments for the test binary.",				"");
 }
 
 } // opt
 
-using std::vector;
-using std::string;
+enum RunMode
+{
+	RUNMODE_CONNECT,
+	RUNMODE_START_SERVER
+};
 
 struct CommandLine
 {
@@ -109,20 +125,20 @@
 	{
 	}
 
-	xe::TargetConfiguration		targetCfg;
-	std::string					serverBin;
-	std::string					host;
-	int							port;
-	std::string					caseListDir;
-	std::vector<std::string>	testset;
-	std::vector<std::string>	exclude;
-	std::string					inFile;
-	std::string					outFile;
-	std::string					infoFile;
-	bool						summary;
+	xe::TargetConfiguration	targetCfg;
+	RunMode					runMode;
+	string					serverBinOrAddress;
+	int						port;
+	string					caseListDir;
+	vector<string>			testset;
+	vector<string>			exclude;
+	string					inFile;
+	string					outFile;
+	string					infoFile;
+	bool					summary;
 };
 
-static bool parseCommandLine (CommandLine& cmdLine, int argc, const char* const* argv)
+bool parseCommandLine (CommandLine& cmdLine, int argc, const char* const* argv)
 {
 	de::cmdline::Parser			parser;
 	de::cmdline::CommandLine	opts;
@@ -138,13 +154,49 @@
 		return false;
 	}
 
-	cmdLine.serverBin				= opts.getOption<opt::StartServer>();
-	cmdLine.host					= opts.getOption<opt::Host>();
+	if (opts.hasOption<opt::StartServer>() && opts.hasOption<opt::Host>())
+	{
+		std::cout << "Invalid command line arguments. Both --start-server and --connect defined." << std::endl;
+		return false;
+	}
+	else if (!opts.hasOption<opt::StartServer>() && !opts.hasOption<opt::Host>())
+	{
+		std::cout << "Invalid command line arguments. Must define either --start-server or --connect." << std::endl;
+		return false;
+	}
+
+	if (!opts.hasOption<opt::TestSet>())
+	{
+		std::cout << "Invalid command line arguments. --testset not defined." << std::endl;
+		return false;
+	}
+
+	if (opts.hasOption<opt::StartServer>())
+	{
+		cmdLine.runMode				= RUNMODE_START_SERVER;
+		cmdLine.serverBinOrAddress	= opts.getOption<opt::StartServer>();
+	}
+	else
+	{
+		cmdLine.runMode				= RUNMODE_CONNECT;
+		cmdLine.serverBinOrAddress	= opts.getOption<opt::Host>();
+	}
+
+	if (opts.hasOption<opt::ContinueFile>())
+	{
+		cmdLine.inFile = opts.getOption<opt::ContinueFile>();
+
+		if (cmdLine.inFile.empty())
+		{
+			std::cout << "Invalid command line arguments. --continue argument is empty." << std::endl;
+			return false;
+		}
+	}
+
 	cmdLine.port					= opts.getOption<opt::Port>();
 	cmdLine.caseListDir				= opts.getOption<opt::CaseListDir>();
 	cmdLine.testset					= opts.getOption<opt::TestSet>();
 	cmdLine.exclude					= opts.getOption<opt::ExcludeSet>();
-	cmdLine.inFile					= opts.getOption<opt::ContinueFile>();
 	cmdLine.outFile					= opts.getOption<opt::TestLogFile>();
 	cmdLine.infoFile				= opts.getOption<opt::InfoLogFile>();
 	cmdLine.summary					= opts.getOption<opt::Summary>();
@@ -155,7 +207,7 @@
 	return true;
 }
 
-static bool checkCasePathPatternMatch (const char* pattern, const char* casePath, bool isTestGroup)
+bool checkCasePathPatternMatch (const char* pattern, const char* casePath, bool isTestGroup)
 {
 	int ptrnPos = 0;
 	int casePos = 0;
@@ -199,7 +251,7 @@
 	return false;
 }
 
-static void readCaseList (xe::TestGroup* root, const char* filename)
+void readCaseList (xe::TestGroup* root, const char* filename)
 {
 	xe::TestCaseListParser	caseListParser;
 	std::ifstream			in				(filename, std::ios_base::binary);
@@ -222,9 +274,10 @@
 	}
 }
 
-static void readCaseLists (xe::TestRoot& root, const char* caseListDir)
+void readCaseLists (xe::TestRoot& root, const char* caseListDir)
 {
-	de::DirectoryIterator iter(caseListDir);
+	int						testCaseListCount	= 0;
+	de::DirectoryIterator	iter				(caseListDir);
 
 	for (; iter.hasItem(); iter.next())
 	{
@@ -232,25 +285,29 @@
 
 		if (item.getType() == de::FilePath::TYPE_FILE)
 		{
-			std::string baseName = item.getBaseName();
+			string baseName = item.getBaseName();
 			if (baseName.find("-cases.xml") == baseName.length()-10)
 			{
-				std::string		packageName	= baseName.substr(0, baseName.length()-10);
+				string		packageName	= baseName.substr(0, baseName.length()-10);
 				xe::TestGroup*	package		= root.createGroup(packageName.c_str(), "");
 
 				readCaseList(package, item.getPath());
+				testCaseListCount++;
 			}
 		}
 	}
+
+	if (testCaseListCount == 0)
+		throw xe::Error("Couldn't find test case lists from test case list directory: '" + string(caseListDir)  + "'");
 }
 
-static void addMatchingCases (const xe::TestGroup& group, xe::TestSet& testSet, const char* filter)
+void addMatchingCases (const xe::TestGroup& group, xe::TestSet& testSet, const char* filter)
 {
 	for (int childNdx = 0; childNdx < group.getNumChildren(); childNdx++)
 	{
 		const xe::TestNode* child		= group.getChild(childNdx);
 		const bool			isGroup		= child->getNodeType() == xe::TESTNODETYPE_GROUP;
-		const std::string	fullPath	= child->getFullPath();
+		const string	 	fullPath	= child->getFullPath();
 
 		if (checkCasePathPatternMatch(filter, fullPath.c_str(), isGroup))
 		{
@@ -268,13 +325,13 @@
 	}
 }
 
-static void removeMatchingCases (const xe::TestGroup& group, xe::TestSet& testSet, const char* filter)
+void removeMatchingCases (const xe::TestGroup& group, xe::TestSet& testSet, const char* filter)
 {
 	for (int childNdx = 0; childNdx < group.getNumChildren(); childNdx++)
 	{
 		const xe::TestNode* child		= group.getChild(childNdx);
 		const bool			isGroup		= child->getNodeType() == xe::TESTNODETYPE_GROUP;
-		const std::string	fullPath	= child->getFullPath();
+		const string		fullPath	= child->getFullPath();
 
 		if (checkCasePathPatternMatch(filter, fullPath.c_str(), isGroup))
 		{
@@ -326,7 +383,7 @@
 	xe::BatchResult* m_batchResult;
 };
 
-static void readLogFile (xe::BatchResult* batchResult, const char* filename)
+void readLogFile (xe::BatchResult* batchResult, const char* filename)
 {
 	std::ifstream		in		(filename, std::ifstream::binary|std::ifstream::in);
 	BatchResultHandler	handler	(batchResult);
@@ -348,7 +405,7 @@
 	in.close();
 }
 
-static void printBatchResultSummary (const xe::TestNode* root, const xe::TestSet& testSet, const xe::BatchResult& batchResult)
+void printBatchResultSummary (const xe::TestNode* root, const xe::TestSet& testSet, const xe::BatchResult& batchResult)
 {
 	int countByStatusCode[xe::TESTSTATUSCODE_LAST];
 	std::fill(&countByStatusCode[0], &countByStatusCode[0]+DE_LENGTH_OF_ARRAY(countByStatusCode), 0);
@@ -359,7 +416,7 @@
 		if (node->getNodeType() == xe::TESTNODETYPE_TEST_CASE && testSet.hasNode(node))
 		{
 			const xe::TestCase*				testCase		= static_cast<const xe::TestCase*>(node);
-			std::string						fullPath;
+			string							fullPath;
 			xe::TestStatusCode				statusCode		= xe::TESTSTATUSCODE_PENDING;
 			testCase->getFullPath(fullPath);
 
@@ -390,7 +447,7 @@
 	printf("  %20s: %5d\n", "Total", totalCases);
 }
 
-static void writeInfoLog (const xe::InfoLog& log, const char* filename)
+void writeInfoLog (const xe::InfoLog& log, const char* filename)
 {
 	std::ofstream out(filename, std::ios_base::binary);
 	XE_CHECK(out.good());
@@ -398,14 +455,14 @@
 	out.close();
 }
 
-static xe::CommLink* createCommLink (const CommandLine& cmdLine)
+xe::CommLink* createCommLink (const CommandLine& cmdLine)
 {
-	if (!cmdLine.serverBin.empty())
+	if (cmdLine.runMode == RUNMODE_START_SERVER)
 	{
 		xe::LocalTcpIpLink* link = new xe::LocalTcpIpLink();
 		try
 		{
-			link->start(cmdLine.serverBin.c_str(), DE_NULL, cmdLine.port);
+			link->start(cmdLine.serverBinOrAddress.c_str(), DE_NULL, cmdLine.port);
 			return link;
 		}
 		catch (...)
@@ -414,29 +471,110 @@
 			throw;
 		}
 	}
+	else if (cmdLine.runMode == RUNMODE_CONNECT)
+	{
+		de::SocketAddress address;
+
+		address.setFamily(DE_SOCKETFAMILY_INET4);
+		address.setProtocol(DE_SOCKETPROTOCOL_TCP);
+		address.setHost(cmdLine.serverBinOrAddress.c_str());
+		address.setPort(cmdLine.port);
+
+		xe::TcpIpLink* link = new xe::TcpIpLink();
+		try
+		{
+			std::string error;
+
+			link->connect(address);
+			return link;
+		}
+		catch (const std::exception& error)
+		{
+			delete link;
+			throw xe::Error("Failed to connect to ExecServer at: " + cmdLine.serverBinOrAddress + ":" + de::toString(cmdLine.port) + ", " + error.what());
+		}
+		catch (...)
+		{
+			delete link;
+			throw;
+		}
+	}
 	else
 	{
-		de::SocketAddress address;
-		address.setFamily(DE_SOCKETFAMILY_INET4);
-		address.setProtocol(DE_SOCKETPROTOCOL_TCP);
-		address.setHost(cmdLine.host.c_str());
-		address.setPort(cmdLine.port);
-
-		xe::TcpIpLink* link = new xe::TcpIpLink();
-		try
-		{
-			link->connect(address);
-			return link;
-		}
-		catch (...)
-		{
-			delete link;
-			throw;
-		}
+		DE_ASSERT(false);
+		return DE_NULL;
 	}
 }
 
-static void runExecutor (const CommandLine& cmdLine)
+#if (DE_OS == DE_OS_UNIX) || (DE_OS == DE_OS_ANDROID)
+
+static xe::BatchExecutor* s_executor = DE_NULL;
+
+void signalHandler (int, siginfo_t*, void*)
+{
+	if (s_executor)
+		s_executor->cancel();
+}
+
+void setupSignalHandler (xe::BatchExecutor* executor)
+{
+	s_executor = executor;
+	struct sigaction sa;
+
+	sa.sa_sigaction = signalHandler;
+	sa.sa_flags = SA_SIGINFO | SA_RESTART;
+	sigfillset(&sa.sa_mask);
+
+	sigaction(SIGINT, &sa, DE_NULL);
+}
+
+void resetSignalHandler (void)
+{
+	struct sigaction sa;
+
+	sa.sa_handler = SIG_DFL;
+	sa.sa_flags = SA_RESTART;
+	sigfillset(&sa.sa_mask);
+
+	sigaction(SIGINT, &sa, DE_NULL);
+	s_executor = DE_NULL;
+}
+
+#elif (DE_OS == DE_OS_WIN32)
+
+static xe::BatchExecutor* s_executor = DE_NULL;
+
+void signalHandler (int)
+{
+	if (s_executor)
+		s_executor->cancel();
+}
+
+void setupSignalHandler (xe::BatchExecutor* executor)
+{
+	s_executor = executor;
+	signal(SIGINT, signalHandler);
+}
+
+void resetSignalHandler (void)
+{
+	signal(SIGINT, SIG_DFL);
+	s_executor = DE_NULL;
+}
+
+#else
+
+void setupSignalHandler (xe::BatchExecutor*)
+{
+}
+
+void resetSignalHandler (void)
+{
+}
+
+#endif
+
+void runExecutor (const CommandLine& cmdLine)
 {
 	xe::TestRoot root;
 
@@ -450,6 +588,9 @@
 	for (vector<string>::const_iterator filterIter = cmdLine.testset.begin(); filterIter != cmdLine.testset.end(); ++filterIter)
 		addMatchingCases(root, testSet, filterIter->c_str());
 
+	if (testSet.empty())
+		throw xe::Error("None of the test case lists contains tests matching any of the test sets.");
+
 	// Remove excluded cases.
 	for (vector<string>::const_iterator filterIter = cmdLine.exclude.begin(); filterIter != cmdLine.exclude.end(); ++filterIter)
 		removeMatchingCases(root, testSet, filterIter->c_str());
@@ -466,9 +607,34 @@
 	std::auto_ptr<xe::CommLink> commLink(createCommLink(cmdLine));
 
 	xe::BatchExecutor executor(cmdLine.targetCfg, commLink.get(), &root, testSet, &batchResult, &infoLog);
-	executor.run();
 
-	commLink.reset();
+	try
+	{
+		setupSignalHandler(&executor);
+		executor.run();
+		resetSignalHandler();
+	}
+	catch (...)
+	{
+		resetSignalHandler();
+
+		if (!cmdLine.outFile.empty())
+		{
+			xe::writeBatchResultToFile(batchResult, cmdLine.outFile.c_str());
+			printf("Test log written to %s\n", cmdLine.outFile.c_str());
+		}
+
+		if (!cmdLine.infoFile.empty())
+		{
+			writeInfoLog(infoLog, cmdLine.infoFile.c_str());
+			printf("Info log written to %s\n", cmdLine.infoFile.c_str());
+		}
+
+		if (cmdLine.summary)
+			printBatchResultSummary(&root, testSet, batchResult);
+
+		throw;
+	}
 
 	if (!cmdLine.outFile.empty())
 	{
@@ -484,8 +650,17 @@
 
 	if (cmdLine.summary)
 		printBatchResultSummary(&root, testSet, batchResult);
+
+	{
+		string err;
+
+		if (commLink->getState(err) == xe::COMMLINKSTATE_ERROR)
+			throw xe::Error(err);
+	}
 }
 
+} // anonymous
+
 int main (int argc, const char* const* argv)
 {
 	CommandLine cmdLine;
diff --git a/executor/xeBatchExecutor.cpp b/executor/xeBatchExecutor.cpp
index 46fe449..bd7a251 100644
--- a/executor/xeBatchExecutor.cpp
+++ b/executor/xeBatchExecutor.cpp
@@ -224,6 +224,12 @@
 	m_commLink->setCallbacks(DE_NULL, DE_NULL, DE_NULL, DE_NULL);
 }
 
+void BatchExecutor::cancel (void)
+{
+	m_state = STATE_FINISHED;
+	m_dispatcher.cancel();
+}
+
 void BatchExecutor::onStateChanged (CommLinkState state, const char* message)
 {
 	switch (state)
@@ -278,7 +284,7 @@
 	}
 }
 
-void BatchExecutor::onTestLogData (const deUint8* bytes, int numBytes)
+void BatchExecutor::onTestLogData (const deUint8* bytes, size_t numBytes)
 {
 	try
 	{
@@ -291,7 +297,7 @@
 	}
 }
 
-void BatchExecutor::onInfoLogData (const deUint8* bytes, int numBytes)
+void BatchExecutor::onInfoLogData (const deUint8* bytes, size_t numBytes)
 {
 	if (numBytes > 0 && m_infoLog)
 		m_infoLog->append(bytes, numBytes);
@@ -353,7 +359,7 @@
 	writer.enqueue();
 }
 
-void BatchExecutor::enqueueTestLogData (void* userPtr, const deUint8* bytes, int numBytes)
+void BatchExecutor::enqueueTestLogData (void* userPtr, const deUint8* bytes, size_t numBytes)
 {
 	BatchExecutor*	executor	= static_cast<BatchExecutor*>(userPtr);
 	CallWriter		writer		(&executor->m_dispatcher, BatchExecutor::dispatchTestLogData);
@@ -365,7 +371,7 @@
 	writer.enqueue();
 }
 
-void BatchExecutor::enqueueInfoLogData (void* userPtr, const deUint8* bytes, int numBytes)
+void BatchExecutor::enqueueInfoLogData (void* userPtr, const deUint8* bytes, size_t numBytes)
 {
 	BatchExecutor*	executor	= static_cast<BatchExecutor*>(userPtr);
 	CallWriter		writer		(&executor->m_dispatcher, BatchExecutor::dispatchInfoLogData);
@@ -377,7 +383,7 @@
 	writer.enqueue();
 }
 
-void BatchExecutor::dispatchStateChanged (CallReader data)
+void BatchExecutor::dispatchStateChanged (CallReader& data)
 {
 	BatchExecutor*	executor	= DE_NULL;
 	CommLinkState	state		= COMMLINKSTATE_LAST;
@@ -390,10 +396,10 @@
 	executor->onStateChanged(state, message.c_str());
 }
 
-void BatchExecutor::dispatchTestLogData (CallReader data)
+void BatchExecutor::dispatchTestLogData (CallReader& data)
 {
 	BatchExecutor*	executor	= DE_NULL;
-	int				numBytes;
+	size_t			numBytes;
 
 	data >> executor
 		 >> numBytes;
@@ -401,10 +407,10 @@
 	executor->onTestLogData(data.getDataBlock(numBytes), numBytes);
 }
 
-void BatchExecutor::dispatchInfoLogData (CallReader data)
+void BatchExecutor::dispatchInfoLogData (CallReader& data)
 {
 	BatchExecutor*	executor	= DE_NULL;
-	int				numBytes;
+	size_t			numBytes;
 
 	data >> executor
 		 >> numBytes;
diff --git a/executor/xeBatchExecutor.hpp b/executor/xeBatchExecutor.hpp
index 509bbb0..b84d054 100644
--- a/executor/xeBatchExecutor.hpp
+++ b/executor/xeBatchExecutor.hpp
@@ -80,20 +80,20 @@
 	bool					iterate				(void);
 
 	void					onStateChanged		(CommLinkState state, const char* message);
-	void					onTestLogData		(const deUint8* bytes, int numBytes);
-	void					onInfoLogData		(const deUint8* bytes, int numBytes);
+	void					onTestLogData		(const deUint8* bytes, size_t numBytes);
+	void					onInfoLogData		(const deUint8* bytes, size_t numBytes);
 
 	void					launchTestSet		(const TestSet& testSet);
 
 	// Callbacks for CommLink.
 	static void				enqueueStateChanged	(void* userPtr, CommLinkState state, const char* message);
-	static void				enqueueTestLogData	(void* userPtr, const deUint8* bytes, int numBytes);
-	static void				enqueueInfoLogData	(void* userPtr, const deUint8* bytes, int numBytes);
+	static void				enqueueTestLogData	(void* userPtr, const deUint8* bytes, size_t numBytes);
+	static void				enqueueInfoLogData	(void* userPtr, const deUint8* bytes, size_t numBytes);
 
 	// Called in CallQueue dispatch.
-	static void				dispatchStateChanged	(CallReader data);
-	static void				dispatchTestLogData		(CallReader data);
-	static void				dispatchInfoLogData		(CallReader data);
+	static void				dispatchStateChanged	(CallReader& data);
+	static void				dispatchTestLogData		(CallReader& data);
+	static void				dispatchInfoLogData		(CallReader& data);
 
 	enum State
 	{
diff --git a/executor/xeBatchResult.cpp b/executor/xeBatchResult.cpp
index 4a8f7e4..be4d8db 100644
--- a/executor/xeBatchResult.cpp
+++ b/executor/xeBatchResult.cpp
@@ -37,10 +37,10 @@
 {
 }
 
-void InfoLog::append (const deUint8* bytes, int numBytes)
+void InfoLog::append (const deUint8* bytes, size_t numBytes)
 {
 	DE_ASSERT(numBytes > 0);
-	int oldSize = (int)m_data.size();
+	const size_t oldSize = m_data.size();
 	m_data.resize(oldSize+numBytes);
 	deMemcpy(&m_data[oldSize], bytes, numBytes);
 }
diff --git a/executor/xeBatchResult.hpp b/executor/xeBatchResult.hpp
index ef6bc6d..f76b61c 100644
--- a/executor/xeBatchResult.hpp
+++ b/executor/xeBatchResult.hpp
@@ -55,10 +55,10 @@
 public:
 							InfoLog			(void);
 
-	int						getSize			(void) const { return (int)m_data.size();						}
+	size_t					getSize			(void) const { return m_data.size();							}
 	const deUint8*			getBytes		(void) const { return !m_data.empty() ? &m_data[0] : DE_NULL;	}
 
-	void					append			(const deUint8* bytes, int numBytes);
+	void					append			(const deUint8* bytes, size_t numBytes);
 
 private:
 							InfoLog			(const InfoLog& other);
diff --git a/executor/xeCallQueue.cpp b/executor/xeCallQueue.cpp
index 7f87b54..ae68000 100644
--- a/executor/xeCallQueue.cpp
+++ b/executor/xeCallQueue.cpp
@@ -38,7 +38,8 @@
 // CallQueue
 
 CallQueue::CallQueue (void)
-	: m_callSem		(0)
+	: m_canceled	(false)
+	, m_callSem		(0)
 	, m_callQueue	(64)
 {
 }
@@ -50,6 +51,12 @@
 		delete *i;
 }
 
+void CallQueue::cancel (void)
+{
+	m_canceled = true;
+	m_callSem.increment();
+}
+
 void CallQueue::callNext (void)
 {
 	Call* call = DE_NULL;
@@ -57,6 +64,9 @@
 	// Wait for a call.
 	m_callSem.decrement();
 
+	if (m_canceled)
+		return;
+
 	// Acquire call from buffer.
 	{
 		de::ScopedLock lock(m_lock);
@@ -66,7 +76,12 @@
 	try
 	{
 		// \note Enqueue lock is not held during call so it is possible to enqueue more work from dispatched call.
-		call->getFunction()(CallReader(call));
+		CallReader reader(call);
+
+		call->getFunction()(reader);
+
+		// check callee consumed all
+		DE_ASSERT(reader.isDataConsumed());
 		call->clear();
 	}
 	catch (const std::exception&)
@@ -160,14 +175,14 @@
 {
 }
 
-void CallReader::read (deUint8* bytes, int numBytes)
+void CallReader::read (deUint8* bytes, size_t numBytes)
 {
 	DE_ASSERT(m_curPos + numBytes <= m_call->getDataSize());
 	deMemcpy(bytes, m_call->getData()+m_curPos, numBytes);
 	m_curPos += numBytes;
 }
 
-const deUint8* CallReader::getDataBlock (int numBytes)
+const deUint8* CallReader::getDataBlock (size_t numBytes)
 {
 	DE_ASSERT(m_curPos + numBytes <= m_call->getDataSize());
 
@@ -177,6 +192,11 @@
 	return ptr;
 }
 
+bool CallReader::isDataConsumed (void) const
+{
+	return m_curPos == m_call->getDataSize();
+}
+
 CallReader& operator>> (CallReader& reader, std::string& value)
 {
 	value.clear();
@@ -209,10 +229,10 @@
 		m_queue->freeCall(m_call);
 }
 
-void CallWriter::write (const deUint8* bytes, int numBytes)
+void CallWriter::write (const deUint8* bytes, size_t numBytes)
 {
 	DE_ASSERT(!m_enqueued);
-	int curPos = m_call->getDataSize();
+	size_t curPos = m_call->getDataSize();
 	m_call->setDataSize(curPos+numBytes);
 	deMemcpy(m_call->getData()+curPos, bytes, numBytes);
 }
diff --git a/executor/xeCallQueue.hpp b/executor/xeCallQueue.hpp
index 3d72655..c88e669 100644
--- a/executor/xeCallQueue.hpp
+++ b/executor/xeCallQueue.hpp
@@ -45,7 +45,7 @@
 class Call
 {
 public:
-	typedef void (*Function) (CallReader data);
+	typedef void (*Function) (CallReader& data);
 
 								Call				(void);
 								~Call				(void);
@@ -55,8 +55,8 @@
 	Function					getFunction			(void) const	{ return m_func;				}
 	void						setFunction			(Function func)	{ m_func = func;				}
 
-	int							getDataSize			(void) const	{ return (int)m_data.size();	}
-	void						setDataSize			(int size)		{ m_data.resize(size);			}
+	size_t						getDataSize			(void) const	{ return m_data.size();			}
+	void						setDataSize			(size_t size)	{ m_data.resize(size);			}
 
 	const deUint8*				getData				(void) const	{ return m_data.empty() ? DE_NULL : &m_data[0];	}
 	deUint8*					getData				(void)			{ return m_data.empty() ? DE_NULL : &m_data[0];	}
@@ -72,12 +72,16 @@
 					CallReader			(Call* call);
 					CallReader			(void) : m_call(DE_NULL), m_curPos(0) {}
 
-	void			read				(deUint8* bytes, int numBytes);
-	const deUint8*	getDataBlock		(int numBytes);					//!< \note Valid only during call.
+	void			read				(deUint8* bytes, size_t numBytes);
+	const deUint8*	getDataBlock		(size_t numBytes);					//!< \note Valid only during call.
+	bool			isDataConsumed		(void) const;						//!< all data has been consumed
 
 private:
+					CallReader			(const CallReader& other);	//!< disallowed
+	CallReader&		operator=			(const CallReader& other);	//!< disallowed
+
 	Call*			m_call;
-	int				m_curPos;
+	size_t			m_curPos;
 };
 
 class CallWriter
@@ -86,7 +90,7 @@
 					CallWriter			(CallQueue* queue, Call::Function function);
 					~CallWriter			(void);
 
-	void			write				(const deUint8* bytes, int numBytes);
+	void			write				(const deUint8* bytes, size_t numBytes);
 	void			enqueue				(void);
 
 private:
@@ -109,11 +113,13 @@
 	Call*					getEmptyCall		(void);
 	void					enqueue				(Call* call);
 	void					freeCall			(Call* call);
+	void					cancel				(void);
 
 private:
 							CallQueue			(const CallQueue& other);
 	CallQueue&				operator=			(const CallQueue& other);
 
+	bool					m_canceled;
 	de::Semaphore			m_callSem;
 
 	de::Mutex				m_lock;
diff --git a/executor/xeCommLink.hpp b/executor/xeCommLink.hpp
index 66c314d..c4fedef 100644
--- a/executor/xeCommLink.hpp
+++ b/executor/xeCommLink.hpp
@@ -48,7 +48,7 @@
 {
 public:
 	typedef void (*StateChangedFunc)	(void* userPtr, CommLinkState state, const char* message);
-	typedef void (*LogDataFunc)			(void* userPtr, const deUint8* bytes, int numBytes);
+	typedef void (*LogDataFunc)			(void* userPtr, const deUint8* bytes, size_t numBytes);
 
 								CommLink				(void);
 	virtual						~CommLink				(void);
diff --git a/executor/xeContainerFormatParser.cpp b/executor/xeContainerFormatParser.cpp
index a15449c..a02d8b8 100644
--- a/executor/xeContainerFormatParser.cpp
+++ b/executor/xeContainerFormatParser.cpp
@@ -62,14 +62,14 @@
 	throw ContainerParseError(what);
 }
 
-void ContainerFormatParser::feed (const deUint8* bytes, int numBytes)
+void ContainerFormatParser::feed (const deUint8* bytes, size_t numBytes)
 {
 	// Grow buffer if necessary.
-	if (m_buf.getNumFree() < numBytes)
-		m_buf.resize(getNextBufferSize(m_buf.getSize(), m_buf.getNumElements()+numBytes));
+	if (m_buf.getNumFree() < (int)numBytes)
+		m_buf.resize(getNextBufferSize(m_buf.getSize(), m_buf.getNumElements()+(int)numBytes));
 
 	// Append to front.
-	m_buf.pushFront(bytes, numBytes);
+	m_buf.pushFront(bytes, (int)numBytes);
 
 	// If we haven't parsed complete element, re-try after data feed.
 	if (m_element == CONTAINERELEMENT_INCOMPLETE)
diff --git a/executor/xeContainerFormatParser.hpp b/executor/xeContainerFormatParser.hpp
index 40c0f44..5167ce8 100644
--- a/executor/xeContainerFormatParser.hpp
+++ b/executor/xeContainerFormatParser.hpp
@@ -58,7 +58,7 @@
 
 	void						clear						(void);
 
-	void						feed						(const deUint8* bytes, int numBytes);
+	void						feed						(const deUint8* bytes, size_t numBytes);
 	void						advance						(void);
 
 	ContainerElement			getElement					(void) const { return m_element; }
diff --git a/executor/xeLocalTcpIpLink.cpp b/executor/xeLocalTcpIpLink.cpp
index 0550582..8bc9491 100644
--- a/executor/xeLocalTcpIpLink.cpp
+++ b/executor/xeLocalTcpIpLink.cpp
@@ -62,7 +62,7 @@
 		deProcess_destroy(m_process);
 		m_process = DE_NULL;
 
-		XE_FAIL((std::string("Failed to start server: ") + err).c_str());
+		XE_FAIL((std::string("Failed to start ExecServer '") + execServerPath + "' : " + err).c_str());
 	}
 
 	try
diff --git a/executor/xeTcpIpLink.cpp b/executor/xeTcpIpLink.cpp
index 1778a4f..68065c6 100644
--- a/executor/xeTcpIpLink.cpp
+++ b/executor/xeTcpIpLink.cpp
@@ -133,7 +133,7 @@
 		callback(userPtr, state, error);
 }
 
-void TcpIpLinkState::onTestLogData (const deUint8* bytes, int numBytes) const
+void TcpIpLinkState::onTestLogData (const deUint8* bytes, size_t numBytes) const
 {
 	CommLink::LogDataFunc	callback	= DE_NULL;
 	void*					userPtr		= DE_NULL;
@@ -147,7 +147,7 @@
 		callback(userPtr, bytes, numBytes);
 }
 
-void TcpIpLinkState::onInfoLogData (const deUint8* bytes, int numBytes) const
+void TcpIpLinkState::onInfoLogData (const deUint8* bytes, size_t numBytes) const
 {
 	CommLink::LogDataFunc	callback	= DE_NULL;
 	void*					userPtr		= DE_NULL;
@@ -206,8 +206,8 @@
 
 		while (!m_buffer.isCanceled())
 		{
-			int				numToSend	= 0;
-			int				numSent		= 0;
+			size_t			numToSend	= 0;
+			size_t			numSent		= 0;
 			deSocketResult	result		= DE_SOCKETRESULT_LAST;
 
 			try
@@ -234,7 +234,7 @@
 				else if (result == DE_SOCKETRESULT_WOULD_BLOCK)
 				{
 					// \note Socket should not be in non-blocking mode.
-					DE_ASSERT(numSent <= 0);
+					DE_ASSERT(numSent == 0);
 					deYield();
 				}
 				else
@@ -291,7 +291,7 @@
 		{
 			bool				hasHeader		= m_curMsgPos >= xs::MESSAGE_HEADER_SIZE;
 			bool				hasPayload		= false;
-			int					messageSize		= 0;
+			size_t				messageSize		= 0;
 			xs::MessageType		messageType		= (xs::MessageType)0;
 
 			if (hasHeader)
@@ -309,12 +309,12 @@
 			else
 			{
 				// Try to receive missing bytes.
-				int					curSize			= hasHeader ? messageSize : xs::MESSAGE_HEADER_SIZE;
-				int					bytesToRecv		= curSize-m_curMsgPos;
-				int					numRecv			= 0;
+				size_t				curSize			= hasHeader ? messageSize : (size_t)xs::MESSAGE_HEADER_SIZE;
+				size_t				bytesToRecv		= curSize-m_curMsgPos;
+				size_t				numRecv			= 0;
 				deSocketResult		result			= DE_SOCKETRESULT_LAST;
 
-				if ((int)m_curMsgBuf.size() < curSize)
+				if (m_curMsgBuf.size() < curSize)
 					m_curMsgBuf.resize(curSize);
 
 				result = m_socket.receive(&m_curMsgBuf[m_curMsgPos], bytesToRecv, &numRecv);
@@ -328,7 +328,7 @@
 				else if (result == DE_SOCKETRESULT_WOULD_BLOCK)
 				{
 					// \note Socket should not be in non-blocking mode.
-					DE_ASSERT(numRecv <= 0);
+					DE_ASSERT(numRecv == 0);
 					deYield();
 				}
 				else
@@ -359,7 +359,7 @@
 	}
 }
 
-void TcpIpRecvThread::handleMessage (xs::MessageType messageType, const deUint8* data, int dataSize)
+void TcpIpRecvThread::handleMessage (xs::MessageType messageType, const deUint8* data, size_t dataSize)
 {
 	switch (messageType)
 	{
@@ -480,6 +480,7 @@
 	{
 		closeConnection();
 		m_state.setState(COMMLINKSTATE_ERROR, e.what());
+		throw;
 	}
 }
 
diff --git a/executor/xeTcpIpLink.hpp b/executor/xeTcpIpLink.hpp
index d401355..51ca7c3 100644
--- a/executor/xeTcpIpLink.hpp
+++ b/executor/xeTcpIpLink.hpp
@@ -49,8 +49,8 @@
 	void						setCallbacks				(CommLink::StateChangedFunc stateChangedCallback, CommLink::LogDataFunc testLogDataCallback, CommLink::LogDataFunc infoLogDataCallback, void* userPtr);
 
 	void						setState					(CommLinkState state, const char* error = "");
-	void						onTestLogData				(const deUint8* bytes, int numBytes) const;
-	void						onInfoLogData				(const deUint8* bytes, int numBytes) const;
+	void						onTestLogData				(const deUint8* bytes, size_t numBytes) const;
+	void						onInfoLogData				(const deUint8* bytes, size_t numBytes) const;
 
 	void						onKeepaliveReceived			(void);
 	deUint64					getLastKeepaliveRecevied	(void) const;
@@ -104,13 +104,13 @@
 	bool						isRunning				(void) const { return m_isRunning; }
 
 private:
-	void						handleMessage			(xs::MessageType messageType, const deUint8* data, int dataSize);
+	void						handleMessage			(xs::MessageType messageType, const deUint8* data, size_t dataSize);
 
 	de::Socket&					m_socket;
 	TcpIpLinkState&				m_state;
 
 	std::vector<deUint8>		m_curMsgBuf;
-	int							m_curMsgPos;
+	size_t						m_curMsgPos;
 
 	bool						m_isRunning;
 };
diff --git a/executor/xeTestLogParser.cpp b/executor/xeTestLogParser.cpp
index e871663..01627c1 100644
--- a/executor/xeTestLogParser.cpp
+++ b/executor/xeTestLogParser.cpp
@@ -49,7 +49,7 @@
 	m_inSession		= false;
 }
 
-void TestLogParser::parse (const deUint8* bytes, int numBytes)
+void TestLogParser::parse (const deUint8* bytes, size_t numBytes)
 {
 	m_containerParser.feed(bytes, numBytes);
 
diff --git a/executor/xeTestLogParser.hpp b/executor/xeTestLogParser.hpp
index f009e05..bc323f3 100644
--- a/executor/xeTestLogParser.hpp
+++ b/executor/xeTestLogParser.hpp
@@ -56,7 +56,7 @@
 
 	void					reset					(void);
 
-	void					parse					(const deUint8* bytes, int numBytes);
+	void					parse					(const deUint8* bytes, size_t numBytes);
 
 private:
 							TestLogParser			(const TestLogParser& other);
diff --git a/executor/xeTestResultParser.cpp b/executor/xeTestResultParser.cpp
index 1c7072a..0b95b8e 100644
--- a/executor/xeTestResultParser.cpp
+++ b/executor/xeTestResultParser.cpp
@@ -802,11 +802,11 @@
 				deUint8		decodedBits	= 0;
 
 				if (de::inRange<deInt8>(byte, 'A', 'Z'))
-					decodedBits = byte - 'A';
+					decodedBits = (deUint8)(byte - 'A');
 				else if (de::inRange<deInt8>(byte, 'a', 'z'))
-					decodedBits = ('Z'-'A'+1) + (byte-'a');
+					decodedBits = (deUint8)(('Z'-'A'+1) + (byte-'a'));
 				else if (de::inRange<deInt8>(byte, '0', '9'))
-					decodedBits = ('Z'-'A'+1) + ('z'-'a'+1) + (byte-'0');
+					decodedBits = (deUint8)(('Z'-'A'+1) + ('z'-'a'+1) + (byte-'0'));
 				else if (byte == '+')
 					decodedBits = ('Z'-'A'+1) + ('z'-'a'+1) + ('9'-'0'+1);
 				else if (byte == '/')
@@ -833,10 +833,10 @@
 
 				switch (phase)
 				{
-					case 0: outPtr[0] |= decodedBits<<2;											break;
-					case 1: outPtr[0] |= (decodedBits>>4);	outPtr[1] |= ((decodedBits&0xF)<<4);	break;
-					case 2: outPtr[1] |= (decodedBits>>2);	outPtr[2] |= ((decodedBits&0x3)<<6);	break;
-					case 3: outPtr[2] |= decodedBits;												break;
+					case 0: outPtr[0] |= (deUint8)(decodedBits<<2);													break;
+					case 1: outPtr[0] |= (deUint8)(decodedBits>>4);	outPtr[1] |= (deUint8)((decodedBits&0xF)<<4);	break;
+					case 2: outPtr[1] |= (deUint8)(decodedBits>>2);	outPtr[2] |= (deUint8)((decodedBits&0x3)<<6);	break;
+					case 3: outPtr[2] |= decodedBits;																break;
 					default:
 						DE_ASSERT(false);
 				}
diff --git a/external/fetch_sources.py b/external/fetch_sources.py
index 5f6a30f..ff0c78e 100644
--- a/external/fetch_sources.py
+++ b/external/fetch_sources.py
@@ -1,5 +1,25 @@
 # -*- coding: utf-8 -*-
 
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import os
 import sys
 import shutil
@@ -68,7 +88,7 @@
 
 	extractedEntries = os.listdir(tmpPath)
 	if len(extractedEntries) != 1 or not os.path.isdir(os.path.join(tmpPath, extractedEntries[0])):
-		raise Exception("%s doesn't contain single top-level directory") % pkg.filename
+		raise Exception("%s doesn't contain single top-level directory" % pkg.filename)
 
 	topLevelPath = os.path.join(tmpPath, extractedEntries[0])
 
@@ -93,7 +113,7 @@
 				  "zlib-1.2.8.tar.gz",
 				  "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d",
 				  "zlib"),
-	SourcePackage("ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/libpng-1.6.17.tar.gz",
+	SourcePackage("http://prdownloads.sourceforge.net/libpng/libpng-1.6.17.tar.gz",
 				  "libpng-1.6.17.tar.gz",
 				  "a18233c99e1dc59a256180e6871d9305a42e91b3f98799b3ceb98e87e9ec5e31",
 				  "libpng",
diff --git a/framework/common/tcuApp.cpp b/framework/common/tcuApp.cpp
index a16e45e..409a677 100644
--- a/framework/common/tcuApp.cpp
+++ b/framework/common/tcuApp.cpp
@@ -28,13 +28,47 @@
 #include "tcuTestHierarchyUtil.hpp"
 #include "tcuCommandLine.hpp"
 #include "tcuTestLog.hpp"
+
 #include "qpInfo.h"
 #include "qpDebugOut.h"
+
 #include "deMath.h"
 
+#include <iostream>
+
 namespace tcu
 {
 
+using std::string;
+
+/*--------------------------------------------------------------------*//*!
+ *  Writes all packages found stdout without any
+ *  separations. Recommended to be used with a single package
+ *  only. It's possible to use test selectors for limiting the export
+ *  to one package in a multipackage binary.
+ *//*--------------------------------------------------------------------*/
+static void writeCaselistsToStdout (TestPackageRoot& root, TestContext& testCtx, const CommandLine& cmdLine)
+{
+	DefaultHierarchyInflater	inflater	(testCtx);
+	TestHierarchyIterator		iter		(root, inflater, cmdLine);
+
+	while (iter.getState() != TestHierarchyIterator::STATE_FINISHED)
+	{
+		iter.next();
+
+		while (iter.getNode()->getNodeType() != NODETYPE_PACKAGE)
+		{
+			if (iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE)
+				std::cout << (isTestNodeTypeExecutable(iter.getNode()->getNodeType()) ? "TEST" : "GROUP") << ": " << iter.getNodePath() << "\n";
+			iter.next();
+		}
+
+		DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_LEAVE_NODE &&
+				  iter.getNode()->getNodeType() == NODETYPE_PACKAGE);
+		iter.next();
+	}
+}
+
 /*--------------------------------------------------------------------*//*!
  * \brief Construct test application
  *
@@ -79,10 +113,12 @@
 		// \note No executor is created if runmode is not EXECUTE
 		if (runMode == RUNMODE_EXECUTE)
 			m_testExecutor = new TestSessionExecutor(*m_testRoot, *m_testCtx);
+		else if (runMode == RUNMODE_DUMP_STDOUT_CASELIST)
+			writeCaselistsToStdout(*m_testRoot, *m_testCtx, cmdLine);
 		else if (runMode == RUNMODE_DUMP_XML_CASELIST)
-			writeXmlCaselists(*m_testRoot, *m_testCtx, m_testCtx->getCommandLine());
+			writeXmlCaselistsToFiles(*m_testRoot, *m_testCtx, cmdLine);
 		else if (runMode == RUNMODE_DUMP_TEXT_CASELIST)
-			writeTxtCaselists(*m_testRoot, *m_testCtx, m_testCtx->getCommandLine());
+			writeTxtCaselistsToFiles(*m_testRoot, *m_testCtx, cmdLine);
 		else
 			DE_ASSERT(false);
 	}
@@ -155,10 +191,10 @@
 
 			// Report statistics.
 			print("\nTest run totals:\n");
-			print("  Passed:        %d/%d (%.1f%%)\n", result.numPassed,		result.numExecuted, (result.numExecuted > 0 ? (100.0f * result.numPassed		/ result.numExecuted) : 0.0f));
-			print("  Failed:        %d/%d (%.1f%%)\n", result.numFailed,		result.numExecuted, (result.numExecuted > 0 ? (100.0f * result.numFailed		/ result.numExecuted) : 0.0f));
-			print("  Not supported: %d/%d (%.1f%%)\n", result.numNotSupported,	result.numExecuted, (result.numExecuted > 0 ? (100.0f * result.numNotSupported	/ result.numExecuted) : 0.0f));
-			print("  Warnings:      %d/%d (%.1f%%)\n", result.numWarnings,		result.numExecuted, (result.numExecuted > 0 ? (100.0f * result.numWarnings		/ result.numExecuted) : 0.0f));
+			print("  Passed:        %d/%d (%.1f%%)\n", result.numPassed,		result.numExecuted, (result.numExecuted > 0 ? (100.0f * (float)result.numPassed			/ (float)result.numExecuted) : 0.0f));
+			print("  Failed:        %d/%d (%.1f%%)\n", result.numFailed,		result.numExecuted, (result.numExecuted > 0 ? (100.0f * (float)result.numFailed			/ (float)result.numExecuted) : 0.0f));
+			print("  Not supported: %d/%d (%.1f%%)\n", result.numNotSupported,	result.numExecuted, (result.numExecuted > 0 ? (100.0f * (float)result.numNotSupported	/ (float)result.numExecuted) : 0.0f));
+			print("  Warnings:      %d/%d (%.1f%%)\n", result.numWarnings,		result.numExecuted, (result.numExecuted > 0 ? (100.0f * (float)result.numWarnings		/ (float)result.numExecuted) : 0.0f));
 			if (!result.isComplete)
 				print("Test run was ABORTED!\n");
 		}
diff --git a/framework/common/tcuBilinearImageCompare.cpp b/framework/common/tcuBilinearImageCompare.cpp
index 9b53ff9..df6f7c2 100644
--- a/framework/common/tcuBilinearImageCompare.cpp
+++ b/framework/common/tcuBilinearImageCompare.cpp
@@ -173,8 +173,8 @@
 
 		for (int sampleNdx = 0; sampleNdx < DE_LENGTH_OF_ARRAY(s_offsets); sampleNdx++)
 		{
-			const int u = ((x-1)<<NUM_SUBPIXEL_BITS) + (int)s_offsets[sampleNdx][0];
-			const int v = ((y-1)<<NUM_SUBPIXEL_BITS) + (int)s_offsets[sampleNdx][1];
+			const int u = (x<<NUM_SUBPIXEL_BITS) + (int)s_offsets[sampleNdx][0] - (1<<NUM_SUBPIXEL_BITS);
+			const int v = (y<<NUM_SUBPIXEL_BITS) + (int)s_offsets[sampleNdx][1] - (1<<NUM_SUBPIXEL_BITS);
 
 			if (!de::inBounds(u, 0, (reference.getWidth()-1)<<NUM_SUBPIXEL_BITS) ||
 				!de::inBounds(v, 0, (reference.getHeight()-1)<<NUM_SUBPIXEL_BITS))
diff --git a/framework/common/tcuCommandLine.cpp b/framework/common/tcuCommandLine.cpp
index 405d9bd..c660e63 100644
--- a/framework/common/tcuCommandLine.cpp
+++ b/framework/common/tcuCommandLine.cpp
@@ -54,33 +54,34 @@
 namespace opt
 {
 
-DE_DECLARE_COMMAND_LINE_OPT(CasePath,			std::string);
-DE_DECLARE_COMMAND_LINE_OPT(CaseList,			std::string);
-DE_DECLARE_COMMAND_LINE_OPT(CaseListFile,		std::string);
-DE_DECLARE_COMMAND_LINE_OPT(StdinCaseList,		bool);
-DE_DECLARE_COMMAND_LINE_OPT(LogFilename,		std::string);
-DE_DECLARE_COMMAND_LINE_OPT(RunMode,			tcu::RunMode);
-DE_DECLARE_COMMAND_LINE_OPT(WatchDog,			bool);
-DE_DECLARE_COMMAND_LINE_OPT(CrashHandler,		bool);
-DE_DECLARE_COMMAND_LINE_OPT(BaseSeed,			int);
-DE_DECLARE_COMMAND_LINE_OPT(TestIterationCount,	int);
-DE_DECLARE_COMMAND_LINE_OPT(Visibility,			WindowVisibility);
-DE_DECLARE_COMMAND_LINE_OPT(SurfaceWidth,		int);
-DE_DECLARE_COMMAND_LINE_OPT(SurfaceHeight,		int);
-DE_DECLARE_COMMAND_LINE_OPT(SurfaceType,		tcu::SurfaceType);
-DE_DECLARE_COMMAND_LINE_OPT(ScreenRotation,		tcu::ScreenRotation);
-DE_DECLARE_COMMAND_LINE_OPT(GLContextType,		std::string);
-DE_DECLARE_COMMAND_LINE_OPT(GLConfigID,			int);
-DE_DECLARE_COMMAND_LINE_OPT(GLConfigName,		std::string);
-DE_DECLARE_COMMAND_LINE_OPT(GLContextFlags,		std::string);
-DE_DECLARE_COMMAND_LINE_OPT(CLPlatformID,		int);
-DE_DECLARE_COMMAND_LINE_OPT(CLDeviceIDs,		std::vector<int>);
-DE_DECLARE_COMMAND_LINE_OPT(CLBuildOptions,		std::string);
-DE_DECLARE_COMMAND_LINE_OPT(EGLDisplayType,		std::string);
-DE_DECLARE_COMMAND_LINE_OPT(EGLWindowType,		std::string);
-DE_DECLARE_COMMAND_LINE_OPT(EGLPixmapType,		std::string);
-DE_DECLARE_COMMAND_LINE_OPT(LogImages,			bool);
-DE_DECLARE_COMMAND_LINE_OPT(TestOOM,			bool);
+DE_DECLARE_COMMAND_LINE_OPT(CasePath,					std::string);
+DE_DECLARE_COMMAND_LINE_OPT(CaseList,					std::string);
+DE_DECLARE_COMMAND_LINE_OPT(CaseListFile,				std::string);
+DE_DECLARE_COMMAND_LINE_OPT(StdinCaseList,				bool);
+DE_DECLARE_COMMAND_LINE_OPT(LogFilename,				std::string);
+DE_DECLARE_COMMAND_LINE_OPT(RunMode,					tcu::RunMode);
+DE_DECLARE_COMMAND_LINE_OPT(ExportFilenamePattern,		std::string);
+DE_DECLARE_COMMAND_LINE_OPT(WatchDog,					bool);
+DE_DECLARE_COMMAND_LINE_OPT(CrashHandler,				bool);
+DE_DECLARE_COMMAND_LINE_OPT(BaseSeed,					int);
+DE_DECLARE_COMMAND_LINE_OPT(TestIterationCount,			int);
+DE_DECLARE_COMMAND_LINE_OPT(Visibility,					WindowVisibility);
+DE_DECLARE_COMMAND_LINE_OPT(SurfaceWidth,				int);
+DE_DECLARE_COMMAND_LINE_OPT(SurfaceHeight,				int);
+DE_DECLARE_COMMAND_LINE_OPT(SurfaceType,				tcu::SurfaceType);
+DE_DECLARE_COMMAND_LINE_OPT(ScreenRotation,				tcu::ScreenRotation);
+DE_DECLARE_COMMAND_LINE_OPT(GLContextType,				std::string);
+DE_DECLARE_COMMAND_LINE_OPT(GLConfigID,					int);
+DE_DECLARE_COMMAND_LINE_OPT(GLConfigName,				std::string);
+DE_DECLARE_COMMAND_LINE_OPT(GLContextFlags,				std::string);
+DE_DECLARE_COMMAND_LINE_OPT(CLPlatformID,				int);
+DE_DECLARE_COMMAND_LINE_OPT(CLDeviceIDs,				std::vector<int>);
+DE_DECLARE_COMMAND_LINE_OPT(CLBuildOptions,				std::string);
+DE_DECLARE_COMMAND_LINE_OPT(EGLDisplayType,				std::string);
+DE_DECLARE_COMMAND_LINE_OPT(EGLWindowType,				std::string);
+DE_DECLARE_COMMAND_LINE_OPT(EGLPixmapType,				std::string);
+DE_DECLARE_COMMAND_LINE_OPT(LogImages,					bool);
+DE_DECLARE_COMMAND_LINE_OPT(TestOOM,					bool);
 
 static void parseIntList (const char* src, std::vector<int>* dst)
 {
@@ -109,7 +110,8 @@
 	{
 		{ "execute",		RUNMODE_EXECUTE				},
 		{ "xml-caselist",	RUNMODE_DUMP_XML_CASELIST	},
-		{ "txt-caselist",	RUNMODE_DUMP_TEXT_CASELIST	}
+		{ "txt-caselist",	RUNMODE_DUMP_TEXT_CASELIST	},
+		{ "stdout-caselist",RUNMODE_DUMP_STDOUT_CASELIST}
 	};
 	static const NamedValue<WindowVisibility> s_visibilites[] =
 	{
@@ -141,6 +143,7 @@
 		<< Option<LogFilename>			(DE_NULL,	"deqp-log-filename",			"Write test results to given file",					"TestResults.qpa")
 		<< Option<RunMode>				(DE_NULL,	"deqp-runmode",					"Execute tests, or write list of test cases into a file",
 																																		s_runModes,			"execute")
+		<< Option<ExportFilenamePattern>(DE_NULL,	"deqp-caselist-export-file",	"Set the target file name pattern for caselist export",					"${packageName}-cases.${typeExtension}")
 		<< Option<WatchDog>				(DE_NULL,	"deqp-watchdog",				"Enable test watchdog",								s_enableNames,		"disable")
 		<< Option<CrashHandler>			(DE_NULL,	"deqp-crashhandler",			"Enable crash handling",							s_enableNames,		"disable")
 		<< Option<BaseSeed>				(DE_NULL,	"deqp-base-seed",				"Base seed for test cases that use randomization",						"0")
@@ -785,22 +788,23 @@
 	return isOk;
 }
 
-const char*				CommandLine::getLogFileName				(void) const	{ return m_cmdLine.getOption<opt::LogFilename>().c_str();		}
-deUint32				CommandLine::getLogFlags				(void) const	{ return m_logFlags;											}
-RunMode					CommandLine::getRunMode					(void) const	{ return m_cmdLine.getOption<opt::RunMode>();					}
-WindowVisibility		CommandLine::getVisibility				(void) const	{ return m_cmdLine.getOption<opt::Visibility>();				}
-bool					CommandLine::isWatchDogEnabled			(void) const	{ return m_cmdLine.getOption<opt::WatchDog>();					}
-bool					CommandLine::isCrashHandlingEnabled		(void) const	{ return m_cmdLine.getOption<opt::CrashHandler>();				}
-int						CommandLine::getBaseSeed				(void) const	{ return m_cmdLine.getOption<opt::BaseSeed>();					}
-int						CommandLine::getTestIterationCount		(void) const	{ return m_cmdLine.getOption<opt::TestIterationCount>();		}
-int						CommandLine::getSurfaceWidth			(void) const	{ return m_cmdLine.getOption<opt::SurfaceWidth>();				}
-int						CommandLine::getSurfaceHeight			(void) const	{ return m_cmdLine.getOption<opt::SurfaceHeight>();				}
-SurfaceType				CommandLine::getSurfaceType				(void) const	{ return m_cmdLine.getOption<opt::SurfaceType>();				}
-ScreenRotation			CommandLine::getScreenRotation			(void) const	{ return m_cmdLine.getOption<opt::ScreenRotation>();			}
-int						CommandLine::getGLConfigId				(void) const	{ return m_cmdLine.getOption<opt::GLConfigID>();				}
-int						CommandLine::getCLPlatformId			(void) const	{ return m_cmdLine.getOption<opt::CLPlatformID>();				}
-const std::vector<int>&	CommandLine::getCLDeviceIds				(void) const	{ return m_cmdLine.getOption<opt::CLDeviceIDs>();				}
-bool					CommandLine::isOutOfMemoryTestEnabled	(void) const	{ return m_cmdLine.getOption<opt::TestOOM>();					}
+const char*				CommandLine::getLogFileName				(void) const	{ return m_cmdLine.getOption<opt::LogFilename>().c_str();		   }
+deUint32				CommandLine::getLogFlags				(void) const	{ return m_logFlags;											   }
+RunMode					CommandLine::getRunMode					(void) const	{ return m_cmdLine.getOption<opt::RunMode>();					   }
+const char*				CommandLine::getCaseListExportFile		(void) const	{ return m_cmdLine.getOption<opt::ExportFilenamePattern>().c_str();}
+WindowVisibility		CommandLine::getVisibility				(void) const	{ return m_cmdLine.getOption<opt::Visibility>();				   }
+bool					CommandLine::isWatchDogEnabled			(void) const	{ return m_cmdLine.getOption<opt::WatchDog>();					   }
+bool					CommandLine::isCrashHandlingEnabled		(void) const	{ return m_cmdLine.getOption<opt::CrashHandler>();				   }
+int						CommandLine::getBaseSeed				(void) const	{ return m_cmdLine.getOption<opt::BaseSeed>();					   }
+int						CommandLine::getTestIterationCount		(void) const	{ return m_cmdLine.getOption<opt::TestIterationCount>();		   }
+int						CommandLine::getSurfaceWidth			(void) const	{ return m_cmdLine.getOption<opt::SurfaceWidth>();				   }
+int						CommandLine::getSurfaceHeight			(void) const	{ return m_cmdLine.getOption<opt::SurfaceHeight>();				   }
+SurfaceType				CommandLine::getSurfaceType				(void) const	{ return m_cmdLine.getOption<opt::SurfaceType>();				   }
+ScreenRotation			CommandLine::getScreenRotation			(void) const	{ return m_cmdLine.getOption<opt::ScreenRotation>();			   }
+int						CommandLine::getGLConfigId				(void) const	{ return m_cmdLine.getOption<opt::GLConfigID>();				   }
+int						CommandLine::getCLPlatformId			(void) const	{ return m_cmdLine.getOption<opt::CLPlatformID>();				   }
+const std::vector<int>&	CommandLine::getCLDeviceIds				(void) const	{ return m_cmdLine.getOption<opt::CLDeviceIDs>();				   }
+bool					CommandLine::isOutOfMemoryTestEnabled	(void) const	{ return m_cmdLine.getOption<opt::TestOOM>();					   }
 
 const char* CommandLine::getGLContextType (void) const
 {
diff --git a/framework/common/tcuCommandLine.hpp b/framework/common/tcuCommandLine.hpp
index 1685e90..37a79a7 100644
--- a/framework/common/tcuCommandLine.hpp
+++ b/framework/common/tcuCommandLine.hpp
@@ -42,6 +42,7 @@
 	RUNMODE_EXECUTE = 0,			//! Test program executes the tests.
 	RUNMODE_DUMP_XML_CASELIST,		//! Test program dumps the list of contained test cases in XML format.
 	RUNMODE_DUMP_TEXT_CASELIST,		//! Test program dumps the list of contained test cases in plain-text format.
+	RUNMODE_DUMP_STDOUT_CASELIST,	//! Test program dumps the list of contained test cases in plain-text format into stdout.
 
 	RUNMODE_LAST
 };
@@ -114,6 +115,9 @@
 	//! Get run mode (--deqp-runmode)
 	RunMode							getRunMode					(void) const;
 
+	//! Get caselist dump target file pattern (--deqp-caselist-export-file)
+	const char*						getCaseListExportFile		(void) const;
+
 	//! Get default window visibility (--deqp-visibility)
 	WindowVisibility				getVisibility				(void) const;
 
diff --git a/framework/common/tcuCompressedTexture.cpp b/framework/common/tcuCompressedTexture.cpp
index c911576..7d0073b 100644
--- a/framework/common/tcuCompressedTexture.cpp
+++ b/framework/common/tcuCompressedTexture.cpp
@@ -330,33 +330,33 @@
 	const int numBits = (high-low) + 1;
 	DE_ASSERT(de::inRange(numBits, 1, 32));
 	if (numBits < 32)
-		return (src >> low) & ((1u<<numBits)-1);
+		return (deUint32)((src >> low) & ((1u<<numBits)-1));
 	else
-		return (src >> low) & 0xFFFFFFFFu;
+		return (deUint32)((src >> low) & 0xFFFFFFFFu);
 }
 
 inline deUint8 extend4To8 (deUint8 src)
 {
 	DE_ASSERT((src & ~((1<<4)-1)) == 0);
-	return (src << 4) | src;
+	return (deUint8)((src << 4) | src);
 }
 
 inline deUint8 extend5To8 (deUint8 src)
 {
 	DE_ASSERT((src & ~((1<<5)-1)) == 0);
-	return (src << 3) | (src >> 2);
+	return (deUint8)((src << 3) | (src >> 2));
 }
 
 inline deUint8 extend6To8 (deUint8 src)
 {
 	DE_ASSERT((src & ~((1<<6)-1)) == 0);
-	return (src << 2) | (src >> 4);
+	return (deUint8)((src << 2) | (src >> 4));
 }
 
 inline deUint8 extend7To8 (deUint8 src)
 {
 	DE_ASSERT((src & ~((1<<7)-1)) == 0);
-	return (src << 1) | (src >> 6);
+	return (deUint8)((src << 1) | (src >> 6));
 }
 
 inline deInt8 extendSigned3To8 (deUint8 src)
@@ -374,13 +374,13 @@
 inline deUint16 extend11To16 (deUint16 src)
 {
 	DE_ASSERT((src & ~((1<<11)-1)) == 0);
-	return (src << 5) | (src >> 6);
+	return (deUint16)((src << 5) | (src >> 6));
 }
 
 inline deInt16 extend11To16WithSign (deInt16 src)
 {
 	if (src < 0)
-		return -(deInt16)extend11To16(-src);
+		return (deInt16)(-(deInt16)extend11To16((deUint16)(-src)));
 	else
 		return (deInt16)extend11To16(src);
 }
@@ -591,7 +591,7 @@
 			const deUint32	distNdx		= (getBits(src, 34, 35) << 1) | getBit(src, 32);
 			const int		dist		= distTable[distNdx];
 
-			paintR[0] = extend4To8((R1a << 2) | R1b);
+			paintR[0] = extend4To8((deUint8)((R1a << 2) | R1b));
 			paintG[0] = extend4To8(G1);
 			paintB[0] = extend4To8(B1);
 			paintR[2] = extend4To8(R2);
@@ -623,8 +623,8 @@
 			int				dist;
 
 			baseR[0]		= extend4To8(R1);
-			baseG[0]		= extend4To8((G1a << 1) | G1b);
-			baseB[0]		= extend4To8((B1a << 3) | B1b);
+			baseG[0]		= extend4To8((deUint8)((G1a << 1) | G1b));
+			baseB[0]		= extend4To8((deUint8)((B1a << 3) | B1b));
 			baseR[1]		= extend4To8(R2);
 			baseG[1]		= extend4To8(G2);
 			baseB[1]		= extend4To8(B2);
@@ -685,9 +685,9 @@
 		const deUint8 RH1	= (deUint8)getBits(src, 34, 38);
 		const deUint8 RH2	= (deUint8)getBit(src, 32);
 		const deUint8 RO	= extend6To8((deUint8)getBits(src, 57, 62));
-		const deUint8 GO	= extend7To8((GO1 << 6) | GO2);
-		const deUint8 BO	= extend6To8((BO1 << 5) | (BO2 << 3) | BO3);
-		const deUint8 RH	= extend6To8((RH1 << 1) | RH2);
+		const deUint8 GO	= extend7To8((deUint8)((GO1 << 6) | GO2));
+		const deUint8 BO	= extend6To8((deUint8)((BO1 << 5) | (BO2 << 3) | BO3));
+		const deUint8 RH	= extend6To8((deUint8)((RH1 << 1) | RH2));
 		const deUint8 GH	= extend7To8((deUint8)getBits(src, 25, 31));
 		const deUint8 BH	= extend6To8((deUint8)getBits(src, 19, 24));
 		const deUint8 RV	= extend6To8((deUint8)getBits(src, 13, 18));
@@ -1103,7 +1103,7 @@
 		// \note "foo << bar << 1" done instead of "foo << (bar+1)" to avoid overflow, i.e. shift amount being too big.
 
 		if (word0Ndx == word1Ndx)
-			return (m_words[word0Ndx] & ((((Word)1 << high%WORD_BITS << 1) - 1))) >> ((Word)low % WORD_BITS);
+			return (deUint32)((m_words[word0Ndx] & ((((Word)1 << high%WORD_BITS << 1) - 1))) >> ((Word)low % WORD_BITS));
 		else
 		{
 			DE_ASSERT(word1Ndx == word0Ndx + 1);
@@ -1409,7 +1409,7 @@
 		deUint8* const dstU = (deUint8*)dst;
 		for (int i = 0; i < blockWidth*blockHeight; i++)
 		for (int c = 0; c < 4; c++)
-			dstU[i*4 + c] = (rgba[c] & 0xff00) >> 8;
+			dstU[i*4 + c] = (deUint8)((rgba[c] & 0xff00) >> 8);
 	}
 	else
 	{
@@ -1419,7 +1419,7 @@
 		{
 			for (int c = 0; c < 4; c++)
 			{
-				if (isFloat16InfOrNan(rgba[c]))
+				if (isFloat16InfOrNan((deFloat16)rgba[c]))
 					throw InternalError("Infinity or NaN color component in HDR void extent block in ASTC texture (behavior undefined by ASTC specification)");
 			}
 
@@ -2140,7 +2140,7 @@
 	}
 }
 
-void unquantizeWeights (deUint32* dst, const ISEDecodedResult* weightGrid, const ASTCBlockMode& blockMode)
+void unquantizeWeights (deUint32 dst[64], const ISEDecodedResult* weightGrid, const ASTCBlockMode& blockMode)
 {
 	const int			numWeights	= computeNumWeights(blockMode);
 	const ISEParams&	iseParams	= blockMode.weightISEParams;
@@ -2194,6 +2194,11 @@
 
 	for (int weightNdx = 0; weightNdx < numWeights; weightNdx++)
 		dst[weightNdx] += dst[weightNdx] > 32 ? 1 : 0;
+
+	// Initialize nonexistent weights to poison values
+	for (int weightNdx = numWeights; weightNdx < 64; weightNdx++)
+		dst[weightNdx] = ~0u;
+
 }
 
 void interpolateWeights (TexelWeightPair* dst, const deUint32* unquantizedWeights, int blockWidth, int blockHeight, const ASTCBlockMode& blockMode)
@@ -2264,23 +2269,31 @@
 	const deUint32	z		= smallBlock ? zIn << 1 : zIn;
 	const deUint32	seed	= seedIn + 1024*(numPartitions-1);
 	const deUint32	rnum	= hash52(seed);
-	deUint8			seed1	=  rnum							& 0xf;
-	deUint8			seed2	= (rnum >>  4)					& 0xf;
-	deUint8			seed3	= (rnum >>  8)					& 0xf;
-	deUint8			seed4	= (rnum >> 12)					& 0xf;
-	deUint8			seed5	= (rnum >> 16)					& 0xf;
-	deUint8			seed6	= (rnum >> 20)					& 0xf;
-	deUint8			seed7	= (rnum >> 24)					& 0xf;
-	deUint8			seed8	= (rnum >> 28)					& 0xf;
-	deUint8			seed9	= (rnum >> 18)					& 0xf;
-	deUint8			seed10	= (rnum >> 22)					& 0xf;
-	deUint8			seed11	= (rnum >> 26)					& 0xf;
-	deUint8			seed12	= ((rnum >> 30) | (rnum << 2))	& 0xf;
+	deUint8			seed1	= (deUint8)( rnum							& 0xf);
+	deUint8			seed2	= (deUint8)((rnum >>  4)					& 0xf);
+	deUint8			seed3	= (deUint8)((rnum >>  8)					& 0xf);
+	deUint8			seed4	= (deUint8)((rnum >> 12)					& 0xf);
+	deUint8			seed5	= (deUint8)((rnum >> 16)					& 0xf);
+	deUint8			seed6	= (deUint8)((rnum >> 20)					& 0xf);
+	deUint8			seed7	= (deUint8)((rnum >> 24)					& 0xf);
+	deUint8			seed8	= (deUint8)((rnum >> 28)					& 0xf);
+	deUint8			seed9	= (deUint8)((rnum >> 18)					& 0xf);
+	deUint8			seed10	= (deUint8)((rnum >> 22)					& 0xf);
+	deUint8			seed11	= (deUint8)((rnum >> 26)					& 0xf);
+	deUint8			seed12	= (deUint8)(((rnum >> 30) | (rnum << 2))	& 0xf);
 
-	seed1 *= seed1;		seed5 *= seed5;		seed9  *= seed9;
-	seed2 *= seed2;		seed6 *= seed6;		seed10 *= seed10;
-	seed3 *= seed3;		seed7 *= seed7;		seed11 *= seed11;
-	seed4 *= seed4;		seed8 *= seed8;		seed12 *= seed12;
+	seed1  = (deUint8)(seed1  * seed1 );
+	seed2  = (deUint8)(seed2  * seed2 );
+	seed3  = (deUint8)(seed3  * seed3 );
+	seed4  = (deUint8)(seed4  * seed4 );
+	seed5  = (deUint8)(seed5  * seed5 );
+	seed6  = (deUint8)(seed6  * seed6 );
+	seed7  = (deUint8)(seed7  * seed7 );
+	seed8  = (deUint8)(seed8  * seed8 );
+	seed9  = (deUint8)(seed9  * seed9 );
+	seed10 = (deUint8)(seed10 * seed10);
+	seed11 = (deUint8)(seed11 * seed11);
+	seed12 = (deUint8)(seed12 * seed12);
 
 	const int shA = (seed & 2) != 0		? 4		: 5;
 	const int shB = numPartitions == 3	? 6		: 5;
@@ -2288,9 +2301,18 @@
 	const int sh2 = (seed & 1) != 0		? shB	: shA;
 	const int sh3 = (seed & 0x10) != 0	? sh1	: sh2;
 
-	seed1 >>= sh1;		seed2  >>= sh2;		seed3  >>= sh1;		seed4  >>= sh2;
-	seed5 >>= sh1;		seed6  >>= sh2;		seed7  >>= sh1;		seed8  >>= sh2;
-	seed9 >>= sh3;		seed10 >>= sh3;		seed11 >>= sh3;		seed12 >>= sh3;
+	seed1  = (deUint8)(seed1  >> sh1);
+	seed2  = (deUint8)(seed2  >> sh2);
+	seed3  = (deUint8)(seed3  >> sh1);
+	seed4  = (deUint8)(seed4  >> sh2);
+	seed5  = (deUint8)(seed5  >> sh1);
+	seed6  = (deUint8)(seed6  >> sh2);
+	seed7  = (deUint8)(seed7  >> sh1);
+	seed8  = (deUint8)(seed8  >> sh2);
+	seed9  = (deUint8)(seed9  >> sh3);
+	seed10 = (deUint8)(seed10 >> sh3);
+	seed11 = (deUint8)(seed11 >> sh3);
+	seed12 = (deUint8)(seed12 >> sh3);
 
 	const int a =						0x3f & (seed1*x + seed2*y + seed11*z + (rnum >> 14));
 	const int b =						0x3f & (seed3*x + seed4*y + seed12*z + (rnum >> 10));
@@ -2351,7 +2373,7 @@
 					const deUint32 c	= (c0*(64-w) + c1*w + 32) / 64;
 
 					if (isSRGB)
-						((deUint8*)dst)[texelNdx*4 + channelNdx] = (c & 0xff00) >> 8;
+						((deUint8*)dst)[texelNdx*4 + channelNdx] = (deUint8)((c & 0xff00) >> 8);
 					else
 						((float*)dst)[texelNdx*4 + channelNdx] = c == 65535 ? 1.0f : (float)c / 65536.0f;
 				}
@@ -2367,7 +2389,7 @@
 					const deUint32		mt	= m < 512		? 3*m
 											: m >= 1536		? 5*m - 2048
 											:				  4*m - 512;
-					const deFloat16		cf	= (e << 10) + (mt >> 3);
+					const deFloat16		cf	= (deFloat16)((e << 10) + (mt >> 3));
 
 					((float*)dst)[texelNdx*4 + channelNdx] = deFloat16To32(isFloat16InfOrNan(cf) ? 0x7bff : cf);
 				}
diff --git a/framework/common/tcuFloat.hpp b/framework/common/tcuFloat.hpp
index c25692d..fcadc12 100644
--- a/framework/common/tcuFloat.hpp
+++ b/framework/common/tcuFloat.hpp
@@ -106,7 +106,7 @@
 	float					asFloat			(void) const;
 	double					asDouble		(void) const;
 
-	inline int				signBit			(void) const	{ return (m_value >> (ExponentBits+MantissaBits)) & 1;						}
+	inline int				signBit			(void) const	{ return (int)(m_value >> (ExponentBits+MantissaBits)) & 1;					}
 	inline StorageType		exponentBits	(void) const	{ return (m_value >> MantissaBits) & ((StorageType(1)<<ExponentBits)-1);	}
 	inline StorageType		mantissaBits	(void) const	{ return m_value & ((StorageType(1)<<MantissaBits)-1);						}
 
@@ -211,7 +211,7 @@
 	// Handles the typical notation for zero (min exponent, mantissa 0). Note that the exponent usually used exponent (-ExponentBias) for zero/subnormals is not used.
 	// Instead zero/subnormals have the (normally implicit) leading mantissa bit set to zero.
 	const bool			isDenormOrZero	= (exponent == 1 - ExponentBias) && (mantissa >> MantissaBits == 0);
-	const StorageType	s				= StorageType(sign < 0 ? 1 : 0) << (ExponentBits+MantissaBits);
+	const StorageType	s				= StorageType((StorageType(sign < 0 ? 1 : 0)) << (StorageType(ExponentBits+MantissaBits)));
 	const StorageType	exp				= (isShorthandZero  || isDenormOrZero) ? StorageType(0) : StorageType(exponent + ExponentBias);
 
 	DE_ASSERT(sign == +1 || sign == -1);
@@ -264,7 +264,7 @@
 		const int			eMin	= 1 - ExponentBias;
 		const int			eMax	= ((1<<ExponentBits)-2) - ExponentBias;
 
-		const StorageType	s		= StorageType(other.signBit()) << (ExponentBits+MantissaBits); // \note Not sign, but sign bit.
+		const StorageType	s		= StorageType((StorageType(other.signBit())) << (StorageType(ExponentBits+MantissaBits))); // \note Not sign, but sign bit.
 		int					e		= other.exponent();
 		deUint64			m		= other.mantissa();
 
diff --git a/framework/common/tcuFloatFormat.cpp b/framework/common/tcuFloatFormat.cpp
index 4c51d3e..d895e47 100644
--- a/framework/common/tcuFloatFormat.cpp
+++ b/framework/common/tcuFloatFormat.cpp
@@ -42,7 +42,7 @@
 		case NO:	return no;
 		case YES:	return yes;
 		case MAYBE:	return no | yes;
-		default:	DE_ASSERT(!"Impossible case");
+		default:	DE_FATAL("Impossible case");
 	}
 
 	return Interval();
diff --git a/framework/common/tcuFormatUtil.hpp b/framework/common/tcuFormatUtil.hpp
index 77f65bd..a45c728 100644
--- a/framework/common/tcuFormatUtil.hpp
+++ b/framework/common/tcuFormatUtil.hpp
@@ -35,7 +35,7 @@
 {
 
 // Hexadecimal value formatter.
-template <int NumDigits>
+template <size_t NumDigits>
 class Hex
 {
 public:
@@ -63,7 +63,7 @@
 	deUint64 value;
 };
 
-template <int NumDigits>
+template <size_t NumDigits>
 std::ostream& operator<< (std::ostream& stream, tcu::Format::Hex<NumDigits> hex)
 {
 	return hex.toStream(stream);
@@ -82,7 +82,7 @@
 
 #define TCU_BIT_DESC(BIT) tcu::Format::BitDesc(BIT, #BIT)
 
-template <int BitfieldSize>
+template <size_t BitfieldSize>
 class Bitfield
 {
 public:
@@ -123,7 +123,7 @@
 	const BitDesc*		m_end;
 };
 
-template <int BitfieldSize>
+template <size_t BitfieldSize>
 inline std::ostream& operator<< (std::ostream& stream, Bitfield<BitfieldSize> decoder)
 {
 	return decoder.toStream(stream);
@@ -131,7 +131,7 @@
 
 // Enum formatter.
 // \todo [2012-10-30 pyry] Use template for GetName.
-template <typename T, int NumBytes = sizeof(T)>
+template <typename T, size_t NumBytes = sizeof(T)>
 class Enum
 {
 public:
@@ -149,7 +149,7 @@
 		if (name)
 			return stream << name;
 		else
-			return stream << Hex<NumBytes*2>(m_value);
+			return stream << Hex<NumBytes*2>((deUint64)m_value);
 	}
 
 	std::string toString (void) const
@@ -158,7 +158,7 @@
 		if (name)
 			return std::string(name);
 		else
-			return Hex<NumBytes*2>(m_value).toString();
+			return Hex<NumBytes*2>((deUint64)m_value).toString();
 	}
 
 private:
@@ -166,7 +166,7 @@
 	const T				m_value;
 };
 
-template <typename T, int NumBytes>
+template <typename T, size_t NumBytes>
 inline std::ostream& operator<< (std::ostream& stream, const Enum<T, NumBytes>& fmt) { return fmt.toStream(stream); }
 
 // Array formatters.
@@ -245,7 +245,7 @@
 template <typename T>	inline deUint64	toUint64			(T value)			{ return (deUint64)value & makeMask64<sizeof(T)*8>();	}
 
 /** Format value as hexadecimal number. */
-template <int NumDigits, typename T>
+template <size_t NumDigits, typename T>
 inline Format::Hex<NumDigits> toHex (T value)
 {
 	return Format::Hex<NumDigits>(toUint64(value));
diff --git a/framework/common/tcuFuzzyImageCompare.cpp b/framework/common/tcuFuzzyImageCompare.cpp
index 7d4eda1..596ab83 100644
--- a/framework/common/tcuFuzzyImageCompare.cpp
+++ b/framework/common/tcuFuzzyImageCompare.cpp
@@ -32,6 +32,11 @@
 namespace tcu
 {
 
+enum
+{
+	MIN_ERR_THRESHOLD	= 4 // Magic to make small differences go away
+};
+
 using std::vector;
 
 template<int Channel>
@@ -105,17 +110,14 @@
 }
 #endif
 
-static inline float compareColors (deUint32 pa, deUint32 pb, int minErrThreshold)
+static inline deUint32 colorDistSquared (deUint32 pa, deUint32 pb)
 {
-	int r = de::max<int>(de::abs((int)getChannel<0>(pa) - (int)getChannel<0>(pb)) - minErrThreshold, 0);
-	int g = de::max<int>(de::abs((int)getChannel<1>(pa) - (int)getChannel<1>(pb)) - minErrThreshold, 0);
-	int b = de::max<int>(de::abs((int)getChannel<2>(pa) - (int)getChannel<2>(pb)) - minErrThreshold, 0);
-	int a = de::max<int>(de::abs((int)getChannel<3>(pa) - (int)getChannel<3>(pb)) - minErrThreshold, 0);
+	const int	r	= de::max<int>(de::abs((int)getChannel<0>(pa) - (int)getChannel<0>(pb)) - MIN_ERR_THRESHOLD, 0);
+	const int	g	= de::max<int>(de::abs((int)getChannel<1>(pa) - (int)getChannel<1>(pb)) - MIN_ERR_THRESHOLD, 0);
+	const int	b	= de::max<int>(de::abs((int)getChannel<2>(pa) - (int)getChannel<2>(pb)) - MIN_ERR_THRESHOLD, 0);
+	const int	a	= de::max<int>(de::abs((int)getChannel<3>(pa) - (int)getChannel<3>(pb)) - MIN_ERR_THRESHOLD, 0);
 
-	float scale	= 1.0f/(255-minErrThreshold);
-	float sqSum	= (float)(r*r + g*g + b*b + a*a) * (scale*scale);
-
-	return deFloatSqrt(sqSum);
+	return deUint32(r*r + g*g + b*b + a*a);
 }
 
 template<int NumChannels>
@@ -208,14 +210,13 @@
 }
 
 template<int NumChannels>
-static float compareToNeighbor (const FuzzyCompareParams& params, de::Random& rnd, deUint32 pixel, const ConstPixelBufferAccess& surface, int x, int y)
+static deUint32 distSquaredToNeighbor (de::Random& rnd, deUint32 pixel, const ConstPixelBufferAccess& surface, int x, int y)
 {
-	float minErr = +100.f;
-
 	// (x, y) + (0, 0)
-	minErr = deFloatMin(minErr, compareColors(pixel, readUnorm8<NumChannels>(surface, x, y), params.minErrThreshold));
-	if (minErr == 0.0f)
-		return minErr;
+	deUint32	minDist		= colorDistSquared(pixel, readUnorm8<NumChannels>(surface, x, y));
+
+	if (minDist == 0)
+		return minDist;
 
 	// Area around (x, y)
 	static const int s_coords[][2] =
@@ -238,9 +239,9 @@
 		if (!deInBounds32(dx, 0, surface.getWidth()) || !deInBounds32(dy, 0, surface.getHeight()))
 			continue;
 
-		minErr = deFloatMin(minErr, compareColors(pixel, readUnorm8<NumChannels>(surface, dx, dy), params.minErrThreshold));
-		if (minErr == 0.0f)
-			return minErr;
+		minDist = de::min(minDist, colorDistSquared(pixel, readUnorm8<NumChannels>(surface, dx, dy)));
+		if (minDist == 0)
+			return minDist;
 	}
 
 	// Random bilinear-interpolated samples around (x, y)
@@ -251,12 +252,12 @@
 
 		deUint32 sample = bilinearSample<NumChannels>(surface, dx, dy);
 
-		minErr = deFloatMin(minErr, compareColors(pixel, sample, params.minErrThreshold));
-		if (minErr == 0.0f)
-			return minErr;
+		minDist = de::min(minDist, colorDistSquared(pixel, sample));
+		if (minDist == 0)
+			return minDist;
 	}
 
-	return minErr;
+	return minDist;
 }
 
 static inline float toGrayscale (const Vec4& c)
@@ -285,7 +286,7 @@
 	TextureLevel refFiltered(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), width, height);
 	TextureLevel cmpFiltered(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), width, height);
 
-	// Kernel = {0.15, 0.7, 0.15}
+	// Kernel = {0.1, 0.8, 0.1}
 	vector<float> kernel(3);
 	kernel[0] = kernel[2] = 0.1f; kernel[1]= 0.8f;
 	int shift = (int)(kernel.size() - 1) / 2;
@@ -306,8 +307,8 @@
 			DE_ASSERT(DE_FALSE);
 	}
 
-	int		numSamples	= 0;
-	float	errSum		= 0.0f;
+	int			numSamples	= 0;
+	deUint64	distSum4	= 0ull;
 
 	// Clear error mask to green.
 	clear(errorMask, Vec4(0.0f, 1.0f, 0.0f, 1.0f));
@@ -319,27 +320,36 @@
 	{
 		for (int x = 1; x < width-1; x += params.maxSampleSkip > 0 ? (int)rnd.getInt(0, params.maxSampleSkip) : 1)
 		{
-			const float	err0	= compareToNeighbor<4>(params, rnd, readUnorm8<4>(refAccess, x, y), cmpAccess, x, y);
-			const float	err1	= compareToNeighbor<4>(params, rnd, readUnorm8<4>(cmpAccess, x, y), refAccess, x, y);
-			float		err		= deFloatMin(err0, err1);
+			const deUint32	minDist2RefToCmp	= distSquaredToNeighbor<4>(rnd, readUnorm8<4>(refAccess, x, y), cmpAccess, x, y);
+			const deUint32	minDist2CmpToRef	= distSquaredToNeighbor<4>(rnd, readUnorm8<4>(cmpAccess, x, y), refAccess, x, y);
+			const deUint32	minDist2			= de::min(minDist2RefToCmp, minDist2CmpToRef);
+			const deUint64	newSum4				= distSum4 + minDist2*minDist2;
 
-			err = deFloatPow(err, params.errExp);
-
-			errSum		+= err;
+			distSum4	 = (newSum4 >= distSum4) ? newSum4 : ~0ull; // In case of overflow
 			numSamples	+= 1;
 
 			// Build error image.
-			float	red		= err * 500.0f;
-			float	luma	= toGrayscale(cmp.getPixel(x, y));
-			float	rF		= 0.7f + 0.3f*luma;
-			errorMask.setPixel(Vec4(red*rF, (1.0f-red)*rF, 0.0f, 1.0f), x, y);
+			{
+				const int	scale	= 255-MIN_ERR_THRESHOLD;
+				const float	err2	= float(minDist2) / float(scale*scale);
+				const float	err4	= err2*err2;
+				const float	red		= err4 * 500.0f;
+				const float	luma	= toGrayscale(cmp.getPixel(x, y));
+				const float	rF		= 0.7f + 0.3f*luma;
+
+				errorMask.setPixel(Vec4(red*rF, (1.0f-red)*rF, 0.0f, 1.0f), x, y);
+			}
 		}
 	}
 
-	// Scale error sum based on number of samples taken
-	errSum *= (float)((width-2) * (height-2)) / (float)numSamples;
+	{
+		// Scale error sum based on number of samples taken
+		const double	pSamples	= double((width-2) * (height-2)) / double(numSamples);
+		const deUint64	colScale	= deUint64(255-MIN_ERR_THRESHOLD);
+		const deUint64	colScale4	= colScale*colScale*colScale*colScale;
 
-	return errSum;
+		return float(double(distSum4) / double(colScale4) * pSamples);
+	}
 }
 
 } // tcu
diff --git a/framework/common/tcuFuzzyImageCompare.hpp b/framework/common/tcuFuzzyImageCompare.hpp
index ba28ab4..0c81fbc 100644
--- a/framework/common/tcuFuzzyImageCompare.hpp
+++ b/framework/common/tcuFuzzyImageCompare.hpp
@@ -33,18 +33,12 @@
 
 struct FuzzyCompareParams
 {
-	FuzzyCompareParams (int		maxSampleSkip_		= 8,
-						int		minErrThreshold_	= 4,
-						float	errExp_				= 4.0f)
-		: maxSampleSkip		(maxSampleSkip_)
-		, minErrThreshold	(minErrThreshold_)
-		, errExp			(errExp_)
+	FuzzyCompareParams (int maxSampleSkip_ = 8)
+		: maxSampleSkip(maxSampleSkip_)
 	{
 	}
 
 	int		maxSampleSkip;
-	int		minErrThreshold;
-	float	errExp;
 };
 
 float fuzzyCompare (const FuzzyCompareParams& params, const ConstPixelBufferAccess& ref, const ConstPixelBufferAccess& cmp, const PixelBufferAccess& errorMask);
diff --git a/framework/common/tcuImageCompare.cpp b/framework/common/tcuImageCompare.cpp
index 0811c92..469b095 100644
--- a/framework/common/tcuImageCompare.cpp
+++ b/framework/common/tcuImageCompare.cpp
@@ -101,9 +101,9 @@
 	const int			beginX				= (acceptOutOfBoundsAsAnyValue) ? (maxPositionDeviation.x()) : (0);
 	const int			beginY				= (acceptOutOfBoundsAsAnyValue) ? (maxPositionDeviation.y()) : (0);
 	const int			beginZ				= (acceptOutOfBoundsAsAnyValue) ? (maxPositionDeviation.z()) : (0);
-	const int			endX				= (acceptOutOfBoundsAsAnyValue) ? (width  - maxPositionDeviation.x()) : (0);
-	const int			endY				= (acceptOutOfBoundsAsAnyValue) ? (height - maxPositionDeviation.y()) : (0);
-	const int			endZ				= (acceptOutOfBoundsAsAnyValue) ? (depth  - maxPositionDeviation.z()) : (0);
+	const int			endX				= (acceptOutOfBoundsAsAnyValue) ? (width  - maxPositionDeviation.x()) : (width);
+	const int			endY				= (acceptOutOfBoundsAsAnyValue) ? (height - maxPositionDeviation.y()) : (height);
+	const int			endZ				= (acceptOutOfBoundsAsAnyValue) ? (depth  - maxPositionDeviation.z()) : (depth);
 
 	TCU_CHECK_INTERNAL(result.getWidth() == width && result.getHeight() == height && result.getDepth() == depth);
 
@@ -427,8 +427,9 @@
 			// the gap here too to keep the float enumeration continuous.
 			//
 			// Denormals occupy one exponent pattern. Removing one from
-			// exponent should to the trick.
-			return (deInt32)(f.bits() - (1u << 23u));
+			// exponent should to the trick. Add one since the removed range
+			// contained one representable value, 0.
+			return (deInt32)(f.bits() - (1u << 23u) + 1u);
 		}
 	}
 }
diff --git a/framework/common/tcuImageIO.cpp b/framework/common/tcuImageIO.cpp
index e17443b..a87360f 100644
--- a/framework/common/tcuImageIO.cpp
+++ b/framework/common/tcuImageIO.cpp
@@ -214,7 +214,7 @@
 {
 	deUint16 val;
 	resource->read((deUint8*)&val, sizeof(val));
-	return ((val >> 8) & 0xFF) | ((val << 8) & 0xFF00);
+	return (deUint16)(((val >> 8) & 0xFF) | ((val << 8) & 0xFF00));
 }
 
 /*--------------------------------------------------------------------*//*!
diff --git a/framework/common/tcuRGBA.cpp b/framework/common/tcuRGBA.cpp
index 3d8d399..fedd91c 100644
--- a/framework/common/tcuRGBA.cpp
+++ b/framework/common/tcuRGBA.cpp
@@ -23,6 +23,7 @@
 
 #include "tcuRGBA.hpp"
 #include "tcuVector.hpp"
+#include "tcuTextureUtil.hpp"
 
 namespace tcu
 {
@@ -36,10 +37,10 @@
 
 RGBA::RGBA (const Vec4& v)
 {
-	int r = deClamp32(int(v.x() * 255.0f + 0.5f), 0, 255);
-	int g = deClamp32(int(v.y() * 255.0f + 0.5f), 0, 255);
-	int b = deClamp32(int(v.z() * 255.0f + 0.5f), 0, 255);
-	int a = deClamp32(int(v.w() * 255.0f + 0.5f), 0, 255);
+	const deUint32 r = (deUint32)floatToU8(v.x());
+	const deUint32 g = (deUint32)floatToU8(v.y());
+	const deUint32 b = (deUint32)floatToU8(v.z());
+	const deUint32 a = (deUint32)floatToU8(v.w());
 	m_value = (a << ALPHA_SHIFT) | (r << RED_SHIFT) | (g << GREEN_SHIFT) | (b << BLUE_SHIFT);
 }
 
diff --git a/framework/common/tcuRGBA.hpp b/framework/common/tcuRGBA.hpp
index c5d3243..76e7dbc 100644
--- a/framework/common/tcuRGBA.hpp
+++ b/framework/common/tcuRGBA.hpp
@@ -62,7 +62,7 @@
 		DE_ASSERT(deInRange32(g, 0, 255));
 		DE_ASSERT(deInRange32(b, 0, 255));
 		DE_ASSERT(deInRange32(a, 0, 255));
-		m_value = (a << ALPHA_SHIFT) | (r << RED_SHIFT) | (g << GREEN_SHIFT) | (b << BLUE_SHIFT);
+		m_value = ((deUint32)a << ALPHA_SHIFT) | ((deUint32)r << RED_SHIFT) | ((deUint32)g << GREEN_SHIFT) | ((deUint32)b << BLUE_SHIFT);
 	}
 
 	explicit RGBA (deUint32 val)
@@ -72,20 +72,20 @@
 
 	explicit	RGBA					(const Vec4& v);
 
-	void		setRed					(int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~(0xFF << RED_SHIFT)) | (v << RED_SHIFT); }
-	void		setGreen				(int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~(0xFF << GREEN_SHIFT)) | (v << GREEN_SHIFT); }
-	void		setBlue					(int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~(0xFF << BLUE_SHIFT)) | (v << BLUE_SHIFT); }
-	void		setAlpha				(int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~(0xFF << ALPHA_SHIFT)) | (v << ALPHA_SHIFT); }
-	int			getRed					(void) const { return (m_value >> RED_SHIFT) & 0xFF; }
-	int			getGreen				(void) const { return (m_value >> GREEN_SHIFT) & 0xFF; }
-	int			getBlue					(void) const { return (m_value >> BLUE_SHIFT) & 0xFF; }
-	int			getAlpha				(void) const { return (m_value >> ALPHA_SHIFT) & 0xFF; }
+	void		setRed					(int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~((deUint32)0xFFu << RED_SHIFT))   | ((deUint32)v << RED_SHIFT);   }
+	void		setGreen				(int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~((deUint32)0xFFu << GREEN_SHIFT)) | ((deUint32)v << GREEN_SHIFT); }
+	void		setBlue					(int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~((deUint32)0xFFu << BLUE_SHIFT))  | ((deUint32)v << BLUE_SHIFT);  }
+	void		setAlpha				(int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~((deUint32)0xFFu << ALPHA_SHIFT)) | ((deUint32)v << ALPHA_SHIFT); }
+	int			getRed					(void) const { return (int)((m_value >> (deUint32)RED_SHIFT)   & 0xFFu); }
+	int			getGreen				(void) const { return (int)((m_value >> (deUint32)GREEN_SHIFT) & 0xFFu); }
+	int			getBlue					(void) const { return (int)((m_value >> (deUint32)BLUE_SHIFT)  & 0xFFu); }
+	int			getAlpha				(void) const { return (int)((m_value >> (deUint32)ALPHA_SHIFT) & 0xFFu); }
 	deUint32	getPacked				(void) const { return m_value; }
 
 	bool		isBelowThreshold		(RGBA thr) const	{ return (getRed() <= thr.getRed()) && (getGreen() <= thr.getGreen()) && (getBlue() <= thr.getBlue()) && (getAlpha() <= thr.getAlpha()); }
 
 	static RGBA	fromBytes				(const deUint8* bytes)	{ return RGBA(bytes[0], bytes[1], bytes[2], bytes[3]); }
-	void		toBytes					(deUint8* bytes) const	{ bytes[0] = getRed(); bytes[1] = getGreen(); bytes[2] = getBlue(); bytes[3] = getAlpha(); }
+	void		toBytes					(deUint8* bytes) const	{ bytes[0] = (deUint8)getRed(); bytes[1] = (deUint8)getGreen(); bytes[2] = (deUint8)getBlue(); bytes[3] = (deUint8)getAlpha(); }
 	Vec4		toVec					(void) const;
 	IVec4		toIVec					(void) const;
 
diff --git a/framework/common/tcuResultCollector.cpp b/framework/common/tcuResultCollector.cpp
index e760466..d5e0c29 100644
--- a/framework/common/tcuResultCollector.cpp
+++ b/framework/common/tcuResultCollector.cpp
@@ -43,7 +43,7 @@
 		case QP_TEST_RESULT_RESOURCE_ERROR:			return 110;
 		case QP_TEST_RESULT_INTERNAL_ERROR:			return 120;
 		case QP_TEST_RESULT_CRASH:					return 150;
-		default:									DE_ASSERT(!"Impossible case");
+		default:									DE_FATAL("Impossible case");
 	}
 	return 0;
 }
diff --git a/framework/common/tcuResultCollector.hpp b/framework/common/tcuResultCollector.hpp
index d4af499..7fb8ed2 100644
--- a/framework/common/tcuResultCollector.hpp
+++ b/framework/common/tcuResultCollector.hpp
@@ -43,24 +43,25 @@
 class ResultCollector
 {
 public:
-					ResultCollector			(void);
-					ResultCollector			(TestLog& log, const std::string& prefix = "");
+						ResultCollector			(void);
+						ResultCollector			(TestLog& log, const std::string& prefix = "");
 
-	qpTestResult	getResult				(void) const  { return m_result; }
+	qpTestResult		getResult				(void) const { return m_result;		}
+	const std::string	getMessage				(void) const { return m_message;	}
 
-	void			fail					(const std::string& msg);
-	bool			check					(bool condition, const std::string& msg);
+	void				fail					(const std::string& msg);
+	bool				check					(bool condition, const std::string& msg);
 
-	void			addResult				(qpTestResult result, const std::string& msg);
-	bool			checkResult				(bool condition, qpTestResult result, const std::string& msg);
+	void				addResult				(qpTestResult result, const std::string& msg);
+	bool				checkResult				(bool condition, qpTestResult result, const std::string& msg);
 
-	void			setTestContextResult	(TestContext& testCtx);
+	void				setTestContextResult	(TestContext& testCtx);
 
 private:
-	TestLog*		m_log;
-	std::string		m_prefix;
-	qpTestResult	m_result;
-	std::string		m_message;
+	TestLog* const		m_log;
+	const std::string	m_prefix;
+	qpTestResult		m_result;
+	std::string			m_message;
 } DE_WARN_UNUSED_TYPE;
 
 } // tcu
diff --git a/framework/common/tcuSeedBuilder.cpp b/framework/common/tcuSeedBuilder.cpp
index b08d22d..688b9c7 100644
--- a/framework/common/tcuSeedBuilder.cpp
+++ b/framework/common/tcuSeedBuilder.cpp
@@ -87,7 +87,7 @@
 
 SeedBuilder& operator<< (SeedBuilder& builder, deUint8 value)
 {
-	const deInt8 val = value ^ 140u;
+	const deUint8 val = value ^ 140u;
 
 	builder.feed(sizeof(val), &val);
 	return builder;
diff --git a/framework/common/tcuSurface.cpp b/framework/common/tcuSurface.cpp
index 6e796e7..9a1238e 100644
--- a/framework/common/tcuSurface.cpp
+++ b/framework/common/tcuSurface.cpp
@@ -53,5 +53,5 @@
 {
 	m_width		= width;
 	m_height	= height;
-	m_pixels.resize(width*height);
+	m_pixels.setStorage(width * height);
 }
diff --git a/framework/common/tcuSurface.hpp b/framework/common/tcuSurface.hpp
index 89f2073..b9e4863 100644
--- a/framework/common/tcuSurface.hpp
+++ b/framework/common/tcuSurface.hpp
@@ -27,7 +27,7 @@
 #include "tcuRGBA.hpp"
 #include "tcuTexture.hpp"
 
-#include <vector>
+#include "deArrayBuffer.hpp"
 
 namespace tcu
 {
@@ -62,9 +62,9 @@
 private:
 	// \note Copy constructor and assignment operators are public and auto-generated
 
-	int						m_width;
-	int 					m_height;
-	std::vector<deUint32>	m_pixels;
+	int							m_width;
+	int 						m_height;
+	de::ArrayBuffer<deUint32>	m_pixels;
 } DE_WARN_UNUSED_TYPE;
 
 inline void Surface::setPixel (int x, int y, RGBA col)
@@ -72,7 +72,7 @@
 	DE_ASSERT(de::inBounds(x, 0, m_width) && de::inBounds(y, 0, m_height));
 
 	const int		pixOffset	= y*m_width + x;
-	deUint32*		pixAddr		= &m_pixels[pixOffset];
+	deUint32*		pixAddr		= m_pixels.getElementPtr(pixOffset);
 
 #if (DE_ENDIANNESS == DE_LITTLE_ENDIAN)
 	*pixAddr = col.getPacked();
@@ -89,7 +89,7 @@
 	DE_ASSERT(de::inBounds(x, 0, m_width) && de::inBounds(y, 0, m_height));
 
 	const int		pixOffset	= y*m_width + x;
-	const deUint32*	pixAddr		= &m_pixels[pixOffset];
+	const deUint32*	pixAddr		= m_pixels.getElementPtr(pixOffset);
 
 	DE_STATIC_ASSERT(RGBA::RED_SHIFT == 0 && RGBA::GREEN_SHIFT == 8 && RGBA::BLUE_SHIFT == 16 && RGBA::ALPHA_SHIFT == 24);
 
@@ -104,13 +104,13 @@
 /** Get pixel buffer access from surface. */
 inline ConstPixelBufferAccess Surface::getAccess (void) const
 {
-	return ConstPixelBufferAccess(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), m_width, m_height, 1, m_pixels.empty() ? DE_NULL : &m_pixels[0]);
+	return ConstPixelBufferAccess(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), m_width, m_height, 1, m_pixels.empty() ? DE_NULL : m_pixels.getPtr());
 }
 
 /** Get pixel buffer access from surface. */
 inline PixelBufferAccess Surface::getAccess (void)
 {
-	return PixelBufferAccess(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), m_width, m_height, 1, m_pixels.empty() ? DE_NULL : &m_pixels[0]);
+	return PixelBufferAccess(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), m_width, m_height, 1, m_pixels.empty() ? DE_NULL : m_pixels.getPtr());
 }
 
 } // tcu
diff --git a/framework/common/tcuTestHierarchyUtil.cpp b/framework/common/tcuTestHierarchyUtil.cpp
index e8cd6c9..dc21619 100644
--- a/framework/common/tcuTestHierarchyUtil.cpp
+++ b/framework/common/tcuTestHierarchyUtil.cpp
@@ -23,6 +23,8 @@
 
 #include "tcuTestHierarchyUtil.hpp"
 #include "tcuStringTemplate.hpp"
+#include "tcuCommandLine.hpp"
+
 #include "qpXmlWriter.h"
 
 #include <fstream>
@@ -57,122 +59,141 @@
 	return StringTemplate(pattern).specialize(args);
 }
 
-void writeXmlCaselists (TestPackageRoot& root, TestContext& testCtx, const tcu::CommandLine& cmdLine)
+static void writeXmlCaselist (TestHierarchyIterator& iter, qpXmlWriter* writer)
 {
-	const  char* const			filenamePattern	= "${packageName}-cases.${typeExtension}";	// \todo [2015-02-27 pyry] Make this command line argument
-	DefaultHierarchyInflater	inflater		(testCtx);
-	TestHierarchyIterator		iter			(root, inflater, cmdLine);
-	FILE*						curFile			= DE_NULL;
-	qpXmlWriter*				writer			= DE_NULL;
+	DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE &&
+			  iter.getNode()->getNodeType() == NODETYPE_PACKAGE);
 
-	try
 	{
-		while (iter.getState() != TestHierarchyIterator::STATE_FINISHED)
+		const TestNode* node		= iter.getNode();
+		qpXmlAttribute	attribs[2];
+		int				numAttribs	= 0;
+		attribs[numAttribs++] = qpSetStringAttrib("PackageName", node->getName());
+		attribs[numAttribs++] = qpSetStringAttrib("Description", node->getDescription());
+		DE_ASSERT(numAttribs <= DE_LENGTH_OF_ARRAY(attribs));
+
+		if (!qpXmlWriter_startDocument(writer) ||
+			!qpXmlWriter_startElement(writer, "TestCaseList", numAttribs, attribs))
+			throw Exception("Failed to start XML document");
+	}
+
+	iter.next();
+
+	while (iter.getNode()->getNodeType() != NODETYPE_PACKAGE)
+	{
+		const TestNode* const	node		= iter.getNode();
+		const TestNodeType		nodeType	= node->getNodeType();
+		const bool				isEnter		= iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE;
+
+		DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE ||
+				  iter.getState() == TestHierarchyIterator::STATE_LEAVE_NODE);
 		{
-			const TestNode* const	node		= iter.getNode();
-			const TestNodeType		nodeType	= node->getNodeType();
-			const bool				isEnter		= iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE;
-
-			DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE ||
-					  iter.getState() == TestHierarchyIterator::STATE_LEAVE_NODE);
-
-			if (nodeType == NODETYPE_PACKAGE)
+			if (isEnter)
 			{
-				if (isEnter)
-				{
-					const string	filename	= makePackageFilename(filenamePattern, node->getName(), "xml");
-					qpXmlAttribute	attribs[2];
-					int				numAttribs	= 0;
+				const string	caseName	= node->getName();
+				const string	description	= node->getDescription();
+				qpXmlAttribute	attribs[3];
+				int				numAttribs = 0;
 
-					DE_ASSERT(!curFile && !writer);
+				attribs[numAttribs++] = qpSetStringAttrib("Name",			caseName.c_str());
+				attribs[numAttribs++] = qpSetStringAttrib("CaseType",		getNodeTypeName(nodeType));
+				attribs[numAttribs++] = qpSetStringAttrib("Description",	description.c_str());
+				DE_ASSERT(numAttribs <= DE_LENGTH_OF_ARRAY(attribs));
 
-					print("Writing test cases from '%s' to file '%s'..\n", node->getName(), filename.c_str());
-
-					curFile = fopen(filename.c_str(), "wb");
-					if (!curFile)
-						throw Exception("Failed to open " + filename);
-
-					writer = qpXmlWriter_createFileWriter(curFile, DE_FALSE);
-					if (!writer)
-						throw Exception("Failed to create qpXmlWriter");
-
-					attribs[numAttribs++] = qpSetStringAttrib("PackageName",	node->getName());
-					attribs[numAttribs++] = qpSetStringAttrib("Description",	node->getDescription());
-					DE_ASSERT(numAttribs <= DE_LENGTH_OF_ARRAY(attribs));
-
-					if (!qpXmlWriter_startDocument(writer) ||
-						!qpXmlWriter_startElement(writer, "TestCaseList", numAttribs, attribs))
-						throw Exception("Failed to start XML document");
-				}
-				else
-				{
-					if (!qpXmlWriter_endElement(writer, "TestCaseList") ||
-						!qpXmlWriter_endDocument(writer))
-						throw Exception("Failed to terminate XML document");
-
-					qpXmlWriter_destroy(writer);
-					fclose(curFile);
-
-					writer	= DE_NULL;
-					curFile	= DE_NULL;
-				}
+				if (!qpXmlWriter_startElement(writer, "TestCase", numAttribs, attribs))
+					throw Exception("Writing to case list file failed");
 			}
 			else
 			{
-				if (isEnter)
-				{
-					const string	caseName	= node->getName();
-					const string	description	= node->getDescription();
-					qpXmlAttribute	attribs[3];
-					int				numAttribs = 0;
-
-					attribs[numAttribs++] = qpSetStringAttrib("Name",			caseName.c_str());
-					attribs[numAttribs++] = qpSetStringAttrib("CaseType",		getNodeTypeName(nodeType));
-					attribs[numAttribs++] = qpSetStringAttrib("Description",	description.c_str());
-					DE_ASSERT(numAttribs <= DE_LENGTH_OF_ARRAY(attribs));
-
-					if (!qpXmlWriter_startElement(writer, "TestCase", numAttribs, attribs))
-						throw Exception("Writing to case list file failed");
-				}
-				else
-				{
-					if (!qpXmlWriter_endElement(writer, "TestCase"))
-						throw tcu::Exception("Writing to case list file failed");
-				}
+				if (!qpXmlWriter_endElement(writer, "TestCase"))
+					throw tcu::Exception("Writing to case list file failed");
 			}
-
-			iter.next();
 		}
-	}
-	catch (...)
-	{
-		if (writer)
-			qpXmlWriter_destroy(writer);
 
-		if (curFile)
-			fclose(curFile);
-
-		throw;
+		iter.next();
 	}
 
-	DE_ASSERT(!curFile && !writer);
+	// This could be done in catch, but the file is corrupt at that point anyways.
+	if (!qpXmlWriter_endElement(writer, "TestCaseList") ||
+		!qpXmlWriter_endDocument(writer))
+		throw Exception("Failed to terminate XML document");
 }
 
-void writeTxtCaselists (TestPackageRoot& root, TestContext& testCtx, const tcu::CommandLine& cmdLine)
+/*--------------------------------------------------------------------*//*!
+ * \brief Export the test list of each package into a separate XML file.
+ *//*--------------------------------------------------------------------*/
+void writeXmlCaselistsToFiles (TestPackageRoot& root, TestContext& testCtx, const CommandLine& cmdLine)
 {
-	const  char* const			filenamePattern	= "${packageName}-cases.${typeExtension}";	// \todo [2015-02-27 pyry] Make this command line argument
 	DefaultHierarchyInflater	inflater		(testCtx);
 	TestHierarchyIterator		iter			(root, inflater, cmdLine);
+	const char* const			filenamePattern = cmdLine.getCaseListExportFile();
 
 	while (iter.getState() != TestHierarchyIterator::STATE_FINISHED)
 	{
+		const TestNode* node		= iter.getNode();
+		const char*		pkgName		= node->getName();
+		const string	filename	= makePackageFilename(filenamePattern, pkgName, "xml");
+
 		DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE &&
+				  node->getNodeType() == NODETYPE_PACKAGE);
+
+		FILE* 			file 	= DE_NULL;
+		qpXmlWriter*	writer	= DE_NULL;
+
+		try
+		{
+			file = fopen(filename.c_str(), "wb");
+			if (!file)
+				throw Exception("Failed to open " + filename);
+
+			writer = qpXmlWriter_createFileWriter(file, DE_FALSE);
+			if (!writer)
+				throw Exception("XML writer creation failed");
+
+			print("Writing test cases from '%s' to file '%s'..\n", pkgName, filename.c_str());
+
+			writeXmlCaselist(iter, writer);
+
+			qpXmlWriter_destroy(writer);
+			writer = DE_NULL;
+
+			fclose(file);
+			file = DE_NULL;
+		}
+		catch (...)
+		{
+			if (writer)
+				qpXmlWriter_destroy(writer);
+			if (file)
+				fclose(file);
+			throw;
+		}
+
+		DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_LEAVE_NODE &&
 				  iter.getNode()->getNodeType() == NODETYPE_PACKAGE);
+		iter.next();
+	}
+}
 
-		const char*		pkgName		= iter.getNode()->getName();
+/*--------------------------------------------------------------------*//*!
+ * \brief Export the test list of each package into a separate ascii file.
+ *//*--------------------------------------------------------------------*/
+void writeTxtCaselistsToFiles (TestPackageRoot& root, TestContext& testCtx, const CommandLine& cmdLine)
+{
+	DefaultHierarchyInflater	inflater		(testCtx);
+	TestHierarchyIterator		iter			(root, inflater, cmdLine);
+	const char* const			filenamePattern = cmdLine.getCaseListExportFile();
+
+	while (iter.getState() != TestHierarchyIterator::STATE_FINISHED)
+	{
+		const TestNode* node		= iter.getNode();
+		const char*		pkgName		= node->getName();
 		const string	filename	= makePackageFilename(filenamePattern, pkgName, "txt");
-		std::ofstream	out			(filename.c_str(), std::ios_base::binary);
 
+		DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE &&
+				  node->getNodeType() == NODETYPE_PACKAGE);
+
+		std::ofstream out(filename.c_str(), std::ios_base::binary);
 		if (!out.is_open() || !out.good())
 			throw Exception("Failed to open " + filename);
 
diff --git a/framework/common/tcuTestHierarchyUtil.hpp b/framework/common/tcuTestHierarchyUtil.hpp
index 683f7f1..a535533 100644
--- a/framework/common/tcuTestHierarchyUtil.hpp
+++ b/framework/common/tcuTestHierarchyUtil.hpp
@@ -30,8 +30,8 @@
 {
 
 // \todo [2015-02-26 pyry] Remove TestContext requirement
-void	writeXmlCaselists	(TestPackageRoot& root, TestContext& testCtx, const tcu::CommandLine& cmdLine);
-void	writeTxtCaselists	(TestPackageRoot& root, TestContext& testCtx, const tcu::CommandLine& cmdLine);
+void writeXmlCaselistsToFiles (TestPackageRoot& root, TestContext& testCtx, const CommandLine& cmdLine);
+void writeTxtCaselistsToFiles (TestPackageRoot& root, TestContext& testCtx, const CommandLine& cmdLine);
 
 } // tcu
 
diff --git a/framework/common/tcuTestLog.cpp b/framework/common/tcuTestLog.cpp
index 5870f10..bbb41ee 100644
--- a/framework/common/tcuTestLog.cpp
+++ b/framework/common/tcuTestLog.cpp
@@ -63,7 +63,77 @@
 	, m_bias		(0.0f, 0.0f, 0.0f, 0.0f)
 	, m_compression	(compression)
 {
-	computePixelScaleBias(access, m_scale, m_bias);
+	// Simplify combined formats that only use a single channel
+	if (tcu::isCombinedDepthStencilType(m_access.getFormat().type))
+	{
+		if (m_access.getFormat().order == tcu::TextureFormat::D)
+			m_access = tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_DEPTH);
+		else if (m_access.getFormat().order == tcu::TextureFormat::S)
+			m_access = tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_STENCIL);
+	}
+
+	// Implicit scale and bias
+	if (m_access.getFormat().order != tcu::TextureFormat::DS)
+		computePixelScaleBias(m_access, m_scale, m_bias);
+	else
+	{
+		// Pack D and S bias and scale to R and G
+		const ConstPixelBufferAccess	depthAccess		= tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_DEPTH);
+		const ConstPixelBufferAccess	stencilAccess	= tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_STENCIL);
+		tcu::Vec4						depthScale;
+		tcu::Vec4						depthBias;
+		tcu::Vec4						stencilScale;
+		tcu::Vec4						stencilBias;
+
+		computePixelScaleBias(depthAccess, depthScale, depthBias);
+		computePixelScaleBias(stencilAccess, stencilScale, stencilBias);
+
+		m_scale = tcu::Vec4(depthScale.x(), stencilScale.x(), 0.0f, 0.0f);
+		m_bias = tcu::Vec4(depthBias.x(), stencilBias.x(), 0.0f, 0.0f);
+	}
+}
+
+LogImage::LogImage (const std::string& name, const std::string& description, const ConstPixelBufferAccess& access, const Vec4& scale, const Vec4& bias, qpImageCompressionMode compression)
+	: m_name		(name)
+	, m_description	(description)
+	, m_access		(access)
+	, m_scale		(scale)
+	, m_bias		(bias)
+	, m_compression	(compression)
+{
+	// Cannot set scale and bias of combined formats
+	DE_ASSERT(access.getFormat().order != tcu::TextureFormat::DS);
+
+	// Simplify access
+	if (tcu::isCombinedDepthStencilType(access.getFormat().type))
+	{
+		if (access.getFormat().order == tcu::TextureFormat::D)
+			m_access = tcu::getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_DEPTH);
+		if (access.getFormat().order == tcu::TextureFormat::S)
+			m_access = tcu::getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_STENCIL);
+		else
+		{
+			// Cannot log a DS format
+			DE_ASSERT(false);
+			return;
+		}
+	}
+}
+
+void LogImage::write (TestLog& log) const
+{
+	if (m_access.getFormat().order != tcu::TextureFormat::DS)
+		log.writeImage(m_name.c_str(), m_description.c_str(), m_access, m_scale, m_bias, m_compression);
+	else
+	{
+		const ConstPixelBufferAccess	depthAccess		= tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_DEPTH);
+		const ConstPixelBufferAccess	stencilAccess	= tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_STENCIL);
+
+		log.startImageSet(m_name.c_str(), m_description.c_str());
+		log.writeImage("Depth", "Depth channel", depthAccess, m_scale.swizzle(0, 0, 0, 0), m_bias.swizzle(0, 0, 0, 0), m_compression);
+		log.writeImage("Stencil", "Stencil channel", stencilAccess, m_scale.swizzle(1, 1, 1, 1), m_bias.swizzle(1, 1, 1, 1), m_compression);
+		log.endImageSet();
+	}
 }
 
 // MessageBuilder
@@ -170,6 +240,9 @@
 	int						height		= access.getHeight();
 	int						depth		= access.getDepth();
 
+	// Writing a combined image does not make sense
+	DE_ASSERT(!tcu::isCombinedDepthStencilType(access.getFormat().type));
+
 	// Do not bother with preprocessing if images are not stored
 	if ((qpTestLog_getLogFlags(m_log) & QP_TEST_LOG_EXCLUDE_IMAGES) != 0)
 		return;
diff --git a/framework/common/tcuTestLog.hpp b/framework/common/tcuTestLog.hpp
index dc7e045..7d76921 100644
--- a/framework/common/tcuTestLog.hpp
+++ b/framework/common/tcuTestLog.hpp
@@ -253,15 +253,7 @@
 
 	LogImage (const std::string& name, const std::string& description, const ConstPixelBufferAccess& access, qpImageCompressionMode compression = QP_IMAGE_COMPRESSION_MODE_BEST);
 
-	LogImage (const std::string& name, const std::string& description, const ConstPixelBufferAccess& access, const Vec4& scale, const Vec4& bias, qpImageCompressionMode compression = QP_IMAGE_COMPRESSION_MODE_BEST)
-		: m_name		(name)
-		, m_description	(description)
-		, m_access		(access)
-		, m_scale		(scale)
-		, m_bias		(bias)
-		, m_compression	(compression)
-	{
-	}
+	LogImage (const std::string& name, const std::string& description, const ConstPixelBufferAccess& access, const Vec4& scale, const Vec4& bias, qpImageCompressionMode compression = QP_IMAGE_COMPRESSION_MODE_BEST);
 
 	void write (TestLog& log) const;
 
@@ -478,11 +470,6 @@
 	log.startImageSet(m_name.c_str(), m_description.c_str());
 }
 
-inline void LogImage::write (TestLog& log) const
-{
-	log.writeImage(m_name.c_str(), m_description.c_str(), m_access, m_scale, m_bias, m_compression);
-}
-
 inline void LogSection::write (TestLog& log) const
 {
 	log.startSection(m_name.c_str(), m_description.c_str());
diff --git a/framework/common/tcuTexLookupVerifier.cpp b/framework/common/tcuTexLookupVerifier.cpp
index 4a70168..7f3e277 100644
--- a/framework/common/tcuTexLookupVerifier.cpp
+++ b/framework/common/tcuTexLookupVerifier.cpp
@@ -293,6 +293,8 @@
 {
 	DE_ASSERT(xBounds.x() <= xBounds.y());
 	DE_ASSERT(yBounds.x() <= yBounds.y());
+	DE_ASSERT(xBounds.x() + searchStep > xBounds.x()); // step is not effectively 0
+	DE_ASSERT(xBounds.y() + searchStep > xBounds.y());
 
 	if (!isInColorBounds(prec, quad, result))
 		return false;
@@ -322,6 +324,10 @@
 	DE_ASSERT(xBounds.x() <= xBounds.y());
 	DE_ASSERT(yBounds.x() <= yBounds.y());
 	DE_ASSERT(zBounds.x() <= zBounds.y());
+	DE_ASSERT(xBounds.x() + searchStep > xBounds.x()); // step is not effectively 0
+	DE_ASSERT(xBounds.y() + searchStep > xBounds.y());
+	DE_ASSERT(yBounds.x() + searchStep > yBounds.x());
+	DE_ASSERT(yBounds.y() + searchStep > yBounds.y());
 
 	if (!isInColorBounds(prec, quad0, quad1, result))
 		return false;
@@ -354,6 +360,10 @@
 {
 	DE_ASSERT(xBounds0.x() <= xBounds0.y());
 	DE_ASSERT(xBounds1.x() <= xBounds1.y());
+	DE_ASSERT(xBounds0.x() + searchStep > xBounds0.x()); // step is not effectively 0
+	DE_ASSERT(xBounds0.y() + searchStep > xBounds0.y());
+	DE_ASSERT(xBounds1.x() + searchStep > xBounds1.x());
+	DE_ASSERT(xBounds1.y() + searchStep > xBounds1.y());
 
 	if (!isInColorBounds(prec, line0, line1, result))
 		return false;
@@ -391,6 +401,14 @@
 	DE_ASSERT(yBounds0.x() <= yBounds0.y());
 	DE_ASSERT(xBounds1.x() <= xBounds1.y());
 	DE_ASSERT(yBounds1.x() <= yBounds1.y());
+	DE_ASSERT(xBounds0.x() + searchStep > xBounds0.x()); // step is not effectively 0
+	DE_ASSERT(xBounds0.y() + searchStep > xBounds0.y());
+	DE_ASSERT(yBounds0.x() + searchStep > yBounds0.x());
+	DE_ASSERT(yBounds0.y() + searchStep > yBounds0.y());
+	DE_ASSERT(xBounds1.x() + searchStep > xBounds1.x());
+	DE_ASSERT(xBounds1.y() + searchStep > xBounds1.y());
+	DE_ASSERT(yBounds1.x() + searchStep > yBounds1.x());
+	DE_ASSERT(yBounds1.y() + searchStep > yBounds1.y());
 
 	if (!isInColorBounds(prec, quad0, quad1, result))
 		return false;
@@ -442,6 +460,18 @@
 	DE_ASSERT(xBounds1.x() <= xBounds1.y());
 	DE_ASSERT(yBounds1.x() <= yBounds1.y());
 	DE_ASSERT(zBounds1.x() <= zBounds1.y());
+	DE_ASSERT(xBounds0.x() + searchStep > xBounds0.x()); // step is not effectively 0
+	DE_ASSERT(xBounds0.y() + searchStep > xBounds0.y());
+	DE_ASSERT(yBounds0.x() + searchStep > yBounds0.x());
+	DE_ASSERT(yBounds0.y() + searchStep > yBounds0.y());
+	DE_ASSERT(zBounds0.x() + searchStep > zBounds0.x());
+	DE_ASSERT(zBounds0.y() + searchStep > zBounds0.y());
+	DE_ASSERT(xBounds1.x() + searchStep > xBounds1.x());
+	DE_ASSERT(xBounds1.y() + searchStep > xBounds1.y());
+	DE_ASSERT(yBounds1.x() + searchStep > yBounds1.x());
+	DE_ASSERT(yBounds1.y() + searchStep > yBounds1.y());
+	DE_ASSERT(zBounds1.x() + searchStep > zBounds1.x());
+	DE_ASSERT(zBounds1.y() + searchStep > zBounds1.y());
 
 	if (!isInColorBounds(prec, quad00, quad01, quad10, quad11, result))
 		return false;
@@ -603,6 +633,15 @@
 
 	const int					w				= level.getWidth();
 
+	const TextureFormat			format			= level.getFormat();
+	const TextureChannelClass	texClass		= getTextureChannelClass(format.type);
+
+	DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+	DE_UNREF(texClass);
+	DE_UNREF(format);
+
 	for (int i = minI; i <= maxI; i++)
 	{
 		// Wrapped coordinates
@@ -647,6 +686,10 @@
 												  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	? computeBilinearSearchStepForSnorm(prec) :
 												  0.0f; // Step is computed for floating-point quads based on texel values.
 
+	DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
 	// \todo [2013-07-03 pyry] This could be optimized by first computing ranges based on wrap mode.
 
 	for (int j = minJ; j <= maxJ; j++)
@@ -706,6 +749,10 @@
 												  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	? computeBilinearSearchStepForSnorm(prec) :
 												  0.0f; // Step is computed for floating-point quads based on texel values.
 
+	DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
 	// \todo [2013-07-03 pyry] This could be optimized by first computing ranges based on wrap mode.
 
 	for (int k = minK; k <= maxK; k++)
@@ -910,8 +957,8 @@
 	const int					w0				= level0.getWidth();
 	const int					w1				= level1.getWidth();
 
-	const Vec2					uBounds0		= computeNonNormalizedCoordBounds(sampler.normalizedCoords, w0,	coordX, prec.coordBits.x(), prec.uvwBits.x());
-	const Vec2					uBounds1		= computeNonNormalizedCoordBounds(sampler.normalizedCoords, w1,	coordX, prec.coordBits.x(), prec.uvwBits.x());
+	const Vec2					uBounds0		= computeNonNormalizedCoordBounds(sampler.normalizedCoords, w0, coordX, prec.coordBits.x(), prec.uvwBits.x());
+	const Vec2					uBounds1		= computeNonNormalizedCoordBounds(sampler.normalizedCoords, w1, coordX, prec.coordBits.x(), prec.uvwBits.x());
 
 	// Integer coordinates - without wrap mode
 	const int					minI0			= deFloorFloatToInt32(uBounds0.x()-0.5f);
@@ -924,6 +971,10 @@
 												  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	? computeBilinearSearchStepForSnorm(prec) :
 												  0.0f; // Step is computed for floating-point quads based on texel values.
 
+	DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
 	for (int i0 = minI0; i0 <= maxI0; i0++)
 	{
 		ColorLine	line0;
@@ -1007,6 +1058,10 @@
 												  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	? computeBilinearSearchStepForSnorm(prec) :
 												  0.0f; // Step is computed for floating-point quads based on texel values.
 
+	DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
 	for (int j0 = minJ0; j0 <= maxJ0; j0++)
 	{
 		for (int i0 = minI0; i0 <= maxI0; i0++)
@@ -1112,6 +1167,10 @@
 												  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	? computeBilinearSearchStepForSnorm(prec) :
 												  0.0f; // Step is computed for floating-point quads based on texel values.
 
+	DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
 	for (int k0 = minK0; k0 <= maxK0; k0++)
 	{
 		for (int j0 = minJ0; j0 <= maxJ0; j0++)
@@ -1403,6 +1462,10 @@
 												  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	? computeBilinearSearchStepForSnorm(prec) :
 												  0.0f; // Step is computed for floating-point quads based on texel values.
 
+	DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
 	for (int j = minJ; j <= maxJ; j++)
 	{
 		for (int i = minI; i <= maxI; i++)
@@ -1474,6 +1537,10 @@
 												  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	? computeBilinearSearchStepForSnorm(prec) :
 												  0.0f; // Step is computed for floating-point quads based on texel values.
 
+	DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT	||
+			  texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
 	for (int j0 = minJ0; j0 <= maxJ0; j0++)
 	{
 		for (int i0 = minI0; i0 <= maxI0; i0++)
@@ -1570,7 +1637,7 @@
 }
 
 static bool isCubeMipmapLinearSampleResultValid (const ConstPixelBufferAccess	(&faces0)[CUBEFACE_LAST],
-												const ConstPixelBufferAccess	(&faces1)[CUBEFACE_LAST],
+												 const ConstPixelBufferAccess	(&faces1)[CUBEFACE_LAST],
 												 const Sampler&					sampler,
 												 const Sampler::FilterMode		levelFilter,
 												 const LookupPrecision&			prec,
@@ -2264,8 +2331,8 @@
 										const IVec2						(&offsets)[4],
 										const Vector<ScalarType, 4>&	result)
 {
-	const Vec2	uBounds		= computeNonNormalizedCoordBounds(sampler.normalizedCoords, level.getWidth(),	coord.x(), prec.coordBits.x(), prec.uvwBits.x());
-	const Vec2	vBounds		= computeNonNormalizedCoordBounds(sampler.normalizedCoords, level.getHeight(),	coord.y(), prec.coordBits.y(), prec.uvwBits.y());
+	const Vec2	uBounds		= computeNonNormalizedCoordBounds(sampler.normalizedCoords, level.getWidth(), coord.x(), prec.coordBits.x(), prec.uvwBits.x());
+	const Vec2	vBounds		= computeNonNormalizedCoordBounds(sampler.normalizedCoords, level.getHeight(), coord.y(), prec.coordBits.y(), prec.uvwBits.y());
 
 	// Integer coordinate bounds for (x0, y0) - without wrap mode
 	const int	minI		= deFloorFloatToInt32(uBounds.x()-0.5f);
diff --git a/framework/common/tcuTexture.cpp b/framework/common/tcuTexture.cpp
index 6fb69f0..43c7616 100644
--- a/framework/common/tcuTexture.cpp
+++ b/framework/common/tcuTexture.cpp
@@ -57,17 +57,17 @@
 
 inline void writeRGBA8888Int (deUint8* ptr, const IVec4& val)
 {
-	ptr[0] = de::clamp(val[0], 0, 255);
-	ptr[1] = de::clamp(val[1], 0, 255);
-	ptr[2] = de::clamp(val[2], 0, 255);
-	ptr[3] = de::clamp(val[3], 0, 255);
+	ptr[0] = (deUint8)de::clamp(val[0], 0, 255);
+	ptr[1] = (deUint8)de::clamp(val[1], 0, 255);
+	ptr[2] = (deUint8)de::clamp(val[2], 0, 255);
+	ptr[3] = (deUint8)de::clamp(val[3], 0, 255);
 }
 
 inline void writeRGB888Int (deUint8* ptr, const IVec4& val)
 {
-	ptr[0] = de::clamp(val[0], 0, 255);
-	ptr[1] = de::clamp(val[1], 0, 255);
-	ptr[2] = de::clamp(val[2], 0, 255);
+	ptr[0] = (deUint8)de::clamp(val[0], 0, 255);
+	ptr[1] = (deUint8)de::clamp(val[1], 0, 255);
+	ptr[2] = (deUint8)de::clamp(val[2], 0, 255);
 }
 
 inline void writeRGBA8888Float (deUint8* ptr, const Vec4& val)
@@ -111,6 +111,50 @@
 #endif
 }
 
+inline deUint8 readUint32Low8 (const deUint8* src)
+{
+#if (DE_ENDIANNESS == DE_LITTLE_ENDIAN)
+	const deUint32 uint32ByteOffsetBits0To8	= 0; //!< least significant byte in the lowest address
+#else
+	const deUint32 uint32ByteOffsetBits0To8	= 3; //!< least significant byte in the highest address
+#endif
+
+	return src[uint32ByteOffsetBits0To8];
+}
+
+inline void writeUint32Low8 (deUint8* dst, deUint8 val)
+{
+#if (DE_ENDIANNESS == DE_LITTLE_ENDIAN)
+	const deUint32 uint32ByteOffsetBits0To8	= 0; //!< least significant byte in the lowest address
+#else
+	const deUint32 uint32ByteOffsetBits0To8	= 3; //!< least significant byte in the highest address
+#endif
+
+	dst[uint32ByteOffsetBits0To8] = val;
+}
+
+inline deUint32 readUint32High24 (const deUint8* src)
+{
+#if (DE_ENDIANNESS == DE_LITTLE_ENDIAN)
+	const deUint32 uint32ByteOffset8To32	= 1;
+#else
+	const deUint32 uint32ByteOffset8To32	= 0;
+#endif
+
+	return readUint24(src + uint32ByteOffset8To32);
+}
+
+inline void writeUint32High24 (deUint8* dst, deUint32 val)
+{
+#if (DE_ENDIANNESS == DE_LITTLE_ENDIAN)
+	const deUint32 uint32ByteOffset8To32	= 1;
+#else
+	const deUint32 uint32ByteOffset8To32	= 0;
+#endif
+
+	writeUint24(dst + uint32ByteOffset8To32, val);
+}
+
 // \todo [2011-09-21 pyry] Move to tcutil?
 template <typename T>
 inline T convertSatRte (float f)
@@ -405,7 +449,6 @@
 	static const TextureSwizzle ARGB	= {{ TextureSwizzle::CHANNEL_1,		TextureSwizzle::CHANNEL_2,		TextureSwizzle::CHANNEL_3,		TextureSwizzle::CHANNEL_0	}};
 	static const TextureSwizzle D		= {{ TextureSwizzle::CHANNEL_0,		TextureSwizzle::CHANNEL_ZERO,	TextureSwizzle::CHANNEL_ZERO,	TextureSwizzle::CHANNEL_ONE	}};
 	static const TextureSwizzle S		= {{ TextureSwizzle::CHANNEL_0,		TextureSwizzle::CHANNEL_ZERO,	TextureSwizzle::CHANNEL_ZERO,	TextureSwizzle::CHANNEL_ONE	}};
-	static const TextureSwizzle DS		= {{ TextureSwizzle::CHANNEL_0,		TextureSwizzle::CHANNEL_ZERO,	TextureSwizzle::CHANNEL_ZERO,	TextureSwizzle::CHANNEL_1	}};
 
 	switch (order)
 	{
@@ -426,7 +469,11 @@
 		case TextureFormat::sRGBA:		return RGBA;
 		case TextureFormat::D:			return D;
 		case TextureFormat::S:			return S;
-		case TextureFormat::DS:			return DS;
+
+		case TextureFormat::DS:
+			DE_ASSERT(false); // combined formats cannot be read from
+			return INV;
+
 		default:
 			DE_ASSERT(DE_FALSE);
 			return INV;
@@ -452,7 +499,6 @@
 	static const TextureSwizzle ARGB	= {{ TextureSwizzle::CHANNEL_3,		TextureSwizzle::CHANNEL_0,		TextureSwizzle::CHANNEL_1,		TextureSwizzle::CHANNEL_2		}};
 	static const TextureSwizzle D		= {{ TextureSwizzle::CHANNEL_0,		TextureSwizzle::CHANNEL_LAST,	TextureSwizzle::CHANNEL_LAST,	TextureSwizzle::CHANNEL_LAST	}};
 	static const TextureSwizzle S		= {{ TextureSwizzle::CHANNEL_0,		TextureSwizzle::CHANNEL_LAST,	TextureSwizzle::CHANNEL_LAST,	TextureSwizzle::CHANNEL_LAST	}};
-	static const TextureSwizzle DS		= {{ TextureSwizzle::CHANNEL_0,		TextureSwizzle::CHANNEL_3,		TextureSwizzle::CHANNEL_LAST,	TextureSwizzle::CHANNEL_LAST	}};
 
 	switch (order)
 	{
@@ -473,7 +519,11 @@
 		case TextureFormat::sRGBA:		return RGBA;
 		case TextureFormat::D:			return D;
 		case TextureFormat::S:			return S;
-		case TextureFormat::DS:			return DS;
+
+		case TextureFormat::DS:
+			DE_ASSERT(false); // combined formats cannot be written to
+			return INV;
+
 		default:
 			DE_ASSERT(DE_FALSE);
 			return INV;
@@ -610,15 +660,17 @@
 	DE_ASSERT(de::inBounds(x, 0, m_size.x()));
 	DE_ASSERT(de::inBounds(y, 0, m_size.y()));
 	DE_ASSERT(de::inBounds(z, 0, m_size.z()));
+	DE_ASSERT(!isCombinedDepthStencilType(m_format.type)); // combined types cannot be accessed directly
+	DE_ASSERT(m_format.order != TextureFormat::DS); // combined formats cannot be accessed directly
 
-	const deUint8* pixelPtr = (const deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
+	const deUint8* pixelPtr = (const deUint8*)getPixelPtr(x, y, z);
 
 	// Optimized fomats.
 	if (m_format.type == TextureFormat::UNORM_INT8)
 	{
-		if (m_format.order == TextureFormat::RGBA)
+		if (m_format.order == TextureFormat::RGBA || m_format.order == TextureFormat::sRGBA)
 			return readRGBA8888Float(pixelPtr);
-		else if (m_format.order == TextureFormat::RGB)
+		else if (m_format.order == TextureFormat::RGB || m_format.order == TextureFormat::sRGB)
 			return readRGB888Float(pixelPtr);
 	}
 
@@ -639,25 +691,6 @@
 		case TextureFormat::UNSIGNED_INT_1010102_REV:	return UVec4(UB32(0, 10), UB32(10, 10), UB32(20, 10), UB32(30, 2)).cast<float>();
 		case TextureFormat::UNSIGNED_INT_999_E5_REV:	return unpackRGB999E5(*((const deUint32*)pixelPtr));
 
-		case TextureFormat::UNSIGNED_INT_24_8:
-			switch (m_format.order)
-			{
-				// \note Stencil is always ignored.
-				case TextureFormat::D:	return Vec4(NB32(8, 24), 0.0f, 0.0f, 1.0f);
-				case TextureFormat::DS:	return Vec4(NB32(8, 24), 0.0f, 0.0f, 1.0f /* (float)UB32(0, 8) */);
-				default:
-					DE_ASSERT(false);
-			}
-
-		case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
-		{
-			DE_ASSERT(m_format.order == TextureFormat::DS);
-			float	d	= *((const float*)pixelPtr);
-			// \note Stencil is ignored.
-//			deUint8	s	= *((const deUint32*)(pixelPtr+4)) & 0xff;
-			return Vec4(d, 0.0f, 0.0f, 1.0f);
-		}
-
 		case TextureFormat::UNSIGNED_INT_11F_11F_10F_REV:
 			return Vec4(Float11(UB32(0, 11)).asFloat(), Float11(UB32(11, 11)).asFloat(), Float10(UB32(22, 10)).asFloat(), 1.0f);
 
@@ -707,15 +740,19 @@
 	DE_ASSERT(de::inBounds(x, 0, m_size.x()));
 	DE_ASSERT(de::inBounds(y, 0, m_size.y()));
 	DE_ASSERT(de::inBounds(z, 0, m_size.z()));
+	DE_ASSERT(!isCombinedDepthStencilType(m_format.type)); // combined types cannot be accessed directly
+	DE_ASSERT(m_format.order != TextureFormat::DS); // combined formats cannot be accessed directly
 
-	const deUint8* const	pixelPtr = (const deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
+	const deUint8* const	pixelPtr = (const deUint8*)getPixelPtr(x, y, z);
 	IVec4					result;
 
 	// Optimized fomats.
 	if (m_format.type == TextureFormat::UNORM_INT8)
 	{
-		if (m_format.order == TextureFormat::RGBA)		return readRGBA8888Int(pixelPtr);
-		else if (m_format.order == TextureFormat::RGB)	return readRGB888Int(pixelPtr);
+		if (m_format.order == TextureFormat::RGBA || m_format.order == TextureFormat::sRGBA)
+			return readRGBA8888Int(pixelPtr);
+		else if (m_format.order == TextureFormat::RGB || m_format.order == TextureFormat::sRGB)
+			return readRGB888Int(pixelPtr);
 	}
 
 #define U16(OFFS, COUNT)		((*((const deUint16*)pixelPtr) >> (OFFS)) & ((1<<(COUNT))-1))
@@ -731,25 +768,6 @@
 		case TextureFormat::UNORM_INT_1010102_REV:		return UVec4(U32( 0, 10), U32(10, 10), U32(20, 10), U32(30, 2)).cast<int>();
 		case TextureFormat::UNSIGNED_INT_1010102_REV:	return UVec4(U32( 0, 10), U32(10, 10), U32(20, 10), U32(30, 2)).cast<int>();
 
-		case TextureFormat::UNSIGNED_INT_24_8:
-			switch (m_format.order)
-			{
-				case TextureFormat::D:	return UVec4(U32(8, 24), 0, 0, 1).cast<int>();
-				case TextureFormat::S:	return UVec4(0, 0, 0, U32(8, 24)).cast<int>();
-				case TextureFormat::DS:	return UVec4(U32(8, 24), 0, 0, U32(0, 8)).cast<int>();
-				default:
-					DE_ASSERT(false);
-			}
-
-		case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
-		{
-			DE_ASSERT(m_format.order == TextureFormat::DS);
-			float	d	= *((const float*)pixelPtr);
-			deUint8	s	= *((const deUint32*)(pixelPtr+4)) & 0xffu;
-			// \note Returns bit-representation of depth floating-point value.
-			return UVec4(tcu::Float32(d).bits(), 0, 0, s).cast<int>();
-		}
-
 		default:
 			break; // To generic path.
 	}
@@ -812,10 +830,7 @@
 	DE_ASSERT(de::inBounds(y, 0, getHeight()));
 	DE_ASSERT(de::inBounds(z, 0, getDepth()));
 
-	const deUint8* const pixelPtr = (const deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
-
-#define UB32(OFFS, COUNT) ((*((const deUint32*)pixelPtr) >> (OFFS)) & ((1<<(COUNT))-1))
-#define NB32(OFFS, COUNT) channelToNormFloat(UB32(OFFS, COUNT), (COUNT))
+	const deUint8* const pixelPtr = (const deUint8*)getPixelPtr(x, y, z);
 
 	DE_ASSERT(m_format.order == TextureFormat::DS || m_format.order == TextureFormat::D);
 
@@ -826,7 +841,8 @@
 			{
 				case TextureFormat::D:
 				case TextureFormat::DS: // \note Fall-through.
-					return NB32(8, 24);
+					return (float)readUint32High24(pixelPtr) / 16777215.0f;
+
 				default:
 					DE_ASSERT(false);
 					return 0.0f;
@@ -837,12 +853,9 @@
 			return *((const float*)pixelPtr);
 
 		default:
-			DE_ASSERT(m_format.order == TextureFormat::D || m_format.order == TextureFormat::DS);
+			DE_ASSERT(m_format.order == TextureFormat::D); // no other combined depth stencil types
 			return channelToFloat(pixelPtr, m_format.type);
 	}
-
-#undef UB32
-#undef NB32
 }
 
 int ConstPixelBufferAccess::getPixStencil (int x, int y, int z) const
@@ -851,15 +864,16 @@
 	DE_ASSERT(de::inBounds(y, 0, getHeight()));
 	DE_ASSERT(de::inBounds(z, 0, getDepth()));
 
-	const deUint8* const pixelPtr = (const deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
+	const deUint8* const pixelPtr = (const deUint8*)getPixelPtr(x, y, z);
 
 	switch (m_format.type)
 	{
 		case TextureFormat::UNSIGNED_INT_24_8:
 			switch (m_format.order)
 			{
-				case TextureFormat::S:		return (int)(*((const deUint32*)pixelPtr) >> 8);
-				case TextureFormat::DS:		return (int)(*((const deUint32*)pixelPtr) & 0xff);
+				case TextureFormat::S:
+				case TextureFormat::DS:
+					return (int)readUint32Low8(pixelPtr);
 
 				default:
 					DE_ASSERT(false);
@@ -868,18 +882,12 @@
 
 		case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
 			DE_ASSERT(m_format.order == TextureFormat::DS);
-			return *((const deUint32*)(pixelPtr+4)) & 0xff;
+			return (int)readUint32Low8(pixelPtr + 4);
 
 		default:
 		{
-			if (m_format.order == TextureFormat::S)
-				return channelToInt(pixelPtr, m_format.type);
-			else
-			{
-				DE_ASSERT(m_format.order == TextureFormat::DS);
-				const int stencilChannelIndex = 3;
-				return channelToInt(pixelPtr + getChannelSize(m_format.type)*stencilChannelIndex, m_format.type);
-			}
+			DE_ASSERT(m_format.order == TextureFormat::S); // no other combined depth stencil types
+			return channelToInt(pixelPtr, m_format.type);
 		}
 	}
 }
@@ -889,18 +897,20 @@
 	DE_ASSERT(de::inBounds(x, 0, getWidth()));
 	DE_ASSERT(de::inBounds(y, 0, getHeight()));
 	DE_ASSERT(de::inBounds(z, 0, getDepth()));
+	DE_ASSERT(!isCombinedDepthStencilType(m_format.type)); // combined types cannot be accessed directly
+	DE_ASSERT(m_format.order != TextureFormat::DS); // combined formats cannot be accessed directly
 
-	deUint8* const pixelPtr = (deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
+	deUint8* const pixelPtr = (deUint8*)getPixelPtr(x, y, z);
 
 	// Optimized fomats.
 	if (m_format.type == TextureFormat::UNORM_INT8)
 	{
-		if (m_format.order == TextureFormat::RGBA)
+		if (m_format.order == TextureFormat::RGBA || m_format.order == TextureFormat::sRGBA)
 		{
 			writeRGBA8888Float(pixelPtr, color);
 			return;
 		}
-		else if (m_format.order == TextureFormat::RGB)
+		else if (m_format.order == TextureFormat::RGB || m_format.order == TextureFormat::sRGB)
 		{
 			writeRGB888Float(pixelPtr, color);
 			return;
@@ -934,31 +944,6 @@
 			*((deUint32*)pixelPtr) = packRGB999E5(color);
 			break;
 
-		case TextureFormat::UNSIGNED_INT_24_8:
-			switch (m_format.order)
-			{
-				case TextureFormat::D:		*((deUint32*)pixelPtr) = PN(color[0], 8, 24);									break;
-				case TextureFormat::S:		*((deUint32*)pixelPtr) = PN(color[3], 8, 24);									break;
-				case TextureFormat::DS:		*((deUint32*)pixelPtr) = PN(color[0], 8, 24) | PU((deUint32)color[3], 0, 8);	break;
-				default:
-					DE_ASSERT(false);
-			}
-			break;
-
-		case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
-			DE_ASSERT(m_format.order == TextureFormat::DS);
-			*((float*)pixelPtr)			= color[0];
-			*((deUint32*)(pixelPtr+4))	= PU((deUint32)color[3], 0, 8);
-			break;
-
-		case TextureFormat::FLOAT:
-			if (m_format.order == TextureFormat::D)
-			{
-				*((float*)pixelPtr) = color[0];
-				break;
-			}
-			// else fall-through to default case!
-
 		default:
 		{
 			// Generic path.
@@ -984,14 +969,24 @@
 	DE_ASSERT(de::inBounds(x, 0, getWidth()));
 	DE_ASSERT(de::inBounds(y, 0, getHeight()));
 	DE_ASSERT(de::inBounds(z, 0, getDepth()));
+	DE_ASSERT(!isCombinedDepthStencilType(m_format.type)); // combined types cannot be accessed directly
+	DE_ASSERT(m_format.order != TextureFormat::DS); // combined formats cannot be accessed directly
 
-	deUint8* const pixelPtr = (deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
+	deUint8* const pixelPtr = (deUint8*)getPixelPtr(x, y, z);
 
 	// Optimized fomats.
 	if (m_format.type == TextureFormat::UNORM_INT8)
 	{
-		if (m_format.order == TextureFormat::RGBA)		{ writeRGBA8888Int(pixelPtr, color);	return; }
-		else if (m_format.order == TextureFormat::RGB)	{ writeRGB888Int(pixelPtr, color);		return; }
+		if (m_format.order == TextureFormat::RGBA || m_format.order == TextureFormat::sRGBA)
+		{
+			writeRGBA8888Int(pixelPtr, color);
+			return;
+		}
+		else if (m_format.order == TextureFormat::RGB || m_format.order == TextureFormat::sRGB)
+		{
+			writeRGB888Int(pixelPtr, color);
+			return;
+		}
 	}
 
 #define PU(VAL, OFFS, BITS)		(uintToChannel((deUint32)(VAL), (BITS)) << (OFFS))
@@ -1006,23 +1001,6 @@
 		case TextureFormat::UNORM_INT_1010102_REV:		*((deUint32*)pixelPtr) = PU(color[0],  0, 10) | PU(color[1], 10, 10) | PU(color[2], 20, 10) | PU(color[3], 30, 2);			break;
 		case TextureFormat::UNSIGNED_INT_1010102_REV:	*((deUint32*)pixelPtr) = PU(color[0],  0, 10) | PU(color[1], 10, 10) | PU(color[2], 20, 10) | PU(color[3], 30, 2);			break;
 
-		case TextureFormat::UNSIGNED_INT_24_8:
-			switch (m_format.order)
-			{
-				case TextureFormat::D:		*((deUint32*)pixelPtr) = PU(color[0], 8, 24);										break;
-				case TextureFormat::S:		*((deUint32*)pixelPtr) = PU(color[3], 8, 24);										break;
-				case TextureFormat::DS:		*((deUint32*)pixelPtr) = PU(color[0], 8, 24) | PU((deUint32)color[3], 0, 8);		break;
-				default:
-					DE_ASSERT(false);
-			}
-			break;
-
-		case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
-			DE_ASSERT(m_format.order == TextureFormat::DS);
-			*((deUint32*)pixelPtr)		= color[0];
-			*((deUint32*)(pixelPtr+4))	= PU((deUint32)color[3], 0, 8);
-			break;
-
 		default:
 		{
 			// Generic path.
@@ -1048,17 +1026,18 @@
 	DE_ASSERT(de::inBounds(y, 0, getHeight()));
 	DE_ASSERT(de::inBounds(z, 0, getDepth()));
 
-	deUint8* const pixelPtr = (deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
-
-#define PN(VAL, OFFS, BITS) (normFloatToChannel((VAL), (BITS)) << (OFFS))
+	deUint8* const pixelPtr = (deUint8*)getPixelPtr(x, y, z);
 
 	switch (m_format.type)
 	{
 		case TextureFormat::UNSIGNED_INT_24_8:
 			switch (m_format.order)
 			{
-				case TextureFormat::D:		*((deUint32*)pixelPtr) = PN(depth, 8, 24);											break;
-				case TextureFormat::DS:		*((deUint32*)pixelPtr) = (*((deUint32*)pixelPtr) & 0x000000ff) | PN(depth, 8, 24);	break;
+				case TextureFormat::D:
+				case TextureFormat::DS:
+					writeUint32High24(pixelPtr,  convertSatRteUint24(depth * 16777215.0f));
+					break;
+
 				default:
 					DE_ASSERT(false);
 			}
@@ -1070,12 +1049,10 @@
 			break;
 
 		default:
-			DE_ASSERT(m_format.order == TextureFormat::D || m_format.order == TextureFormat::DS);
+			DE_ASSERT(m_format.order == TextureFormat::D); // no other combined depth stencil types
 			floatToChannel(pixelPtr, depth, m_format.type);
 			break;
 	}
-
-#undef PN
 }
 
 void PixelBufferAccess::setPixStencil (int stencil, int x, int y, int z) const
@@ -1084,17 +1061,18 @@
 	DE_ASSERT(de::inBounds(y, 0, getHeight()));
 	DE_ASSERT(de::inBounds(z, 0, getDepth()));
 
-	deUint8* const pixelPtr = (deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
-
-#define PU(VAL, OFFS, BITS) (uintToChannel((deUint32)(VAL), (BITS)) << (OFFS))
+	deUint8* const pixelPtr = (deUint8*)getPixelPtr(x, y, z);
 
 	switch (m_format.type)
 	{
 		case TextureFormat::UNSIGNED_INT_24_8:
 			switch (m_format.order)
 			{
-				case TextureFormat::S:		*((deUint32*)pixelPtr) = PU(stencil, 8, 24);										break;
-				case TextureFormat::DS:		*((deUint32*)pixelPtr) = (*((deUint32*)pixelPtr) & 0xffffff00) | PU(stencil, 0, 8);	break;
+				case TextureFormat::S:
+				case TextureFormat::DS:
+					writeUint32Low8(pixelPtr, convertSat<deUint8>((deUint32)stencil));
+					break;
+
 				default:
 					DE_ASSERT(false);
 			}
@@ -1102,23 +1080,14 @@
 
 		case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
 			DE_ASSERT(m_format.order == TextureFormat::DS);
-			*((deUint32*)(pixelPtr+4))	= PU((deUint32)stencil, 0, 8);
+			writeUint32Low8(pixelPtr + 4, convertSat<deUint8>((deUint32)stencil));
 			break;
 
 		default:
-			if (m_format.order == TextureFormat::S)
-				intToChannel(pixelPtr, stencil, m_format.type);
-			else
-			{
-				DE_ASSERT(m_format.order == TextureFormat::DS);
-				const int stencilChannelIndex = 3;
-				intToChannel(pixelPtr + getChannelSize(m_format.type)*stencilChannelIndex, stencil, m_format.type);
-			}
-
+			DE_ASSERT(m_format.order == TextureFormat::S);  // no other combined depth stencil types
+			intToChannel(pixelPtr, stencil, m_format.type);
 			break;
 	}
-
-#undef PU
 }
 
 static inline int imod (int a, int b)
@@ -1201,31 +1170,18 @@
 
 static bool isFixedPointDepthTextureFormat (const tcu::TextureFormat& format)
 {
+	DE_ASSERT(format.order == TextureFormat::D);
+
 	const tcu::TextureChannelClass channelClass = tcu::getTextureChannelClass(format.type);
-
-	if (format.order == TextureFormat::D)
+	if (channelClass == tcu::TEXTURECHANNELCLASS_FLOATING_POINT)
+		return false;
+	else if (channelClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT)
+		return true;
+	else
 	{
-		// depth internal formats cannot be non-normalized integers
-		return channelClass != tcu::TEXTURECHANNELCLASS_FLOATING_POINT;
+		DE_ASSERT(false);
+		return false;
 	}
-	else if (format.order == TextureFormat::DS)
-	{
-		// combined formats have no single channel class, detect format manually
-		switch (format.type)
-		{
-			case tcu::TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:	return false;
-			case tcu::TextureFormat::UNSIGNED_INT_24_8:				return true;
-
-			default:
-			{
-				// unknown format
-				DE_ASSERT(false);
-				return true;
-			}
-		}
-	}
-
-	return false;
 }
 
 // Texel lookup with color conversion.
diff --git a/framework/common/tcuTexture.hpp b/framework/common/tcuTexture.hpp
index fde4919..6ddc1ef 100644
--- a/framework/common/tcuTexture.hpp
+++ b/framework/common/tcuTexture.hpp
@@ -587,11 +587,11 @@
 									~TextureLevelPyramid(void);
 
 	const TextureFormat&			getFormat			(void) const			{ return m_format;					}
-	bool							isLevelEmpty		(int levelNdx) const	{ return m_data[levelNdx].empty();	}
-
 	int								getNumLevels		(void) const			{ return (int)m_access.size();		}
-	const ConstPixelBufferAccess&	getLevel			(int ndx) const			{ return m_access[ndx];				}
-	const PixelBufferAccess&		getLevel			(int ndx)				{ return m_access[ndx];				}
+
+	bool							isLevelEmpty		(int levelNdx) const	{ DE_ASSERT(de::inBounds(levelNdx, 0, getNumLevels())); return m_data[(size_t)levelNdx].empty();	}
+	const ConstPixelBufferAccess&	getLevel			(int levelNdx) const	{ DE_ASSERT(de::inBounds(levelNdx, 0, getNumLevels())); return m_access[(size_t)levelNdx];			}
+	const PixelBufferAccess&		getLevel			(int levelNdx)			{ DE_ASSERT(de::inBounds(levelNdx, 0, getNumLevels())); return m_access[(size_t)levelNdx];			}
 
 	const ConstPixelBufferAccess*	getLevels			(void) const			{ return &m_access[0];				}
 	const PixelBufferAccess*		getLevels			(void)					{ return &m_access[0];				}
@@ -763,12 +763,12 @@
 	int								getSize				(void) const	{ return m_size;	}
 
 	int								getNumLevels		(void) const					{ return (int)m_access[0].size();	}
-	const ConstPixelBufferAccess&	getLevelFace		(int ndx, CubeFace face) const	{ return m_access[face][ndx];		}
-	const PixelBufferAccess&		getLevelFace		(int ndx, CubeFace face)		{ return m_access[face][ndx];		}
+	const ConstPixelBufferAccess&	getLevelFace		(int ndx, CubeFace face) const	{ DE_ASSERT(de::inBounds(ndx, 0, getNumLevels())); return m_access[face][(size_t)ndx];	}
+	const PixelBufferAccess&		getLevelFace		(int ndx, CubeFace face)		{ DE_ASSERT(de::inBounds(ndx, 0, getNumLevels())); return m_access[face][(size_t)ndx];	}
 
 	void							allocLevel			(CubeFace face, int levelNdx);
 	void							clearLevel			(CubeFace face, int levelNdx);
-	bool							isLevelEmpty		(CubeFace face, int levelNdx) const		{ return m_data[face][levelNdx].empty();	}
+	bool							isLevelEmpty		(CubeFace face, int levelNdx) const	{ DE_ASSERT(de::inBounds(levelNdx, 0, getNumLevels())); return m_data[face][(size_t)levelNdx].empty();	}
 
 	Vec4							sample				(const Sampler& sampler, float s, float t, float p, float lod) const;
 	float							sampleCompare		(const Sampler& sampler, float ref, float s, float t, float r, float lod) const;
diff --git a/framework/common/tcuTextureUtil.cpp b/framework/common/tcuTextureUtil.cpp
index 99f8dbd..2591f10 100644
--- a/framework/common/tcuTextureUtil.cpp
+++ b/framework/common/tcuTextureUtil.cpp
@@ -718,9 +718,9 @@
 
 		// For combined formats, treat D and S as separate channels
 		if (hasDepth)
-			fillWithComponentGradients(getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_DEPTH), colorA, colorB);
+			fillWithGrid(getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_DEPTH), cellSize, colorA, colorB);
 		if (hasStencil)
-			fillWithComponentGradients(getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_STENCIL), colorA.swizzle(3,2,1,0), colorB.swizzle(3,2,1,0));
+			fillWithGrid(getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_STENCIL), cellSize, colorA.swizzle(3,2,1,0), colorB.swizzle(3,2,1,0));
 	}
 	else
 	{
@@ -901,14 +901,14 @@
 	{
 		for (int y = 0; y < dst.getHeight(); y++)
 		for (int x = 0; x < dst.getWidth(); x++)
-			dst.setPixel(src.sample2D(sampler, filter, (x+0.5f)*sX, (y+0.5f)*sY, 0), x, y);
+			dst.setPixel(src.sample2D(sampler, filter, ((float)x+0.5f)*sX, ((float)y+0.5f)*sY, 0), x, y);
 	}
 	else
 	{
 		for (int z = 0; z < dst.getDepth(); z++)
 		for (int y = 0; y < dst.getHeight(); y++)
 		for (int x = 0; x < dst.getWidth(); x++)
-			dst.setPixel(src.sample3D(sampler, filter, (x+0.5f)*sX, (y+0.5f)*sY, (z+0.5f)*sZ), x, y, z);
+			dst.setPixel(src.sample3D(sampler, filter, ((float)x+0.5f)*sX, ((float)y+0.5f)*sY, ((float)z+0.5f)*sZ), x, y, z);
 	}
 }
 
diff --git a/framework/common/tcuThreadUtil.cpp b/framework/common/tcuThreadUtil.cpp
index d3a1c9a..84ac428 100644
--- a/framework/common/tcuThreadUtil.cpp
+++ b/framework/common/tcuThreadUtil.cpp
@@ -163,7 +163,7 @@
 	m_thread.pushMessage(m_stream.str());
 }
 
-Thread::Thread (int seed)
+Thread::Thread (deUint32 seed)
 	: m_random	(seed)
 	, m_status	(THREADSTATUS_NOT_STARTED)
 {
@@ -267,7 +267,7 @@
 void DataBlock::setData (size_t size, const void* data)
 {
 	m_data = std::vector<deUint8>(size);
-	deMemcpy(&(m_data[0]), data, (int)size);
+	deMemcpy(&(m_data[0]), data, size);
 }
 
 CompareData::CompareData (SharedPtr<DataBlock> a, SharedPtr<DataBlock> b)
diff --git a/framework/common/tcuThreadUtil.hpp b/framework/common/tcuThreadUtil.hpp
index a8c88ae..7157d2c 100644
--- a/framework/common/tcuThreadUtil.hpp
+++ b/framework/common/tcuThreadUtil.hpp
@@ -162,7 +162,7 @@
 		THREADSTATUS_FAILED,
 		THREADSTATUS_NOT_SUPPORTED
 	};
-							Thread				(int seed);
+							Thread				(deUint32 seed);
 							~Thread				(void);
 
 	virtual void			init				(void) {}	//!< Called first before any Operation
diff --git a/framework/common/tcuVector.hpp b/framework/common/tcuVector.hpp
index cc5aeca..2b40a18 100644
--- a/framework/common/tcuVector.hpp
+++ b/framework/common/tcuVector.hpp
@@ -141,7 +141,7 @@
 	VecAccess<T, Size, 4>	xyzw		(void) { DE_ASSERT(Size >= 4); return VecAccess<T, Size, 4>(*this, 0, 1, 2, 3); }
 
 	// Swizzles.
-	const T&				swizzle		(int a) const { DE_ASSERT(a >= 0 && a < Size); return m_data[a]; }
+	Vector<T, 1>			swizzle		(int a) const { DE_ASSERT(a >= 0 && a < Size); return Vector<T, 1>(m_data[a]); }
 	Vector<T, 2>			swizzle		(int a, int b) const { DE_ASSERT(a >= 0 && a < Size); DE_ASSERT(b >= 0 && b < Size); return Vector<T, 2>(m_data[a], m_data[b]); }
 	Vector<T, 3>			swizzle		(int a, int b, int c) const { DE_ASSERT(a >= 0 && a < Size); DE_ASSERT(b >= 0 && b < Size); DE_ASSERT(c >= 0 && c < Size); return Vector<T, 3>(m_data[a], m_data[b], m_data[c]); }
 	Vector<T, 4>			swizzle		(int a, int b, int c, int d) const { DE_ASSERT(a >= 0 && a < Size); DE_ASSERT(b >= 0 && b < Size); DE_ASSERT(c >= 0 && c < Size); DE_ASSERT(d >= 0 && d < Size); return Vector<T, 4>(m_data[a], m_data[b], m_data[c], m_data[d]); }
diff --git a/framework/common/tcuVectorType.hpp b/framework/common/tcuVectorType.hpp
index 832c31b..1865a61 100644
--- a/framework/common/tcuVectorType.hpp
+++ b/framework/common/tcuVectorType.hpp
@@ -35,18 +35,22 @@
 template <typename T, int Size>
 class Vector;
 
+typedef Vector<float, 1>	Vec1;
 typedef Vector<float, 2>	Vec2;
 typedef Vector<float, 3>	Vec3;
 typedef Vector<float, 4>	Vec4;
 
+typedef Vector<int, 1>		IVec1;
 typedef Vector<int, 2>		IVec2;
 typedef Vector<int, 3>		IVec3;
 typedef Vector<int, 4>		IVec4;
 
+typedef Vector<deUint32, 1>	UVec1;
 typedef Vector<deUint32, 2>	UVec2;
 typedef Vector<deUint32, 3>	UVec3;
 typedef Vector<deUint32, 4>	UVec4;
 
+typedef Vector<bool, 1>		BVec1;
 typedef Vector<bool, 2>		BVec2;
 typedef Vector<bool, 3>		BVec3;
 typedef Vector<bool, 4>		BVec4;
diff --git a/framework/common/tcuVectorUtil.hpp b/framework/common/tcuVectorUtil.hpp
index de17642..e21fb2e 100644
--- a/framework/common/tcuVectorUtil.hpp
+++ b/framework/common/tcuVectorUtil.hpp
@@ -25,6 +25,7 @@
 
 #include "tcuDefs.hpp"
 #include "tcuVector.hpp"
+#include "deMeta.hpp"
 #include "deMath.h"
 #include "deInt32.h"
 
@@ -55,15 +56,13 @@
 template<typename T> inline T logicalOr		(T a, T b)	{ return a || b; }
 
 template<typename T>	inline T		mod		(T a, T b)			{ return a % b; }
-template<>				inline float	mod		(float x, float y)	{ return x - y * floor(x / y); }
+template<>				inline float	mod		(float x, float y)	{ return x - y * deFloatFloor(x / y); }
 
 template<typename T>	inline	T			negate				(T f)			{ return -f; }
 template<>				inline	deUint32	negate<deUint32>	(deUint32 f)	{ return (deUint32)-(int)f;	}
 
 inline float radians		(float f) { return deFloatRadians(f); }
 inline float degrees		(float f) { return deFloatDegrees(f); }
-inline float exp2			(float f) { return deFloatExp2(f); }
-inline float log2			(float f) { return deFloatLog2(f); }
 inline float inverseSqrt	(float f) { return deFloatRsq(f); }
 inline float sign			(float f) { return (f < 0.0f) ? -1.0f : ((f > 0.0f) ? +1.0f : 0.0f); }
 inline float fract			(float f) { return f - deFloatFloor(f); }
@@ -94,13 +93,9 @@
 	if (k < 0.0f)
 		return 0.0f;
 	else
-		return eta * i - (eta * cosAngle + ::sqrt(k)) * n;
+		return eta * i - (eta * cosAngle + deFloatSqrt(k)) * n;
 }
 
-inline float asinh			(float a) { return deFloatAsinh(a); }
-inline float acosh			(float a) { return deFloatAcosh(a); }
-inline float atanh			(float a) { return deFloatAtanh(a); }
-
 template<typename T> inline bool	lessThan			(T a, T b) { return (a < b); }
 template<typename T> inline bool	lessThanEqual		(T a, T b) { return (a <= b); }
 template<typename T> inline bool	greaterThan			(T a, T b) { return (a > b); }
@@ -114,8 +109,6 @@
 
 inline int chopToInt			(float a) { return deChopFloatToInt32(a); }
 
-inline float trunc				(float a) { return (float)chopToInt(a); }
-
 inline float roundToEven (float a)
 {
 	float q = deFloatFrac(a);
@@ -148,12 +141,18 @@
 }
 
 template <typename T, int Size>
-inline T length (const Vector<T, Size>& a)
+inline typename de::meta::EnableIf<T, de::meta::TypesSame<T, double>::Value>::Type length (const Vector<T, Size>& a)
 {
 	return ::sqrt(lengthSquared(a));
 }
 
 template <typename T, int Size>
+inline typename de::meta::EnableIf<T, de::meta::TypesSame<T, float>::Value>::Type length (const Vector<T, Size>& a)
+{
+	return deFloatSqrt(lengthSquared(a));
+}
+
+template <typename T, int Size>
 inline T distance (const Vector<T, Size>& a, const Vector<T, Size>& b)
 {
 	return length(a - b);
@@ -450,7 +449,7 @@
 TCU_DECLARE_VECTOR_UNARY_FUNC(abs, de::abs)
 TCU_DECLARE_VECTOR_UNARY_FUNC(sign, deFloatSign)
 TCU_DECLARE_VECTOR_UNARY_FUNC(floor, deFloatFloor)
-TCU_DECLARE_VECTOR_UNARY_FUNC(trunc, trunc)
+TCU_DECLARE_VECTOR_UNARY_FUNC(trunc, deFloatTrunc)
 TCU_DECLARE_VECTOR_UNARY_FUNC(roundToEven, roundToEven)
 TCU_DECLARE_VECTOR_UNARY_FUNC(ceil, deFloatCeil)
 TCU_DECLARE_VECTOR_UNARY_FUNC(fract, deFloatFrac)
diff --git a/framework/delibs/cmake/CFlags.cmake b/framework/delibs/cmake/CFlags.cmake
index d292e6e..ff25740 100644
--- a/framework/delibs/cmake/CFlags.cmake
+++ b/framework/delibs/cmake/CFlags.cmake
@@ -43,8 +43,8 @@
 	set(DE_3RD_PARTY_C_FLAGS	"${CMAKE_C_FLAGS} ${TARGET_FLAGS} -w")
 	set(DE_3RD_PARTY_CXX_FLAGS	"${CMAKE_CXX_FLAGS} ${TARGET_FLAGS} -w")
 
-	# \note Add -Wconversion for more warnings
-	set(WARNING_FLAGS			"-Wall -Wextra -Wno-long-long -Wshadow -Wundef")
+	# \note Remove -Wno-sign-conversion for more warnings
+	set(WARNING_FLAGS			"-Wall -Wextra -Wno-long-long -Wshadow -Wundef -Wconversion -Wno-sign-conversion")
 
 	set(CMAKE_C_FLAGS			"${CMAKE_C_FLAGS} ${TARGET_FLAGS} ${WARNING_FLAGS} -ansi -pedantic ")
 	set(CMAKE_CXX_FLAGS			"${CMAKE_CXX_FLAGS} ${TARGET_FLAGS} ${WARNING_FLAGS}")
diff --git a/framework/delibs/cmake/toolchain-android-r10e.cmake b/framework/delibs/cmake/toolchain-android-r10e.cmake
new file mode 100644
index 0000000..25fe730
--- /dev/null
+++ b/framework/delibs/cmake/toolchain-android-r10e.cmake
@@ -0,0 +1,175 @@
+# Platform defines.
+set(CMAKE_SYSTEM_NAME Linux)
+
+set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
+
+set(CMAKE_CROSSCOMPILING 1)
+
+# NDK installation path
+if (NOT DEFINED ANDROID_NDK_PATH)
+	message(FATAL_ERROR "Please provide ANDROID_NDK_PATH")
+endif ()
+
+# Host os (for toolchain binaries)
+if (NOT DEFINED ANDROID_NDK_HOST_OS)
+	message(STATUS "Warning: ANDROID_NDK_HOST_OS is not set")
+	if (WIN32)
+		set(ANDROID_NDK_HOST_OS "windows")
+	elseif (UNIX)
+		set(ANDROID_NDK_HOST_OS "linux-86")
+	endif ()
+endif ()
+
+# Compile target
+set(ANDROID_ABI			"armeabi-v7a"			CACHE STRING "Android ABI")
+set(ANDROID_NDK_TARGET	"android-${DE_ANDROID_API}")
+
+# dE defines
+set(DE_OS "DE_OS_ANDROID")
+
+if (NOT DEFINED DE_COMPILER)
+	set(DE_COMPILER	"DE_COMPILER_CLANG")
+endif ()
+
+if (NOT DEFINED DE_ANDROID_API)
+	set(DE_ANDROID_API 9)
+endif ()
+
+set(COMMON_C_FLAGS		"-D__STDC_INT64__")
+set(COMMON_CXX_FLAGS	"${COMMON_C_FLAGS} -frtti -fexceptions")
+set(COMMON_LINKER_FLAGS	"")
+set(ARM_C_FLAGS			"-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ ")
+
+# ABI-dependent bits
+if (ANDROID_ABI STREQUAL "x86")
+	set(DE_CPU					"DE_CPU_X86")
+	set(CMAKE_SYSTEM_PROCESSOR	i686-android-linux)
+
+	set(ANDROID_CC_PATH			"${ANDROID_NDK_PATH}/toolchains/x86-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
+	set(CROSS_COMPILE			"${ANDROID_CC_PATH}bin/i686-linux-android-")
+	set(ANDROID_SYSROOT			"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-x86")
+
+	set(CMAKE_FIND_ROOT_PATH
+		"${ANDROID_CC_PATH}i686-linux-android"
+		"${ANDROID_CC_PATH}lib/gcc/i686-linux-android/4.9"
+		)
+
+	set(TARGET_C_FLAGS			"-march=i686 -msse3 -mstackrealign -mfpmath=sse")
+	set(TARGET_LINKER_FLAGS		"")
+	set(LLVM_TRIPLE				"i686-none-linux-android")
+
+elseif (ANDROID_ABI STREQUAL "armeabi" OR
+		ANDROID_ABI STREQUAL "armeabi-v7a")
+	set(DE_CPU					"DE_CPU_ARM")
+	set(CMAKE_SYSTEM_PROCESSOR	arm-linux-androideabi)
+
+	set(ANDROID_CC_PATH	"${ANDROID_NDK_PATH}/toolchains/arm-linux-androideabi-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
+	set(CROSS_COMPILE	"${ANDROID_CC_PATH}bin/arm-linux-androideabi-")
+	set(ANDROID_SYSROOT	"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-arm")
+
+	if (ANDROID_ABI STREQUAL "armeabi-v7a")
+		set(TARGET_C_FLAGS		"${ARM_C_FLAGS} -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp")
+		set(TARGET_LINKER_FLAGS	"-Wl,--fix-cortex-a8 -march=armv7-a")
+		set(LLVM_TRIPLE			"armv7-none-linux-androideabi")
+
+	else () # armeabi
+		set(TARGET_C_FLAGS		"${ARM_C_FLAGS} -march=armv5te -mfloat-abi=softfp")
+		set(TARGET_LINKER_FLAGS	"-Wl,--fix-cortex-a8 -march=armv5te")
+		set(LLVM_TRIPLE			"armv5te-none-linux-androideabi")
+	endif ()
+
+	set(CMAKE_FIND_ROOT_PATH
+		"${ANDROID_CC_PATH}arm-linux-androideabi"
+		)
+
+elseif (ANDROID_ABI STREQUAL "arm64-v8a")
+	set(DE_CPU					"DE_CPU_ARM_64")
+	set(CMAKE_SYSTEM_PROCESSOR	aarch64-linux-android)
+	set(CMAKE_SIZEOF_VOID_P		8)
+
+	set(ANDROID_CC_PATH	"${ANDROID_NDK_PATH}/toolchains/aarch64-linux-android-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
+	set(CROSS_COMPILE	"${ANDROID_CC_PATH}bin/aarch64-linux-android-")
+	set(ANDROID_SYSROOT	"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-arm64")
+
+	set(CMAKE_FIND_ROOT_PATH
+		"${ANDROID_CC_PATH}arm-linux-androideabi"
+		)
+
+	set(TARGET_C_FLAGS		"-march=armv8-a")
+	set(TARGET_LINKER_FLAGS	"-Wl,--fix-cortex-a53-835769 -Wl,--fix-cortex-a53-835769 -march=armv8-a")
+	set(LLVM_TRIPLE			"aarch64-none-linux-android")
+
+	if (DE_COMPILER STREQUAL "DE_COMPILER_GCC")
+		set(TARGET_C_FLAGS "${TARGET_C_FLAGS} -mabi=lp64")
+	endif ()
+
+else ()
+	message(FATAL_ERROR "Unknown ABI \"${ANDROID_ABI}\"")
+endif ()
+
+# C++ library
+if (ANDROID_ABI STREQUAL "x86")
+	# Use gnu-libstc++, since libc++ is currently broken on x86, bug #22124988
+	set(ANDROID_CXX_LIBRARY 	"${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/libs/${ANDROID_ABI}/libgnustl_static.a")
+	set(CXX_INCLUDES			"-I${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/include -I${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/libs/${ANDROID_ABI}/include")
+	set(CMAKE_FIND_ROOT_PATH	"${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/libs/${ANDROID_ABI}" ${CMAKE_FIND_ROOT_PATH})
+else ()
+	# Use LLVM libc++ for full C++11 support
+	set(ANDROID_CXX_LIBRARY		"${ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_static.a")
+	set(CXX_INCLUDES			"-I${ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++/libcxx/include")
+	set(CMAKE_FIND_ROOT_PATH	"" ${CMAKE_FIND_ROOT_PATH})
+endif ()
+
+set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${ANDROID_SYSROOT})
+
+include(CMakeForceCompiler)
+
+if (DE_COMPILER STREQUAL "DE_COMPILER_GCC")
+	if (ANDROID_NDK_HOST_OS STREQUAL "linux-x86" OR
+		ANDROID_NDK_HOST_OS STREQUAL "linux-x86_64" OR
+		ANDROID_NDK_HOST_OS STREQUAL "darwin-x86")
+		cmake_force_c_compiler("${CROSS_COMPILE}gcc"		GNU)
+		cmake_force_cxx_compiler("${CROSS_COMPILE}g++"		GNU)
+	elseif (ANDROID_NDK_HOST_OS STREQUAL "windows")
+		cmake_force_c_compiler("${CROSS_COMPILE}gcc.exe"	GNU)
+		cmake_force_cxx_compiler("${CROSS_COMPILE}g++.exe"	GNU)
+	else ()
+		message(FATAL_ERROR "Unknown ANDROID_NDK_HOST_OS")
+	endif ()
+
+	set(TARGET_C_FLAGS		"-mandroid ${TARGET_C_FLAGS}")
+
+elseif (DE_COMPILER STREQUAL "DE_COMPILER_CLANG")
+	set(LLVM_PATH "${ANDROID_NDK_PATH}/toolchains/llvm-3.6/prebuilt/${ANDROID_NDK_HOST_OS}/")
+
+	if (ANDROID_NDK_HOST_OS STREQUAL "linux-x86" OR
+		ANDROID_NDK_HOST_OS STREQUAL "linux-x86_64" OR
+		ANDROID_NDK_HOST_OS STREQUAL "darwin-x86")
+		cmake_force_c_compiler("${LLVM_PATH}bin/clang"			Clang)
+		cmake_force_cxx_compiler("${LLVM_PATH}bin/clang++"		Clang)
+		set(CMAKE_AR "${LLVM_PATH}/bin/llvm-ar" CACHE FILEPATH "Archiver")
+	elseif (ANDROID_NDK_HOST_OS STREQUAL "windows")
+		cmake_force_c_compiler("${LLVM_PATH}bin/clang.exe"		Clang)
+		cmake_force_cxx_compiler("${LLVM_PATH}bin/clang++.exe"	Clang)
+		set(CMAKE_AR "${LLVM_PATH}bin/llvm-ar.exe" CACHE FILEPATH "Archiver")
+	else ()
+		message(FATAL_ERROR "Unknown ANDROID_NDK_HOST_OS")
+	endif ()
+
+	set(TARGET_C_FLAGS		"-target ${LLVM_TRIPLE} -gcc-toolchain ${ANDROID_CC_PATH} ${TARGET_C_FLAGS}")
+	set(TARGET_LINKER_FLAGS	"-target ${LLVM_TRIPLE} -gcc-toolchain ${ANDROID_CC_PATH} ${TARGET_LINKER_FLAGS}")
+
+endif ()
+
+set(CMAKE_SHARED_LIBRARY_C_FLAGS	"")
+set(CMAKE_SHARED_LIBRARY_CXX_FLAGS	"")
+
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+# \note Without CACHE STRING FORCE cmake ignores these.
+set(CMAKE_C_FLAGS				"--sysroot=${ANDROID_SYSROOT} ${COMMON_C_FLAGS} ${TARGET_C_FLAGS}" CACHE STRING "" FORCE)
+set(CMAKE_CXX_FLAGS				"--sysroot=${ANDROID_SYSROOT} ${COMMON_CXX_FLAGS} ${TARGET_C_FLAGS} ${CXX_INCLUDES} -I${ANDROID_NDK_PATH}/sources/android/support/include" CACHE STRING "" FORCE)
+set(CMAKE_SHARED_LINKER_FLAGS	"-nodefaultlibs -Wl,-shared,-Bsymbolic -Wl,--no-undefined ${COMMON_LINKER_FLAGS} ${TARGET_LINKER_FLAGS}" CACHE STRING "" FORCE)
+set(CMAKE_EXE_LINKER_FLAGS		"-nodefaultlibs ${COMMON_LINKER_FLAGS} ${TARGET_LINKER_FLAGS}" CACHE STRING "" FORCE)
diff --git a/framework/delibs/debase/deDefs.c b/framework/delibs/debase/deDefs.c
index b664724..68e578b 100644
--- a/framework/delibs/debase/deDefs.c
+++ b/framework/delibs/debase/deDefs.c
@@ -123,7 +123,7 @@
 #elif ((DE_OS == DE_OS_WIN32) && (DE_COMPILER == DE_COMPILER_CLANG))
 	_assert(reason, file, line);
 #elif (DE_OS == DE_OS_UNIX)
-	__assert_fail(reason, file, line, "Unknown function");
+	__assert_fail(reason, file, (unsigned int)line, "Unknown function");
 #elif (DE_OS == DE_OS_SYMBIAN)
 	__assert("Unknown function", file, line, reason);
 #elif (DE_OS == DE_OS_OSX) || (DE_OS == DE_OS_IOS)
diff --git a/framework/delibs/debase/deDefs.h b/framework/delibs/debase/deDefs.h
index 3c3abbf..42826f7 100644
--- a/framework/delibs/debase/deDefs.h
+++ b/framework/delibs/debase/deDefs.h
@@ -263,6 +263,10 @@
 /* Assertion macro family. */
 void deAssertFail(const char* reason, const char* file, int line);
 
+/* Assertion failure callback. Requires DE_ASSERT_FAILURE_CALLBACK to be defined or otherwise has no effect. */
+typedef void (*deAssertFailureCallbackFunc) (const char* reason, const char* file, int line);
+void deSetAssertFailureCallback (deAssertFailureCallbackFunc callback);
+
 DE_INLINE deBool deGetFalse (void) { return DE_FALSE; }
 DE_INLINE deBool deGetTrue (void) { return DE_TRUE; }
 
@@ -273,10 +277,6 @@
 #	define DE_ASSERT(X) /*@ -noeffect*/ ((void)0)	/*!< Assertion macro. */
 #endif
 
-/* Assertion failure callback. Requires DE_ASSERT_FAILURE_CALLBACK to be defined or otherwise has no effect. */
-typedef void (*deAssertFailureCallbackFunc) (const char* reason, const char* file, int line);
-void deSetAssertFailureCallback (deAssertFailureCallbackFunc callback);
-
 /* Verify macro. Behaves like assert in debug build, but executes statement in release build. */
 #if defined(DE_DEBUG)
 #	define DE_VERIFY(X) do { if ((!deGetFalse() && (X)) ? DE_FALSE : DE_TRUE) deAssertFail(#X, __FILE__, __LINE__); } while(deGetFalse())
@@ -284,16 +284,24 @@
 #	define DE_VERIFY(X) X
 #endif
 
+/* Fatal macro. */
+#if defined(DE_DEBUG) && !defined(DE_COVERAGE_BUILD)
+#	define DE_FATAL(MSG) do { deAssertFail("" /* force to string literal */ MSG, __FILE__, __LINE__); } while(deGetFalse())
+#else
+#	define DE_FATAL(MSG) /*@ -noeffect*/ ((void)0)	/*!< Fatal macro. */
+#endif
+
 /** Test assert macro for use in testers (same as DE_ASSERT, but always enabled). */
 #define DE_TEST_ASSERT(X) do { if ((!deGetFalse() && (X)) ? DE_FALSE : DE_TRUE) deAssertFail(#X, __FILE__, __LINE__); } while(deGetFalse())
 
-/** Compile-time assertion macro. */
-#if (DE_COMPILER == DE_COMPILER_GCC)
+#if (DE_COMPILER == DE_COMPILER_GCC) || (DE_COMPILER == DE_COMPILER_CLANG)
 	/* GCC 4.8 and newer warns about unused typedefs. */
 #	define DE_UNUSED_TYPEDEF_ATTR __attribute__((unused))
 #else
 #	define DE_UNUSED_TYPEDEF_ATTR
 #endif
+
+/** Compile-time assertion macro. */
 #define DE_STATIC_ASSERT(X)						typedef char DE_UNIQUE_NAME[(X) ? 1 : -1] DE_UNUSED_TYPEDEF_ATTR
 #define DE_HEADER_STATIC_ASSERT(HEADERTOKEN, X)	typedef char DE_HEADER_UNIQUE_NAME(HEADERTOKEN)[(X) ? 1 : -1] DE_UNUSED_TYPEDEF_ATTR
 
@@ -312,7 +320,7 @@
 #elif (DE_CPU == DE_CPU_ARM) && (DE_COMPILER == DE_COMPILER_MSC)
 #	define DE_BREAKPOINT() do { printf("Software breakpoint encountered in %s, line %d\n", __FILE__, __LINE__); DebugBreak(); } while (deGetFalse())
 #else
-#	define DE_BREAKPOINT() DE_ASSERT(!"Software breakpoint encountered!")
+#	define DE_BREAKPOINT() DE_FATAL("Software breakpoint encountered!")
 #endif
 
 /** Swap two values. */
diff --git a/framework/delibs/debase/deFloat16.c b/framework/delibs/debase/deFloat16.c
index 375fdc3..e424395 100644
--- a/framework/delibs/debase/deFloat16.c
+++ b/framework/delibs/debase/deFloat16.c
@@ -27,19 +27,19 @@
 
 deFloat16 deFloat32To16 (float val32)
 {
-	int sign;
-	int expotent;
-	int mantissa;
+	deUint32	sign;
+	int			expotent;
+	deUint32	mantissa;
 	union
 	{
-		float	f;
-		int		i;
+		float		f;
+		deUint32	u;
 	} x;
 
 	x.f 		= val32;
-	sign		= (x.i >> 16) & 0x00008000;
-	expotent	= ((x.i >> 23) & 0x000000ff) - (127 - 15);
-	mantissa	= x.i & 0x007fffff;
+	sign		= (x.u >> 16u) & 0x00008000u;
+	expotent	= (int)((x.u >> 23u) & 0x000000ffu) - (127 - 15);
+	mantissa	= x.u & 0x007fffffu;
 
 	if (expotent <= 0)
 	{
@@ -50,13 +50,13 @@
 		}
 
 		/* Converted to denormalized half, add leading 1 to significand. */
-		mantissa = mantissa | 0x00800000;
+		mantissa = mantissa | 0x00800000u;
 
 		/* Round mantissa to nearest (10+e) */
 		{
-			int t = 14 - expotent;
-			int a = (1 << (t - 1)) - 1;
-			int b = (mantissa >> t) & 1;
+			deUint32 t = 14u - expotent;
+			deUint32 a = (1u << (t - 1u)) - 1u;
+			deUint32 b = (mantissa >> t) & 1u;
 
 			mantissa = (mantissa + a + b) >> t;
 		}
@@ -65,99 +65,99 @@
 	}
 	else if (expotent == 0xff - (127 - 15))
 	{
-		if (mantissa == 0)
+		if (mantissa == 0u)
 		{
 			/* InF */
-			return (deFloat16) (sign | 0x7c00);
+			return (deFloat16) (sign | 0x7c00u);
 		}
 		else
 		{
 			/* NaN */
-			mantissa >>= 13;
-			return (deFloat16) (sign | 0x7c00 | mantissa | (mantissa == 0));
+			mantissa >>= 13u;
+			return (deFloat16) (sign | 0x7c00u | mantissa | (mantissa == 0u));
 		}
 	}
 	else
 	{
 		/* Normalized float. */
-		mantissa = mantissa + 0x00000fff + ((mantissa >> 13) & 1);
+		mantissa = mantissa + 0x00000fffu + ((mantissa >> 13u) & 1u);
 
-		if (mantissa & 0x00800000)
+		if (mantissa & 0x00800000u)
 		{
 			/* Overflow in mantissa. */
-			mantissa  = 0;
+			mantissa  = 0u;
 			expotent += 1;
 		}
 
 		if (expotent > 30)
 		{
 			/* \todo [pyry] Cause hw fp overflow */
-			return (deFloat16) (sign | 0x7c00);
+			return (deFloat16) (sign | 0x7c00u);
 		}
 
-		return (deFloat16) (sign | (expotent << 10) | (mantissa >> 13));
+		return (deFloat16) (sign | ((deUint32)expotent << 10u) | (mantissa >> 13u));
 	}
 }
 
 float deFloat16To32 (deFloat16 val16)
 {
-	int sign;
-	int expotent;
-	int mantissa;
+	deUint32 sign;
+	deUint32 expotent;
+	deUint32 mantissa;
 	union
 	{
-		float	f;
-		int		i;
+		float		f;
+		deUint32	u;
 	} x;
 
-	x.i			= 0;
+	x.u			= 0u;
 
-	sign		= ((int) val16 >> 15) & 0x00000001;
-	expotent	= ((int) val16 >> 10) & 0x0000001f;
-	mantissa	= (int) val16 & 0x000003ff;
+	sign		= ((deUint32)val16 >> 15u) & 0x00000001u;
+	expotent	= ((deUint32)val16 >> 10u) & 0x0000001fu;
+	mantissa	= (deUint32)val16 & 0x000003ffu;
 
-	if (expotent == 0)
+	if (expotent == 0u)
 	{
-		if (mantissa == 0)
+		if (mantissa == 0u)
 		{
 			/* +/- 0 */
-			x.i = sign << 31;
+			x.u = sign << 31u;
 			return x.f;
 		}
 		else
 		{
 			/* Denormalized, normalize it. */
 
-			while (!(mantissa & 0x00000400))
+			while (!(mantissa & 0x00000400u))
 			{
-				mantissa <<= 1;
-				expotent -=  1;
+				mantissa <<= 1u;
+				expotent -=  1u;
 			}
 
-			expotent += 1;
-			mantissa &= ~0x00000400;
+			expotent += 1u;
+			mantissa &= ~0x00000400u;
 		}
 	}
-	else if (expotent == 31)
+	else if (expotent == 31u)
 	{
-		if (mantissa == 0)
+		if (mantissa == 0u)
 		{
 			/* +/- InF */
-			x.i = (sign << 31) | 0x7f800000;
+			x.u = (sign << 31u) | 0x7f800000u;
 			return x.f;
 		}
 		else
 		{
 			/* +/- NaN */
-			x.i = (sign << 31) | 0x7f800000 | (mantissa << 13);
+			x.u = (sign << 31u) | 0x7f800000u | (mantissa << 13u);
 			return x.f;
 		}
 	}
 
-	expotent = expotent + (127 - 15);
-	mantissa = mantissa << 13;
+	expotent = expotent + (127u - 15u);
+	mantissa = mantissa << 13u;
 
-	x.i = (sign << 31) | (expotent << 23) | mantissa;
+	x.u = (sign << 31u) | (expotent << 23u) | mantissa;
 	return x.f;
 }
 
diff --git a/framework/delibs/debase/deInt32.h b/framework/delibs/debase/deInt32.h
index 1ec9a37..6e574e5 100644
--- a/framework/delibs/debase/deInt32.h
+++ b/framework/delibs/debase/deInt32.h
@@ -158,9 +158,9 @@
  * \param a	Input value.
  * \return 0x80000000 if a<0, 0 otherwise.
  *//*--------------------------------------------------------------------*/
-DE_INLINE int deSignBit32 (int a)
+DE_INLINE deInt32 deSignBit32 (deInt32 a)
 {
-	return (a & 0x80000000);
+	return (deInt32)((deUint32)a & 0x80000000u);
 }
 
 /*--------------------------------------------------------------------*//*!
@@ -293,7 +293,7 @@
 DE_INLINE int deLog2Floor32 (deInt32 a)
 {
 	DE_ASSERT(a > 0);
-	return 31 - deClz32(a);
+	return 31 - deClz32((deUint32)a);
 }
 
 /*--------------------------------------------------------------------*//*!
@@ -356,6 +356,16 @@
 	return b0|b1|b2|b3;
 }
 
+/*--------------------------------------------------------------------*//*!
+ * \brief Reverse bytes in 16-bit integer (for example MSB -> LSB).
+ * \param a	Input value.
+ * \return The input with bytes reversed
+ *//*--------------------------------------------------------------------*/
+DE_INLINE deUint16 deReverseBytes16 (deUint16 v)
+{
+	return (deUint16)((v << 8) | (v >> 8));
+}
+
 DE_INLINE deInt32 deSafeMul32 (deInt32 a, deInt32 b)
 {
 	deInt32 res = a * b;
@@ -401,11 +411,11 @@
 	return (a >= 0) ? a : -a;
 }
 
-DE_INLINE int deClz64 (deInt64 a)
+DE_INLINE int deClz64 (deUint64 a)
 {
-	if (((deUint64)a >> 32) != 0)
-		return deClz32((deInt32)(a >> 32));
-	return deClz32((deInt32)a) + 32;
+	if ((a >> 32) != 0)
+		return deClz32((deUint32)(a >> 32));
+	return deClz32((deUint32)a) + 32;
 }
 
 /* Common hash & compare functions. */
@@ -413,7 +423,7 @@
 DE_INLINE deUint32 deInt32Hash (deInt32 a)
 {
 	/* From: http://www.concentric.net/~Ttwang/tech/inthash.htm */
-	deUint32 key = a;
+	deUint32 key = (deUint32)a;
 	key = (key ^ 61) ^ (key >> 16);
 	key = key + (key << 3);
 	key = key ^ (key >> 4);
@@ -425,7 +435,7 @@
 DE_INLINE deUint32 deInt64Hash (deInt64 a)
 {
 	/* From: http://www.concentric.net/~Ttwang/tech/inthash.htm */
-	deUint64 key = a;
+	deUint64 key = (deUint64)a;
 	key = (~key) + (key << 21); /* key = (key << 21) - key - 1; */
 	key = key ^ (key >> 24);
 	key = (key + (key << 3)) + (key << 8); /* key * 265 */
@@ -436,10 +446,10 @@
 	return (deUint32)key;
 }
 
-DE_INLINE int		deInt16Hash		(deInt16 v)					{ return deInt32Hash(v);			}
-DE_INLINE int		deUint16Hash	(deUint16 v)				{ return deInt32Hash((deInt32)v);	}
-DE_INLINE int		deUint32Hash	(deUint32 v)				{ return deInt32Hash((deInt32)v);	}
-DE_INLINE int		deUint64Hash	(deUint64 v)				{ return deInt64Hash((deInt64)v);	}
+DE_INLINE deUint32	deInt16Hash		(deInt16 v)					{ return deInt32Hash(v);			}
+DE_INLINE deUint32	deUint16Hash	(deUint16 v)				{ return deInt32Hash((deInt32)v);	}
+DE_INLINE deUint32	deUint32Hash	(deUint32 v)				{ return deInt32Hash((deInt32)v);	}
+DE_INLINE deUint32	deUint64Hash	(deUint64 v)				{ return deInt64Hash((deInt64)v);	}
 
 DE_INLINE deBool	deInt16Equal	(deInt16 a, deInt16 b)		{ return (a == b);	}
 DE_INLINE deBool	deUint16Equal	(deUint16 a, deUint16 b)	{ return (a == b);	}
@@ -448,7 +458,7 @@
 DE_INLINE deBool	deInt64Equal	(deInt64 a, deInt64 b)		{ return (a == b);	}
 DE_INLINE deBool	deUint64Equal	(deUint64 a, deUint64 b)	{ return (a == b);	}
 
-DE_INLINE int dePointerHash (const void* ptr)
+DE_INLINE deUint32	dePointerHash (const void* ptr)
 {
 	deUintptr val = (deUintptr)ptr;
 #if (DE_PTR_SIZE == 4)
@@ -532,6 +542,23 @@
 	}
 }
 
+DE_INLINE deInt32 deSignExtendTo32 (deInt32 value, int numBits)
+{
+	DE_ASSERT(deInRange32(numBits, 1, 32));
+
+	if (numBits < 32)
+	{
+		deBool		signSet		= ((deUint32)value & (1u<<(numBits-1))) != 0;
+		deUint32	signMask	= deBitMask32(numBits, 32-numBits);
+
+		DE_ASSERT(((deUint32)value & signMask) == 0u);
+
+		return (deInt32)((deUint32)value | (signSet ? signMask : 0u));
+	}
+	else
+		return value;
+}
+
 DE_END_EXTERN_C
 
 #endif /* _DEINT32_H */
diff --git a/framework/delibs/debase/deInt32Test.c b/framework/delibs/debase/deInt32Test.c
index eaf20dc..9d3d29a 100644
--- a/framework/delibs/debase/deInt32Test.c
+++ b/framework/delibs/debase/deInt32Test.c
@@ -43,8 +43,8 @@
 
 	for (ndx = 0; ndx < (1<<RCP_LUT_BITS); ndx++)
 	{
-		deUint32	val = (1u << RCP_LUT_BITS) | ndx;
-		deUint32	rcp = (int)((1u << DE_RCP_FRAC_BITS) / ((double)val / (1<<RCP_LUT_BITS)));
+		deUint32	val = (1u << RCP_LUT_BITS) | (deUint32)ndx;
+		deUint32	rcp = (deUint32)((1u << DE_RCP_FRAC_BITS) / ((double)val / (1<<RCP_LUT_BITS)));
 
 		if ((ndx & 3) == 0)
 			printf("\t");
@@ -87,8 +87,8 @@
 	DE_TEST_ASSERT(deClz32(0x80000000) == 0);
 
 	/* Test simple inputs for dePop32(). */
-	DE_TEST_ASSERT(dePop32(0) == 0);
-	DE_TEST_ASSERT(dePop32(~0) == 32);
+	DE_TEST_ASSERT(dePop32(0u) == 0);
+	DE_TEST_ASSERT(dePop32(~0u) == 32);
 	DE_TEST_ASSERT(dePop32(0xFF) == 8);
 	DE_TEST_ASSERT(dePop32(0xFF00FF) == 16);
 	DE_TEST_ASSERT(dePop32(0x3333333) == 14);
@@ -97,8 +97,8 @@
 	/* dePop32(): Check exp2(N) values and inverses. */
 	for (numBits = 0; numBits < 32; numBits++)
 	{
-		DE_TEST_ASSERT(dePop32(1<<numBits) == 1);
-		DE_TEST_ASSERT(dePop32(~(1<<numBits)) == 31);
+		DE_TEST_ASSERT(dePop32(1u<<numBits) == 1);
+		DE_TEST_ASSERT(dePop32(~(1u<<numBits)) == 31);
 	}
 
 	/* Check exp2(N) values. */
@@ -119,10 +119,10 @@
 
 		for (iter = 0; iter < NUM_ITERS; iter++)
 		{
-			const int	EPS = 1 << (DE_RCP_FRAC_BITS - NUM_ACCURATE_BITS);
+			const deUint32	EPS = 1u << (DE_RCP_FRAC_BITS - NUM_ACCURATE_BITS);
 
-			deUint32	val = (deRandom_getUint32(&rnd) & ((1u<<numBits)-1)) | (1u<<numBits);
-			deUint32	ref = (deUint32)(((1.0f / (double)val) * (double)(1<<DE_RCP_FRAC_BITS)) * (double)(1u<<numBits));
+			deUint32		val = (deRandom_getUint32(&rnd) & ((1u<<numBits)-1)) | (1u<<numBits);
+			deUint32		ref = (deUint32)(((1.0f / (double)val) * (double)(1<<DE_RCP_FRAC_BITS)) * (double)(1u<<numBits));
 
 			deRcp32(val, &rcp, &exp);
 
@@ -155,6 +155,24 @@
 	DE_TEST_ASSERT(deIntMinValue32(1) == -1);
 	DE_TEST_ASSERT(deIntMinValue32(2) == -2);
 	DE_TEST_ASSERT(deIntMinValue32(32) == -0x7FFFFFFF - 1);
+
+	DE_TEST_ASSERT(deSignExtendTo32((int)0x0, 1) == 0);
+	DE_TEST_ASSERT(deSignExtendTo32((int)0x1, 1) == (int)0xFFFFFFFF);
+	DE_TEST_ASSERT(deSignExtendTo32((int)0x3, 3) == 3);
+	DE_TEST_ASSERT(deSignExtendTo32((int)0x6, 3) == (int)0xFFFFFFFE);
+	DE_TEST_ASSERT(deSignExtendTo32((int)0x3, 4) == 3);
+	DE_TEST_ASSERT(deSignExtendTo32((int)0xC, 4) == (int)0xFFFFFFFC);
+	DE_TEST_ASSERT(deSignExtendTo32((int)0x7FC3, 16) == (int)0x7FC3);
+	DE_TEST_ASSERT(deSignExtendTo32((int)0x84A0, 16) == (int)0xFFFF84A0);
+	DE_TEST_ASSERT(deSignExtendTo32((int)0xFFC3, 17) == (int)0xFFC3);
+	DE_TEST_ASSERT(deSignExtendTo32((int)0x184A0, 17) == (int)0xFFFF84A0);
+	DE_TEST_ASSERT(deSignExtendTo32((int)0x7A016601, 32) == (int)0x7A016601);
+	DE_TEST_ASSERT(deSignExtendTo32((int)0x8A016601, 32) == (int)0x8A016601);
+
+	DE_TEST_ASSERT(deReverseBytes32(0x11223344) == 0x44332211);
+	DE_TEST_ASSERT(deReverseBytes32(0xfecddeef) == 0xefdecdfe);
+	DE_TEST_ASSERT(deReverseBytes16(0x1122) == 0x2211);
+	DE_TEST_ASSERT(deReverseBytes16(0xdeef) == 0xefde);
 }
 
 DE_END_EXTERN_C
diff --git a/framework/delibs/debase/deMemory.c b/framework/delibs/debase/deMemory.c
index 93ae325..35d2cf7 100644
--- a/framework/delibs/debase/deMemory.c
+++ b/framework/delibs/debase/deMemory.c
@@ -43,7 +43,7 @@
  * \param numBytes	Number of bytes to allocate.
  * \return Pointer to the allocated memory (or null on failure).
  *//*--------------------------------------------------------------------*/
-void* deMalloc (int numBytes)
+void* deMalloc (size_t numBytes)
 {
 	void* ptr;
 
@@ -73,7 +73,7 @@
  * \param numBytes	Number of bytes to allocate.
  * \return Pointer to the allocated memory (or null on failure).
  *//*--------------------------------------------------------------------*/
-void* deCalloc (int numBytes)
+void* deCalloc (size_t numBytes)
 {
 	void* ptr = deMalloc(numBytes);
 	if (ptr)
@@ -81,15 +81,17 @@
 	return ptr;
 }
 
-void* deAlignedMalloc (int numBytes, int alignBytes)
+void* deAlignedMalloc (size_t numBytes, deUint32 alignBytes)
 {
-	int			ptrSize		= sizeof(void*);
-	deUintptr	origPtr		= (deUintptr)deMalloc(numBytes + ptrSize + alignBytes);
+	size_t		ptrSize		= sizeof(void*);
+	deUintptr	origPtr		= (deUintptr)deMalloc(numBytes + ptrSize + (size_t)alignBytes);
+
+	DE_ASSERT(deInRange32(alignBytes, 0, 256) && deIsPowerOfTwo32(alignBytes));
+
 	if (origPtr)
 	{
-		deUintptr	alignedPtr	= (deUintptr)deAlignPtr((void*)(origPtr + ptrSize), alignBytes);
+		deUintptr	alignedPtr	= (deUintptr)deAlignPtr((void*)(origPtr + ptrSize), (deUintptr)alignBytes);
 		deUintptr	ptrPtr		= (alignedPtr - ptrSize);
-		DE_ASSERT(deInRange32(alignBytes, 0, 256) && deIsPowerOfTwo32(alignBytes));
 		*(deUintptr*)ptrPtr = origPtr;
 		return (void*)alignedPtr;
 	}
@@ -103,9 +105,9 @@
  * \param numBytes	New size in bytes
  * \return Pointer to the reallocated (and possibly moved) memory block
  *//*--------------------------------------------------------------------*/
-void* deRealloc (void* ptr, int numBytes)
+void* deRealloc (void* ptr, size_t numBytes)
 {
-	return realloc(ptr, (size_t)numBytes);
+	return realloc(ptr, numBytes);
 }
 
 /*--------------------------------------------------------------------*//*!
@@ -121,7 +123,7 @@
 {
 	if (ptr)
 	{
-		int			ptrSize		= sizeof(void*);
+		size_t		ptrSize		= sizeof(void*);
 		deUintptr	ptrPtr		= (deUintptr)ptr - ptrSize;
 		deUintptr	origPtr		= *(deUintptr*)ptrPtr;
 		DE_ASSERT(ptrPtr - origPtr < 256);
diff --git a/framework/delibs/debase/deMemory.h b/framework/delibs/debase/deMemory.h
index 1736be8..105d4d9 100644
--- a/framework/delibs/debase/deMemory.h
+++ b/framework/delibs/debase/deMemory.h
@@ -32,12 +32,12 @@
 #define DE_NEW(TYPE)			((TYPE*)deMalloc(sizeof(TYPE)))
 #define DE_DELETE(TYPE, PTR)	deFree(PTR)
 
-void*	deMalloc		(int numBytes);
-void*	deCalloc		(int numBytes);
-void*	deRealloc		(void* ptr, int numBytes);
+void*	deMalloc		(size_t numBytes);
+void*	deCalloc		(size_t numBytes);
+void*	deRealloc		(void* ptr, size_t numBytes);
 void	deFree			(void* ptr);
 
-void*	deAlignedMalloc	(int numBytes, int alignBytes);
+void*	deAlignedMalloc	(size_t numBytes, deUint32 alignBytes);
 void	deAlignedFree	(void* ptr);
 
 char*	deStrdup		(const char* str);
@@ -48,13 +48,13 @@
  * \param value		Value to fill with.
  * \param numBytes	Number of bytes to write.
  *//*--------------------------------------------------------------------*/
-DE_INLINE void deMemset (void* ptr, int value, int numBytes)
+DE_INLINE void deMemset (void* ptr, int value, size_t numBytes)
 {
 	DE_ASSERT((value & 0xFF) == value);
 	memset(ptr, value, numBytes);
 }
 
-DE_INLINE int deMemCmp (const void* a, const void* b, int numBytes)
+DE_INLINE int deMemCmp (const void* a, const void* b, size_t numBytes)
 {
 	return memcmp(a, b, numBytes);
 }
@@ -66,12 +66,12 @@
  * \param numBytes	Number of bytes to copy
  * \return Destination buffer.
  *//*--------------------------------------------------------------------*/
-DE_INLINE void* deMemcpy (void* dst, const void* src, int numBytes)
+DE_INLINE void* deMemcpy (void* dst, const void* src, size_t numBytes)
 {
 	return memcpy(dst, src, numBytes);
 }
 
-DE_INLINE void* deMemmove (void* dst, const void* src, int numBytes)
+DE_INLINE void* deMemmove (void* dst, const void* src, size_t numBytes)
 {
 	return memmove(dst, src, numBytes);
 }
diff --git a/framework/delibs/debase/deString.c b/framework/delibs/debase/deString.c
index fe60c0f..f53657d 100644
--- a/framework/delibs/debase/deString.c
+++ b/framework/delibs/debase/deString.c
@@ -67,7 +67,7 @@
 	return hash;
 }
 
-deUint32 deMemoryHash (const void* ptr, int numBytes)
+deUint32 deMemoryHash (const void* ptr, size_t numBytes)
 {
 	/* \todo [2010-05-10 pyry] Better generic hash function? */
 	const deUint8*	input	= (const deUint8*)ptr;
@@ -80,7 +80,7 @@
 	return hash;
 }
 
-deBool deMemoryEqual (const void* ptr, const void* cmp, int numBytes)
+deBool deMemoryEqual (const void* ptr, const void* cmp, size_t numBytes)
 {
 	return memcmp(ptr, cmp, numBytes) == 0;
 }
diff --git a/framework/delibs/debase/deString.h b/framework/delibs/debase/deString.h
index 832523c..52e232a 100644
--- a/framework/delibs/debase/deString.h
+++ b/framework/delibs/debase/deString.h
@@ -36,8 +36,8 @@
 deBool		deStringEqual			(const char* a, const char* b);
 deBool		deStringBeginsWith		(const char* str, const char* leading);
 
-deUint32	deMemoryHash			(const void* ptr, int numBytes);
-deBool		deMemoryEqual			(const void* ptr, const void* cmp, int numBytes);
+deUint32	deMemoryHash			(const void* ptr, size_t numBytes);
+deBool		deMemoryEqual			(const void* ptr, const void* cmp, size_t numBytes);
 
 deInt32		deVsprintf				(char* string, size_t size, const char* format, va_list args);
 deInt32		deSprintf				(char* string, size_t size, const char* format, ...) DE_PRINTF_FUNC_ATTR(3, 4);
diff --git a/framework/delibs/decpp/CMakeLists.txt b/framework/delibs/decpp/CMakeLists.txt
index 974c385..1d8bbf1 100644
--- a/framework/delibs/decpp/CMakeLists.txt
+++ b/framework/delibs/decpp/CMakeLists.txt
@@ -59,5 +59,21 @@
 	deSpinBarrier.hpp
 	)
 
+set(DECPP_LIBS
+	debase
+	depool
+	dethread
+	deutil
+	)
+
+# \note [pyry] Somewhat kludgy that toolchain file doesn't set it, but there is no easy way
+if (DE_OS_IS_ANDROID)
+	if (DEFINED ANDROID_CXX_LIBRARY)
+		set(DECPP_LIBS ${DECPP_LIBS} ${ANDROID_CXX_LIBRARY})
+	else ()
+		message(STATUS "Warning: ANDROID_CXX_LIBRARY not defined")
+	endif ()
+endif ()
+
 add_library(decpp STATIC ${DECPP_SRCS})
-target_link_libraries(decpp debase depool dethread deutil)
+target_link_libraries(decpp ${DECPP_LIBS})
diff --git a/framework/delibs/decpp/deArrayBuffer.hpp b/framework/delibs/decpp/deArrayBuffer.hpp
index 0ecb690..5a98898 100644
--- a/framework/delibs/decpp/deArrayBuffer.hpp
+++ b/framework/delibs/decpp/deArrayBuffer.hpp
@@ -48,8 +48,11 @@
 class ArrayBuffer
 {
 public:
+	DE_STATIC_ASSERT(Stride >= sizeof(T));
+
 					ArrayBuffer		(void) throw();
 					ArrayBuffer		(size_t numElements);
+					ArrayBuffer		(const T* ptr, size_t numElements);
 					ArrayBuffer		(const ArrayBuffer& other);
 					~ArrayBuffer	(void) throw();
 	ArrayBuffer&	operator=		(const ArrayBuffer& other);
@@ -97,6 +100,33 @@
 }
 
 template <typename T, size_t Alignment, size_t Stride>
+ArrayBuffer<T,Alignment,Stride>::ArrayBuffer (const T* ptr, size_t numElements)
+	: m_ptr	(DE_NULL)
+	, m_cap	(0)
+{
+	if (numElements)
+	{
+		// create new buffer of wanted size, copy to it, and swap to it
+		ArrayBuffer<T,Alignment,Stride> tmp(numElements);
+
+		if (Stride == sizeof(T))
+		{
+			// tightly packed
+			const size_t storageSize = sizeof(T) * numElements;
+			deMemcpy(tmp.m_ptr, ptr, (int)storageSize);
+		}
+		else
+		{
+			// sparsely packed
+			for (size_t ndx = 0; ndx < numElements; ++ndx)
+				*tmp.getElementPtr(ndx) = ptr[ndx];
+		}
+
+		swap(tmp);
+	}
+}
+
+template <typename T, size_t Alignment, size_t Stride>
 ArrayBuffer<T,Alignment,Stride>::ArrayBuffer (const ArrayBuffer<T,Alignment,Stride>& other)
 	: m_ptr	(DE_NULL)
 	, m_cap	(0)
diff --git a/framework/delibs/decpp/deBlockBuffer.cpp b/framework/delibs/decpp/deBlockBuffer.cpp
index 69cf477..7e00594 100644
--- a/framework/delibs/decpp/deBlockBuffer.cpp
+++ b/framework/delibs/decpp/deBlockBuffer.cpp
@@ -50,8 +50,8 @@
 	{
 	}
 
-	deUint16 getThreadId	(void) const { return data >> 16;		}
-	deUint16 getPayload		(void) const { return data & 0xffff;	}
+	deUint16 getThreadId	(void) const { return (deUint16)(data >> 16);		}
+	deUint16 getPayload		(void) const { return (deUint16)(data & 0xffff);	}
 };
 
 typedef BlockBuffer<Message> MessageBuffer;
@@ -208,7 +208,7 @@
 		{
 			deUint32 cmpSum = 0;
 			for (int j = 0; j < numConsumers; j++)
-				cmpSum += consumers[j]->getPayloadSum(i);
+				cmpSum += consumers[j]->getPayloadSum((deUint16)i);
 			DE_TEST_ASSERT(refSum == cmpSum);
 		}
 
diff --git a/framework/delibs/decpp/deMeta.hpp b/framework/delibs/decpp/deMeta.hpp
index 231aac0..f7b5ac1 100644
--- a/framework/delibs/decpp/deMeta.hpp
+++ b/framework/delibs/decpp/deMeta.hpp
@@ -48,6 +48,24 @@
 	};
 };
 
+template <typename A, typename B>
+struct TypesSame
+{
+	enum
+	{
+		Value = false
+	};
+};
+
+template <typename A>
+struct TypesSame<A, A>
+{
+	enum
+	{
+		Value = true
+	};
+};
+
 } // meta
 } // de
 
diff --git a/framework/delibs/decpp/dePoolArray.hpp b/framework/delibs/decpp/dePoolArray.hpp
index 9a1db24..cec9acd 100644
--- a/framework/delibs/decpp/dePoolArray.hpp
+++ b/framework/delibs/decpp/dePoolArray.hpp
@@ -48,7 +48,7 @@
  *       to access next element(s) doesn't work.
  * \todo [2013-02-11 pyry] Make elements per page template argument.
  *//*--------------------------------------------------------------------*/
-template<typename T, deUint32 Alignment = (sizeof(T) > 4 ? 4 : sizeof(T))>
+template<typename T, deUint32 Alignment = (sizeof(T) > 4 ? 4 : (deUint32)sizeof(T))>
 class PoolArray
 {
 public:
diff --git a/framework/delibs/decpp/deSocket.hpp b/framework/delibs/decpp/deSocket.hpp
index f8198ff..e401605 100644
--- a/framework/delibs/decpp/deSocket.hpp
+++ b/framework/delibs/decpp/deSocket.hpp
@@ -95,8 +95,8 @@
 
 	void				close				(void);
 
-	deSocketResult		send				(const void* buf, int bufSize, int* numSent)	{ return deSocket_send(m_socket, buf, bufSize, numSent);	}
-	deSocketResult		receive				(void* buf, int bufSize, int* numRecv)			{ return deSocket_receive(m_socket, buf, bufSize, numRecv);	}
+	deSocketResult		send				(const void* buf, size_t bufSize, size_t* numSent)	{ return deSocket_send(m_socket, buf, bufSize, numSent);	}
+	deSocketResult		receive				(void* buf, size_t bufSize, size_t* numRecv)		{ return deSocket_receive(m_socket, buf, bufSize, numRecv);	}
 
 private:
 						Socket				(deSocket* socket) : m_socket(socket) {}
diff --git a/framework/delibs/decpp/deSpinBarrier.cpp b/framework/delibs/decpp/deSpinBarrier.cpp
index 150bbc2..e328abc 100644
--- a/framework/delibs/decpp/deSpinBarrier.cpp
+++ b/framework/delibs/decpp/deSpinBarrier.cpp
@@ -32,9 +32,11 @@
 {
 
 SpinBarrier::SpinBarrier (deInt32 numThreads)
-	: m_numThreads	(numThreads)
+	: m_numCores	(deGetNumAvailableLogicalCores())
+	, m_numThreads	(numThreads)
 	, m_numEntered	(0)
 	, m_numLeaving	(0)
+	, m_numRemoved	(0)
 {
 	DE_ASSERT(numThreads > 0);
 }
@@ -44,12 +46,42 @@
 	DE_ASSERT(m_numEntered == 0 && m_numLeaving == 0);
 }
 
-void SpinBarrier::sync (WaitMode mode)
+void SpinBarrier::reset (deUint32 numThreads)
 {
-	DE_ASSERT(mode == WAIT_MODE_YIELD || mode == WAIT_MODE_BUSY);
+	// If last threads were removed, m_numEntered > 0 && m_numRemoved > 0
+	DE_ASSERT(m_numLeaving == 0);
+	DE_ASSERT(numThreads > 0);
+	m_numThreads = numThreads;
+	m_numEntered = 0;
+	m_numLeaving = 0;
+	m_numRemoved = 0;
+}
+
+inline SpinBarrier::WaitMode getWaitMode (SpinBarrier::WaitMode requested, deUint32 numCores, deInt32 numThreads)
+{
+	if (requested == SpinBarrier::WAIT_MODE_AUTO)
+		return ((deUint32)numThreads <= numCores) ? SpinBarrier::WAIT_MODE_BUSY : SpinBarrier::WAIT_MODE_YIELD;
+	else
+		return requested;
+}
+
+inline void wait (SpinBarrier::WaitMode mode)
+{
+	DE_ASSERT(mode == SpinBarrier::WAIT_MODE_YIELD || mode == SpinBarrier::WAIT_MODE_BUSY);
+
+	if (mode == SpinBarrier::WAIT_MODE_YIELD)
+		deYield();
+}
+
+void SpinBarrier::sync (WaitMode requestedMode)
+{
+	const deInt32	cachedNumThreads	= m_numThreads;
+	const WaitMode	waitMode			= getWaitMode(requestedMode, m_numCores, cachedNumThreads);
 
 	deMemoryReadWriteFence();
 
+	// m_numEntered must not be touched until all threads have had
+	// a chance to observe it being 0.
 	if (m_numLeaving > 0)
 	{
 		for (;;)
@@ -57,16 +89,25 @@
 			if (m_numLeaving == 0)
 				break;
 
-			if (mode == WAIT_MODE_YIELD)
-				deYield();
+			wait(waitMode);
 		}
 	}
 
-	if (deAtomicIncrement32(&m_numEntered) == m_numThreads)
+	// If m_numRemoved > 0, m_numThreads will decrease. If m_numThreads is decreased
+	// just after atomicOp and before comparison, the branch could be taken by multiple
+	// threads. Since m_numThreads only changes if all threads are inside the spinbarrier,
+	// cached value at snapshotted at the beginning of the function will be equal for
+	// all threads.
+	if (deAtomicIncrement32(&m_numEntered) == cachedNumThreads)
 	{
-		m_numLeaving = m_numThreads;
+		// Release all waiting threads. Since this thread has not been removed, m_numLeaving will
+		// be >= 1 until m_numLeaving is decremented at the end of this function.
+		m_numThreads -= m_numRemoved;
+		m_numLeaving  = m_numThreads;
+		m_numRemoved  = 0;
+
 		deMemoryReadWriteFence();
-		m_numEntered = 0;
+		m_numEntered  = 0;
 	}
 	else
 	{
@@ -75,8 +116,7 @@
 			if (m_numEntered == 0)
 				break;
 
-			if (mode == WAIT_MODE_YIELD)
-				deYield();
+			wait(waitMode);
 		}
 	}
 
@@ -84,6 +124,39 @@
 	deMemoryReadWriteFence();
 }
 
+void SpinBarrier::removeThread (WaitMode requestedMode)
+{
+	const deInt32	cachedNumThreads	= m_numThreads;
+	const WaitMode	waitMode			= getWaitMode(requestedMode, m_numCores, cachedNumThreads);
+
+	// Wait for other threads exiting previous barrier
+	if (m_numLeaving > 0)
+	{
+		for (;;)
+		{
+			if (m_numLeaving == 0)
+				break;
+
+			wait(waitMode);
+		}
+	}
+
+	// Ask for last thread entering barrier to adjust thread count
+	deAtomicIncrement32(&m_numRemoved);
+
+	// See sync() - use cached value
+	if (deAtomicIncrement32(&m_numEntered) == cachedNumThreads)
+	{
+		// Release all waiting threads.
+		m_numThreads -= m_numRemoved;
+		m_numLeaving  = m_numThreads;
+		m_numRemoved  = 0;
+
+		deMemoryReadWriteFence();
+		m_numEntered  = 0;
+	}
+}
+
 namespace
 {
 
@@ -99,12 +172,12 @@
 class TestThread : public de::Thread
 {
 public:
-	TestThread (SpinBarrier& barrier, volatile deInt32* sharedVar, int numThreads, int threadNdx, bool busyOk)
+	TestThread (SpinBarrier& barrier, volatile deInt32* sharedVar, int numThreads, int threadNdx)
 		: m_barrier		(barrier)
 		, m_sharedVar	(sharedVar)
 		, m_numThreads	(numThreads)
 		, m_threadNdx	(threadNdx)
-		, m_busyOk		(busyOk)
+		, m_busyOk		((deUint32)m_numThreads <= deGetNumAvailableLogicalCores())
 	{
 	}
 
@@ -138,18 +211,23 @@
 	}
 
 private:
-	SpinBarrier&		m_barrier;
-	volatile deInt32*	m_sharedVar;
-	int					m_numThreads;
-	int					m_threadNdx;
-	bool				m_busyOk;
+	SpinBarrier&			m_barrier;
+	volatile deInt32* const	m_sharedVar;
+	const int				m_numThreads;
+	const int				m_threadNdx;
+	const bool				m_busyOk;
 
 	SpinBarrier::WaitMode getWaitMode (de::Random& rnd)
 	{
-		if (m_busyOk && rnd.getBool())
-			return SpinBarrier::WAIT_MODE_BUSY;
-		else
-			return SpinBarrier::WAIT_MODE_YIELD;
+		static const SpinBarrier::WaitMode	s_allModes[]	=
+		{
+			SpinBarrier::WAIT_MODE_YIELD,
+			SpinBarrier::WAIT_MODE_AUTO,
+			SpinBarrier::WAIT_MODE_BUSY,
+		};
+		const int							numModes		= DE_LENGTH_OF_ARRAY(s_allModes) - (m_busyOk ? 0 : 1);
+
+		return rnd.choose<SpinBarrier::WaitMode>(DE_ARRAY_BEGIN(s_allModes), DE_ARRAY_BEGIN(s_allModes) + numModes);
 	}
 };
 
@@ -159,14 +237,9 @@
 	volatile deInt32			sharedVar	= 0;
 	std::vector<TestThread*>	threads		(numThreads, static_cast<TestThread*>(DE_NULL));
 
-	// Going over logical cores with busy-waiting will cause priority inversion and make tests take
-	// excessive amount of time. Use busy waiting only when number of threads is at most one per
-	// core.
-	const bool					busyOk		= (deUint32)numThreads <= deGetNumAvailableLogicalCores();
-
 	for (int ndx = 0; ndx < numThreads; ndx++)
 	{
-		threads[ndx] = new TestThread(barrier, &sharedVar, numThreads, ndx, busyOk);
+		threads[ndx] = new TestThread(barrier, &sharedVar, numThreads, ndx);
 		DE_TEST_ASSERT(threads[ndx]);
 		threads[ndx]->start();
 	}
@@ -180,17 +253,104 @@
 	DE_TEST_ASSERT(sharedVar == 0);
 }
 
-} // namespace
+void singleThreadRemoveTest (SpinBarrier::WaitMode mode)
+{
+	SpinBarrier barrier(3);
+
+	barrier.removeThread(mode);
+	barrier.removeThread(mode);
+	barrier.sync(mode);
+	barrier.removeThread(mode);
+
+	barrier.reset(1);
+	barrier.sync(mode);
+
+	barrier.reset(2);
+	barrier.removeThread(mode);
+	barrier.sync(mode);
+}
+
+class TestExitThread : public de::Thread
+{
+public:
+	TestExitThread (SpinBarrier& barrier, int numThreads, int threadNdx, SpinBarrier::WaitMode waitMode)
+		: m_barrier		(barrier)
+		, m_numThreads	(numThreads)
+		, m_threadNdx	(threadNdx)
+		, m_waitMode	(waitMode)
+	{
+	}
+
+	void run (void)
+	{
+		const int	numIters	= 10000;
+		de::Random	rnd			(deInt32Hash(m_numThreads) ^ deInt32Hash(m_threadNdx) ^ deInt32Hash((deInt32)m_waitMode));
+		const int	invExitProb	= 1000;
+
+		for (int iterNdx = 0; iterNdx < numIters; iterNdx++)
+		{
+			if (rnd.getInt(0, invExitProb) == 0)
+			{
+				m_barrier.removeThread(m_waitMode);
+				break;
+			}
+			else
+				m_barrier.sync(m_waitMode);
+		}
+	}
+
+private:
+	SpinBarrier&				m_barrier;
+	const int					m_numThreads;
+	const int					m_threadNdx;
+	const SpinBarrier::WaitMode	m_waitMode;
+};
+
+void multiThreadRemoveTest (int numThreads, SpinBarrier::WaitMode waitMode)
+{
+	SpinBarrier						barrier		(numThreads);
+	std::vector<TestExitThread*>	threads		(numThreads, static_cast<TestExitThread*>(DE_NULL));
+
+	for (int ndx = 0; ndx < numThreads; ndx++)
+	{
+		threads[ndx] = new TestExitThread(barrier, numThreads, ndx, waitMode);
+		DE_TEST_ASSERT(threads[ndx]);
+		threads[ndx]->start();
+	}
+
+	for (int ndx = 0; ndx < numThreads; ndx++)
+	{
+		threads[ndx]->join();
+		delete threads[ndx];
+	}
+}
+
+} // anonymous
 
 void SpinBarrier_selfTest (void)
 {
 	singleThreadTest(SpinBarrier::WAIT_MODE_YIELD);
 	singleThreadTest(SpinBarrier::WAIT_MODE_BUSY);
+	singleThreadTest(SpinBarrier::WAIT_MODE_AUTO);
 	multiThreadTest(1);
 	multiThreadTest(2);
 	multiThreadTest(4);
 	multiThreadTest(8);
 	multiThreadTest(16);
+
+	singleThreadRemoveTest(SpinBarrier::WAIT_MODE_YIELD);
+	singleThreadRemoveTest(SpinBarrier::WAIT_MODE_BUSY);
+	singleThreadRemoveTest(SpinBarrier::WAIT_MODE_AUTO);
+	multiThreadRemoveTest(1, SpinBarrier::WAIT_MODE_BUSY);
+	multiThreadRemoveTest(2, SpinBarrier::WAIT_MODE_AUTO);
+	multiThreadRemoveTest(4, SpinBarrier::WAIT_MODE_AUTO);
+	multiThreadRemoveTest(8, SpinBarrier::WAIT_MODE_AUTO);
+	multiThreadRemoveTest(16, SpinBarrier::WAIT_MODE_AUTO);
+	multiThreadRemoveTest(1, SpinBarrier::WAIT_MODE_YIELD);
+	multiThreadRemoveTest(2, SpinBarrier::WAIT_MODE_YIELD);
+	multiThreadRemoveTest(4, SpinBarrier::WAIT_MODE_YIELD);
+	multiThreadRemoveTest(8, SpinBarrier::WAIT_MODE_YIELD);
+	multiThreadRemoveTest(16, SpinBarrier::WAIT_MODE_YIELD);
 }
 
 } // de
diff --git a/framework/delibs/decpp/deSpinBarrier.hpp b/framework/delibs/decpp/deSpinBarrier.hpp
index 6679f8d..484d57a 100644
--- a/framework/delibs/decpp/deSpinBarrier.hpp
+++ b/framework/delibs/decpp/deSpinBarrier.hpp
@@ -35,14 +35,21 @@
  * SpinBarrier provides barrier implementation that uses spin loop for
  * waiting for other threads. Threads may choose to wait in tight loop
  * (WAIT_MODE_BUSY) or yield between iterations (WAIT_MODE_YIELD).
+ *
+ * It is not recommended to use WAIT_MODE_BUSY when there are more threads
+ * than number of cores participating in the barrier as it will lead to
+ * priority inversion and dramatic slowdown. For that reason WAIT_MODE_AUTO
+ * is provided, which selects between busy and yielding waiting based on
+ * number of threads.
  *//*--------------------------------------------------------------------*/
 class SpinBarrier
 {
 public:
 	enum WaitMode
 	{
-		WAIT_MODE_BUSY = 0,
-		WAIT_MODE_YIELD,
+		WAIT_MODE_BUSY = 0,	//! Wait in tight spin loop.
+		WAIT_MODE_YIELD,	//! Call deYield() between spin loop iterations.
+		WAIT_MODE_AUTO,		//! Use WAIT_MODE_BUSY loop if #threads <= #cores, otherwise WAIT_MODE_YIELD.
 
 		WAIT_MODE_LAST
 	};
@@ -50,15 +57,28 @@
 						SpinBarrier		(deInt32 numThreads);
 						~SpinBarrier	(void);
 
+	//! Reset barrier. Not thread-safe, e.g. no other thread can
+	//! be calling sync() or removeThread() at the same time.
+	void				reset			(deUint32 numThreads);
+
+	//! Wait until all threads (determined by active thread count)
+	//! have entered sync().
 	void				sync			(WaitMode mode);
 
+	//! Remove thread from barrier (decrements active thread count).
+	//! Can be called concurrently with sync() or removeThread().
+	void				removeThread	(WaitMode mode);
+
 private:
 						SpinBarrier		(const SpinBarrier&);
 	SpinBarrier			operator=		(const SpinBarrier&);
 
-	const deInt32		m_numThreads;
+	const deUint32		m_numCores;
+
+	volatile deInt32	m_numThreads;
 	volatile deInt32	m_numEntered;
 	volatile deInt32	m_numLeaving;
+	volatile deInt32	m_numRemoved;
 };
 
 void	SpinBarrier_selfTest	(void);
diff --git a/framework/delibs/decpp/deThreadSafeRingBuffer.cpp b/framework/delibs/decpp/deThreadSafeRingBuffer.cpp
index 065688b..3a8030d 100644
--- a/framework/delibs/decpp/deThreadSafeRingBuffer.cpp
+++ b/framework/delibs/decpp/deThreadSafeRingBuffer.cpp
@@ -49,8 +49,8 @@
 	{
 	}
 
-	deUint16 getThreadId	(void) const { return data >> 16;		}
-	deUint16 getPayload		(void) const { return data & 0xffff;	}
+	deUint16 getThreadId	(void) const { return (deUint16)(data >> 16);		}
+	deUint16 getPayload		(void) const { return (deUint16)(data & 0xffff);	}
 };
 
 class Consumer : public Thread
@@ -169,7 +169,7 @@
 		{
 			deUint32 cmpSum = 0;
 			for (int j = 0; j < numConsumers; j++)
-				cmpSum += consumers[j]->getPayloadSum(i);
+				cmpSum += consumers[j]->getPayloadSum((deUint16)i);
 			DE_TEST_ASSERT(refSum == cmpSum);
 		}
 
diff --git a/framework/delibs/deimage/deImage.c b/framework/delibs/deimage/deImage.c
index 26aab59..ff8f9be 100644
--- a/framework/delibs/deimage/deImage.c
+++ b/framework/delibs/deimage/deImage.c
@@ -76,7 +76,7 @@
 		case DE_IMAGEFORMAT_XRGB8888:	return *(deARGB*)addr;
 		case DE_IMAGEFORMAT_ARGB8888:	return *(deARGB*)addr;
 		default:
-			DE_ASSERT(!"deImage_getPixel(): invalid format");
+			DE_FATAL("deImage_getPixel(): invalid format");
 			return deARGB_black();
 	}
 }
@@ -89,7 +89,7 @@
 		case DE_IMAGEFORMAT_XRGB8888:	*(deARGB*)addr = argb;	break;
 		case DE_IMAGEFORMAT_ARGB8888:	*(deARGB*)addr = argb;	break;
 		default:
-			DE_ASSERT(!"deImage_getPixel(): invalid format");
+			DE_FATAL("deImage_getPixel(): invalid format");
 	}
 }
 
@@ -125,8 +125,8 @@
 	{
 		for (x = 0; x < dstWidth; x++)
 		{
-			float	xFloat	= (float)(x + 0.5f) / (float)dstWidth * (float)srcImage->width - 0.5f;
-			float	yFloat	= (float)(y + 0.5f) / (float)dstHeight * (float)srcImage->height - 0.5f;
+			float	xFloat	= ((float)x + 0.5f) / (float)dstWidth * (float)srcImage->width - 0.5f;
+			float	yFloat	= ((float)y + 0.5f) / (float)dstHeight * (float)srcImage->height - 0.5f;
 			int		xFixed	= deFloorFloatToInt32(xFloat * 256.0f);
 			int		yFixed	= deFloorFloatToInt32(yFloat * 256.0f);
 			int		xFactor	= (xFixed & 0xFF);
diff --git a/framework/delibs/depool/deMemPool.c b/framework/delibs/depool/deMemPool.c
index 7c32f3d..5ae8920 100644
--- a/framework/delibs/depool/deMemPool.c
+++ b/framework/delibs/depool/deMemPool.c
@@ -118,13 +118,13 @@
  * \param page		Memory page to initialize.
  * \param capacity	Capacity allocated for the memory page.
  *//*--------------------------------------------------------------------*/
-static void MemPage_init (MemPage* page, int capacity)
+static void MemPage_init (MemPage* page, size_t capacity)
 {
 	memset(page, 0, sizeof(MemPage));
 #if defined(DE_DEBUG)
 	memset(page + 1, 0xCD, capacity);
 #endif
-	page->capacity = capacity;
+	page->capacity = (int)capacity;
 }
 
 /*--------------------------------------------------------------------*//*!
@@ -133,7 +133,7 @@
  * \param capacity	Capacity for the memory page.
  * \return The created memory page (or null on failure).
  *//*--------------------------------------------------------------------*/
-static MemPage* MemPage_create (int capacity)
+static MemPage* MemPage_create (size_t capacity)
 {
 	MemPage* page = (MemPage*)deMalloc(sizeof(MemPage) + capacity);
 	if (!page)
@@ -155,7 +155,7 @@
 #if defined(DE_DEBUG)
 	/* Fill with garbage to hopefully catch dangling pointer bugs easier. */
 	deUint8* dataPtr = (deUint8*)(page + 1);
-	memset(dataPtr, 0xCD, page->capacity);
+	memset(dataPtr, 0xCD, (size_t)page->capacity);
 #endif
 	deFree(page);
 }
@@ -423,7 +423,7 @@
 	return numCapacityBytes;
 }
 
-DE_INLINE void* deMemPool_allocInternal (deMemPool* pool, int numBytes, deUint32 alignBytes)
+DE_INLINE void* deMemPool_allocInternal (deMemPool* pool, size_t numBytes, deUint32 alignBytes)
 {
 	MemPage* curPage = pool->currentPage;
 
@@ -457,19 +457,19 @@
 #endif
 
 	DE_ASSERT(curPage);
-	DE_ASSERT(deIsPowerOfTwo32(alignBytes));
+	DE_ASSERT(deIsPowerOfTwo32((int)alignBytes));
 	{
 		void*	curPagePtr		= (void*)((deUint8*)(curPage + 1) + curPage->bytesAllocated);
 		void*	alignedPtr		= deAlignPtr(curPagePtr, alignBytes);
-		int		alignPadding	= (int)((deUintptr)alignedPtr - (deUintptr)curPagePtr);
+		size_t	alignPadding	= (size_t)((deUintptr)alignedPtr - (deUintptr)curPagePtr);
 
-		if (numBytes + alignPadding > curPage->capacity - curPage->bytesAllocated)
+		if (numBytes + alignPadding > (size_t)(curPage->capacity - curPage->bytesAllocated))
 		{
 			/* Does not fit to current page. */
-			int		maxAlignPadding		= deMax32(0, alignBytes-MEM_PAGE_BASE_ALIGN);
-			int		newPageCapacity		= deMax32(deMin32(2*curPage->capacity, MAX_PAGE_SIZE), numBytes+maxAlignPadding);
+			int		maxAlignPadding		= deMax32(0, ((int)alignBytes)-MEM_PAGE_BASE_ALIGN);
+			int		newPageCapacity		= deMax32(deMin32(2*curPage->capacity, MAX_PAGE_SIZE), ((int)numBytes)+maxAlignPadding);
 
-			curPage = MemPage_create(newPageCapacity);
+			curPage = MemPage_create((size_t)newPageCapacity);
 			if (!curPage)
 				return DE_NULL;
 
@@ -480,12 +480,12 @@
 
 			curPagePtr			= (void*)(curPage + 1);
 			alignedPtr			= deAlignPtr(curPagePtr, alignBytes);
-			alignPadding		= (int)((deUintptr)alignedPtr - (deUintptr)curPagePtr);
+			alignPadding		= (size_t)((deUintptr)alignedPtr - (deUintptr)curPagePtr);
 
-			DE_ASSERT(numBytes + alignPadding <= curPage->capacity);
+			DE_ASSERT(numBytes + alignPadding <= (size_t)curPage->capacity);
 		}
 
-		curPage->bytesAllocated += numBytes+alignPadding;
+		curPage->bytesAllocated += (int)(numBytes + alignPadding);
 		return alignedPtr;
 	}
 }
@@ -496,7 +496,7 @@
  * \param numBytes	Number of bytes to allocate.
  * \return Pointer to the allocate memory (or null on failure).
  *//*--------------------------------------------------------------------*/
-void* deMemPool_alloc (deMemPool* pool, int numBytes)
+void* deMemPool_alloc (deMemPool* pool, size_t numBytes)
 {
 	void* ptr;
 	DE_ASSERT(pool);
@@ -514,7 +514,7 @@
  * \param alignBytes	Required alignment in bytes, must be power of two.
  * \return Pointer to the allocate memory (or null on failure).
  *//*--------------------------------------------------------------------*/
-void* deMemPool_alignedAlloc (deMemPool* pool, int numBytes, deUint32 alignBytes)
+void* deMemPool_alignedAlloc (deMemPool* pool, size_t numBytes, deUint32 alignBytes)
 {
 	void* ptr;
 	DE_ASSERT(pool);
@@ -533,7 +533,7 @@
  * \param ptr	Piece of memory to duplicate.
  * \return Pointer to the copied memory block (or null on failure).
  *//*--------------------------------------------------------------------*/
-void* deMemPool_memDup (deMemPool* pool, const void* ptr, int numBytes)
+void* deMemPool_memDup (deMemPool* pool, const void* ptr, size_t numBytes)
 {
 	void* newPtr = deMemPool_alloc(pool, numBytes);
 	if (newPtr)
@@ -549,7 +549,7 @@
  *//*--------------------------------------------------------------------*/
 char* deMemPool_strDup (deMemPool* pool, const char* str)
 {
-	int		len		= (int)strlen(str);
+	size_t	len		= strlen(str);
 	char*	newStr	= (char*)deMemPool_alloc(pool, len+1);
 	if (newStr)
 		memcpy(newStr, str, len+1);
@@ -565,8 +565,11 @@
  *//*--------------------------------------------------------------------*/
 char* deMemPool_strnDup (deMemPool* pool, const char* str, int maxLength)
 {
-	int		len			= deMin32((int)strlen(str), maxLength);
+	size_t	len			= (size_t)deMin32((int)strlen(str), deMax32(0, maxLength));
 	char*	newStr		= (char*)deMemPool_alloc(pool, len + 1);
+
+	DE_ASSERT(maxLength >= 0);
+
 	if (newStr)
 	{
 		memcpy(newStr, str, len);
diff --git a/framework/delibs/depool/deMemPool.h b/framework/delibs/depool/deMemPool.h
index fde8738..44e074d 100644
--- a/framework/delibs/depool/deMemPool.h
+++ b/framework/delibs/depool/deMemPool.h
@@ -69,9 +69,9 @@
 int			deMemPool_getNumAllocatedBytes		(const deMemPool* pool, deBool recurse);
 int			deMemPool_getCapacity				(const deMemPool* pool, deBool recurse);
 
-void*		deMemPool_alloc						(deMemPool* pool, int numBytes);
-void*		deMemPool_alignedAlloc				(deMemPool* pool, int numBytes, deUint32 alignBytes);
-void*		deMemPool_memDup					(deMemPool* pool, const void* ptr, int numBytes);
+void*		deMemPool_alloc						(deMemPool* pool, size_t numBytes);
+void*		deMemPool_alignedAlloc				(deMemPool* pool, size_t numBytes, deUint32 alignBytes);
+void*		deMemPool_memDup					(deMemPool* pool, const void* ptr, size_t numBytes);
 char*		deMemPool_strDup					(deMemPool* pool, const char* str);
 char*		deMemPool_strnDup					(deMemPool* pool, const char* str, int maxLength);
 
diff --git a/framework/delibs/depool/dePoolArray.c b/framework/delibs/depool/dePoolArray.c
index 6f6752f..aff04de 100644
--- a/framework/delibs/depool/dePoolArray.c
+++ b/framework/delibs/depool/dePoolArray.c
@@ -75,7 +75,7 @@
 		if (arr->pageTableCapacity < reqPageTableCapacity)
 		{
 			int		newPageTableCapacity	= deMax32(2*arr->pageTableCapacity, reqPageTableCapacity);
-			void**	newPageTable			= (void**)deMemPool_alloc(arr->pool, newPageTableCapacity * sizeof(void*));
+			void**	newPageTable			= (void**)deMemPool_alloc(arr->pool, (size_t)newPageTableCapacity * sizeof(void*));
 			int		i;
 
 			if (!newPageTable)
@@ -89,7 +89,7 @@
 
 			/* Grab information about old page table for recycling purposes. */
 			oldPageTable		= arr->pageTable;
-			oldPageTableSize	= arr->pageTableCapacity * sizeof(void*);
+			oldPageTableSize	= arr->pageTableCapacity * (int)sizeof(void*);
 
 			arr->pageTable			= newPageTable;
 			arr->pageTableCapacity	= newPageTableCapacity;
@@ -115,7 +115,7 @@
 			/* Allocate the rest of the needed pages from the pool. */
 			for (; pageTableNdx < reqPageTableCapacity; pageTableNdx++)
 			{
-				void* newPage = deMemPool_alloc(arr->pool, pageAllocSize);
+				void* newPage = deMemPool_alloc(arr->pool, (size_t)pageAllocSize);
 				if (!newPage)
 					return DE_FALSE;
 
diff --git a/framework/delibs/depool/dePoolHash.h b/framework/delibs/depool/dePoolHash.h
index 1507c16..8aedba9 100644
--- a/framework/delibs/depool/dePoolHash.h
+++ b/framework/delibs/depool/dePoolHash.h
@@ -257,7 +257,7 @@
 	if (newSlotTableSize > hash->slotTableSize)    \
 	{ \
 		TYPENAME##Slot**	oldSlotTable = hash->slotTable; \
-		TYPENAME##Slot**	newSlotTable = (TYPENAME##Slot**)deMemPool_alloc(hash->pool, sizeof(TYPENAME##Slot*) * newSlotTableSize); \
+		TYPENAME##Slot**	newSlotTable = (TYPENAME##Slot**)deMemPool_alloc(hash->pool, sizeof(TYPENAME##Slot*) * (size_t)newSlotTableSize); \
 		int					oldSlotTableSize = hash->slotTableSize; \
 		int					slotNdx; \
 \
@@ -298,7 +298,7 @@
 {    \
 	if (hash->numElements > 0) \
 	{	\
-		int				slotNdx	= HASHFUNC(key) & (hash->slotTableSize - 1); \
+		int				slotNdx	= (int)(HASHFUNC(key) & (deUint32)(hash->slotTableSize - 1)); \
 		TYPENAME##Slot*	slot	= hash->slotTable[slotNdx]; \
 		DE_ASSERT(deInBounds32(slotNdx, 0, hash->slotTableSize)); \
 	\
@@ -328,7 +328,7 @@
 		if (!TYPENAME##_rehash(hash, deMax32(4, 2*hash->slotTableSize))) \
 			return DE_FALSE; \
 \
-	slotNdx	= HASHFUNC(key) & (hash->slotTableSize - 1); \
+	slotNdx	= (int)(HASHFUNC(key) & (deUint32)(hash->slotTableSize - 1)); \
 	DE_ASSERT(slotNdx >= 0 && slotNdx < hash->slotTableSize); \
 	slot	= hash->slotTable[slotNdx]; \
 \
@@ -371,7 +371,7 @@
 	TYPENAME##Slot*	prevSlot = DE_NULL; \
 \
 	DE_ASSERT(hash->numElements > 0); \
-	slotNdx	= HASHFUNC(key) & (hash->slotTableSize - 1); \
+	slotNdx	= (int)(HASHFUNC(key) & (deUint32)(hash->slotTableSize - 1)); \
 	DE_ASSERT(slotNdx >= 0 && slotNdx < hash->slotTableSize); \
 	slot	= hash->slotTable[slotNdx]; \
 	DE_ASSERT(slot); \
diff --git a/framework/delibs/depool/dePoolMultiSet.h b/framework/delibs/depool/dePoolMultiSet.h
index b837ac9..30d17d9 100644
--- a/framework/delibs/depool/dePoolMultiSet.h
+++ b/framework/delibs/depool/dePoolMultiSet.h
@@ -243,7 +243,7 @@
 \
 void TYPENAME##_intersectInplace (TYPENAME* a, const TYPENAME* b)	\
 {	\
-	DE_ASSERT(!"Not implemented.");	\
+	DE_FATAL("Not implemented.");	\
 }	\
 \
 deBool TYPENAME##_sum (TYPENAME* to, const TYPENAME* a, const TYPENAME* b)	\
@@ -288,7 +288,7 @@
 \
 void TYPENAME##_differenceInplace (TYPENAME* a, const TYPENAME* b)	\
 {	\
-	DE_ASSERT(!"Not implemented.");	\
+	DE_FATAL("Not implemented.");	\
 }	\
 \
 struct TYPENAME##SetwiseImplementDummy_s { int dummy; }
diff --git a/framework/delibs/depool/dePoolSet.h b/framework/delibs/depool/dePoolSet.h
index f0fb3af..52f29bb 100644
--- a/framework/delibs/depool/dePoolSet.h
+++ b/framework/delibs/depool/dePoolSet.h
@@ -265,7 +265,7 @@
 	if (newSlotTableSize > set->slotTableSize)    \
 	{ \
 		TYPENAME##Slot**	oldSlotTable = set->slotTable; \
-		TYPENAME##Slot**	newSlotTable = (TYPENAME##Slot**)deMemPool_alloc(set->pool, sizeof(TYPENAME##Slot*) * newSlotTableSize); \
+		TYPENAME##Slot**	newSlotTable = (TYPENAME##Slot**)deMemPool_alloc(set->pool, sizeof(TYPENAME##Slot*) * (size_t)newSlotTableSize); \
 		int					oldSlotTableSize = set->slotTableSize; \
 		int					slotNdx; \
 \
@@ -306,7 +306,7 @@
 {    \
 	if (set->numElements > 0) \
 	{	\
-		int				slotNdx	= HASHFUNC(key) & (set->slotTableSize - 1); \
+		int				slotNdx	= (int)(HASHFUNC(key) & (deUint32)(set->slotTableSize - 1)); \
 		TYPENAME##Slot*	slot	= set->slotTable[slotNdx]; \
 		DE_ASSERT(deInBounds32(slotNdx, 0, set->slotTableSize)); \
 	\
@@ -337,7 +337,7 @@
 		if (!TYPENAME##_rehash(set, deMax32(4, 2*set->slotTableSize))) \
 			return DE_FALSE; \
 \
-	slotNdx	= HASHFUNC(key) & (set->slotTableSize - 1); \
+	slotNdx	= (int)(HASHFUNC(key) & (deUint32)(set->slotTableSize - 1)); \
 	DE_ASSERT(slotNdx >= 0 && slotNdx < set->slotTableSize); \
 	slot	= set->slotTable[slotNdx]; \
 \
@@ -379,7 +379,7 @@
 	TYPENAME##Slot*	prevSlot = DE_NULL; \
 \
 	DE_ASSERT(set->numElements > 0); \
-	slotNdx	= HASHFUNC(key) & (set->slotTableSize - 1); \
+	slotNdx	= (int)(HASHFUNC(key) & (deUint32)(set->slotTableSize - 1)); \
 	DE_ASSERT(slotNdx >= 0 && slotNdx < set->slotTableSize); \
 	slot	= set->slotTable[slotNdx]; \
 	DE_ASSERT(slot); \
@@ -538,7 +538,7 @@
 void TYPENAME##_intersectInplace (TYPENAME* a, const TYPENAME* b)	\
 {	\
 	DE_UNREF(a && b);	\
-	DE_ASSERT(!"Not implemented.");	\
+	DE_FATAL("Not implemented.");	\
 }	\
 \
 deBool TYPENAME##_difference (TYPENAME* to, const TYPENAME* a, const TYPENAME* b)	\
diff --git a/framework/delibs/depool/dePoolStringBuilder.c b/framework/delibs/depool/dePoolStringBuilder.c
index 4e4dd46..53a0f14 100644
--- a/framework/delibs/depool/dePoolStringBuilder.c
+++ b/framework/delibs/depool/dePoolStringBuilder.c
@@ -58,7 +58,7 @@
 deBool dePoolStringBuilder_appendString (dePoolStringBuilder* builder, const char* str)
 {
 	StringBlock*	block		= DE_POOL_NEW(builder->pool, StringBlock);
-	int				len			= (int)strlen(str);
+	size_t			len			= strlen(str);
 	char*			blockStr	= (char*)deMemPool_alloc(builder->pool, len + 1);
 
 	if (!block || !blockStr)
@@ -84,7 +84,7 @@
 
 	builder->blockListTail = block;
 
-	builder->length += len;
+	builder->length += (int)len;
 
 	return DE_TRUE;
 }
@@ -117,7 +117,7 @@
 
 char* dePoolStringBuilder_dupToPool (dePoolStringBuilder* builder, deMemPool* pool)
 {
-	char* resultStr = (char*)deMemPool_alloc(pool, builder->length + 1);
+	char* resultStr = (char*)deMemPool_alloc(pool, (size_t)builder->length + 1);
 
 	if (resultStr)
 	{
diff --git a/framework/delibs/destream/deRingbuffer.c b/framework/delibs/destream/deRingbuffer.c
index 4e55139..7468484 100644
--- a/framework/delibs/destream/deRingbuffer.c
+++ b/framework/delibs/destream/deRingbuffer.c
@@ -59,8 +59,8 @@
 
 	ringbuffer->blockSize	= blockSize;
 	ringbuffer->blockCount	= blockCount;
-	ringbuffer->buffer		= (deUint8*)deMalloc(sizeof(deUint8) * blockSize * blockCount);
-	ringbuffer->blockUsage	= (deInt32*)deMalloc(sizeof(deUint32) * blockCount);
+	ringbuffer->buffer		= (deUint8*)deMalloc(sizeof(deUint8) * (size_t)blockSize * (size_t)blockCount);
+	ringbuffer->blockUsage	= (deInt32*)deMalloc(sizeof(deUint32) * (size_t)blockCount);
 	ringbuffer->emptyCount	= deSemaphore_create(ringbuffer->blockCount, DE_NULL);
 	ringbuffer->fullCount	= deSemaphore_create(0, DE_NULL);
 
@@ -79,7 +79,7 @@
 		return DE_NULL;
 	}
 
-	memset(ringbuffer->blockUsage, 0, sizeof(deInt32) * blockCount);
+	memset(ringbuffer->blockUsage, 0, sizeof(deInt32) * (size_t)blockCount);
 
 	ringbuffer->outBlock	= 0;
 	ringbuffer->outPos		= 0;
@@ -141,7 +141,7 @@
 		dst			= ringbuffer->buffer + ringbuffer->blockSize * ringbuffer->inBlock + ringbuffer->inPos;
 		src			= (deUint8*)buf + *written;
 
-		deMemcpy(dst, src, writeSize);
+		deMemcpy(dst, src, (size_t)writeSize);
 
 		ringbuffer->inPos += writeSize;
 		*written += writeSize;
@@ -238,7 +238,7 @@
 		src			= ringbuffer->buffer + ringbuffer->blockSize * ringbuffer->outBlock + ringbuffer->outPos;
 		dst			= (deUint8*)buf + *read;
 
-		deMemcpy(dst, src, writeSize);
+		deMemcpy(dst, src, (size_t)writeSize);
 
 		ringbuffer->outPos += writeSize;
 		*read += writeSize;
diff --git a/framework/delibs/destream/deStreamCpyThread.c b/framework/delibs/destream/deStreamCpyThread.c
index 97a0d9a..c07266a 100644
--- a/framework/delibs/destream/deStreamCpyThread.c
+++ b/framework/delibs/destream/deStreamCpyThread.c
@@ -28,7 +28,7 @@
 void cpyStream (void* arg)
 {
 	deStreamCpyThread* thread = (deStreamCpyThread*)arg;
-	deUint8* buffer = malloc(sizeof(deUint8) * thread->bufferSize);
+	deUint8* buffer = malloc(sizeof(deUint8) * (size_t)thread->bufferSize);
 
 	for(;;)
 	{
diff --git a/framework/delibs/destream/deThreadStream.c b/framework/delibs/destream/deThreadStream.c
index 2cc0bf3..3c5ad98 100644
--- a/framework/delibs/destream/deThreadStream.c
+++ b/framework/delibs/destream/deThreadStream.c
@@ -48,7 +48,7 @@
 {
 	deThreadInStream* threadStream = (deThreadInStream*)arg;
 
-	deUint8* buffer = malloc(sizeof(deUint8) * threadStream->bufferSize);
+	deUint8* buffer = malloc(sizeof(deUint8) * (size_t)threadStream->bufferSize);
 
 	for(;;)
 	{
diff --git a/framework/delibs/dethread/deThreadTest.c b/framework/delibs/dethread/deThreadTest.c
index 2af44de..dfd3b27 100644
--- a/framework/delibs/dethread/deThreadTest.c
+++ b/framework/delibs/dethread/deThreadTest.c
@@ -355,12 +355,12 @@
 
 typedef struct TestBuffer_s
 {
-	deInt32			buffer[32];
+	deUint32		buffer[32];
 	deSemaphore		empty;
 	deSemaphore		fill;
 
-	deInt32			producerSum;
-	deInt32			consumerSum;
+	deUint32		producerHash;
+	deUint32		consumerHash;
 } TestBuffer;
 
 void producerThread (void* arg)
@@ -375,16 +375,16 @@
 
 	for (ndx = 0; ndx <= numToProduce; ndx++)
 	{
-		deInt32 val;
+		deUint32 val;
 
 		if (ndx == numToProduce)
 		{
-			val = 0; /* End. */
+			val = 0u; /* End. */
 		}
 		else
 		{
-			val = (deInt32)deRandom_getUint32(&random);
-			val = val ? val : 1;
+			val = deRandom_getUint32(&random);
+			val = val ? val : 1u;
 		}
 
 		deSemaphore_decrement(buffer->empty);
@@ -394,7 +394,7 @@
 
 		deSemaphore_increment(buffer->fill);
 
-		buffer->producerSum += val;
+		buffer->producerHash ^= val;
 	}
 }
 
@@ -414,7 +414,7 @@
 
 		deSemaphore_increment(buffer->empty);
 
-		buffer->consumerSum += val;
+		buffer->consumerHash ^= val;
 
 		if (val == 0)
 			break;
@@ -463,7 +463,7 @@
 
 		deSemaphore_destroy(testBuffer.empty);
 		deSemaphore_destroy(testBuffer.fill);
-		DE_TEST_ASSERT(testBuffer.producerSum == testBuffer.consumerSum);
+		DE_TEST_ASSERT(testBuffer.producerHash == testBuffer.consumerHash);
 	}
 }
 
diff --git a/framework/delibs/dethread/unix/deSemaphoreUnix.c b/framework/delibs/dethread/unix/deSemaphoreUnix.c
index 110e35e..a9c6f14 100644
--- a/framework/delibs/dethread/unix/deSemaphoreUnix.c
+++ b/framework/delibs/dethread/unix/deSemaphoreUnix.c
@@ -36,11 +36,12 @@
 	sem_t*	sem	= (sem_t*)deMalloc(sizeof(sem_t));
 
 	DE_UNREF(attributes);
+	DE_ASSERT(initialValue >= 0);
 
 	if (!sem)
 		return 0;
 
-	if (sem_init(sem, 0, initialValue) != 0)
+	if (sem_init(sem, 0, (unsigned int)initialValue) != 0)
 	{
 		deFree(sem);
 		return 0;
diff --git a/framework/delibs/dethread/unix/deThreadUnix.c b/framework/delibs/dethread/unix/deThreadUnix.c
index 04035ef..6eeafbd 100644
--- a/framework/delibs/dethread/unix/deThreadUnix.c
+++ b/framework/delibs/dethread/unix/deThreadUnix.c
@@ -172,12 +172,12 @@
 
 	if (ret > 0)
 	{
-		return dePop64(mask);
+		return (deUint32)dePop64(mask);
 	}
 	else
 	{
 #if defined(_SC_NPROCESSORS_ONLN)
-		const int count = sysconf(_SC_NPROCESSORS_ONLN);
+		const long count = sysconf(_SC_NPROCESSORS_ONLN);
 
 		if (count <= 0)
 			return 1;
@@ -194,7 +194,7 @@
 deUint32 deGetNumAvailableLogicalCores (void)
 {
 #if defined(_SC_NPROCESSORS_ONLN)
-	const int count = sysconf(_SC_NPROCESSORS_ONLN);
+	const long count = sysconf(_SC_NPROCESSORS_ONLN);
 
 	if (count <= 0)
 		return 1;
@@ -210,7 +210,7 @@
 deUint32 deGetNumTotalLogicalCores (void)
 {
 #if defined(_SC_NPROCESSORS_CONF)
-	const int count = sysconf(_SC_NPROCESSORS_CONF);
+	const long count = sysconf(_SC_NPROCESSORS_CONF);
 
 	if (count <= 0)
 		return 1;
diff --git a/framework/delibs/deutil/deCommandLine.c b/framework/delibs/deutil/deCommandLine.c
index 44f61f4..d0ebb1c 100644
--- a/framework/delibs/deutil/deCommandLine.c
+++ b/framework/delibs/deutil/deCommandLine.c
@@ -56,7 +56,7 @@
 	DE_ASSERT(commandLine);
 
 	/* Create buffer for args (no expansion can happen). */
-	buf		= (char*)deCalloc((int)strlen(commandLine)+1);
+	buf		= (char*)deCalloc(strlen(commandLine)+1);
 	pos		= 0;
 	argNdx	= 0;
 	outPtr	= buf;
@@ -118,7 +118,7 @@
 	{
 		deCommandLine* cmdLine = (deCommandLine*)deCalloc(sizeof(deCommandLine));
 
-		if (!cmdLine || !(cmdLine->args = (char**)deCalloc(sizeof(char*)*CharPtrArray_getNumElements(args))))
+		if (!cmdLine || !(cmdLine->args = (char**)deCalloc(sizeof(char*)*(size_t)CharPtrArray_getNumElements(args))))
 		{
 			deFree(cmdLine);
 			deFree(buf);
diff --git a/framework/delibs/deutil/deFile.c b/framework/delibs/deutil/deFile.c
index 9cc2bf8..3cd1265 100644
--- a/framework/delibs/deutil/deFile.c
+++ b/framework/delibs/deutil/deFile.c
@@ -148,7 +148,7 @@
 
 deBool deFile_seek (deFile* file, deFilePosition base, deInt64 offset)
 {
-	return lseek(file->fd, offset, mapSeekPosition(base)) >= 0;
+	return lseek(file->fd, (off_t)offset, mapSeekPosition(base)) >= 0;
 }
 
 deInt64 deFile_getPosition (const deFile* file)
@@ -168,7 +168,7 @@
 		return -1;
 
 	size = lseek(file->fd, 0, SEEK_CUR);
-	lseek(file->fd, curPos, SEEK_SET);
+	lseek(file->fd, (off_t)curPos, SEEK_SET);
 
 	return size;
 }
@@ -185,7 +185,7 @@
 
 deFileResult deFile_read (deFile* file, void* buf, deInt64 bufSize, deInt64* numReadPtr)
 {
-	deInt64 numRead = read(file->fd, buf, bufSize);
+	deInt64 numRead = read(file->fd, buf, (size_t)bufSize);
 
 	if (numReadPtr)
 		*numReadPtr = numRead;
@@ -195,7 +195,7 @@
 
 deFileResult deFile_write (deFile* file, const void* buf, deInt64 bufSize, deInt64* numWrittenPtr)
 {
-	deInt64 numWritten = write(file->fd, buf, bufSize);
+	deInt64 numWritten = write(file->fd, buf, (size_t)bufSize);
 
 	if (numWrittenPtr)
 		*numWrittenPtr = numWritten;
diff --git a/framework/delibs/deutil/deProcess.c b/framework/delibs/deutil/deProcess.c
index 1b7ed5d..2962a1a 100644
--- a/framework/delibs/deutil/deProcess.c
+++ b/framework/delibs/deutil/deProcess.c
@@ -60,8 +60,9 @@
 
 static void die (int statusPipe, const char* message)
 {
-	int msgLen = strlen(message);
-	int res = 0;
+	size_t	msgLen	= strlen(message);
+	int		res		= 0;
+
 	printf("Process launch failed: %s\n", message);
 	res = (int)write(statusPipe, message, msgLen+1);
 	DE_UNREF(res); /* No need to check result. */
@@ -78,7 +79,7 @@
 
 DE_INLINE deBool beginsWithPath (const char* fileName, const char* pathPrefix)
 {
-	int pathLen = strlen(pathPrefix);
+	size_t pathLen = strlen(pathPrefix);
 
 	/* Strip trailing / */
 	while (pathLen > 0 && pathPrefix[pathLen-1] == '/')
@@ -89,8 +90,8 @@
 
 static void stripLeadingPath (char* fileName, const char* pathPrefix)
 {
-	int pathLen		= strlen(pathPrefix);
-	int fileNameLen	= strlen(fileName);
+	size_t pathLen		= strlen(pathPrefix);
+	size_t fileNameLen	= strlen(fileName);
 
 	DE_ASSERT(beginsWithPath(fileName, pathPrefix));
 
@@ -108,7 +109,7 @@
 static void execProcess (const char* commandLine, const char* workingDirectory, int statusPipe)
 {
 	deCommandLine*	cmdLine		= deCommandLine_parse(commandLine);
-	char**			argList		= cmdLine ? (char**)deCalloc(sizeof(char*)*(cmdLine->numArgs+1)) : DE_NULL;
+	char**			argList		= cmdLine ? (char**)deCalloc(sizeof(char*)*((size_t)cmdLine->numArgs+1)) : DE_NULL;
 
 	if (!cmdLine || !argList)
 		die(statusPipe, "Command line parsing failed (out of memory)");
@@ -299,7 +300,7 @@
 		/* Check status. */
 		{
 			char	errBuf[256];
-			int		result	= 0;
+			ssize_t	result = 0;
 
 			close(statusPipe[1]);
 			while ((result = read(statusPipe[0], errBuf, 1)) == -1)
@@ -307,6 +308,8 @@
 
 			if (result > 0)
 			{
+				int procStatus = 0;
+
 				/* Read full error msg. */
 				int errPos = 1;
 				while (errPos < DE_LENGTH_OF_ARRAY(errBuf))
@@ -328,7 +331,7 @@
 				closePipe(pipeErr);
 
 				/* Run waitpid to clean up zombie. */
-				waitpid(pid, &result, 0);
+				waitpid(pid, &procStatus, 0);
 
 				deProcess_setError(process, errBuf);
 
@@ -348,9 +351,9 @@
 		close(pipeOut[1]);
 		close(pipeErr[1]);
 
-		process->standardIn		= deFile_createFromHandle(pipeIn[1]);
-		process->standardOut	= deFile_createFromHandle(pipeOut[0]);
-		process->standardErr	= deFile_createFromHandle(pipeErr[0]);
+		process->standardIn		= deFile_createFromHandle((deUintptr)pipeIn[1]);
+		process->standardOut	= deFile_createFromHandle((deUintptr)pipeOut[0]);
+		process->standardErr	= deFile_createFromHandle((deUintptr)pipeErr[0]);
 
 		if (!process->standardIn)
 			close(pipeIn[1]);
diff --git a/framework/delibs/deutil/deSocket.c b/framework/delibs/deutil/deSocket.c
index fa8eced..ce8a1dd 100644
--- a/framework/delibs/deutil/deSocket.c
+++ b/framework/delibs/deutil/deSocket.c
@@ -24,6 +24,7 @@
 #include "deSocket.h"
 #include "deMemory.h"
 #include "deMutex.h"
+#include "deInt32.h"
 
 #if (DE_OS == DE_OS_WIN32)
 #	define DE_USE_WINSOCK
@@ -189,9 +190,13 @@
 #if defined(DE_USE_WINSOCK)
 	/* \note SOCKET is unsigned type! */
 	typedef SOCKET					deSocketHandle;
+	typedef int						NativeSocklen;
+	typedef int						NativeSize;
 #	define DE_INVALID_SOCKET_HANDLE	INVALID_SOCKET
 #else
 	typedef int						deSocketHandle;
+	typedef socklen_t				NativeSocklen;
+	typedef size_t					NativeSize;
 #	define DE_INVALID_SOCKET_HANDLE	-1
 #endif
 
@@ -215,6 +220,27 @@
 
 /* Common socket functions. */
 
+static deUint16 deHostToNetworkOrder16 (deUint16 v)
+{
+#if (DE_ENDIANNESS == DE_LITTLE_ENDIAN)
+	return deReverseBytes16(v);
+#else
+	return v;
+#endif
+}
+
+static deUint16 deNetworkToHostOrder16 (deUint16 v)
+{
+#if (DE_ENDIANNESS == DE_LITTLE_ENDIAN)
+	return deReverseBytes16(v);
+#else
+	return v;
+#endif
+}
+
+DE_STATIC_ASSERT(sizeof(((struct sockaddr_in*)DE_NULL)->sin_port) == sizeof(deUint16));
+DE_STATIC_ASSERT(sizeof(((struct sockaddr_in6*)DE_NULL)->sin6_port) == sizeof(deUint16));
+
 static int deSocketFamilyToBsdFamily (deSocketFamily family)
 {
 	switch (family)
@@ -251,7 +277,7 @@
 	}
 }
 
-static deBool deSocketAddressToBsdAddress (const deSocketAddress* address, int bsdAddrBufSize, struct sockaddr* bsdAddr, int* bsdAddrLen)
+static deBool deSocketAddressToBsdAddress (const deSocketAddress* address, size_t bsdAddrBufSize, struct sockaddr* bsdAddr, NativeSocklen* bsdAddrLen)
 {
 	deMemset(bsdAddr, 0, bsdAddrBufSize);
 
@@ -275,30 +301,30 @@
 
 		/* \note Always uses first address. */
 
-		if (bsdAddrBufSize < (int)result->ai_addrlen)
+		if (bsdAddrBufSize < (size_t)result->ai_addrlen)
 		{
-			DE_ASSERT(!"Too small bsdAddr buffer");
+			DE_FATAL("Too small bsdAddr buffer");
 			freeaddrinfo(result);
 			return DE_FALSE;
 		}
 
-		*bsdAddrLen	= (int)result->ai_addrlen;
+		*bsdAddrLen	= (NativeSocklen)result->ai_addrlen;
 
-		deMemcpy(bsdAddr, result->ai_addr, (int)result->ai_addrlen);
+		deMemcpy(bsdAddr, result->ai_addr, (size_t)result->ai_addrlen);
 		freeaddrinfo(result);
 
 		/* Add port. */
 		if (bsdAddr->sa_family == AF_INET)
 		{
-			if (*bsdAddrLen < (int)sizeof(struct sockaddr_in))
+			if (*bsdAddrLen < (NativeSocklen)sizeof(struct sockaddr_in))
 				return DE_FALSE;
-			((struct sockaddr_in*)bsdAddr)->sin_port = htons((deUint16)address->port);
+			((struct sockaddr_in*)bsdAddr)->sin_port = deHostToNetworkOrder16((deUint16)address->port);
 		}
 		else if (bsdAddr->sa_family == AF_INET6)
 		{
-			if (*bsdAddrLen < (int)sizeof(struct sockaddr_in6))
+			if (*bsdAddrLen < (NativeSocklen)sizeof(struct sockaddr_in6))
 				return DE_FALSE;
-			((struct sockaddr_in6*)bsdAddr)->sin6_port = htons((deUint16)address->port);
+			((struct sockaddr_in6*)bsdAddr)->sin6_port = deHostToNetworkOrder16((deUint16)address->port);
 		}
 		else
 			return DE_FALSE;
@@ -309,17 +335,17 @@
 	{
 		struct sockaddr_in* addr4 = (struct sockaddr_in*)bsdAddr;
 
-		if (bsdAddrBufSize < (int)sizeof(struct sockaddr_in))
+		if (bsdAddrBufSize < sizeof(struct sockaddr_in))
 		{
-			DE_ASSERT(!"Too small bsdAddr buffer");
+			DE_FATAL("Too small bsdAddr buffer");
 			return DE_FALSE;
 		}
 
-		addr4->sin_port			= htons((deUint16)address->port);
+		addr4->sin_port			= deHostToNetworkOrder16((deUint16)address->port);
 		addr4->sin_family		= AF_INET;
 		addr4->sin_addr.s_addr	= INADDR_ANY;
 
-		*bsdAddrLen	= sizeof(struct sockaddr_in);
+		*bsdAddrLen	= (NativeSocklen)sizeof(struct sockaddr_in);
 
 		return DE_TRUE;
 	}
@@ -327,16 +353,16 @@
 	{
 		struct sockaddr_in6* addr6 = (struct sockaddr_in6*)bsdAddr;
 
-		if (bsdAddrBufSize < (int)sizeof(struct sockaddr_in6))
+		if (bsdAddrBufSize < sizeof(struct sockaddr_in6))
 		{
-			DE_ASSERT(!"Too small bsdAddr buffer");
+			DE_FATAL("Too small bsdAddr buffer");
 			return DE_FALSE;
 		}
 
-		addr6->sin6_port	= htons((deUint16)address->port);
+		addr6->sin6_port	= deHostToNetworkOrder16((deUint16)address->port);
 		addr6->sin6_family	= AF_INET6;
 
-		*bsdAddrLen	= sizeof(struct sockaddr_in6);
+		*bsdAddrLen	= (NativeSocklen)sizeof(struct sockaddr_in6);
 
 		return DE_TRUE;
 	}
@@ -354,7 +380,7 @@
 		DE_UNREF(addrLen);
 
 		deSocketAddress_setFamily(address, DE_SOCKETFAMILY_INET4);
-		deSocketAddress_setPort(address, ntohs(addr4->sin_port));
+		deSocketAddress_setPort(address, (int)deNetworkToHostOrder16((deUint16)addr4->sin_port));
 
 		{
 			char buf[16]; /* Max valid address takes 3*4 + 3 = 15 chars */
@@ -369,7 +395,7 @@
 		DE_UNREF(addrLen);
 
 		deSocketAddress_setFamily(address, DE_SOCKETFAMILY_INET6);
-		deSocketAddress_setPort(address, ntohs(addr6->sin6_port));
+		deSocketAddress_setPort(address, (int)deNetworkToHostOrder16((deUint16)addr6->sin6_port));
 
 		{
 			char buf[40]; /* Max valid address takes 8*4 + 7 = 39 chars */
@@ -472,13 +498,13 @@
 	const int			backlogSize	= 4;
 	deUint8				bsdAddrBuf[sizeof(struct sockaddr_in6)];
 	struct sockaddr*	bsdAddr		= (struct sockaddr*)&bsdAddrBuf[0];
-	int					bsdAddrLen;
+	NativeSocklen		bsdAddrLen;
 
 	if (sock->state != DE_SOCKETSTATE_CLOSED)
 		return DE_FALSE;
 
 	/* Resolve address. */
-	if (!deSocketAddressToBsdAddress(address, (int)sizeof(bsdAddrBuf), bsdAddr, &bsdAddrLen))
+	if (!deSocketAddressToBsdAddress(address, sizeof(bsdAddrBuf), bsdAddr, &bsdAddrLen))
 		return DE_FALSE;
 
 	/* Create socket. */
@@ -495,7 +521,7 @@
 	}
 
 	/* Bind to address. */
-	if (bind(sock->handle, bsdAddr, bsdAddrLen) != 0)
+	if (bind(sock->handle, bsdAddr, (NativeSocklen)bsdAddrLen) != 0)
 	{
 		deSocket_close(sock);
 		return DE_FALSE;
@@ -519,19 +545,11 @@
 	deSocket*			newSock		= DE_NULL;
 	deUint8				bsdAddrBuf[sizeof(struct sockaddr_in6)];
 	struct sockaddr*	bsdAddr		= (struct sockaddr*)&bsdAddrBuf[0];
-#if defined(DE_USE_WINSOCK)
-	int					bsdAddrLen	= (int)sizeof(bsdAddrBuf);
-#else
-	socklen_t			bsdAddrLen	= (socklen_t)sizeof(bsdAddrBuf);
-#endif
+	NativeSocklen		bsdAddrLen	= (NativeSocklen)sizeof(bsdAddrBuf);
 
-	deMemset(bsdAddr, 0, (int)bsdAddrLen);
+	deMemset(bsdAddr, 0, (size_t)bsdAddrLen);
 
-#if defined(DE_USE_WINSOCK)
 	newFd = accept(sock->handle, bsdAddr, &bsdAddrLen);
-#else
-	newFd = accept(sock->handle, bsdAddr, (socklen_t*)&bsdAddrLen);
-#endif
 	if (!deSocketHandleIsValid(newFd))
 		return DE_NULL;
 
@@ -561,10 +579,10 @@
 {
 	deUint8				bsdAddrBuf[sizeof(struct sockaddr_in6)];
 	struct sockaddr*	bsdAddr		= (struct sockaddr*)&bsdAddrBuf[0];
-	int					bsdAddrLen;
+	NativeSocklen		bsdAddrLen;
 
 	/* Resolve address. */
-	if (!deSocketAddressToBsdAddress(address, (int)sizeof(bsdAddrBuf), bsdAddr, &bsdAddrLen))
+	if (!deSocketAddressToBsdAddress(address, sizeof(bsdAddrBuf), bsdAddr, &bsdAddrLen))
 		return DE_FALSE;
 
 	/* Create socket. */
@@ -603,7 +621,7 @@
 		return DE_FALSE;
 	}
 
-	DE_ASSERT(channels != 0 && (channels & ~DE_SOCKETCHANNEL_BOTH) == 0);
+	DE_ASSERT(channels != 0 && (channels & ~(deUint32)DE_SOCKETCHANNEL_BOTH) == 0);
 
 	/* Don't attempt to close already closed channels on partially open socket. */
 	channels &= sock->openChannels;
@@ -751,13 +769,13 @@
 	deMutex_unlock(sock->stateLock);
 }
 
-deSocketResult deSocket_send (deSocket* sock, const void* buf, int bufSize, int* numSentPtr)
+deSocketResult deSocket_send (deSocket* sock, const void* buf, size_t bufSize, size_t* numSentPtr)
 {
-	int				numSent	= (int)send(sock->handle, (const char*)buf, bufSize, 0);
+	int				numSent	= (int)send(sock->handle, (const char*)buf, (NativeSize)bufSize, 0);
 	deSocketResult	result	= mapSendRecvResult(numSent);
 
 	if (numSentPtr)
-		*numSentPtr = numSent;
+		*numSentPtr = (numSent > 0) ? ((size_t)numSent) : (0);
 
 	/* Update state. */
 	if (result == DE_SOCKETRESULT_CONNECTION_CLOSED)
@@ -768,13 +786,13 @@
 	return result;
 }
 
-deSocketResult deSocket_receive (deSocket* sock, void* buf, int bufSize, int* numReceivedPtr)
+deSocketResult deSocket_receive (deSocket* sock, void* buf, size_t bufSize, size_t* numReceivedPtr)
 {
-	int				numRecv	= (int)recv(sock->handle, (char*)buf, bufSize, 0);
+	int				numRecv	= (int)recv(sock->handle, (char*)buf, (NativeSize)bufSize, 0);
 	deSocketResult	result	= mapSendRecvResult(numRecv);
 
 	if (numReceivedPtr)
-		*numReceivedPtr = numRecv;
+		*numReceivedPtr = (numRecv > 0) ? ((size_t)numRecv) : (0);
 
 	/* Update state. */
 	if (result == DE_SOCKETRESULT_CONNECTION_CLOSED)
diff --git a/framework/delibs/deutil/deSocket.h b/framework/delibs/deutil/deSocket.h
index 6270630..78d9b23 100644
--- a/framework/delibs/deutil/deSocket.h
+++ b/framework/delibs/deutil/deSocket.h
@@ -131,8 +131,8 @@
 deBool				deSocket_shutdown			(deSocket* socket, deUint32 channels);
 deBool				deSocket_close				(deSocket* socket);
 
-deSocketResult		deSocket_send				(deSocket* socket, const void* buf, int bufSize, int* numSent);
-deSocketResult		deSocket_receive			(deSocket* socket, void* buf, int bufSize, int* numReceived);
+deSocketResult		deSocket_send				(deSocket* socket, const void* buf, size_t bufSize, size_t* numSent);
+deSocketResult		deSocket_receive			(deSocket* socket, void* buf, size_t bufSize, size_t* numReceived);
 
 /* Utilities. */
 
diff --git a/framework/delibs/deutil/deTimerTest.c b/framework/delibs/deutil/deTimerTest.c
index 0d39d82..15ec454 100644
--- a/framework/delibs/deutil/deTimerTest.c
+++ b/framework/delibs/deutil/deTimerTest.c
@@ -68,9 +68,9 @@
 
 		DE_TEST_ASSERT(scheduleOk);
 
-		deSleep(interval*intervalSleepMultiplier);
+		deSleep((deUint32)(interval*intervalSleepMultiplier));
 		deTimer_disable(timer);
-		deSleep(interval);
+		deSleep((deUint32)interval);
 
 		printf("  timer fired %d times, expected %d\n", numCalls, expectedCalls);
 		DE_TEST_ASSERT(!isSingle || numCalls == 1);
diff --git a/framework/egl/egluCallLogWrapper.inl b/framework/egl/egluCallLogWrapper.inl
index c09a4e7..fa4f5e7 100644
--- a/framework/egl/egluCallLogWrapper.inl
+++ b/framework/egl/egluCallLogWrapper.inl
@@ -49,6 +49,16 @@
 	return returnValue;
 }
 
+eglw::EGLint CallLogWrapper::eglClientWaitSyncKHR (eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync, eglw::EGLint flags, eglw::EGLTimeKHR timeout)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglClientWaitSyncKHR(" << dpy << ", " << sync << ", " << flags << ", " << timeout << ");" << TestLog::EndMessage;
+	eglw::EGLint returnValue = m_egl.clientWaitSyncKHR(dpy, sync, flags, timeout);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << returnValue << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
 eglw::EGLBoolean CallLogWrapper::eglCopyBuffers (eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLNativePixmapType target)
 {
 	if (m_enableLog)
@@ -79,6 +89,16 @@
 	return returnValue;
 }
 
+eglw::EGLImageKHR CallLogWrapper::eglCreateImageKHR (eglw::EGLDisplay dpy, eglw::EGLContext ctx, eglw::EGLenum target, eglw::EGLClientBuffer buffer, const eglw::EGLint *attrib_list)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglCreateImageKHR(" << dpy << ", " << ctx << ", " << toHex(target) << ", " << toHex(buffer) << ", " << attrib_list << ");" << TestLog::EndMessage;
+	eglw::EGLImageKHR returnValue = m_egl.createImageKHR(dpy, ctx, target, buffer, attrib_list);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << returnValue << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
 eglw::EGLSurface CallLogWrapper::eglCreatePbufferFromClientBuffer (eglw::EGLDisplay dpy, eglw::EGLenum buftype, eglw::EGLClientBuffer buffer, eglw::EGLConfig config, const eglw::EGLint *attrib_list)
 {
 	if (m_enableLog)
@@ -119,6 +139,16 @@
 	return returnValue;
 }
 
+eglw::EGLSurface CallLogWrapper::eglCreatePlatformPixmapSurfaceEXT (eglw::EGLDisplay dpy, eglw::EGLConfig config, void *native_pixmap, const eglw::EGLint *attrib_list)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglCreatePlatformPixmapSurfaceEXT(" << dpy << ", " << toHex(config) << ", " << native_pixmap << ", " << attrib_list << ");" << TestLog::EndMessage;
+	eglw::EGLSurface returnValue = m_egl.createPlatformPixmapSurfaceEXT(dpy, config, native_pixmap, attrib_list);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << toHex(returnValue) << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
 eglw::EGLSurface CallLogWrapper::eglCreatePlatformWindowSurface (eglw::EGLDisplay dpy, eglw::EGLConfig config, void *native_window, const eglw::EGLAttrib *attrib_list)
 {
 	if (m_enableLog)
@@ -129,6 +159,16 @@
 	return returnValue;
 }
 
+eglw::EGLSurface CallLogWrapper::eglCreatePlatformWindowSurfaceEXT (eglw::EGLDisplay dpy, eglw::EGLConfig config, void *native_window, const eglw::EGLint *attrib_list)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglCreatePlatformWindowSurfaceEXT(" << dpy << ", " << toHex(config) << ", " << native_window << ", " << attrib_list << ");" << TestLog::EndMessage;
+	eglw::EGLSurface returnValue = m_egl.createPlatformWindowSurfaceEXT(dpy, config, native_window, attrib_list);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << toHex(returnValue) << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
 eglw::EGLSync CallLogWrapper::eglCreateSync (eglw::EGLDisplay dpy, eglw::EGLenum type, const eglw::EGLAttrib *attrib_list)
 {
 	if (m_enableLog)
@@ -139,6 +179,16 @@
 	return returnValue;
 }
 
+eglw::EGLSyncKHR CallLogWrapper::eglCreateSyncKHR (eglw::EGLDisplay dpy, eglw::EGLenum type, const eglw::EGLint *attrib_list)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglCreateSyncKHR(" << dpy << ", " << toHex(type) << ", " << attrib_list << ");" << TestLog::EndMessage;
+	eglw::EGLSyncKHR returnValue = m_egl.createSyncKHR(dpy, type, attrib_list);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << returnValue << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
 eglw::EGLSurface CallLogWrapper::eglCreateWindowSurface (eglw::EGLDisplay dpy, eglw::EGLConfig config, eglw::EGLNativeWindowType win, const eglw::EGLint *attrib_list)
 {
 	if (m_enableLog)
@@ -169,6 +219,16 @@
 	return returnValue;
 }
 
+eglw::EGLBoolean CallLogWrapper::eglDestroyImageKHR (eglw::EGLDisplay dpy, eglw::EGLImageKHR image)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglDestroyImageKHR(" << dpy << ", " << image << ");" << TestLog::EndMessage;
+	eglw::EGLBoolean returnValue = m_egl.destroyImageKHR(dpy, image);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << getBooleanStr(returnValue) << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
 eglw::EGLBoolean CallLogWrapper::eglDestroySurface (eglw::EGLDisplay dpy, eglw::EGLSurface surface)
 {
 	if (m_enableLog)
@@ -189,6 +249,16 @@
 	return returnValue;
 }
 
+eglw::EGLBoolean CallLogWrapper::eglDestroySyncKHR (eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglDestroySyncKHR(" << dpy << ", " << sync << ");" << TestLog::EndMessage;
+	eglw::EGLBoolean returnValue = m_egl.destroySyncKHR(dpy, sync);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << getBooleanStr(returnValue) << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
 eglw::EGLBoolean CallLogWrapper::eglGetConfigAttrib (eglw::EGLDisplay dpy, eglw::EGLConfig config, eglw::EGLint attribute, eglw::EGLint *value)
 {
 	if (m_enableLog)
@@ -273,6 +343,16 @@
 	return returnValue;
 }
 
+eglw::EGLDisplay CallLogWrapper::eglGetPlatformDisplayEXT (eglw::EGLenum platform, void *native_display, const eglw::EGLint *attrib_list)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglGetPlatformDisplayEXT(" << toHex(platform) << ", " << native_display << ", " << attrib_list << ");" << TestLog::EndMessage;
+	eglw::EGLDisplay returnValue = m_egl.getPlatformDisplayEXT(platform, native_display, attrib_list);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << returnValue << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
 eglw::__eglMustCastToProperFunctionPointerType CallLogWrapper::eglGetProcAddress (const char *procname)
 {
 	if (m_enableLog)
@@ -293,6 +373,16 @@
 	return returnValue;
 }
 
+eglw::EGLBoolean CallLogWrapper::eglGetSyncAttribKHR (eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync, eglw::EGLint attribute, eglw::EGLint *value)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglGetSyncAttribKHR(" << dpy << ", " << sync << ", " << attribute << ", " << value << ");" << TestLog::EndMessage;
+	eglw::EGLBoolean returnValue = m_egl.getSyncAttribKHR(dpy, sync, attribute, value);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << getBooleanStr(returnValue) << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
 eglw::EGLBoolean CallLogWrapper::eglInitialize (eglw::EGLDisplay dpy, eglw::EGLint *major, eglw::EGLint *minor)
 {
 	if (m_enableLog)
@@ -303,6 +393,16 @@
 	return returnValue;
 }
 
+eglw::EGLBoolean CallLogWrapper::eglLockSurfaceKHR (eglw::EGLDisplay dpy, eglw::EGLSurface surface, const eglw::EGLint *attrib_list)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglLockSurfaceKHR(" << dpy << ", " << toHex(surface) << ", " << attrib_list << ");" << TestLog::EndMessage;
+	eglw::EGLBoolean returnValue = m_egl.lockSurfaceKHR(dpy, surface, attrib_list);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << getBooleanStr(returnValue) << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
 eglw::EGLBoolean CallLogWrapper::eglMakeCurrent (eglw::EGLDisplay dpy, eglw::EGLSurface draw, eglw::EGLSurface read, eglw::EGLContext ctx)
 {
 	if (m_enableLog)
@@ -381,6 +481,26 @@
 	return returnValue;
 }
 
+eglw::EGLBoolean CallLogWrapper::eglSetDamageRegionKHR (eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint *rects, eglw::EGLint n_rects)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglSetDamageRegionKHR(" << dpy << ", " << toHex(surface) << ", " << rects << ", " << n_rects << ");" << TestLog::EndMessage;
+	eglw::EGLBoolean returnValue = m_egl.setDamageRegionKHR(dpy, surface, rects, n_rects);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << getBooleanStr(returnValue) << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
+eglw::EGLBoolean CallLogWrapper::eglSignalSyncKHR (eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync, eglw::EGLenum mode)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglSignalSyncKHR(" << dpy << ", " << sync << ", " << toHex(mode) << ");" << TestLog::EndMessage;
+	eglw::EGLBoolean returnValue = m_egl.signalSyncKHR(dpy, sync, mode);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << getBooleanStr(returnValue) << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
 eglw::EGLBoolean CallLogWrapper::eglSurfaceAttrib (eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint attribute, eglw::EGLint value)
 {
 	if (m_enableLog)
@@ -401,6 +521,16 @@
 	return returnValue;
 }
 
+eglw::EGLBoolean CallLogWrapper::eglSwapBuffersWithDamageKHR (eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint *rects, eglw::EGLint n_rects)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglSwapBuffersWithDamageKHR(" << dpy << ", " << toHex(surface) << ", " << rects << ", " << n_rects << ");" << TestLog::EndMessage;
+	eglw::EGLBoolean returnValue = m_egl.swapBuffersWithDamageKHR(dpy, surface, rects, n_rects);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << getBooleanStr(returnValue) << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
 eglw::EGLBoolean CallLogWrapper::eglSwapInterval (eglw::EGLDisplay dpy, eglw::EGLint interval)
 {
 	if (m_enableLog)
@@ -421,6 +551,16 @@
 	return returnValue;
 }
 
+eglw::EGLBoolean CallLogWrapper::eglUnlockSurfaceKHR (eglw::EGLDisplay dpy, eglw::EGLSurface surface)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglUnlockSurfaceKHR(" << dpy << ", " << toHex(surface) << ");" << TestLog::EndMessage;
+	eglw::EGLBoolean returnValue = m_egl.unlockSurfaceKHR(dpy, surface);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << getBooleanStr(returnValue) << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
+
 eglw::EGLBoolean CallLogWrapper::eglWaitClient ()
 {
 	if (m_enableLog)
@@ -460,3 +600,13 @@
 		m_log << TestLog::Message << "// " << getBooleanStr(returnValue) << " returned" << TestLog::EndMessage;
 	return returnValue;
 }
+
+eglw::EGLint CallLogWrapper::eglWaitSyncKHR (eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync, eglw::EGLint flags)
+{
+	if (m_enableLog)
+		m_log << TestLog::Message << "eglWaitSyncKHR(" << dpy << ", " << sync << ", " << flags << ");" << TestLog::EndMessage;
+	eglw::EGLint returnValue = m_egl.waitSyncKHR(dpy, sync, flags);
+	if (m_enableLog)
+		m_log << TestLog::Message << "// " << returnValue << " returned" << TestLog::EndMessage;
+	return returnValue;
+}
diff --git a/framework/egl/egluCallLogWrapperApi.inl b/framework/egl/egluCallLogWrapperApi.inl
index 216a868..ba90ce8 100644
--- a/framework/egl/egluCallLogWrapperApi.inl
+++ b/framework/egl/egluCallLogWrapperApi.inl
@@ -7,20 +7,27 @@
 eglw::EGLBoolean								eglBindTexImage						(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint buffer);
 eglw::EGLBoolean								eglChooseConfig						(eglw::EGLDisplay dpy, const eglw::EGLint *attrib_list, eglw::EGLConfig *configs, eglw::EGLint config_size, eglw::EGLint *num_config);
 eglw::EGLint									eglClientWaitSync					(eglw::EGLDisplay dpy, eglw::EGLSync sync, eglw::EGLint flags, eglw::EGLTime timeout);
+eglw::EGLint									eglClientWaitSyncKHR				(eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync, eglw::EGLint flags, eglw::EGLTimeKHR timeout);
 eglw::EGLBoolean								eglCopyBuffers						(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLNativePixmapType target);
 eglw::EGLContext								eglCreateContext					(eglw::EGLDisplay dpy, eglw::EGLConfig config, eglw::EGLContext share_context, const eglw::EGLint *attrib_list);
 eglw::EGLImage									eglCreateImage						(eglw::EGLDisplay dpy, eglw::EGLContext ctx, eglw::EGLenum target, eglw::EGLClientBuffer buffer, const eglw::EGLAttrib *attrib_list);
+eglw::EGLImageKHR								eglCreateImageKHR					(eglw::EGLDisplay dpy, eglw::EGLContext ctx, eglw::EGLenum target, eglw::EGLClientBuffer buffer, const eglw::EGLint *attrib_list);
 eglw::EGLSurface								eglCreatePbufferFromClientBuffer	(eglw::EGLDisplay dpy, eglw::EGLenum buftype, eglw::EGLClientBuffer buffer, eglw::EGLConfig config, const eglw::EGLint *attrib_list);
 eglw::EGLSurface								eglCreatePbufferSurface				(eglw::EGLDisplay dpy, eglw::EGLConfig config, const eglw::EGLint *attrib_list);
 eglw::EGLSurface								eglCreatePixmapSurface				(eglw::EGLDisplay dpy, eglw::EGLConfig config, eglw::EGLNativePixmapType pixmap, const eglw::EGLint *attrib_list);
 eglw::EGLSurface								eglCreatePlatformPixmapSurface		(eglw::EGLDisplay dpy, eglw::EGLConfig config, void *native_pixmap, const eglw::EGLAttrib *attrib_list);
+eglw::EGLSurface								eglCreatePlatformPixmapSurfaceEXT	(eglw::EGLDisplay dpy, eglw::EGLConfig config, void *native_pixmap, const eglw::EGLint *attrib_list);
 eglw::EGLSurface								eglCreatePlatformWindowSurface		(eglw::EGLDisplay dpy, eglw::EGLConfig config, void *native_window, const eglw::EGLAttrib *attrib_list);
+eglw::EGLSurface								eglCreatePlatformWindowSurfaceEXT	(eglw::EGLDisplay dpy, eglw::EGLConfig config, void *native_window, const eglw::EGLint *attrib_list);
 eglw::EGLSync									eglCreateSync						(eglw::EGLDisplay dpy, eglw::EGLenum type, const eglw::EGLAttrib *attrib_list);
+eglw::EGLSyncKHR								eglCreateSyncKHR					(eglw::EGLDisplay dpy, eglw::EGLenum type, const eglw::EGLint *attrib_list);
 eglw::EGLSurface								eglCreateWindowSurface				(eglw::EGLDisplay dpy, eglw::EGLConfig config, eglw::EGLNativeWindowType win, const eglw::EGLint *attrib_list);
 eglw::EGLBoolean								eglDestroyContext					(eglw::EGLDisplay dpy, eglw::EGLContext ctx);
 eglw::EGLBoolean								eglDestroyImage						(eglw::EGLDisplay dpy, eglw::EGLImage image);
+eglw::EGLBoolean								eglDestroyImageKHR					(eglw::EGLDisplay dpy, eglw::EGLImageKHR image);
 eglw::EGLBoolean								eglDestroySurface					(eglw::EGLDisplay dpy, eglw::EGLSurface surface);
 eglw::EGLBoolean								eglDestroySync						(eglw::EGLDisplay dpy, eglw::EGLSync sync);
+eglw::EGLBoolean								eglDestroySyncKHR					(eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync);
 eglw::EGLBoolean								eglGetConfigAttrib					(eglw::EGLDisplay dpy, eglw::EGLConfig config, eglw::EGLint attribute, eglw::EGLint *value);
 eglw::EGLBoolean								eglGetConfigs						(eglw::EGLDisplay dpy, eglw::EGLConfig *configs, eglw::EGLint config_size, eglw::EGLint *num_config);
 eglw::EGLContext								eglGetCurrentContext				(void);
@@ -29,9 +36,12 @@
 eglw::EGLDisplay								eglGetDisplay						(eglw::EGLNativeDisplayType display_id);
 eglw::EGLint									eglGetError							(void);
 eglw::EGLDisplay								eglGetPlatformDisplay				(eglw::EGLenum platform, void *native_display, const eglw::EGLAttrib *attrib_list);
+eglw::EGLDisplay								eglGetPlatformDisplayEXT			(eglw::EGLenum platform, void *native_display, const eglw::EGLint *attrib_list);
 eglw::__eglMustCastToProperFunctionPointerType	eglGetProcAddress					(const char *procname);
 eglw::EGLBoolean								eglGetSyncAttrib					(eglw::EGLDisplay dpy, eglw::EGLSync sync, eglw::EGLint attribute, eglw::EGLAttrib *value);
+eglw::EGLBoolean								eglGetSyncAttribKHR					(eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync, eglw::EGLint attribute, eglw::EGLint *value);
 eglw::EGLBoolean								eglInitialize						(eglw::EGLDisplay dpy, eglw::EGLint *major, eglw::EGLint *minor);
+eglw::EGLBoolean								eglLockSurfaceKHR					(eglw::EGLDisplay dpy, eglw::EGLSurface surface, const eglw::EGLint *attrib_list);
 eglw::EGLBoolean								eglMakeCurrent						(eglw::EGLDisplay dpy, eglw::EGLSurface draw, eglw::EGLSurface read, eglw::EGLContext ctx);
 eglw::EGLenum									eglQueryAPI							(void);
 eglw::EGLBoolean								eglQueryContext						(eglw::EGLDisplay dpy, eglw::EGLContext ctx, eglw::EGLint attribute, eglw::EGLint *value);
@@ -39,11 +49,16 @@
 eglw::EGLBoolean								eglQuerySurface						(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint attribute, eglw::EGLint *value);
 eglw::EGLBoolean								eglReleaseTexImage					(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint buffer);
 eglw::EGLBoolean								eglReleaseThread					(void);
+eglw::EGLBoolean								eglSetDamageRegionKHR				(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint *rects, eglw::EGLint n_rects);
+eglw::EGLBoolean								eglSignalSyncKHR					(eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync, eglw::EGLenum mode);
 eglw::EGLBoolean								eglSurfaceAttrib					(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint attribute, eglw::EGLint value);
 eglw::EGLBoolean								eglSwapBuffers						(eglw::EGLDisplay dpy, eglw::EGLSurface surface);
+eglw::EGLBoolean								eglSwapBuffersWithDamageKHR			(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint *rects, eglw::EGLint n_rects);
 eglw::EGLBoolean								eglSwapInterval						(eglw::EGLDisplay dpy, eglw::EGLint interval);
 eglw::EGLBoolean								eglTerminate						(eglw::EGLDisplay dpy);
+eglw::EGLBoolean								eglUnlockSurfaceKHR					(eglw::EGLDisplay dpy, eglw::EGLSurface surface);
 eglw::EGLBoolean								eglWaitClient						(void);
 eglw::EGLBoolean								eglWaitGL							(void);
 eglw::EGLBoolean								eglWaitNative						(eglw::EGLint engine);
 eglw::EGLBoolean								eglWaitSync							(eglw::EGLDisplay dpy, eglw::EGLSync sync, eglw::EGLint flags);
+eglw::EGLint									eglWaitSyncKHR						(eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync, eglw::EGLint flags);
diff --git a/framework/egl/egluGLContextFactory.cpp b/framework/egl/egluGLContextFactory.cpp
index 29cc642..349e6c4 100644
--- a/framework/egl/egluGLContextFactory.cpp
+++ b/framework/egl/egluGLContextFactory.cpp
@@ -212,7 +212,7 @@
 		case RenderConfig::VISIBILITY_VISIBLE:		return WindowParams::VISIBILITY_VISIBLE;
 		case RenderConfig::VISIBILITY_FULLSCREEN:	return WindowParams::VISIBILITY_FULLSCREEN;
 		default:
-			DE_ASSERT(visibility == (RenderConfig::Visibility)RenderConfig::DONT_CARE);
+			DE_ASSERT((int)visibility == RenderConfig::DONT_CARE);
 			return WindowParams::VISIBILITY_DONT_CARE;
 	}
 }
diff --git a/framework/egl/egluGLUtil.cpp b/framework/egl/egluGLUtil.cpp
index 0f65b6d..792e101 100644
--- a/framework/egl/egluGLUtil.cpp
+++ b/framework/egl/egluGLUtil.cpp
@@ -50,7 +50,7 @@
 		case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR:	return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
 		case EGL_GL_TEXTURE_3D_KHR:						return GL_TEXTURE_3D;
 		case EGL_GL_RENDERBUFFER_KHR:					return GL_RENDERBUFFER;
-		default:	DE_ASSERT(!"Impossible");			return GL_NONE;
+		default:	DE_FATAL("Impossible");				return GL_NONE;
 	}
 }
 
@@ -67,10 +67,10 @@
 				case 1:		return EGL_OPENGL_ES_BIT;
 				case 2:		return EGL_OPENGL_ES2_BIT;
 				case 3:		return EGL_OPENGL_ES3_BIT_KHR;
-				default:	DE_ASSERT(!"Unknown OpenGL ES version");
+				default:	DE_FATAL("Unknown OpenGL ES version");
 			}
 		default:
-			DE_ASSERT(!"Unknown GL API");
+			DE_FATAL("Unknown GL API");
 	}
 
 	return 0;
@@ -169,7 +169,7 @@
 			return false;
 	}
 
-	if (renderConfig.surfaceType != (glu::RenderConfig::SurfaceType)glu::RenderConfig::DONT_CARE)
+	if (renderConfig.surfaceType != glu::RenderConfig::SURFACETYPE_DONT_CARE)
 	{
 		EGLint		surfaceType		= 0;
 		EGLint		requiredSurface	= 0;
diff --git a/framework/egl/wrapper/eglwEnums.inl b/framework/egl/wrapper/eglwEnums.inl
index a9f811b..2e8a460 100644
--- a/framework/egl/wrapper/eglwEnums.inl
+++ b/framework/egl/wrapper/eglwEnums.inl
@@ -222,6 +222,8 @@
 #define EGL_SYNC_CL_EVENT									0x30FE
 #define EGL_SYNC_CL_EVENT_COMPLETE							0x30FF
 #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT	0x3138
+#define EGL_BUFFER_AGE_KHR									0x313D
+#define EGL_BUFFER_AGE_EXT									0x313D
 #define EGL_NATIVE_BUFFER_ANDROID							0x3140
 #define EGL_CONTEXT_OPENGL_DEBUG							0x31B0
 #define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE				0x31B1
diff --git a/framework/egl/wrapper/eglwFuncPtrLibraryDecl.inl b/framework/egl/wrapper/eglwFuncPtrLibraryDecl.inl
index 24dd7b8..b65985c 100644
--- a/framework/egl/wrapper/eglwFuncPtrLibraryDecl.inl
+++ b/framework/egl/wrapper/eglwFuncPtrLibraryDecl.inl
@@ -49,9 +49,11 @@
 EGLBoolean									querySurface					(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) const;
 EGLBoolean									releaseTexImage					(EGLDisplay dpy, EGLSurface surface, EGLint buffer) const;
 EGLBoolean									releaseThread					(void) const;
+EGLBoolean									setDamageRegionKHR				(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects) const;
 EGLBoolean									signalSyncKHR					(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) const;
 EGLBoolean									surfaceAttrib					(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) const;
 EGLBoolean									swapBuffers						(EGLDisplay dpy, EGLSurface surface) const;
+EGLBoolean									swapBuffersWithDamageKHR		(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects) const;
 EGLBoolean									swapInterval					(EGLDisplay dpy, EGLint interval) const;
 EGLBoolean									terminate						(EGLDisplay dpy) const;
 EGLBoolean									unlockSurfaceKHR				(EGLDisplay dpy, EGLSurface surface) const;
diff --git a/framework/egl/wrapper/eglwFuncPtrLibraryImpl.inl b/framework/egl/wrapper/eglwFuncPtrLibraryImpl.inl
index 0734bd7..007b950 100644
--- a/framework/egl/wrapper/eglwFuncPtrLibraryImpl.inl
+++ b/framework/egl/wrapper/eglwFuncPtrLibraryImpl.inl
@@ -234,6 +234,11 @@
 	return m_egl.releaseThread();
 }
 
+EGLBoolean FuncPtrLibrary::setDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects) const
+{
+	return m_egl.setDamageRegionKHR(dpy, surface, rects, n_rects);
+}
+
 EGLBoolean FuncPtrLibrary::signalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) const
 {
 	return m_egl.signalSyncKHR(dpy, sync, mode);
@@ -249,6 +254,11 @@
 	return m_egl.swapBuffers(dpy, surface);
 }
 
+EGLBoolean FuncPtrLibrary::swapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects) const
+{
+	return m_egl.swapBuffersWithDamageKHR(dpy, surface, rects, n_rects);
+}
+
 EGLBoolean FuncPtrLibrary::swapInterval (EGLDisplay dpy, EGLint interval) const
 {
 	return m_egl.swapInterval(dpy, interval);
diff --git a/framework/egl/wrapper/eglwFunctionTypes.inl b/framework/egl/wrapper/eglwFunctionTypes.inl
index 9b2a87f..e02039a 100644
--- a/framework/egl/wrapper/eglwFunctionTypes.inl
+++ b/framework/egl/wrapper/eglwFunctionTypes.inl
@@ -49,9 +49,11 @@
 typedef EGLW_APICALL EGLBoolean									(EGLW_APIENTRY* eglQuerySurfaceFunc)					(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
 typedef EGLW_APICALL EGLBoolean									(EGLW_APIENTRY* eglReleaseTexImageFunc)					(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
 typedef EGLW_APICALL EGLBoolean									(EGLW_APIENTRY* eglReleaseThreadFunc)					(void);
+typedef EGLW_APICALL EGLBoolean									(EGLW_APIENTRY* eglSetDamageRegionKHRFunc)				(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
 typedef EGLW_APICALL EGLBoolean									(EGLW_APIENTRY* eglSignalSyncKHRFunc)					(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
 typedef EGLW_APICALL EGLBoolean									(EGLW_APIENTRY* eglSurfaceAttribFunc)					(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
 typedef EGLW_APICALL EGLBoolean									(EGLW_APIENTRY* eglSwapBuffersFunc)						(EGLDisplay dpy, EGLSurface surface);
+typedef EGLW_APICALL EGLBoolean									(EGLW_APIENTRY* eglSwapBuffersWithDamageKHRFunc)		(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
 typedef EGLW_APICALL EGLBoolean									(EGLW_APIENTRY* eglSwapIntervalFunc)					(EGLDisplay dpy, EGLint interval);
 typedef EGLW_APICALL EGLBoolean									(EGLW_APIENTRY* eglTerminateFunc)						(EGLDisplay dpy);
 typedef EGLW_APICALL EGLBoolean									(EGLW_APIENTRY* eglUnlockSurfaceKHRFunc)				(EGLDisplay dpy, EGLSurface surface);
diff --git a/framework/egl/wrapper/eglwFunctions.inl b/framework/egl/wrapper/eglwFunctions.inl
index 0d2621f..3ea39ba 100644
--- a/framework/egl/wrapper/eglwFunctions.inl
+++ b/framework/egl/wrapper/eglwFunctions.inl
@@ -49,9 +49,11 @@
 eglQuerySurfaceFunc						querySurface;
 eglReleaseTexImageFunc					releaseTexImage;
 eglReleaseThreadFunc					releaseThread;
+eglSetDamageRegionKHRFunc				setDamageRegionKHR;
 eglSignalSyncKHRFunc					signalSyncKHR;
 eglSurfaceAttribFunc					surfaceAttrib;
 eglSwapBuffersFunc						swapBuffers;
+eglSwapBuffersWithDamageKHRFunc			swapBuffersWithDamageKHR;
 eglSwapIntervalFunc						swapInterval;
 eglTerminateFunc						terminate;
 eglUnlockSurfaceKHRFunc					unlockSurfaceKHR;
diff --git a/framework/egl/wrapper/eglwInitExtensions.inl b/framework/egl/wrapper/eglwInitExtensions.inl
index b492874..9488633 100644
--- a/framework/egl/wrapper/eglwInitExtensions.inl
+++ b/framework/egl/wrapper/eglwInitExtensions.inl
@@ -13,6 +13,8 @@
 dst->getPlatformDisplayEXT			= (eglGetPlatformDisplayEXTFunc)			loader->get("eglGetPlatformDisplayEXT");
 dst->getSyncAttribKHR				= (eglGetSyncAttribKHRFunc)					loader->get("eglGetSyncAttribKHR");
 dst->lockSurfaceKHR					= (eglLockSurfaceKHRFunc)					loader->get("eglLockSurfaceKHR");
+dst->setDamageRegionKHR				= (eglSetDamageRegionKHRFunc)				loader->get("eglSetDamageRegionKHR");
 dst->signalSyncKHR					= (eglSignalSyncKHRFunc)					loader->get("eglSignalSyncKHR");
+dst->swapBuffersWithDamageKHR		= (eglSwapBuffersWithDamageKHRFunc)			loader->get("eglSwapBuffersWithDamageKHR");
 dst->unlockSurfaceKHR				= (eglUnlockSurfaceKHRFunc)					loader->get("eglUnlockSurfaceKHR");
 dst->waitSyncKHR					= (eglWaitSyncKHRFunc)						loader->get("eglWaitSyncKHR");
diff --git a/framework/egl/wrapper/eglwLibrary.inl b/framework/egl/wrapper/eglwLibrary.inl
index eadfe2a..d46e459 100644
--- a/framework/egl/wrapper/eglwLibrary.inl
+++ b/framework/egl/wrapper/eglwLibrary.inl
@@ -49,9 +49,11 @@
 virtual EGLBoolean									querySurface					(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) const										= 0;
 virtual EGLBoolean									releaseTexImage					(EGLDisplay dpy, EGLSurface surface, EGLint buffer) const														= 0;
 virtual EGLBoolean									releaseThread					(void) const																									= 0;
+virtual EGLBoolean									setDamageRegionKHR				(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects) const										= 0;
 virtual EGLBoolean									signalSyncKHR					(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) const															= 0;
 virtual EGLBoolean									surfaceAttrib					(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) const										= 0;
 virtual EGLBoolean									swapBuffers						(EGLDisplay dpy, EGLSurface surface) const																		= 0;
+virtual EGLBoolean									swapBuffersWithDamageKHR		(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects) const										= 0;
 virtual EGLBoolean									swapInterval					(EGLDisplay dpy, EGLint interval) const																			= 0;
 virtual EGLBoolean									terminate						(EGLDisplay dpy) const																							= 0;
 virtual EGLBoolean									unlockSurfaceKHR				(EGLDisplay dpy, EGLSurface surface) const																		= 0;
diff --git a/framework/opengl/gluCallLogWrapper.inl b/framework/opengl/gluCallLogWrapper.inl
index d5829e4..eb8c98c 100644
--- a/framework/opengl/gluCallLogWrapper.inl
+++ b/framework/opengl/gluCallLogWrapper.inl
@@ -119,7 +119,7 @@
 void CallLogWrapper::glBindImageTexture (glw::GLuint unit, glw::GLuint texture, glw::GLint level, glw::GLboolean layered, glw::GLint layer, glw::GLenum access, glw::GLenum format)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glBindImageTexture(" << unit << ", " << texture << ", " << level << ", " << getBooleanStr(layered) << ", " << layer << ", " << getImageAccessStr(access) << ", " << getPixelFormatStr(format) << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glBindImageTexture(" << unit << ", " << texture << ", " << level << ", " << getBooleanStr(layered) << ", " << layer << ", " << getImageAccessStr(access) << ", " << getUncompressedTextureFormatStr(format) << ");" << TestLog::EndMessage;
 	m_gl.bindImageTexture(unit, texture, level, layered, layer, access, format);
 }
 
@@ -520,14 +520,14 @@
 void CallLogWrapper::glCompressedTexImage2D (glw::GLenum target, glw::GLint level, glw::GLenum internalformat, glw::GLsizei width, glw::GLsizei height, glw::GLint border, glw::GLsizei imageSize, const void *data)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glCompressedTexImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << getCompressedTexFormatStr(internalformat) << ", " << width << ", " << height << ", " << border << ", " << imageSize << ", " << data << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glCompressedTexImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << getCompressedTextureFormatStr(internalformat) << ", " << width << ", " << height << ", " << border << ", " << imageSize << ", " << data << ");" << TestLog::EndMessage;
 	m_gl.compressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
 }
 
 void CallLogWrapper::glCompressedTexImage3D (glw::GLenum target, glw::GLint level, glw::GLenum internalformat, glw::GLsizei width, glw::GLsizei height, glw::GLsizei depth, glw::GLint border, glw::GLsizei imageSize, const void *data)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glCompressedTexImage3D(" << toHex(target) << ", " << level << ", " << toHex(internalformat) << ", " << width << ", " << height << ", " << depth << ", " << border << ", " << imageSize << ", " << data << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glCompressedTexImage3D(" << getTextureTargetStr(target) << ", " << level << ", " << getCompressedTextureFormatStr(internalformat) << ", " << width << ", " << height << ", " << depth << ", " << border << ", " << imageSize << ", " << data << ");" << TestLog::EndMessage;
 	m_gl.compressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
 }
 
@@ -541,14 +541,14 @@
 void CallLogWrapper::glCompressedTexSubImage2D (glw::GLenum target, glw::GLint level, glw::GLint xoffset, glw::GLint yoffset, glw::GLsizei width, glw::GLsizei height, glw::GLenum format, glw::GLsizei imageSize, const void *data)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glCompressedTexSubImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << width << ", " << height << ", " << getCompressedTexFormatStr(format) << ", " << imageSize << ", " << data << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glCompressedTexSubImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << width << ", " << height << ", " << getCompressedTextureFormatStr(format) << ", " << imageSize << ", " << data << ");" << TestLog::EndMessage;
 	m_gl.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
 }
 
 void CallLogWrapper::glCompressedTexSubImage3D (glw::GLenum target, glw::GLint level, glw::GLint xoffset, glw::GLint yoffset, glw::GLint zoffset, glw::GLsizei width, glw::GLsizei height, glw::GLsizei depth, glw::GLenum format, glw::GLsizei imageSize, const void *data)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glCompressedTexSubImage3D(" << toHex(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << zoffset << ", " << width << ", " << height << ", " << depth << ", " << toHex(format) << ", " << imageSize << ", " << data << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glCompressedTexSubImage3D(" << getTextureTargetStr(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << zoffset << ", " << width << ", " << height << ", " << depth << ", " << getCompressedTextureFormatStr(format) << ", " << imageSize << ", " << data << ");" << TestLog::EndMessage;
 	m_gl.compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
 }
 
@@ -597,14 +597,14 @@
 void CallLogWrapper::glCopyTexImage1D (glw::GLenum target, glw::GLint level, glw::GLenum internalformat, glw::GLint x, glw::GLint y, glw::GLsizei width, glw::GLint border)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glCopyTexImage1D(" << getTextureTargetStr(target) << ", " << level << ", " << getPixelFormatStr(internalformat) << ", " << x << ", " << y << ", " << width << ", " << border << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glCopyTexImage1D(" << getTextureTargetStr(target) << ", " << level << ", " << getUncompressedTextureFormatStr(internalformat) << ", " << x << ", " << y << ", " << width << ", " << border << ");" << TestLog::EndMessage;
 	m_gl.copyTexImage1D(target, level, internalformat, x, y, width, border);
 }
 
 void CallLogWrapper::glCopyTexImage2D (glw::GLenum target, glw::GLint level, glw::GLenum internalformat, glw::GLint x, glw::GLint y, glw::GLsizei width, glw::GLsizei height, glw::GLint border)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glCopyTexImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << getPixelFormatStr(internalformat) << ", " << x << ", " << y << ", " << width << ", " << height << ", " << border << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glCopyTexImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << getUncompressedTextureFormatStr(internalformat) << ", " << x << ", " << y << ", " << width << ", " << height << ", " << border << ");" << TestLog::EndMessage;
 	m_gl.copyTexImage2D(target, level, internalformat, x, y, width, height, border);
 }
 
@@ -1643,7 +1643,7 @@
 void CallLogWrapper::glGetInternalformativ (glw::GLenum target, glw::GLenum internalformat, glw::GLenum pname, glw::GLsizei bufSize, glw::GLint *params)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glGetInternalformativ(" << getInternalFormatTargetStr(target) << ", " << getPixelFormatStr(internalformat) << ", " << getInternalFormatParameterStr(pname) << ", " << bufSize << ", " << toHex(reinterpret_cast<deUintptr>(static_cast<const void*>(params))) << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glGetInternalformativ(" << getInternalFormatTargetStr(target) << ", " << getUncompressedTextureFormatStr(internalformat) << ", " << getInternalFormatParameterStr(pname) << ", " << bufSize << ", " << toHex(reinterpret_cast<deUintptr>(static_cast<const void*>(params))) << ");" << TestLog::EndMessage;
 	m_gl.getInternalformativ(target, internalformat, pname, bufSize, params);
 	if (m_enableLog)
 		m_log << TestLog::Message << "// params = " << getPointerStr(params, bufSize) << TestLog::EndMessage;
@@ -3306,7 +3306,7 @@
 void CallLogWrapper::glReadPixels (glw::GLint x, glw::GLint y, glw::GLsizei width, glw::GLsizei height, glw::GLenum format, glw::GLenum type, void *pixels)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glReadPixels(" << x << ", " << y << ", " << width << ", " << height << ", " << getPixelFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glReadPixels(" << x << ", " << y << ", " << width << ", " << height << ", " << getUncompressedTextureFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
 	m_gl.readPixels(x, y, width, height, format, type, pixels);
 }
 
@@ -3327,14 +3327,14 @@
 void CallLogWrapper::glRenderbufferStorage (glw::GLenum target, glw::GLenum internalformat, glw::GLsizei width, glw::GLsizei height)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glRenderbufferStorage(" << getFramebufferTargetStr(target) << ", " << getPixelFormatStr(internalformat) << ", " << width << ", " << height << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glRenderbufferStorage(" << getFramebufferTargetStr(target) << ", " << getUncompressedTextureFormatStr(internalformat) << ", " << width << ", " << height << ");" << TestLog::EndMessage;
 	m_gl.renderbufferStorage(target, internalformat, width, height);
 }
 
 void CallLogWrapper::glRenderbufferStorageMultisample (glw::GLenum target, glw::GLsizei samples, glw::GLenum internalformat, glw::GLsizei width, glw::GLsizei height)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glRenderbufferStorageMultisample(" << getFramebufferTargetStr(target) << ", " << samples << ", " << getPixelFormatStr(internalformat) << ", " << width << ", " << height << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glRenderbufferStorageMultisample(" << getFramebufferTargetStr(target) << ", " << samples << ", " << getUncompressedTextureFormatStr(internalformat) << ", " << width << ", " << height << ");" << TestLog::EndMessage;
 	m_gl.renderbufferStorageMultisample(target, samples, internalformat, width, height);
 }
 
@@ -3495,42 +3495,42 @@
 void CallLogWrapper::glTexBuffer (glw::GLenum target, glw::GLenum internalformat, glw::GLuint buffer)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glTexBuffer(" << getBufferTargetStr(target) << ", " << getPixelFormatStr(internalformat) << ", " << buffer << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glTexBuffer(" << getBufferTargetStr(target) << ", " << getUncompressedTextureFormatStr(internalformat) << ", " << buffer << ");" << TestLog::EndMessage;
 	m_gl.texBuffer(target, internalformat, buffer);
 }
 
 void CallLogWrapper::glTexBufferRange (glw::GLenum target, glw::GLenum internalformat, glw::GLuint buffer, glw::GLintptr offset, glw::GLsizeiptr size)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glTexBufferRange(" << getBufferTargetStr(target) << ", " << getPixelFormatStr(internalformat) << ", " << buffer << ", " << offset << ", " << size << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glTexBufferRange(" << getBufferTargetStr(target) << ", " << getUncompressedTextureFormatStr(internalformat) << ", " << buffer << ", " << offset << ", " << size << ");" << TestLog::EndMessage;
 	m_gl.texBufferRange(target, internalformat, buffer, offset, size);
 }
 
 void CallLogWrapper::glTexImage1D (glw::GLenum target, glw::GLint level, glw::GLint internalformat, glw::GLsizei width, glw::GLint border, glw::GLenum format, glw::GLenum type, const void *pixels)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glTexImage1D(" << getTextureTargetStr(target) << ", " << level << ", " << getPixelFormatStr(internalformat) << ", " << width << ", " << border << ", " << getPixelFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glTexImage1D(" << getTextureTargetStr(target) << ", " << level << ", " << getUncompressedTextureFormatStr(internalformat) << ", " << width << ", " << border << ", " << getUncompressedTextureFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
 	m_gl.texImage1D(target, level, internalformat, width, border, format, type, pixels);
 }
 
 void CallLogWrapper::glTexImage2D (glw::GLenum target, glw::GLint level, glw::GLint internalformat, glw::GLsizei width, glw::GLsizei height, glw::GLint border, glw::GLenum format, glw::GLenum type, const void *pixels)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glTexImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << getPixelFormatStr(internalformat) << ", " << width << ", " << height << ", " << border << ", " << getPixelFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glTexImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << getUncompressedTextureFormatStr(internalformat) << ", " << width << ", " << height << ", " << border << ", " << getUncompressedTextureFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
 	m_gl.texImage2D(target, level, internalformat, width, height, border, format, type, pixels);
 }
 
 void CallLogWrapper::glTexImage2DMultisample (glw::GLenum target, glw::GLsizei samples, glw::GLenum internalformat, glw::GLsizei width, glw::GLsizei height, glw::GLboolean fixedsamplelocations)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glTexImage2DMultisample(" << getTextureTargetStr(target) << ", " << samples << ", " << getPixelFormatStr(internalformat) << ", " << width << ", " << height << ", " << getBooleanStr(fixedsamplelocations) << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glTexImage2DMultisample(" << getTextureTargetStr(target) << ", " << samples << ", " << getUncompressedTextureFormatStr(internalformat) << ", " << width << ", " << height << ", " << getBooleanStr(fixedsamplelocations) << ");" << TestLog::EndMessage;
 	m_gl.texImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
 }
 
 void CallLogWrapper::glTexImage3D (glw::GLenum target, glw::GLint level, glw::GLint internalformat, glw::GLsizei width, glw::GLsizei height, glw::GLsizei depth, glw::GLint border, glw::GLenum format, glw::GLenum type, const void *pixels)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glTexImage3D(" << getTextureTargetStr(target) << ", " << level << ", " << getPixelFormatStr(internalformat) << ", " << width << ", " << height << ", " << depth << ", " << border << ", " << getPixelFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glTexImage3D(" << getTextureTargetStr(target) << ", " << level << ", " << getUncompressedTextureFormatStr(internalformat) << ", " << width << ", " << height << ", " << depth << ", " << border << ", " << getUncompressedTextureFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
 	m_gl.texImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
 }
 
@@ -3593,49 +3593,49 @@
 void CallLogWrapper::glTexStorage2D (glw::GLenum target, glw::GLsizei levels, glw::GLenum internalformat, glw::GLsizei width, glw::GLsizei height)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glTexStorage2D(" << getTextureTargetStr(target) << ", " << levels << ", " << getPixelFormatStr(internalformat) << ", " << width << ", " << height << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glTexStorage2D(" << getTextureTargetStr(target) << ", " << levels << ", " << getTextureFormatStr(internalformat) << ", " << width << ", " << height << ");" << TestLog::EndMessage;
 	m_gl.texStorage2D(target, levels, internalformat, width, height);
 }
 
 void CallLogWrapper::glTexStorage2DMultisample (glw::GLenum target, glw::GLsizei samples, glw::GLenum internalformat, glw::GLsizei width, glw::GLsizei height, glw::GLboolean fixedsamplelocations)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glTexStorage2DMultisample(" << getTextureTargetStr(target) << ", " << samples << ", " << getPixelFormatStr(internalformat) << ", " << width << ", " << height << ", " << getBooleanStr(fixedsamplelocations) << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glTexStorage2DMultisample(" << getTextureTargetStr(target) << ", " << samples << ", " << getUncompressedTextureFormatStr(internalformat) << ", " << width << ", " << height << ", " << getBooleanStr(fixedsamplelocations) << ");" << TestLog::EndMessage;
 	m_gl.texStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
 }
 
 void CallLogWrapper::glTexStorage3D (glw::GLenum target, glw::GLsizei levels, glw::GLenum internalformat, glw::GLsizei width, glw::GLsizei height, glw::GLsizei depth)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glTexStorage3D(" << getTextureTargetStr(target) << ", " << levels << ", " << getPixelFormatStr(internalformat) << ", " << width << ", " << height << ", " << depth << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glTexStorage3D(" << getTextureTargetStr(target) << ", " << levels << ", " << getTextureFormatStr(internalformat) << ", " << width << ", " << height << ", " << depth << ");" << TestLog::EndMessage;
 	m_gl.texStorage3D(target, levels, internalformat, width, height, depth);
 }
 
 void CallLogWrapper::glTexStorage3DMultisample (glw::GLenum target, glw::GLsizei samples, glw::GLenum internalformat, glw::GLsizei width, glw::GLsizei height, glw::GLsizei depth, glw::GLboolean fixedsamplelocations)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glTexStorage3DMultisample(" << getTextureTargetStr(target) << ", " << samples << ", " << getPixelFormatStr(internalformat) << ", " << width << ", " << height << ", " << depth << ", " << getBooleanStr(fixedsamplelocations) << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glTexStorage3DMultisample(" << getTextureTargetStr(target) << ", " << samples << ", " << getUncompressedTextureFormatStr(internalformat) << ", " << width << ", " << height << ", " << depth << ", " << getBooleanStr(fixedsamplelocations) << ");" << TestLog::EndMessage;
 	m_gl.texStorage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
 }
 
 void CallLogWrapper::glTexSubImage1D (glw::GLenum target, glw::GLint level, glw::GLint xoffset, glw::GLsizei width, glw::GLenum format, glw::GLenum type, const void *pixels)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glTexSubImage1D(" << getTextureTargetStr(target) << ", " << level << ", " << xoffset << ", " << width << ", " << getPixelFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glTexSubImage1D(" << getTextureTargetStr(target) << ", " << level << ", " << xoffset << ", " << width << ", " << getUncompressedTextureFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
 	m_gl.texSubImage1D(target, level, xoffset, width, format, type, pixels);
 }
 
 void CallLogWrapper::glTexSubImage2D (glw::GLenum target, glw::GLint level, glw::GLint xoffset, glw::GLint yoffset, glw::GLsizei width, glw::GLsizei height, glw::GLenum format, glw::GLenum type, const void *pixels)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glTexSubImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << width << ", " << height << ", " << getPixelFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glTexSubImage2D(" << getTextureTargetStr(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << width << ", " << height << ", " << getUncompressedTextureFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
 	m_gl.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
 }
 
 void CallLogWrapper::glTexSubImage3D (glw::GLenum target, glw::GLint level, glw::GLint xoffset, glw::GLint yoffset, glw::GLint zoffset, glw::GLsizei width, glw::GLsizei height, glw::GLsizei depth, glw::GLenum format, glw::GLenum type, const void *pixels)
 {
 	if (m_enableLog)
-		m_log << TestLog::Message << "glTexSubImage3D(" << getTextureTargetStr(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << zoffset << ", " << width << ", " << height << ", " << depth << ", " << getPixelFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
+		m_log << TestLog::Message << "glTexSubImage3D(" << getTextureTargetStr(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << zoffset << ", " << width << ", " << height << ", " << depth << ", " << getUncompressedTextureFormatStr(format) << ", " << getTypeStr(type) << ", " << pixels << ");" << TestLog::EndMessage;
 	m_gl.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
 }
 
diff --git a/framework/opengl/gluShaderProgram.cpp b/framework/opengl/gluShaderProgram.cpp
index 7c273d8..333e0d5 100644
--- a/framework/opengl/gluShaderProgram.cpp
+++ b/framework/opengl/gluShaderProgram.cpp
@@ -432,7 +432,7 @@
 	return s_typeMap[shaderType];
 }
 
-static tcu::TestLog& operator<< (tcu::TestLog& log, const ShaderInfo& shaderInfo)
+tcu::TestLog& operator<< (tcu::TestLog& log, const ShaderInfo& shaderInfo)
 {
 	return log << tcu::TestLog::Shader(getLogShaderType(shaderInfo.type), shaderInfo.source, shaderInfo.compileOk, shaderInfo.infoLog);
 }
@@ -442,20 +442,13 @@
 	return log << tcu::TestLog::ShaderProgram(false, "Plain shader") << shader.getInfo() << tcu::TestLog::EndShaderProgram;
 }
 
-tcu::TestLog& operator<< (tcu::TestLog& log, const ShaderProgram& program)
+static void logShaderProgram (tcu::TestLog& log, const ProgramInfo& programInfo, size_t numShaders, const ShaderInfo* const* shaderInfos)
 {
-	const ProgramInfo& progInfo = program.getProgramInfo();
-
-	log << tcu::TestLog::ShaderProgram(progInfo.linkOk, progInfo.infoLog);
+	log << tcu::TestLog::ShaderProgram(programInfo.linkOk, programInfo.infoLog);
 	try
 	{
-		for (int shaderTypeNdx = 0; shaderTypeNdx < SHADERTYPE_LAST; shaderTypeNdx++)
-		{
-			const glu::ShaderType shaderType = (glu::ShaderType)shaderTypeNdx;
-
-			for (int shaderNdx = 0; shaderNdx < program.getNumShaders(shaderType); ++shaderNdx)
-				log << program.getShaderInfo(shaderType, shaderNdx);
-		}
+		for (size_t shaderNdx = 0; shaderNdx < numShaders; ++shaderNdx)
+			log << *shaderInfos[shaderNdx];
 	}
 	catch (...)
 	{
@@ -483,21 +476,72 @@
 
 		bool allShadersOk = true;
 
-		for (int shaderTypeNdx = 0; shaderTypeNdx < SHADERTYPE_LAST; shaderTypeNdx++)
+		for (size_t shaderNdx = 0; shaderNdx < numShaders; ++shaderNdx)
 		{
-			const glu::ShaderType shaderType = (glu::ShaderType)shaderTypeNdx;
+			const ShaderInfo&	shaderInfo	= *shaderInfos[shaderNdx];
 
-			for (int shaderNdx = 0; shaderNdx < program.getNumShaders(shaderType); ++shaderNdx)
-			{
-				const ShaderInfo& shaderInfo = program.getShaderInfo(shaderType, shaderNdx);
-				log << tcu::TestLog::Float(s_compileTimeDesc[shaderType].name, s_compileTimeDesc[shaderType].description, "ms", QP_KEY_TAG_TIME, (float)shaderInfo.compileTimeUs / 1000.0f);
-				allShadersOk = allShadersOk && shaderInfo.compileOk;
-			}
+			log << tcu::TestLog::Float(s_compileTimeDesc[shaderInfo.type].name,
+									   s_compileTimeDesc[shaderInfo.type].description,
+									   "ms", QP_KEY_TAG_TIME, (float)shaderInfo.compileTimeUs / 1000.0f);
+
+			allShadersOk = allShadersOk && shaderInfo.compileOk;
 		}
 
 		if (allShadersOk)
-			log << tcu::TestLog::Float("LinkTime", "Link time", "ms", QP_KEY_TAG_TIME, (float)progInfo.linkTimeUs / 1000.0f);
+			log << tcu::TestLog::Float("LinkTime", "Link time", "ms", QP_KEY_TAG_TIME, (float)programInfo.linkTimeUs / 1000.0f);
 	}
+}
+
+tcu::TestLog& operator<< (tcu::TestLog& log, const ShaderProgramInfo& shaderProgramInfo)
+{
+	std::vector<const ShaderInfo*>	shaderPtrs	(shaderProgramInfo.shaders.size());
+
+	for (size_t ndx = 0; ndx < shaderPtrs.size(); ndx++)
+		shaderPtrs[ndx] = &shaderProgramInfo.shaders[ndx];
+
+	logShaderProgram(log, shaderProgramInfo.program, shaderPtrs.size(), shaderPtrs.empty() ? DE_NULL : &shaderPtrs[0]);
+
+	return log;
+}
+
+tcu::TestLog& operator<< (tcu::TestLog& log, const ShaderProgram& shaderProgram)
+{
+	std::vector<const ShaderInfo*>	shaderPtrs;
+
+	for (int shaderType = 0; shaderType < SHADERTYPE_LAST; shaderType++)
+	{
+		for (int shaderNdx = 0; shaderNdx < shaderProgram.getNumShaders((ShaderType)shaderType); shaderNdx++)
+			shaderPtrs.push_back(&shaderProgram.getShaderInfo((ShaderType)shaderType, shaderNdx));
+	}
+
+	logShaderProgram(log, shaderProgram.getProgramInfo(), shaderPtrs.size(), shaderPtrs.empty() ? DE_NULL : &shaderPtrs[0]);
+
+	return log;
+}
+
+tcu::TestLog& operator<< (tcu::TestLog& log, const ProgramSources& sources)
+{
+	log << tcu::TestLog::ShaderProgram(false, "(Source only)");
+
+	try
+	{
+		for (int shaderType = 0; shaderType < SHADERTYPE_LAST; shaderType++)
+		{
+			for (size_t shaderNdx = 0; shaderNdx < sources.sources[shaderType].size(); shaderNdx++)
+			{
+				log << tcu::TestLog::Shader(getLogShaderType((ShaderType)shaderType),
+											sources.sources[shaderType][shaderNdx],
+											false, "");
+			}
+		}
+	}
+	catch (...)
+	{
+		log << tcu::TestLog::EndShaderProgram;
+		throw;
+	}
+
+	log << tcu::TestLog::EndShaderProgram;
 
 	return log;
 }
diff --git a/framework/opengl/gluShaderProgram.hpp b/framework/opengl/gluShaderProgram.hpp
index 8614ecc..e2c7ad2 100644
--- a/framework/opengl/gluShaderProgram.hpp
+++ b/framework/opengl/gluShaderProgram.hpp
@@ -67,6 +67,15 @@
 };
 
 /*--------------------------------------------------------------------*//*!
+ * \brief Combined shader compilation and program linking info.
+ *//*--------------------------------------------------------------------*/
+struct ShaderProgramInfo
+{
+	glu::ProgramInfo				program;
+	std::vector<glu::ShaderInfo>	shaders;
+};
+
+/*--------------------------------------------------------------------*//*!
  * \brief Shader object.
  *//*--------------------------------------------------------------------*/
 class Shader
@@ -201,6 +210,9 @@
 deUint32		getGLShaderTypeBit	(ShaderType shaderType);
 qpShaderType	getLogShaderType	(ShaderType shaderType);
 
+tcu::TestLog&	operator<<			(tcu::TestLog& log, const ShaderInfo& shaderInfo);
+tcu::TestLog&	operator<<			(tcu::TestLog& log, const ShaderProgramInfo& shaderProgramInfo);
+tcu::TestLog&	operator<<			(tcu::TestLog& log, const ProgramSources& sources);
 tcu::TestLog&	operator<<			(tcu::TestLog& log, const Shader& shader);
 tcu::TestLog&	operator<<			(tcu::TestLog& log, const ShaderProgram& program);
 
diff --git a/framework/opengl/gluShaderUtil.cpp b/framework/opengl/gluShaderUtil.cpp
index ef9233c..69c4aaf 100644
--- a/framework/opengl/gluShaderUtil.cpp
+++ b/framework/opengl/gluShaderUtil.cpp
@@ -568,7 +568,7 @@
 	else if (isDataTypeMatrix(dataType))
 		return getDataTypeMatrixNumColumns(dataType);
 
-	DE_ASSERT(!"Illegal datatype.");
+	DE_FATAL("Illegal datatype.");
 	return 0;
 }
 
@@ -579,7 +579,7 @@
 	else if (isDataTypeMatrix(dataType))
 		return getDataTypeMatrixNumRows(dataType);
 
-	DE_ASSERT(!"Illegal datatype.");
+	DE_FATAL("Illegal datatype.");
 	return 0;
 }
 
diff --git a/framework/opengl/gluStrUtil.inl b/framework/opengl/gluStrUtil.inl
index df02349..d43046f 100644
--- a/framework/opengl/gluStrUtil.inl
+++ b/framework/opengl/gluStrUtil.inl
@@ -800,7 +800,7 @@
 	}
 }
 
-const char* getPixelFormatName (int value)
+const char* getUncompressedTextureFormatName (int value)
 {
 	switch (value)
 	{
@@ -891,7 +891,7 @@
 	}
 }
 
-const char* getCompressedTexFormatName (int value)
+const char* getCompressedTextureFormatName (int value)
 {
 	switch (value)
 	{
@@ -1650,6 +1650,143 @@
 	}
 }
 
+const char* getTextureFormatName (int value)
+{
+	switch (value)
+	{
+		case GL_LUMINANCE:									return "GL_LUMINANCE";
+		case GL_LUMINANCE_ALPHA:							return "GL_LUMINANCE_ALPHA";
+		case GL_ALPHA:										return "GL_ALPHA";
+		case GL_RGB:										return "GL_RGB";
+		case GL_RGBA:										return "GL_RGBA";
+		case GL_RGBA4:										return "GL_RGBA4";
+		case GL_RGB5_A1:									return "GL_RGB5_A1";
+		case GL_RGB565:										return "GL_RGB565";
+		case GL_DEPTH_COMPONENT16:							return "GL_DEPTH_COMPONENT16";
+		case GL_STENCIL_INDEX8:								return "GL_STENCIL_INDEX8";
+		case GL_RG:											return "GL_RG";
+		case GL_RED:										return "GL_RED";
+		case GL_RGBA_INTEGER:								return "GL_RGBA_INTEGER";
+		case GL_RGB_INTEGER:								return "GL_RGB_INTEGER";
+		case GL_RG_INTEGER:									return "GL_RG_INTEGER";
+		case GL_RED_INTEGER:								return "GL_RED_INTEGER";
+		case GL_DEPTH_COMPONENT:							return "GL_DEPTH_COMPONENT";
+		case GL_DEPTH_STENCIL:								return "GL_DEPTH_STENCIL";
+		case GL_RGBA32F:									return "GL_RGBA32F";
+		case GL_RGBA32I:									return "GL_RGBA32I";
+		case GL_RGBA32UI:									return "GL_RGBA32UI";
+		case GL_RGBA16:										return "GL_RGBA16";
+		case GL_RGBA16_SNORM:								return "GL_RGBA16_SNORM";
+		case GL_RGBA16F:									return "GL_RGBA16F";
+		case GL_RGBA16I:									return "GL_RGBA16I";
+		case GL_RGBA16UI:									return "GL_RGBA16UI";
+		case GL_RGBA8:										return "GL_RGBA8";
+		case GL_RGBA8I:										return "GL_RGBA8I";
+		case GL_RGBA8UI:									return "GL_RGBA8UI";
+		case GL_SRGB8_ALPHA8:								return "GL_SRGB8_ALPHA8";
+		case GL_RGB10_A2:									return "GL_RGB10_A2";
+		case GL_RGB10_A2UI:									return "GL_RGB10_A2UI";
+		case GL_RGBA8_SNORM:								return "GL_RGBA8_SNORM";
+		case GL_RGB8:										return "GL_RGB8";
+		case GL_R11F_G11F_B10F:								return "GL_R11F_G11F_B10F";
+		case GL_RGB32F:										return "GL_RGB32F";
+		case GL_RGB32I:										return "GL_RGB32I";
+		case GL_RGB32UI:									return "GL_RGB32UI";
+		case GL_RGB16:										return "GL_RGB16";
+		case GL_RGB16_SNORM:								return "GL_RGB16_SNORM";
+		case GL_RGB16F:										return "GL_RGB16F";
+		case GL_RGB16I:										return "GL_RGB16I";
+		case GL_RGB16UI:									return "GL_RGB16UI";
+		case GL_RGB8_SNORM:									return "GL_RGB8_SNORM";
+		case GL_RGB8I:										return "GL_RGB8I";
+		case GL_RGB8UI:										return "GL_RGB8UI";
+		case GL_SRGB8:										return "GL_SRGB8";
+		case GL_RGB9_E5:									return "GL_RGB9_E5";
+		case GL_RG32F:										return "GL_RG32F";
+		case GL_RG32I:										return "GL_RG32I";
+		case GL_RG32UI:										return "GL_RG32UI";
+		case GL_RG16:										return "GL_RG16";
+		case GL_RG16_SNORM:									return "GL_RG16_SNORM";
+		case GL_RG16F:										return "GL_RG16F";
+		case GL_RG16I:										return "GL_RG16I";
+		case GL_RG16UI:										return "GL_RG16UI";
+		case GL_RG8:										return "GL_RG8";
+		case GL_RG8I:										return "GL_RG8I";
+		case GL_RG8UI:										return "GL_RG8UI";
+		case GL_RG8_SNORM:									return "GL_RG8_SNORM";
+		case GL_R32F:										return "GL_R32F";
+		case GL_R32I:										return "GL_R32I";
+		case GL_R32UI:										return "GL_R32UI";
+		case GL_R16:										return "GL_R16";
+		case GL_R16_SNORM:									return "GL_R16_SNORM";
+		case GL_R16F:										return "GL_R16F";
+		case GL_R16I:										return "GL_R16I";
+		case GL_R16UI:										return "GL_R16UI";
+		case GL_R8:											return "GL_R8";
+		case GL_R8I:										return "GL_R8I";
+		case GL_R8UI:										return "GL_R8UI";
+		case GL_R8_SNORM:									return "GL_R8_SNORM";
+		case GL_DEPTH_COMPONENT32F:							return "GL_DEPTH_COMPONENT32F";
+		case GL_DEPTH_COMPONENT24:							return "GL_DEPTH_COMPONENT24";
+		case GL_DEPTH32F_STENCIL8:							return "GL_DEPTH32F_STENCIL8";
+		case GL_DEPTH24_STENCIL8:							return "GL_DEPTH24_STENCIL8";
+		case GL_RGB10:										return "GL_RGB10";
+		case GL_DEPTH_COMPONENT32:							return "GL_DEPTH_COMPONENT32";
+		case GL_SRGB:										return "GL_SRGB";
+		case GL_SRGB_ALPHA:									return "GL_SRGB_ALPHA";
+		case GL_SR8_EXT:									return "GL_SR8_EXT";
+		case GL_SRG8_EXT:									return "GL_SRG8_EXT";
+		case GL_BGRA:										return "GL_BGRA";
+		case GL_COMPRESSED_R11_EAC:							return "GL_COMPRESSED_R11_EAC";
+		case GL_COMPRESSED_SIGNED_R11_EAC:					return "GL_COMPRESSED_SIGNED_R11_EAC";
+		case GL_COMPRESSED_RG11_EAC:						return "GL_COMPRESSED_RG11_EAC";
+		case GL_COMPRESSED_SIGNED_RG11_EAC:					return "GL_COMPRESSED_SIGNED_RG11_EAC";
+		case GL_COMPRESSED_RGB8_ETC2:						return "GL_COMPRESSED_RGB8_ETC2";
+		case GL_COMPRESSED_SRGB8_ETC2:						return "GL_COMPRESSED_SRGB8_ETC2";
+		case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:	return "GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2";
+		case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:	return "GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2";
+		case GL_COMPRESSED_RGBA8_ETC2_EAC:					return "GL_COMPRESSED_RGBA8_ETC2_EAC";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:			return "GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC";
+		case GL_COMPRESSED_RGBA_ASTC_4x4_KHR:				return "GL_COMPRESSED_RGBA_ASTC_4x4_KHR";
+		case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:				return "GL_COMPRESSED_RGBA_ASTC_5x4_KHR";
+		case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:				return "GL_COMPRESSED_RGBA_ASTC_5x5_KHR";
+		case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:				return "GL_COMPRESSED_RGBA_ASTC_6x5_KHR";
+		case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:				return "GL_COMPRESSED_RGBA_ASTC_6x6_KHR";
+		case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:				return "GL_COMPRESSED_RGBA_ASTC_8x5_KHR";
+		case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:				return "GL_COMPRESSED_RGBA_ASTC_8x6_KHR";
+		case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:				return "GL_COMPRESSED_RGBA_ASTC_8x8_KHR";
+		case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:				return "GL_COMPRESSED_RGBA_ASTC_10x5_KHR";
+		case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:				return "GL_COMPRESSED_RGBA_ASTC_10x6_KHR";
+		case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:				return "GL_COMPRESSED_RGBA_ASTC_10x8_KHR";
+		case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:				return "GL_COMPRESSED_RGBA_ASTC_10x10_KHR";
+		case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:				return "GL_COMPRESSED_RGBA_ASTC_12x10_KHR";
+		case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:				return "GL_COMPRESSED_RGBA_ASTC_12x12_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR";
+		case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:		return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR";
+		case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:				return "GL_COMPRESSED_RGB_S3TC_DXT1_EXT";
+		case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:				return "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT";
+		case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:				return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT";
+		case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:				return "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT";
+		case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:			return "GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG";
+		case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:			return "GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG";
+		case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:			return "GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG";
+		case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:			return "GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG";
+		default:											return DE_NULL;
+	}
+}
+
 tcu::Format::Bitfield<16> getBufferMaskStr (int value)
 {
 	static const tcu::Format::BitDesc s_desc[] =
diff --git a/framework/opengl/gluStrUtilPrototypes.inl b/framework/opengl/gluStrUtilPrototypes.inl
index 8bab4ca..d6ca550 100644
--- a/framework/opengl/gluStrUtilPrototypes.inl
+++ b/framework/opengl/gluStrUtilPrototypes.inl
@@ -46,8 +46,8 @@
 const char*							getCubeMapFaceName						(int value);
 const char*							getTextureDepthStencilModeName			(int value);
 const char*							getPixelStoreParameterName				(int value);
-const char*							getPixelFormatName						(int value);
-const char*							getCompressedTexFormatName				(int value);
+const char*							getUncompressedTextureFormatName		(int value);
+const char*							getCompressedTextureFormatName			(int value);
 const char*							getShaderVarTypeName					(int value);
 const char*							getShaderParamName						(int value);
 const char*							getVertexAttribParameterNameName		(int value);
@@ -73,6 +73,7 @@
 const char*							getDebugMessageSeverityName				(int value);
 const char*							getPipelineParamName					(int value);
 const char*							getPatchParamName						(int value);
+const char*							getTextureFormatName					(int value);
 tcu::Format::Bitfield<16>			getBufferMaskStr						(int value);
 tcu::Format::Bitfield<16>			getBufferMapFlagsStr					(int value);
 tcu::Format::Bitfield<16>			getMemoryBarrierFlagsStr				(int value);
@@ -120,8 +121,8 @@
 inline tcu::Format::Enum<int, 2>	getCubeMapFaceStr						(int value)		{ return tcu::Format::Enum<int, 2>(getCubeMapFaceName, value); }
 inline tcu::Format::Enum<int, 2>	getTextureDepthStencilModeStr			(int value)		{ return tcu::Format::Enum<int, 2>(getTextureDepthStencilModeName, value); }
 inline tcu::Format::Enum<int, 2>	getPixelStoreParameterStr				(int value)		{ return tcu::Format::Enum<int, 2>(getPixelStoreParameterName, value); }
-inline tcu::Format::Enum<int, 2>	getPixelFormatStr						(int value)		{ return tcu::Format::Enum<int, 2>(getPixelFormatName, value); }
-inline tcu::Format::Enum<int, 2>	getCompressedTexFormatStr				(int value)		{ return tcu::Format::Enum<int, 2>(getCompressedTexFormatName, value); }
+inline tcu::Format::Enum<int, 2>	getUncompressedTextureFormatStr			(int value)		{ return tcu::Format::Enum<int, 2>(getUncompressedTextureFormatName, value); }
+inline tcu::Format::Enum<int, 2>	getCompressedTextureFormatStr			(int value)		{ return tcu::Format::Enum<int, 2>(getCompressedTextureFormatName, value); }
 inline tcu::Format::Enum<int, 2>	getShaderVarTypeStr						(int value)		{ return tcu::Format::Enum<int, 2>(getShaderVarTypeName, value); }
 inline tcu::Format::Enum<int, 2>	getShaderParamStr						(int value)		{ return tcu::Format::Enum<int, 2>(getShaderParamName, value); }
 inline tcu::Format::Enum<int, 2>	getVertexAttribParameterNameStr			(int value)		{ return tcu::Format::Enum<int, 2>(getVertexAttribParameterNameName, value); }
@@ -147,4 +148,5 @@
 inline tcu::Format::Enum<int, 2>	getDebugMessageSeverityStr				(int value)		{ return tcu::Format::Enum<int, 2>(getDebugMessageSeverityName, value); }
 inline tcu::Format::Enum<int, 2>	getPipelineParamStr						(int value)		{ return tcu::Format::Enum<int, 2>(getPipelineParamName, value); }
 inline tcu::Format::Enum<int, 2>	getPatchParamStr						(int value)		{ return tcu::Format::Enum<int, 2>(getPatchParamName, value); }
+inline tcu::Format::Enum<int, 2>	getTextureFormatStr						(int value)		{ return tcu::Format::Enum<int, 2>(getTextureFormatName, value); }
 inline tcu::Format::Enum<int, 1>	getBooleanStr							(deUint8 value)	{ return tcu::Format::Enum<int, 1>(getBooleanName, (int)value); }
diff --git a/framework/opengl/gluTexture.cpp b/framework/opengl/gluTexture.cpp
index 7ae0a3c..d81bda1 100644
--- a/framework/opengl/gluTexture.cpp
+++ b/framework/opengl/gluTexture.cpp
@@ -839,10 +839,9 @@
 		}
 	}
 
-	m_refBuffer.resize(bufferSize, 0);
-
+	m_refBuffer.setStorage(bufferSize);
 	if (data)
-		deMemcpy(&m_refBuffer[0], data, (int)bufferSize);
+		deMemcpy(m_refBuffer.getPtr(), data, (int)bufferSize);
 
 	m_format	= internalFormat;
 	m_offset	= offset;
@@ -851,16 +850,6 @@
 	DE_ASSERT(size != 0 || offset == 0);
 
 	{
-		const tcu::TextureFormat	format			= mapGLInternalFormat(internalFormat);
-		deInt32						maxTextureSize	= 0;
-
-		gl.getIntegerv(GL_MAX_TEXTURE_BUFFER_SIZE, &maxTextureSize);
-		GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv(GL_MAX_TEXTURE_BUFFER_SIZE) failed");
-
-		m_refTexture = tcu::PixelBufferAccess(format, de::min<int>((int)maxTextureSize, (int)((m_size != 0 ? m_size : bufferSize) / format.getPixelSize())), 1, 1, &(m_refBuffer[m_offset]));
-	}
-
-	{
 		gl.genTextures(1, &m_glTexture);
 		GLU_EXPECT_NO_ERROR(gl.getError(), "glGenTextures() failed");
 
@@ -868,7 +857,7 @@
 		GLU_EXPECT_NO_ERROR(gl.getError(), "glGenBuffers() failed");
 
 		gl.bindBuffer(GL_TEXTURE_BUFFER, m_glBuffer);
-		gl.bufferData(GL_TEXTURE_BUFFER, (glw::GLsizei)m_refBuffer.size(), &(m_refBuffer[0]), GL_STATIC_DRAW);
+		gl.bufferData(GL_TEXTURE_BUFFER, (glw::GLsizei)m_refBuffer.size(), data, GL_STATIC_DRAW);
 		gl.bindBuffer(GL_TEXTURE_BUFFER, 0);
 		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to create buffer");
 
@@ -893,31 +882,31 @@
 		m_context.getFunctions().deleteBuffers(1, &m_glBuffer);
 }
 
+
+const tcu::PixelBufferAccess TextureBuffer::getFullRefTexture (void)
+{
+	const tcu::TextureFormat	format				= mapGLInternalFormat(m_format);
+	const size_t				bufferLengthBytes	= (m_size != 0) ? (m_size) : (m_refBuffer.size());
+	const int					bufferLengthPixels	= (int)bufferLengthBytes / format.getPixelSize();
+
+	return tcu::PixelBufferAccess(format,
+								  tcu::IVec3(bufferLengthPixels, 1, 1),
+								  (deUint8*)m_refBuffer.getPtr() + m_offset);
+}
+
+const tcu::ConstPixelBufferAccess TextureBuffer::getFullRefTexture (void) const
+{
+	return const_cast<TextureBuffer*>(this)->getFullRefTexture();
+}
+
 void TextureBuffer::upload (void)
 {
 	const glw::Functions& gl = m_context.getFunctions();
 
 	gl.bindBuffer(GL_TEXTURE_BUFFER, m_glBuffer);
-	gl.bufferData(GL_TEXTURE_BUFFER, (glw::GLsizei)m_refBuffer.size(), &(m_refBuffer[0]), GL_STATIC_DRAW);
+	gl.bufferData(GL_TEXTURE_BUFFER, (glw::GLsizei)m_refBuffer.size(), m_refBuffer.getPtr(), GL_STATIC_DRAW);
 	gl.bindBuffer(GL_TEXTURE_BUFFER, 0);
 	GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to upload buffer");
 }
 
-void TextureBuffer::bufferData (const deUint8* data, size_t size)
-{
-	const glw::Functions& gl = m_context.getFunctions();
-
-	m_refBuffer = vector<deUint8>(data, data+size);
-
-	{
-		const tcu::TextureFormat	format			= mapGLInternalFormat(m_format);
-		deInt32						maxTextureSize	= 0;
-
-		gl.getIntegerv(GL_MAX_TEXTURE_BUFFER_SIZE, &maxTextureSize);
-		GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv(GL_MAX_TEXTURE_BUFFER_SIZE) failed");
-
-		m_refTexture = tcu::PixelBufferAccess(format, de::min<int>((int)maxTextureSize, (int)((m_size != 0 ? m_size : m_refBuffer.size())  / format.getPixelSize())), 1, 1, &(m_refBuffer[m_offset]));
-	}
-}
-
 } // glu
diff --git a/framework/opengl/gluTexture.hpp b/framework/opengl/gluTexture.hpp
index 1a8d7db..f3670d7 100644
--- a/framework/opengl/gluTexture.hpp
+++ b/framework/opengl/gluTexture.hpp
@@ -276,11 +276,13 @@
 
 										~TextureBuffer		(void);
 
-	const tcu::PixelBufferAccess&		getRefTexture		(void)			{ return m_refTexture;			}
-	const tcu::ConstPixelBufferAccess&	getRefTexture		(void) const	{ return m_refTexture;			}
+	// \note Effective pixel buffer access must be limited to w <= GL_MAX_TEXTURE_BUFFER_SIZE
+	const tcu::PixelBufferAccess		getFullRefTexture	(void);
+	const tcu::ConstPixelBufferAccess	getFullRefTexture	(void) const;
 
-	deUint8*							getRefBuffer		(void)			{ return &(m_refBuffer[0]);		}
-	const deUint8*						getRefBuffer		(void) const	{ return &(m_refBuffer[0]);		}
+	// \note mutating buffer storage will invalidate existing pixel buffer accesses
+	de::ArrayBuffer<deUint8>&			getRefBuffer		(void)			{ return m_refBuffer;			}
+	const de::ArrayBuffer<deUint8>&		getRefBuffer		(void) const	{ return m_refBuffer;			}
 
 	size_t								getSize				(void) const	{ return m_size;				}
 	size_t								getOffset			(void) const	{ return m_offset;				}
@@ -289,25 +291,21 @@
 	deUint32							getGLTexture		(void) const	{ return m_glTexture;			}
 	deUint32							getGLBuffer			(void) const	{ return m_glBuffer;			}
 
-	// \note Resizes reference buffer. Invalidates old pixel buffer acceses.
-	// \note Doesn't upload data.
-	void								bufferData			(const deUint8* data, size_t size);
 	void								upload				(void);
 
 private:
-	void					init					(deUint32 internalFormat, size_t bufferSize, size_t offset, size_t size, const void* data);
-							TextureBuffer			(const TextureBuffer& other); // Not allowed!
-	TextureBuffer&			operator=				(const TextureBuffer& other); // Not allowed!
+	void								init				(deUint32 internalFormat, size_t bufferSize, size_t offset, size_t size, const void* data);
+										TextureBuffer		(const TextureBuffer& other); // Not allowed!
+	TextureBuffer&						operator=			(const TextureBuffer& other); // Not allowed!
 
-	const RenderContext&	m_context;
-	deUint32				m_format;		//!< Internal format.
-	std::vector<deUint8>	m_refBuffer;
-	size_t					m_offset;
-	size_t					m_size;
+	const RenderContext&				m_context;
+	deUint32							m_format;		//!< Internal format.
+	de::ArrayBuffer<deUint8>			m_refBuffer;
+	size_t								m_offset;
+	size_t								m_size;
 
-	tcu::PixelBufferAccess	m_refTexture;
-	deUint32				m_glTexture;
-	deUint32				m_glBuffer;
+	deUint32							m_glTexture;
+	deUint32							m_glBuffer;
 } DE_WARN_UNUSED_TYPE;
 
 } // glu
diff --git a/framework/opengl/gluTextureUtil.cpp b/framework/opengl/gluTextureUtil.cpp
index 5b31d2f..154963e 100644
--- a/framework/opengl/gluTextureUtil.cpp
+++ b/framework/opengl/gluTextureUtil.cpp
@@ -24,6 +24,7 @@
 #include "gluTextureUtil.hpp"
 #include "gluRenderContext.hpp"
 #include "gluContextInfo.hpp"
+#include "gluTexture.hpp"
 #include "tcuTextureUtil.hpp"
 #include "tcuFormatUtil.hpp"
 #include "glwEnums.hpp"
@@ -1170,4 +1171,21 @@
 	return s_defaultOffsets;
 }
 
+tcu::PixelBufferAccess getTextureBufferEffectiveRefTexture (TextureBuffer& buffer, int maxTextureBufferSize)
+{
+	DE_ASSERT(maxTextureBufferSize > 0);
+
+	const tcu::PixelBufferAccess& fullAccess = buffer.getFullRefTexture();
+
+	return tcu::PixelBufferAccess(fullAccess.getFormat(),
+								  tcu::IVec3(de::min(fullAccess.getWidth(), maxTextureBufferSize), 1, 1),
+								  fullAccess.getPitch(),
+								  fullAccess.getDataPtr());
+}
+
+tcu::ConstPixelBufferAccess getTextureBufferEffectiveRefTexture (const TextureBuffer& buffer, int maxTextureBufferSize)
+{
+	return getTextureBufferEffectiveRefTexture(const_cast<TextureBuffer&>(buffer), maxTextureBufferSize);
+}
+
 } // glu
diff --git a/framework/opengl/gluTextureUtil.hpp b/framework/opengl/gluTextureUtil.hpp
index 3112347..f806ec8 100644
--- a/framework/opengl/gluTextureUtil.hpp
+++ b/framework/opengl/gluTextureUtil.hpp
@@ -34,6 +34,7 @@
 
 class RenderContext;
 class ContextInfo;
+class TextureBuffer;
 
 /*--------------------------------------------------------------------*//*!
  * \brief GL pixel transfer format.
@@ -88,6 +89,9 @@
 
 const tcu::IVec2				(&getDefaultGatherOffsets			(void))[4];
 
+tcu::PixelBufferAccess			getTextureBufferEffectiveRefTexture	(TextureBuffer& buffer, int maxTextureBufferSize);
+tcu::ConstPixelBufferAccess		getTextureBufferEffectiveRefTexture	(const TextureBuffer& buffer, int maxTextureBufferSize);
+
 } // glu
 
 #endif // _GLUTEXTUREUTIL_HPP
diff --git a/framework/opengl/simplereference/sglrContext.hpp b/framework/opengl/simplereference/sglrContext.hpp
index 72c0bd4..9799f28 100644
--- a/framework/opengl/simplereference/sglrContext.hpp
+++ b/framework/opengl/simplereference/sglrContext.hpp
@@ -168,8 +168,8 @@
 	virtual void		uniform2iv				(deInt32 index, deInt32 count, const deInt32*)				= DE_NULL;
 	virtual void		uniform3iv				(deInt32 index, deInt32 count, const deInt32*)				= DE_NULL;
 	virtual void		uniform4iv				(deInt32 index, deInt32 count, const deInt32*)				= DE_NULL;
-	virtual void		uniformMatrix3fv		(deInt32 location, deInt32 count, deInt32 transpose, const float *value)	= DE_NULL;
-	virtual void		uniformMatrix4fv		(deInt32 location, deInt32 count, deInt32 transpose, const float *value)	= DE_NULL;
+	virtual void		uniformMatrix3fv		(deInt32 location, deInt32 count, deBool transpose, const float *value)	= DE_NULL;
+	virtual void		uniformMatrix4fv		(deInt32 location, deInt32 count, deBool transpose, const float *value)	= DE_NULL;
 	virtual deInt32		getUniformLocation		(deUint32 program, const char *name)						= DE_NULL;
 
 	virtual void		lineWidth				(float)														= DE_NULL;
diff --git a/framework/opengl/simplereference/sglrGLContext.cpp b/framework/opengl/simplereference/sglrGLContext.cpp
index 6e65113..ed915d6 100644
--- a/framework/opengl/simplereference/sglrGLContext.cpp
+++ b/framework/opengl/simplereference/sglrGLContext.cpp
@@ -299,7 +299,7 @@
 		m_log << TestLog::Message << "glCopyTexImage1D("
 								  << glu::getTextureTargetStr(target) << ", "
 								  << level << ", "
-								  << glu::getPixelFormatStr(internalFormat) << ", "
+								  << glu::getTextureFormatStr(internalFormat) << ", "
 								  << x << ", " << y << ", "
 								  << width << ", " << border << ")"
 			  << TestLog::EndMessage;
@@ -315,7 +315,7 @@
 		m_log << TestLog::Message << "glCopyTexImage2D("
 								  << glu::getTextureTargetStr(target) << ", "
 								  << level << ", "
-								  << glu::getPixelFormatStr(internalFormat) << ", "
+								  << glu::getTextureFormatStr(internalFormat) << ", "
 								  << x << ", " << y << ", "
 								  << width << ", " << height
 								  << ", " << border << ")"
@@ -579,12 +579,12 @@
 
 void GLContext::colorMask (deBool r, deBool g, deBool b, deBool a)
 {
-	m_wrapper->glColorMask(r, g, b, a);
+	m_wrapper->glColorMask((glw::GLboolean)r, (glw::GLboolean)g, (glw::GLboolean)b, (glw::GLboolean)a);
 }
 
 void GLContext::depthMask (deBool mask)
 {
-	m_wrapper->glDepthMask(mask);
+	m_wrapper->glDepthMask((glw::GLboolean)mask);
 }
 
 void GLContext::stencilMask (deUint32 mask)
@@ -655,7 +655,7 @@
 
 void GLContext::vertexAttribPointer (deUint32 index, int size, deUint32 type, deBool normalized, int stride, const void *pointer)
 {
-	m_wrapper->glVertexAttribPointer(index, size, type, normalized, stride, pointer);
+	m_wrapper->glVertexAttribPointer(index, size, type, (glw::GLboolean)normalized, stride, pointer);
 }
 
 void GLContext::vertexAttribIPointer (deUint32 index, int size, deUint32 type, int stride, const void *pointer)
@@ -763,14 +763,14 @@
 	m_wrapper->glUniform4iv(location, count, value);
 }
 
-void GLContext::uniformMatrix3fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value)
+void GLContext::uniformMatrix3fv (deInt32 location, deInt32 count, deBool transpose, const float *value)
 {
-	m_wrapper->glUniformMatrix3fv(location, count, transpose, value);
+	m_wrapper->glUniformMatrix3fv(location, count, (glw::GLboolean)transpose, value);
 }
 
-void GLContext::uniformMatrix4fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value)
+void GLContext::uniformMatrix4fv (deInt32 location, deInt32 count, deBool transpose, const float *value)
 {
-	m_wrapper->glUniformMatrix4fv(location, count, transpose, value);
+	m_wrapper->glUniformMatrix4fv(location, count, (glw::GLboolean)transpose, value);
 }
 deInt32 GLContext::getUniformLocation (deUint32 program, const char *name)
 {
@@ -887,7 +887,7 @@
 		}
 	}
 
-	DE_ASSERT(!"invalid delete");
+	DE_FATAL("invalid delete");
 }
 
 void GLContext::useProgram (deUint32 program)
@@ -901,7 +901,7 @@
 	if ((m_logFlags & GLCONTEXT_LOG_CALLS) != 0)
 		m_log << TestLog::Message << "glReadPixels("
 								  << x << ", " << y << ", " << width << ", " << height << ", "
-								  << glu::getPixelFormatStr(format) << ", "
+								  << glu::getTextureFormatStr(format) << ", "
 								  << glu::getTypeStr(type) << ", " << data << ")"
 			  << TestLog::EndMessage;
 
diff --git a/framework/opengl/simplereference/sglrGLContext.hpp b/framework/opengl/simplereference/sglrGLContext.hpp
index d68931d..fb4c8c4 100644
--- a/framework/opengl/simplereference/sglrGLContext.hpp
+++ b/framework/opengl/simplereference/sglrGLContext.hpp
@@ -180,8 +180,8 @@
 	virtual void						uniform2iv				(deInt32 index, deInt32 count, const deInt32*);
 	virtual void						uniform3iv				(deInt32 index, deInt32 count, const deInt32*);
 	virtual void						uniform4iv				(deInt32 index, deInt32 count, const deInt32*);
-	virtual void						uniformMatrix3fv		(deInt32 location, deInt32 count, deInt32 transpose, const float *value);
-	virtual void						uniformMatrix4fv		(deInt32 location, deInt32 count, deInt32 transpose, const float *value);
+	virtual void						uniformMatrix3fv		(deInt32 location, deInt32 count, deBool transpose, const float *value);
+	virtual void						uniformMatrix4fv		(deInt32 location, deInt32 count, deBool transpose, const float *value);
 	virtual deInt32						getUniformLocation		(deUint32 program, const char *name);
 
 	virtual void						lineWidth				(float);
diff --git a/framework/opengl/simplereference/sglrReferenceContext.cpp b/framework/opengl/simplereference/sglrReferenceContext.cpp
index 9abd42c..e5f443b 100644
--- a/framework/opengl/simplereference/sglrReferenceContext.cpp
+++ b/framework/opengl/simplereference/sglrReferenceContext.cpp
@@ -2068,12 +2068,12 @@
 			if (texObj->getType() == Texture::TYPE_2D_ARRAY || texObj->getType() == Texture::TYPE_CUBE_MAP_ARRAY)
 			{
 				RC_IF_ERROR((layer < 0) || (layer >= GL_MAX_ARRAY_TEXTURE_LAYERS),		GL_INVALID_VALUE,		RC_RET_VOID);
-				RC_IF_ERROR((level < 0) || (level > tcu::log2(GL_MAX_TEXTURE_SIZE)),	GL_INVALID_VALUE,		RC_RET_VOID);
+				RC_IF_ERROR((level < 0) || (level > deFloatLog2(GL_MAX_TEXTURE_SIZE)),	GL_INVALID_VALUE,		RC_RET_VOID);
 			}
 			else if	(texObj->getType() == Texture::TYPE_3D)
 			{
-				RC_IF_ERROR((layer < 0) || (layer >= GL_MAX_3D_TEXTURE_SIZE),			GL_INVALID_VALUE,		RC_RET_VOID);
-				RC_IF_ERROR((level < 0) || (level > tcu::log2(GL_MAX_3D_TEXTURE_SIZE)),	GL_INVALID_VALUE,		RC_RET_VOID);
+				RC_IF_ERROR((layer < 0) || (layer >= GL_MAX_3D_TEXTURE_SIZE),				GL_INVALID_VALUE,		RC_RET_VOID);
+				RC_IF_ERROR((level < 0) || (level > deFloatLog2(GL_MAX_3D_TEXTURE_SIZE)),	GL_INVALID_VALUE,		RC_RET_VOID);
 			}
 		}
 
@@ -3859,7 +3859,7 @@
 	uniformv(location, glu::TYPE_INT_VEC4, count, v);
 }
 
-void ReferenceContext::uniformMatrix3fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value)
+void ReferenceContext::uniformMatrix3fv (deInt32 location, deInt32 count, deBool transpose, const float *value)
 {
 	RC_IF_ERROR(m_currentProgram == DE_NULL, GL_INVALID_OPERATION, RC_RET_VOID);
 
@@ -3897,7 +3897,7 @@
 	}
 }
 
-void ReferenceContext::uniformMatrix4fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value)
+void ReferenceContext::uniformMatrix4fv (deInt32 location, deInt32 count, deBool transpose, const float *value)
 {
 	RC_IF_ERROR(m_currentProgram == DE_NULL, GL_INVALID_OPERATION, RC_RET_VOID);
 
@@ -4286,7 +4286,7 @@
 	const bool							hasStencil	= !isEmpty(stencilBuf);
 	const int							stencilBits	= (hasStencil) ? (getNumStencilBits(stencilBuf.raw().getFormat())) : (0);
 
-	const rr::RenderTarget				renderTarget(colorBuf0, depthBuf,stencilBuf);
+	const rr::RenderTarget				renderTarget(colorBuf0, depthBuf, stencilBuf);
 	const rr::Program					program		(m_currentProgram->m_program->getVertexShader(),
 													 m_currentProgram->m_program->getFragmentShader(),
 													 (m_currentProgram->m_program->m_hasGeometryShader) ? (m_currentProgram->m_program->getGeometryShader()) : (DE_NULL));
@@ -4785,7 +4785,7 @@
 
 void Texture1D::sample4 (tcu::Vec4 output[4], const float packetTexcoords[4], float lodBias) const
 {
-	const int texWidth  = m_view.getWidth();
+	const float texWidth = (float)m_view.getWidth();
 
 	const float dFdx0 = packetTexcoords[1] - packetTexcoords[0];
 	const float dFdx1 = packetTexcoords[3] - packetTexcoords[2];
@@ -4904,8 +4904,8 @@
 
 void Texture2D::sample4 (tcu::Vec4 output[4], const tcu::Vec2 packetTexcoords[4], float lodBias) const
 {
-	const int texWidth  = m_view.getWidth();
-	const int texHeight = m_view.getHeight();
+	const float texWidth  = (float)m_view.getWidth();
+	const float texHeight = (float)m_view.getHeight();
 
 	const tcu::Vec2 dFdx0 = packetTexcoords[1] - packetTexcoords[0];
 	const tcu::Vec2 dFdx1 = packetTexcoords[3] - packetTexcoords[2];
@@ -5022,7 +5022,7 @@
 
 void TextureCube::sample4 (tcu::Vec4 output[4], const tcu::Vec3 packetTexcoords[4], float lodBias) const
 {
-	const int	cubeSide	= m_view.getSize();
+	const float cubeSide = (float)m_view.getSize();
 
 	// Each tex coord might be in a different face.
 
@@ -5137,8 +5137,8 @@
 
 void Texture2DArray::sample4 (tcu::Vec4 output[4], const tcu::Vec3 packetTexcoords[4], float lodBias) const
 {
-	const int texWidth  = m_view.getWidth();
-	const int texHeight = m_view.getHeight();
+	const float texWidth  = (float)m_view.getWidth();
+	const float texHeight = (float)m_view.getHeight();
 
 	const tcu::Vec3 dFdx0 = packetTexcoords[1] - packetTexcoords[0];
 	const tcu::Vec3 dFdx1 = packetTexcoords[3] - packetTexcoords[2];
@@ -5243,7 +5243,7 @@
 
 void TextureCubeArray::sample4 (tcu::Vec4 output[4], const tcu::Vec4 packetTexcoords[4], float lodBias) const
 {
-	const int		cubeSide		= m_view.getSize();
+	const float		cubeSide		= (float)m_view.getSize();
 	const tcu::Vec3	cubeCoords[4]	=
 	{
 		packetTexcoords[0].toWidth<3>(),
@@ -5346,9 +5346,9 @@
 
 void Texture3D::sample4 (tcu::Vec4 output[4], const tcu::Vec3 packetTexcoords[4], float lodBias) const
 {
-	const int texWidth  = m_view.getWidth();
-	const int texHeight = m_view.getHeight();
-	const int texDepth  = m_view.getDepth();
+	const float texWidth  = (float)m_view.getWidth();
+	const float texHeight = (float)m_view.getHeight();
+	const float texDepth  = (float)m_view.getDepth();
 
 	const tcu::Vec3 dFdx0 = packetTexcoords[1] - packetTexcoords[0];
 	const tcu::Vec3 dFdx1 = packetTexcoords[3] - packetTexcoords[2];
diff --git a/framework/opengl/simplereference/sglrReferenceContext.hpp b/framework/opengl/simplereference/sglrReferenceContext.hpp
index dfdb294..37ebcdc 100644
--- a/framework/opengl/simplereference/sglrReferenceContext.hpp
+++ b/framework/opengl/simplereference/sglrReferenceContext.hpp
@@ -731,8 +731,8 @@
 	virtual void			uniform2iv				(deInt32 index, deInt32 count, const deInt32*);
 	virtual void			uniform3iv				(deInt32 index, deInt32 count, const deInt32*);
 	virtual void			uniform4iv				(deInt32 index, deInt32 count, const deInt32*);
-	virtual void			uniformMatrix3fv		(deInt32 location, deInt32 count, deInt32 transpose, const float *value);
-	virtual void			uniformMatrix4fv		(deInt32 location, deInt32 count, deInt32 transpose, const float *value);
+	virtual void			uniformMatrix3fv		(deInt32 location, deInt32 count, deBool transpose, const float *value);
+	virtual void			uniformMatrix4fv		(deInt32 location, deInt32 count, deBool transpose, const float *value);
 	virtual deInt32			getUniformLocation		(deUint32 program, const char *name);
 
 	virtual void			lineWidth				(float);
diff --git a/framework/opengl/simplereference/sglrShaderProgram.cpp b/framework/opengl/simplereference/sglrShaderProgram.cpp
index 2e416f7..872d648 100644
--- a/framework/opengl/simplereference/sglrShaderProgram.cpp
+++ b/framework/opengl/simplereference/sglrShaderProgram.cpp
@@ -208,7 +208,7 @@
 		if (m_uniforms[ndx].name == std::string(name))
 			return m_uniforms[ndx];
 
-	DE_ASSERT(!"Invalid uniform name, uniform not found.");
+	DE_FATAL("Invalid uniform name, uniform not found.");
 	return m_uniforms[0];
 }
 
diff --git a/framework/platform/X11/tcuX11GlxPlatform.cpp b/framework/platform/X11/tcuX11GlxPlatform.cpp
index 1f9e9bc..0f0ccb1 100644
--- a/framework/platform/X11/tcuX11GlxPlatform.cpp
+++ b/framework/platform/X11/tcuX11GlxPlatform.cpp
@@ -317,7 +317,7 @@
 			profileMask = GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
 			break;
 		default:
-			DE_ASSERT(!"Impossible context profile");
+			DE_FATAL("Impossible context profile");
 	}
 
 	const int attribs[] =
@@ -413,7 +413,7 @@
 		case RenderConfig::SURFACETYPE_DONT_CARE:
 			return GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;
 		default:
-			DE_ASSERT(!"Impossible case");
+			DE_FATAL("Impossible case");
 	}
 	return 0;
 }
@@ -583,7 +583,7 @@
 	switch (surfaceType)
 	{
 		case RenderConfig::SURFACETYPE_DONT_CARE:
-			DE_ASSERT(!"Impossible case");
+			DE_FATAL("Impossible case");
 
 		case RenderConfig::SURFACETYPE_WINDOW:
 			return new GlxWindow(visual, config);
diff --git a/framework/platform/android/tcuAndroidInternals.cpp b/framework/platform/android/tcuAndroidInternals.cpp
index 368f3e0..8590393 100644
--- a/framework/platform/android/tcuAndroidInternals.cpp
+++ b/framework/platform/android/tcuAndroidInternals.cpp
@@ -87,6 +87,12 @@
 	((ABIFptr)fptr)(memory, param1, param2, param3, param4);
 	return reinterpret_cast<RT*>(memory);
 #else
+	DE_UNREF(fptr);
+	DE_UNREF(memory);
+	DE_UNREF(param1);
+	DE_UNREF(param2);
+	DE_UNREF(param3);
+	DE_UNREF(param4);
 	TCU_THROW(NotSupportedError, "ABI not supported");
 	return DE_NULL;
 #endif
@@ -112,6 +118,8 @@
 	typedef void (*ABIFptr)(T* obj);
 	((ABIFptr)fptr)(obj);
 #else
+	DE_UNREF(fptr);
+	DE_UNREF(obj);
 	TCU_THROW(NotSupportedError, "ABI not supported");
 #endif
 }
diff --git a/framework/platform/android/tcuAndroidWindow.cpp b/framework/platform/android/tcuAndroidWindow.cpp
index aad607e..619df0e 100644
--- a/framework/platform/android/tcuAndroidWindow.cpp
+++ b/framework/platform/android/tcuAndroidWindow.cpp
@@ -76,7 +76,7 @@
 	else if (m_state == STATE_PENDING_DESTROY)
 		m_state = STATE_READY_FOR_DESTROY;
 	else
-		DE_ASSERT(!"Invalid window state");
+		DE_FATAL("Invalid window state");
 }
 
 void Window::markForDestroy (void)
@@ -88,7 +88,7 @@
 	else if (m_state == STATE_IN_USE)
 		m_state = STATE_PENDING_DESTROY;
 	else
-		DE_ASSERT(!"Invalid window state");
+		DE_FATAL("Invalid window state");
 }
 
 bool Window::isPendingDestroy (void) const
@@ -128,7 +128,7 @@
 		else
 		{
 			print("ERROR: Window was not available for deletion, leaked tcu::Android::Window!\n");
-			DE_ASSERT(!"Window leaked");
+			DE_FATAL("Window leaked");
 		}
 	}
 }
diff --git a/framework/platform/ios/tcuIOSPlatform.hh b/framework/platform/ios/tcuIOSPlatform.hh
index 4cdd741..dbda336 100644
--- a/framework/platform/ios/tcuIOSPlatform.hh
+++ b/framework/platform/ios/tcuIOSPlatform.hh
@@ -90,7 +90,7 @@
 	virtual glu::ContextType		getType					(void) const { return m_type;							}
 	virtual const glw::Functions&	getFunctions			(void) const { return m_functions;						}
 	virtual const RenderTarget&		getRenderTarget			(void) const { return m_emptyTarget;					}
-	virtual deUint32				getDefaultFramebuffer	(void) const { DE_ASSERT(!"No framebuffer"); return 0;	}
+	virtual deUint32				getDefaultFramebuffer	(void) const { DE_FATAL("No framebuffer"); return 0;	}
 	virtual void					postIterate				(void);
 
 protected:
diff --git a/framework/platform/null/tcuNullContextFactory.cpp b/framework/platform/null/tcuNullContextFactory.cpp
new file mode 100644
index 0000000..d466185
--- /dev/null
+++ b/framework/platform/null/tcuNullContextFactory.cpp
@@ -0,0 +1,43 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Tester Core
+ * ----------------------------------------
+ *
+ * Copyright 2014 The Android Open Source Project
+ *
+ * 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 Null GL Context Factory.
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuNullContextFactory.hpp"
+#include "tcuNullRenderContext.hpp"
+
+namespace tcu
+{
+namespace null
+{
+
+NullGLContextFactory::NullGLContextFactory (void)
+	: glu::ContextFactory("null", "Null Render Context")
+{
+}
+
+glu::RenderContext* NullGLContextFactory::createContext (const glu::RenderConfig& config, const tcu::CommandLine&) const
+{
+	return new RenderContext(config);
+}
+
+} // null
+} // tcu
diff --git a/framework/platform/null/tcuNullContextFactory.hpp b/framework/platform/null/tcuNullContextFactory.hpp
new file mode 100644
index 0000000..3f0e975
--- /dev/null
+++ b/framework/platform/null/tcuNullContextFactory.hpp
@@ -0,0 +1,44 @@
+#ifndef _TCUNULLCONTEXTFACTORY_HPP
+#define _TCUNULLCONTEXTFACTORY_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Tester Core
+ * ----------------------------------------
+ *
+ * Copyright 2014 The Android Open Source Project
+ *
+ * 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 Null GL Context Factory.
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "gluContextFactory.hpp"
+
+namespace tcu
+{
+namespace null
+{
+
+class NullGLContextFactory : public glu::ContextFactory
+{
+public:
+						NullGLContextFactory	(void);
+	glu::RenderContext*	createContext			(const glu::RenderConfig& config, const tcu::CommandLine&) const;
+};
+
+} // null
+} // tcu
+
+#endif // _TCUNULLCONTEXTFACTORY_HPP
diff --git a/framework/platform/null/tcuNullPlatform.cpp b/framework/platform/null/tcuNullPlatform.cpp
index 8bb9568..ea790e5 100644
--- a/framework/platform/null/tcuNullPlatform.cpp
+++ b/framework/platform/null/tcuNullPlatform.cpp
@@ -22,6 +22,7 @@
  *//*--------------------------------------------------------------------*/
 
 #include "tcuNullPlatform.hpp"
+#include "tcuNullContextFactory.hpp"
 #include "tcuNullRenderContext.hpp"
 #include "egluNativeDisplay.hpp"
 #include "eglwLibrary.hpp"
@@ -31,20 +32,6 @@
 namespace null
 {
 
-class NullGLContextFactory : public glu::ContextFactory
-{
-public:
-	NullGLContextFactory (void)
-		: glu::ContextFactory("null", "Null Render Context")
-	{
-	}
-
-	glu::RenderContext* createContext (const glu::RenderConfig& config, const tcu::CommandLine&) const
-	{
-		return new RenderContext(config);
-	}
-};
-
 class NullEGLDisplay : public eglu::NativeDisplay
 {
 public:
diff --git a/framework/platform/null/tcuNullRenderContext.cpp b/framework/platform/null/tcuNullRenderContext.cpp
index f82267a..b91d2ee 100644
--- a/framework/platform/null/tcuNullRenderContext.cpp
+++ b/framework/platform/null/tcuNullRenderContext.cpp
@@ -92,6 +92,7 @@
 	string					shadingLanguageVersion;
 	string					extensions;
 	vector<string>			extensionList;
+	vector<deUint32>		compressedTextureList;
 
 	GLenum					lastError;
 
@@ -146,7 +147,7 @@
 		addExtension("GL_OES_sample_shading");
 		addExtension("GL_OES_sample_variables");
 		addExtension("GL_OES_shader_multisample_interpolation");
-		addExtension("GL_OES_shader_image_atomics");
+		addExtension("GL_OES_shader_image_atomic");
 		addExtension("GL_OES_texture_storage_multisample_2d_array");
 		addExtension("GL_KHR_blend_equation_advanced");
 		addExtension("GL_KHR_blend_equation_advanced_coherent");
@@ -156,6 +157,16 @@
 		addExtension("GL_EXT_tessellation_shader");
 		addExtension("GL_EXT_tessellation_point_size");
 		addExtension("GL_EXT_gpu_shader5");
+		addExtension("GL_EXT_shader_implicit_conversions");
+		addExtension("GL_EXT_texture_buffer");
+		addExtension("GL_EXT_texture_cube_map_array");
+		addExtension("GL_EXT_draw_buffers_indexed");
+		addExtension("GL_EXT_texture_sRGB_decode");
+		addExtension("GL_EXT_texture_border_clamp");
+		addExtension("GL_KHR_debug");
+		addExtension("GL_EXT_primitive_bounding_box");
+		addExtension("GL_ANDROID_extension_pack_es31a");
+		addExtension("GL_EXT_copy_image");
 	}
 	else if (glu::isContextTypeGLCore(ctxType) && ctxType.getMajorVersion() == 3)
 	{
@@ -171,7 +182,61 @@
 		throw tcu::NotSupportedError("Unsupported GL version", "", __FILE__, __LINE__);
 
 	if (isContextTypeES(ctxType))
+	{
 		addExtension("GL_EXT_color_buffer_float");
+		addExtension("GL_EXT_color_buffer_half_float");
+	}
+
+	// support compressed formats
+	{
+		static deUint32 compressedFormats[] =
+		{
+			GL_ETC1_RGB8_OES,
+			GL_COMPRESSED_R11_EAC,
+			GL_COMPRESSED_SIGNED_R11_EAC,
+			GL_COMPRESSED_RG11_EAC,
+			GL_COMPRESSED_SIGNED_RG11_EAC,
+			GL_COMPRESSED_RGB8_ETC2,
+			GL_COMPRESSED_SRGB8_ETC2,
+			GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+			GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+			GL_COMPRESSED_RGBA8_ETC2_EAC,
+			GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
+			GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
+			GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
+			GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
+			GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
+			GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
+			GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
+			GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
+			GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
+			GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
+			GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
+			GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
+			GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
+			GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
+			GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
+			GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
+		};
+
+		addExtension("GL_KHR_texture_compression_astc_hdr");
+		addExtension("GL_KHR_texture_compression_astc_ldr");
+		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(compressedFormats); ++ndx)
+			compressedTextureList.push_back(compressedFormats[ndx]);
+	}
 }
 
 Context::~Context (void)
@@ -234,13 +299,52 @@
 		case GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS:
 		case GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS:
 		case GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS:
-			*params = 16;
+			*params = 32;
+			break;
+
+		case GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS:
+		case GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS:
+		case GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS:
+		case GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS:
+		case GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS:
+		case GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS:
+			*params = 8;
+			break;
+
+		case GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS:
+		case GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS:
+		case GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS:
+		case GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS:
+		case GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS:
+		case GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS:
+			*params = 8;
+			break;
+
+		case GL_MAX_SHADER_STORAGE_BLOCK_SIZE:
+			*params = 1u << 25;
+			break;
+
+		case GL_MAX_GEOMETRY_OUTPUT_VERTICES:
+			*params = 256;
+			break;
+
+		case GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
+			*params = 2048;
+			break;
+
+		case GL_MAX_GEOMETRY_SHADER_INVOCATIONS:
+			*params = 4;
+			break;
+
+		case GL_MAX_COLOR_TEXTURE_SAMPLES:
+			*params = 8;
 			break;
 
 		case GL_MAX_TEXTURE_SIZE:
 		case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
 		case GL_MAX_3D_TEXTURE_SIZE:
 		case GL_MAX_RENDERBUFFER_SIZE:
+		case GL_MAX_TEXTURE_BUFFER_SIZE:
 			*params = 2048;
 			break;
 
@@ -253,7 +357,11 @@
 			break;
 
 		case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
-			*params = 0;
+			*params = (int)ctx->compressedTextureList.size();
+			break;
+
+		case GL_COMPRESSED_TEXTURE_FORMATS:
+			deMemcpy(params, &ctx->compressedTextureList[0], (int)ctx->compressedTextureList.size());
 			break;
 
 		case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
@@ -313,6 +421,29 @@
 	}
 }
 
+GLW_APICALL void GLW_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
+{
+	static const int s_sampleCounts[] = { 16, 8, 4, 2, 1 };
+
+	DE_UNREF(internalformat);
+	DE_UNREF(target);
+
+	switch (pname)
+	{
+		case GL_NUM_SAMPLE_COUNTS:
+			if (bufSize >= 1)
+				*params = DE_LENGTH_OF_ARRAY(s_sampleCounts);
+			break;
+
+		case GL_SAMPLES:
+			deMemcpy(params, s_sampleCounts, de::min(bufSize, DE_LENGTH_OF_ARRAY(s_sampleCounts)));
+			break;
+
+		default:
+			break;
+	}
+}
+
 GLW_APICALL const glw::GLubyte* GLW_APIENTRY glGetString (GLenum name)
 {
 	Context* const ctx = getCurrentContext();
@@ -579,6 +710,12 @@
 			ctx->pixelPackBufferBufferBinding = 0;
 }
 
+GLW_APICALL GLint GLW_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name)
+{
+	DE_UNREF(program);
+	return (GLint)(deStringHash(name) & 0x7FFFFFFF);
+}
+
 void initFunctions (glw::Functions* gl)
 {
 #	include "tcuNullRenderContextInitFuncs.inl"
diff --git a/framework/platform/null/tcuNullRenderContextFuncs.inl b/framework/platform/null/tcuNullRenderContextFuncs.inl
index 09144e8..f3467e8 100644
--- a/framework/platform/null/tcuNullRenderContextFuncs.inl
+++ b/framework/platform/null/tcuNullRenderContextFuncs.inl
@@ -1591,14 +1591,6 @@
 
 }
 
-GLW_APICALL GLint GLW_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name)
-{
-	DE_UNREF(program);
-	DE_UNREF(name);
-
-	return (GLint)0;
-}
-
 GLW_APICALL void GLW_APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data)
 {
 	DE_UNREF(target);
@@ -1781,16 +1773,6 @@
 
 }
 
-GLW_APICALL void GLW_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)
-{
-	DE_UNREF(target);
-	DE_UNREF(internalformat);
-	DE_UNREF(pname);
-	DE_UNREF(bufSize);
-	DE_UNREF(params);
-
-}
-
 GLW_APICALL void GLW_APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val)
 {
 	DE_UNREF(pname);
diff --git a/framework/qphelper/qpTestLog.c b/framework/qphelper/qpTestLog.c
index 2a80e48..5bd6301 100644
--- a/framework/qphelper/qpTestLog.c
+++ b/framework/qphelper/qpTestLog.c
@@ -279,12 +279,12 @@
 	deSprintf(&buf[0], 32, "%lld", (long long int)val);
 }
 
-DE_INLINE void floatToString (float value, char* buf, int bufSize)
+DE_INLINE void floatToString (float value, char* buf, size_t bufSize)
 {
 	deSprintf(buf, bufSize, "%f", value);
 }
 
-DE_INLINE void doubleToString (double value, char* buf, int bufSize)
+DE_INLINE void doubleToString (double value, char* buf, size_t bufSize)
 {
 	deSprintf(buf, bufSize, "%f", value);
 }
@@ -627,8 +627,8 @@
 
 typedef struct Buffer_s
 {
-	int			capacity;
-	int			size;
+	size_t		capacity;
+	size_t		size;
 	deUint8*	data;
 } Buffer;
 
@@ -645,12 +645,12 @@
 	Buffer_init(buffer);
 }
 
-deBool Buffer_resize (Buffer* buffer, int newSize)
+deBool Buffer_resize (Buffer* buffer, size_t newSize)
 {
 	/* Grow buffer if necessary. */
 	if (newSize > buffer->capacity)
 	{
-		int			newCapacity	= deAlign32(deMax32(2*buffer->capacity, newSize), 512);
+		size_t		newCapacity	= (size_t)deAlign32(deMax32(2*(int)buffer->capacity, (int)newSize), 512);
 		deUint8*	newData		= (deUint8*)deMalloc(newCapacity);
 		if (!newData)
 			return DE_FALSE;
@@ -665,9 +665,9 @@
 	return DE_TRUE;
 }
 
-deBool Buffer_append (Buffer* buffer, const deUint8* data, int numBytes)
+deBool Buffer_append (Buffer* buffer, const deUint8* data, size_t numBytes)
 {
-	int offset = buffer->size;
+	size_t offset = buffer->size;
 
 	if (!Buffer_resize(buffer, buffer->size + numBytes))
 		return DE_FALSE;
@@ -681,7 +681,7 @@
 void pngWriteData (png_structp png, png_bytep dataPtr, png_size_t numBytes)
 {
 	Buffer* buffer = (Buffer*)png_get_io_ptr(png);
-	if (!Buffer_append(buffer, (const deUint8*)dataPtr, (int)numBytes))
+	if (!Buffer_append(buffer, (const deUint8*)dataPtr, numBytes))
 		png_error(png, "unable to resize PNG write buffer!");
 }
 
@@ -696,7 +696,7 @@
 	if (setjmp(png_jmpbuf(png)) == 0)
 	{
 		/* Write data. */
-		png_set_IHDR(png, info, width, height,
+		png_set_IHDR(png, info, (png_uint_32)width, (png_uint_32)height,
 			8,
 			colorFormat,
 			PNG_INTERLACE_NONE,
@@ -725,7 +725,7 @@
 	DE_ASSERT(imageFormat == QP_IMAGE_FORMAT_RGB888 || imageFormat == QP_IMAGE_FORMAT_RGBA8888);
 
 	/* Allocate & set row pointers. */
-	rowPointers = (png_byte**)deMalloc(height * sizeof(png_byte*));
+	rowPointers = (png_byte**)deMalloc((size_t)height * sizeof(png_byte*));
 	if (!rowPointers)
 		return DE_FALSE;
 
@@ -845,7 +845,7 @@
 	int				numAttribs			= 0;
 	Buffer			compressedBuffer;
 	const void*		writeDataPtr		= DE_NULL;
-	int				writeDataBytes		= -1;
+	size_t			writeDataBytes		= ~(size_t)0;
 
 	DE_ASSERT(log && name);
 	DE_ASSERT(deInRange32(width, 1, 16384));
@@ -899,11 +899,11 @@
 			else
 			{
 				/* Need to re-pack pixels. */
-				if (Buffer_resize(&compressedBuffer, packedStride*height))
+				if (Buffer_resize(&compressedBuffer, (size_t)(packedStride*height)))
 				{
 					int row;
 					for (row = 0; row < height; row++)
-						memcpy(&compressedBuffer.data[packedStride*row], &((const deUint8*)data)[row*stride], pixelSize*width);
+						memcpy(&compressedBuffer.data[packedStride*row], &((const deUint8*)data)[row*stride], (size_t)(pixelSize*width));
 				}
 				else
 				{
@@ -913,7 +913,7 @@
 				}
 			}
 
-			writeDataBytes = packedStride*height;
+			writeDataBytes = (size_t)(packedStride*height);
 			break;
 		}
 
diff --git a/framework/qphelper/qpXmlWriter.c b/framework/qphelper/qpXmlWriter.c
index 5850b41..6921dab 100644
--- a/framework/qphelper/qpXmlWriter.c
+++ b/framework/qphelper/qpXmlWriter.c
@@ -250,7 +250,7 @@
 	return DE_TRUE;
 }
 
-deBool qpXmlWriter_writeBase64 (qpXmlWriter* writer, const deUint8* data, int numBytes)
+deBool qpXmlWriter_writeBase64 (qpXmlWriter* writer, const deUint8* data, size_t numBytes)
 {
 	static const char s_base64Table[64] =
 	{
@@ -262,7 +262,7 @@
 	};
 
 	int			numWritten	= 0;
-	int			srcNdx		= 0;
+	size_t		srcNdx		= 0;
 	deBool		writeIndent	= DE_TRUE;
 	const char*	indentStr	= getIndentStr(writer->xmlElementDepth);
 
@@ -274,7 +274,7 @@
 	/* Loop all input chars. */
 	while (srcNdx < numBytes)
 	{
-		int		numRead = deMin32(3, numBytes - srcNdx);
+		size_t	numRead = (size_t)deMin32(3, (int)(numBytes - srcNdx));
 		deUint8	s0 = data[srcNdx];
 		deUint8	s1 = (numRead >= 2) ? data[srcNdx+1] : 0;
 		deUint8	s2 = (numRead >= 3) ? data[srcNdx+2] : 0;
diff --git a/framework/qphelper/qpXmlWriter.h b/framework/qphelper/qpXmlWriter.h
index 304161e..ebba428 100644
--- a/framework/qphelper/qpXmlWriter.h
+++ b/framework/qphelper/qpXmlWriter.h
@@ -146,7 +146,7 @@
  * \param numBytes	Length of data in bytes
  * \return true on success, false on error
  *//*--------------------------------------------------------------------*/
-deBool			qpXmlWriter_writeBase64 (qpXmlWriter* writer, const deUint8* data, int numBytes);
+deBool			qpXmlWriter_writeBase64 (qpXmlWriter* writer, const deUint8* data, size_t numBytes);
 
 /*--------------------------------------------------------------------*//*!
  * \brief Convenience function for writing XML element
diff --git a/framework/randomshaders/rsgBinaryOps.cpp b/framework/randomshaders/rsgBinaryOps.cpp
index 77cacea..465ec16 100644
--- a/framework/randomshaders/rsgBinaryOps.cpp
+++ b/framework/randomshaders/rsgBinaryOps.cpp
@@ -57,14 +57,14 @@
 	if (m_rightValueExpr == DE_NULL)
 	{
 		state.pushPrecedence(rightPrec);
-		m_rightValueExpr = Expression::createRandom(state, m_rightValueRange);
+		m_rightValueExpr = Expression::createRandom(state, m_rightValueRange.asAccess());
 		state.popPrecedence();
 		return m_rightValueExpr;
 	}
 	else if (m_leftValueExpr == DE_NULL)
 	{
 		state.pushPrecedence(leftPrec);
-		m_leftValueExpr = Expression::createRandom(state, m_leftValueRange);
+		m_leftValueExpr = Expression::createRandom(state, m_leftValueRange.asAccess());
 		state.popPrecedence();
 		return m_leftValueExpr;
 	}
@@ -239,13 +239,13 @@
 	bMax = scale;
 	for (int i = 0; i < 5; i++)
 	{
-		if (de::inBounds(aMin*(scale-i*scaleStep), dstMin, dstMax) &&
-			de::inBounds(aMax*(scale-i*scaleStep), dstMin, dstMax))
-			bMin = scale-i*scaleStep;
+		if (de::inBounds(aMin*(scale-(float)i*scaleStep), dstMin, dstMax) &&
+			de::inBounds(aMax*(scale-(float)i*scaleStep), dstMin, dstMax))
+			bMin = scale-(float)i*scaleStep;
 
-		if (de::inBounds(aMin*(scale+i*scaleStep), dstMin, dstMax) &&
-			de::inBounds(aMax*(scale+i*scaleStep), dstMin, dstMax))
-			bMax = scale+i*scaleStep;
+		if (de::inBounds(aMin*(scale+(float)i*scaleStep), dstMin, dstMax) &&
+			de::inBounds(aMax*(scale+(float)i*scaleStep), dstMin, dstMax))
+			bMax = scale+(float)i*scaleStep;
 	}
 
 	// Negative scale?
diff --git a/framework/randomshaders/rsgBuiltinFunctions.hpp b/framework/randomshaders/rsgBuiltinFunctions.hpp
index 1a6be3c..6563e8f 100644
--- a/framework/randomshaders/rsgBuiltinFunctions.hpp
+++ b/framework/randomshaders/rsgBuiltinFunctions.hpp
@@ -87,7 +87,7 @@
 	if (m_child)
 		return DE_NULL;
 
-	m_child = Expression::createRandom(state, m_inValueRange);
+	m_child = Expression::createRandom(state, m_inValueRange.asAccess());
 	return m_child;
 }
 
diff --git a/framework/randomshaders/rsgExecutionContext.cpp b/framework/randomshaders/rsgExecutionContext.cpp
index 98f9596..a04ec1a 100644
--- a/framework/randomshaders/rsgExecutionContext.cpp
+++ b/framework/randomshaders/rsgExecutionContext.cpp
@@ -164,7 +164,7 @@
 		}
 
 		default:
-			DE_ASSERT(!"Unsupported");
+			DE_FATAL("Unsupported");
 			break;
 	}
 }
diff --git a/framework/randomshaders/rsgExpression.cpp b/framework/randomshaders/rsgExpression.cpp
index b0184d9..35291e3 100644
--- a/framework/randomshaders/rsgExpression.cpp
+++ b/framework/randomshaders/rsgExpression.cpp
@@ -206,8 +206,8 @@
 				int rangeLen	= rnd.getInt(0, maxSteps);
 				int minStep		= rnd.getInt(0, maxSteps-rangeLen);
 
-				float minVal	= minFloatVal + step*minStep;
-				float maxVal	= minVal + step*rangeLen;
+				float minVal	= minFloatVal + step*(float)minStep;
+				float maxVal	= minVal + step*(float)rangeLen;
 
 				valueRange.getMin().component(ndx).asFloat() = minVal;
 				valueRange.getMax().component(ndx).asFloat() = maxVal;
@@ -377,7 +377,7 @@
 
 	int numSteps = (int)((maxVal-minVal)/step) + 1;
 
-	float			value	= deFloatClamp(minVal + step*state.getRandom().getInt(0, numSteps), minVal, maxVal);
+	const float		value	= deFloatClamp(minVal + step*(float)state.getRandom().getInt(0, numSteps), minVal, maxVal);
 	ExecValueAccess	access	= m_value.getValue(VariableType::getScalarType(VariableType::TYPE_FLOAT));
 
 	for (int ndx = 0; ndx < EXEC_VEC_WIDTH; ndx++)
@@ -454,7 +454,7 @@
 		int rangeLength = maxVal - minVal;
 
 		DE_ASSERT(rangeLength >= 0);
-		return deFloatMax(0.1f, 1.0f - rangeLength/4.0f);
+		return deFloatMax(0.1f, 1.0f - (float)rangeLength/4.0f);
 	}
 	else if (type.isVoid())
 		return unusedValueWeight;
@@ -838,12 +838,12 @@
 
 			computeRandomValueRangeForInfElements(state, m_valueRange.asAccess());
 
-			DE_ASSERT(state.getVariableManager().hasEntry(IsWritableIntersectingEntry(m_valueRange)));
+			DE_ASSERT(state.getVariableManager().hasEntry(IsWritableIntersectingEntry(m_valueRange.asAccess())));
 		}
 	}
 
-	IsWritableIntersectingEntry::Iterator first	= state.getVariableManager().getBegin(IsWritableIntersectingEntry(m_valueRange));
-	IsWritableIntersectingEntry::Iterator end	= state.getVariableManager().getEnd(IsWritableIntersectingEntry(m_valueRange));
+	IsWritableIntersectingEntry::Iterator first	= state.getVariableManager().getBegin(IsWritableIntersectingEntry(m_valueRange.asAccess()));
+	IsWritableIntersectingEntry::Iterator end	= state.getVariableManager().getEnd(IsWritableIntersectingEntry(m_valueRange.asAccess()));
 
 	bool possiblyCreateVar = canAllocateVariable(state, m_valueRange.getType()) &&
 							 (first == end || getWeightedBool(state.getRandom(), 0.5f));
@@ -858,7 +858,7 @@
 		bool supersetExists = false;
 		for (IsWritableIntersectingEntry::Iterator i = first; i != end; i++)
 		{
-			if ((*i)->getValueRange().isSupersetOf(m_valueRange))
+			if ((*i)->getValueRange().isSupersetOf(m_valueRange.asAccess()))
 			{
 				supersetExists = true;
 				break;
@@ -871,7 +871,7 @@
 			// \todo [2011-02-03 pyry] Use some heuristics to select the range?
 			ConstValueRangeAccess selectedRange = state.getRandom().choose<const ValueEntry*>(first, end)->getValueRange();
 
-			ValueRange::computeIntersection(m_valueRange, m_valueRange, selectedRange);
+			ValueRange::computeIntersection(m_valueRange.asAccess(), m_valueRange.asAccess(), selectedRange);
 		}
 	}
 }
@@ -913,13 +913,13 @@
 		//  - variable valuerange is made unbound
 		//  - R-value is generated
 		//  - R-values in L-value are generated
-		m_lvalueExpr = Expression::createRandomLValue(state, m_valueRange);
+		m_lvalueExpr = Expression::createRandomLValue(state, m_valueRange.asAccess());
 		return m_lvalueExpr;
 	}
 	else if (m_rvalueExpr == DE_NULL)
 	{
 		// Construct value expr
-		m_rvalueExpr = Expression::createRandom(state, m_valueRange);
+		m_rvalueExpr = Expression::createRandom(state, m_valueRange.asAccess());
 		return m_rvalueExpr;
 	}
 	else
@@ -1046,14 +1046,14 @@
 					continue;
 
 				// Intersection to entry value range length ratio.
-				int intersectionMin			= deMax32(entryMin, readMin);
-				int intersectionMax			= deMin32(entryMax, readMax);
-				int entryRangeLen			= entryMax - entryMin;
-				int readRangeLen			= readMax - readMin;
-				int intersectionLen			= intersectionMax - intersectionMin;
-				float entryRatio			= (entryRangeLen	> 0) ? ((float)intersectionLen / (float)entryRangeLen)	: 1.0f;
-				float readRatio				= (readRangeLen		> 0) ? ((float)intersectionLen / (float)readRangeLen)	: 1.0f;
-				float elementWeight			= 0.5f*readRatio + 0.5f*entryRatio;
+				int		intersectionMin			= deMax32(entryMin, readMin);
+				int		intersectionMax			= deMin32(entryMax, readMax);
+				deInt64 entryRangeLen			= (deInt64)entryMax - (deInt64)entryMin;
+				deInt64	readRangeLen			= (deInt64)readMax - (deInt64)readMin;
+				deInt64	intersectionLen			= (deInt64)intersectionMax - (deInt64)intersectionMin;
+				float	entryRatio				= (entryRangeLen	> 0) ? ((float)intersectionLen / (float)entryRangeLen)	: 1.0f;
+				float	readRatio				= (readRangeLen		> 0) ? ((float)intersectionLen / (float)readRangeLen)	: 1.0f;
+				float 	elementWeight			= 0.5f*readRatio + 0.5f*entryRatio;
 
 				weight = combineWeight(weight, elementWeight);
 			}
@@ -1094,7 +1094,7 @@
 			ValueRange newVarRange(computeRandomType(state, maxScalars));
 			computeRandomValueRange(state, newVarRange.asAccess());
 
-			m_variable = allocateNewVariable(state, newVarRange);
+			m_variable = allocateNewVariable(state, newVarRange.asAccess());
 		}
 		else
 		{
@@ -1135,7 +1135,7 @@
 			// Compute intersection
 			ValueRange intersection(m_variable->getType());
 			ValueRange::computeIntersection(intersection, entry->getValueRange(), valueRange);
-			state.getVariableManager().setValue(m_variable, intersection);
+			state.getVariableManager().setValue(m_variable, intersection.asAccess());
 		}
 	}
 }
@@ -1202,7 +1202,7 @@
 		ValueRange infRange(m_variable->getType());
 		setInfiniteRange(infRange);
 
-		state.getVariableManager().setValue(m_variable, infRange);
+		state.getVariableManager().setValue(m_variable, infRange.asAccess());
 	}
 }
 
@@ -1236,7 +1236,7 @@
 {
 	if (m_child == DE_NULL)
 	{
-		m_child = Expression::createRandom(state, m_valueRange);
+		m_child = Expression::createRandom(state, m_valueRange.asAccess());
 		return m_child;
 	}
 	else
@@ -1326,7 +1326,7 @@
 
 	// Create child.
 	state.pushPrecedence(swizzlePrecedence);
-	m_child = Expression::createRandom(state, inValueRange);
+	m_child = Expression::createRandom(state, inValueRange.asAccess());
 	state.popPrecedence();
 
 	return m_child;
@@ -1486,7 +1486,7 @@
 		ValueRange lodRange(VariableType(VariableType::TYPE_FLOAT, 1));
 		setInfiniteRange(lodRange); // Any value is valid.
 
-		m_lodBiasExpr = Expression::createRandom(state, lodRange);
+		m_lodBiasExpr = Expression::createRandom(state, lodRange.asAccess());
 		return m_lodBiasExpr;
 	}
 
@@ -1514,7 +1514,7 @@
 				}
 			}
 
-			m_coordExpr = Expression::createRandom(state, coordRange);
+			m_coordExpr = Expression::createRandom(state, coordRange.asAccess());
 		}
 		else
 		{
@@ -1532,7 +1532,7 @@
 				coordRange.getMax().component(2) = neg ? -0.25f : 4.0f;
 			}
 
-			m_coordExpr = Expression::createRandom(state, coordRange);
+			m_coordExpr = Expression::createRandom(state, coordRange.asAccess());
 		}
 
 		DE_ASSERT(m_coordExpr);
@@ -1613,7 +1613,7 @@
 		texOutputRange.getMax().component(ndx) = 1.0f;
 	}
 
-	if (!valueRange.isSupersetOf(texOutputRange))
+	if (!valueRange.isSupersetOf(texOutputRange.asAccess()))
 		return 0.0f;
 
 	return state.getShaderParameters().texLookupBaseWeight;
diff --git a/framework/randomshaders/rsgFunctionGenerator.cpp b/framework/randomshaders/rsgFunctionGenerator.cpp
index bdd09c0..6d359da 100644
--- a/framework/randomshaders/rsgFunctionGenerator.cpp
+++ b/framework/randomshaders/rsgFunctionGenerator.cpp
@@ -75,8 +75,8 @@
 		// Remove value entry from this scope. After this entry ptr is invalid.
 		m_state.getVariableManager().removeValueFromCurrentScope(variable);
 
-		if (!isUndefinedValueRange(valueRange))
-			m_function.getBody().addChild(new AssignStatement(m_state, variable, valueRange));
+		if (!isUndefinedValueRange(valueRange.asAccess()))
+			m_function.getBody().addChild(new AssignStatement(m_state, variable, valueRange.asAccess()));
 	}
 }
 
diff --git a/framework/randomshaders/rsgProgramExecutor.cpp b/framework/randomshaders/rsgProgramExecutor.cpp
index a3a3225..cfc3d81 100644
--- a/framework/randomshaders/rsgProgramExecutor.cpp
+++ b/framework/randomshaders/rsgProgramExecutor.cpp
@@ -195,8 +195,8 @@
 
 inline tcu::Vec2 computeGridCellWeights (float cellWidth, float cellHeight, int x, int y)
 {
-	float gx = (x + 0.5f) / cellWidth;
-	float gy = (y + 0.5f) / cellHeight;
+	float gx = ((float)x + 0.5f) / cellWidth;
+	float gy = ((float)y + 0.5f) / cellHeight;
 	return tcu::Vec2(deFloatFrac(gx), deFloatFrac(gy));
 }
 
diff --git a/framework/randomshaders/rsgShaderGenerator.cpp b/framework/randomshaders/rsgShaderGenerator.cpp
index 737e6fa..7af9623 100644
--- a/framework/randomshaders/rsgShaderGenerator.cpp
+++ b/framework/randomshaders/rsgShaderGenerator.cpp
@@ -211,7 +211,7 @@
 
 			fragColorVar->setLayoutLocation(0); // Bind color output to location 0 (applies to GLSL ES 3.0 onwards).
 
-			m_state.getVariableManager().setValue(fragColorVar, valueRange);
+			m_state.getVariableManager().setValue(fragColorVar, valueRange.asAccess());
 		}
 	}
 
@@ -259,7 +259,7 @@
 			valueRange.getMin() = tcu::Vec4(-1.0f, -1.0f, 0.0f, 1.0f);
 			valueRange.getMax() = tcu::Vec4( 1.0f,  1.0f, 0.0f, 1.0f);
 
-			m_state.getVariableManager().setValue(qpPosVariable, valueRange); // \todo [2011-05-24 pyry] No expression should be able to use gl_Position or dEQP_Position..
+			m_state.getVariableManager().setValue(qpPosVariable, valueRange.asAccess()); // \todo [2011-05-24 pyry] No expression should be able to use gl_Position or dEQP_Position..
 
 			createAssignment(main.getBody(), glPosVariable, qpPosVariable);
 		}
diff --git a/framework/randomshaders/rsgUtils.cpp b/framework/randomshaders/rsgUtils.cpp
index 2820fb7..e7e37f8 100644
--- a/framework/randomshaders/rsgUtils.cpp
+++ b/framework/randomshaders/rsgUtils.cpp
@@ -225,8 +225,8 @@
 				int rangeLen	= rnd.getInt(0, maxSteps);
 				int minStep		= rnd.getInt(0, maxSteps-rangeLen);
 
-				float minVal	= minFloatVal + step*minStep;
-				float maxVal	= minVal + step*rangeLen;
+				float minVal	= minFloatVal + step*(float)minStep;
+				float maxVal	= minVal + step*(float)rangeLen;
 
 				valueRange.getMin().component(ndx).asFloat() = minVal;
 				valueRange.getMax().component(ndx).asFloat() = maxVal;
diff --git a/framework/randomshaders/rsgUtils.hpp b/framework/randomshaders/rsgUtils.hpp
index 1ca0757..d659586 100644
--- a/framework/randomshaders/rsgUtils.hpp
+++ b/framework/randomshaders/rsgUtils.hpp
@@ -53,7 +53,7 @@
 inline float getQuantizedFloat (de::Random& rnd, float min, float max, float step)
 {
 	int numSteps = (int)((max-min)/step);
-	return min + step*rnd.getInt(0, numSteps);
+	return min + step * (float)rnd.getInt(0, numSteps);
 }
 
 inline bool quantizeFloatRange (float& min, float& max)
diff --git a/framework/randomshaders/rsgVariableManager.cpp b/framework/randomshaders/rsgVariableManager.cpp
index f8f7041..d2a2fee 100644
--- a/framework/randomshaders/rsgVariableManager.cpp
+++ b/framework/randomshaders/rsgVariableManager.cpp
@@ -477,7 +477,7 @@
 					if (!newTopScope.findEntry(var))
 						newTopScope.allocate(var);
 
-					newTopScope.setValue(var, intersectedValue);
+					newTopScope.setValue(var, intersectedValue.asAccess());
 
 					// Add entry from top scope to cache.
 					m_entryCache.push_back(newTopScope.findEntry(var));
diff --git a/framework/referencerenderer/rrFragmentOperations.cpp b/framework/referencerenderer/rrFragmentOperations.cpp
index 2994b82..6d0f1f9 100644
--- a/framework/referencerenderer/rrFragmentOperations.cpp
+++ b/framework/referencerenderer/rrFragmentOperations.cpp
@@ -763,6 +763,10 @@
 	DE_ASSERT((!hasDepth || colorBuffer.getHeight() == depthBuffer.getHeight())	&& (!hasStencil || colorBuffer.getHeight() == stencilBuffer.getHeight()));
 	DE_ASSERT((!hasDepth || colorBuffer.getDepth() == depthBuffer.getDepth())	&& (!hasStencil || colorBuffer.getDepth() == stencilBuffer.getDepth()));
 
+	// Combined formats must be separated beforehand
+	DE_ASSERT(!hasDepth || (!tcu::isCombinedDepthStencilType(depthBuffer.getFormat().type) && depthBuffer.getFormat().order == tcu::TextureFormat::D));
+	DE_ASSERT(!hasStencil || (!tcu::isCombinedDepthStencilType(stencilBuffer.getFormat().type) && stencilBuffer.getFormat().order == tcu::TextureFormat::S));
+
 	int						numSamplesPerFragment		= colorBuffer.getWidth();
 	int						totalNumSamples				= numFragments*numSamplesPerFragment;
 	int						numSampleGroups				= (totalNumSamples - 1) / SAMPLE_REGISTER_SIZE + 1; // \note totalNumSamples/SAMPLE_REGISTER_SIZE rounded up.
diff --git a/framework/referencerenderer/rrMultisamplePixelBufferAccess.cpp b/framework/referencerenderer/rrMultisamplePixelBufferAccess.cpp
index e7ab014..6777048 100644
--- a/framework/referencerenderer/rrMultisamplePixelBufferAccess.cpp
+++ b/framework/referencerenderer/rrMultisamplePixelBufferAccess.cpp
@@ -138,6 +138,80 @@
 	}
 }
 
+void resolveMultisampleDepthBuffer (const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src)
+{
+	DE_ASSERT(dst.getWidth() == src.raw().getHeight());
+	DE_ASSERT(dst.getHeight() == src.raw().getDepth());
+
+	const tcu::ConstPixelBufferAccess	effectiveSrc = tcu::getEffectiveDepthStencilAccess(src.raw(), tcu::Sampler::MODE_DEPTH);
+	const tcu::PixelBufferAccess		effectiveDst = tcu::getEffectiveDepthStencilAccess(dst, tcu::Sampler::MODE_DEPTH);
+
+	if (src.getNumSamples() == 1)
+	{
+		// fast-path for non-multisampled cases
+		tcu::copy(effectiveDst, MultisampleConstPixelBufferAccess::fromMultisampleAccess(effectiveSrc).toSinglesampleAccess());
+	}
+	else
+	{
+		const float numSamplesInv = 1.0f / (float)src.getNumSamples();
+
+		for (int y = 0; y < dst.getHeight(); y++)
+		for (int x = 0; x < dst.getWidth(); x++)
+		{
+			float sum = 0.0f;
+			for (int s = 0; s < src.getNumSamples(); s++)
+				sum += effectiveSrc.getPixDepth(s, x, y);
+
+			effectiveDst.setPixDepth(sum*numSamplesInv, x, y);
+		}
+	}
+}
+
+void resolveMultisampleStencilBuffer (const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src)
+{
+	DE_ASSERT(dst.getWidth() == src.raw().getHeight());
+	DE_ASSERT(dst.getHeight() == src.raw().getDepth());
+
+	const tcu::ConstPixelBufferAccess	effectiveSrc = tcu::getEffectiveDepthStencilAccess(src.raw(), tcu::Sampler::MODE_STENCIL);
+	const tcu::PixelBufferAccess		effectiveDst = tcu::getEffectiveDepthStencilAccess(dst, tcu::Sampler::MODE_STENCIL);
+
+	if (src.getNumSamples() == 1)
+	{
+		// fast-path for non-multisampled cases
+		tcu::copy(effectiveDst, MultisampleConstPixelBufferAccess::fromMultisampleAccess(effectiveSrc).toSinglesampleAccess());
+	}
+	else
+	{
+		// Resolve by selecting one
+		for (int y = 0; y < dst.getHeight(); y++)
+		for (int x = 0; x < dst.getWidth(); x++)
+			effectiveDst.setPixStencil(effectiveSrc.getPixStencil(0, x, y), x, y);
+	}
+}
+
+void resolveMultisampleBuffer (const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src)
+{
+	switch (src.raw().getFormat().order)
+	{
+		case tcu::TextureFormat::D:
+			resolveMultisampleDepthBuffer(dst, src);
+			return;
+
+		case tcu::TextureFormat::S:
+			resolveMultisampleStencilBuffer(dst, src);
+			return;
+
+		case tcu::TextureFormat::DS:
+			resolveMultisampleDepthBuffer(dst, src);
+			resolveMultisampleStencilBuffer(dst, src);
+			return;
+
+		default:
+			resolveMultisampleColorBuffer(dst, src);
+			return;
+	}
+}
+
 tcu::Vec4 resolveMultisamplePixel (const MultisampleConstPixelBufferAccess& access, int x, int y)
 {
 	tcu::Vec4 sum;
diff --git a/framework/referencerenderer/rrMultisamplePixelBufferAccess.hpp b/framework/referencerenderer/rrMultisamplePixelBufferAccess.hpp
index 975ef80..517c1f7 100644
--- a/framework/referencerenderer/rrMultisamplePixelBufferAccess.hpp
+++ b/framework/referencerenderer/rrMultisamplePixelBufferAccess.hpp
@@ -90,6 +90,9 @@
 MultisampleConstPixelBufferAccess	getSubregion					(const MultisampleConstPixelBufferAccess& access, int x, int y, int width, int height);
 
 void								resolveMultisampleColorBuffer	(const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src);
+void								resolveMultisampleDepthBuffer	(const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src);
+void								resolveMultisampleStencilBuffer	(const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src);
+void								resolveMultisampleBuffer		(const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src);
 tcu::Vec4							resolveMultisamplePixel			(const MultisampleConstPixelBufferAccess& access, int x, int y);
 
 void								clear							(const MultisamplePixelBufferAccess& access, const tcu::Vec4& color);
diff --git a/framework/referencerenderer/rrPrimitivePacket.cpp b/framework/referencerenderer/rrPrimitivePacket.cpp
index c807f29..4f9c752 100644
--- a/framework/referencerenderer/rrPrimitivePacket.cpp
+++ b/framework/referencerenderer/rrPrimitivePacket.cpp
@@ -41,7 +41,7 @@
 
 	if (++m_numEmitted > m_maxVertices)
 	{
-		DE_ASSERT(!"Undefined results, too many vertices emitted.");
+		DE_FATAL("Undefined results, too many vertices emitted.");
 		return;
 	}
 
diff --git a/framework/referencerenderer/rrRasterizer.hpp b/framework/referencerenderer/rrRasterizer.hpp
index b384a8d..dee7c15 100644
--- a/framework/referencerenderer/rrRasterizer.hpp
+++ b/framework/referencerenderer/rrRasterizer.hpp
@@ -42,7 +42,7 @@
 //! Get coverage bit value.
 inline deUint64 getCoverageBit (int numSamples, int x, int y, int sampleNdx)
 {
-	const int	numBits		= sizeof(deUint64)*8;
+	const int	numBits		= (int)sizeof(deUint64)*8;
 	const int	maxSamples	= numBits/4;
 	DE_STATIC_ASSERT(maxSamples >= RASTERIZER_MAX_SAMPLES_PER_FRAGMENT);
 	DE_ASSERT(de::inRange(numSamples, 1, maxSamples) && de::inBounds(x, 0, 2) && de::inBounds(y, 0, 2));
diff --git a/framework/referencerenderer/rrRenderer.cpp b/framework/referencerenderer/rrRenderer.cpp
index dc6ec31..943d8c5 100644
--- a/framework/referencerenderer/rrRenderer.cpp
+++ b/framework/referencerenderer/rrRenderer.cpp
@@ -1032,7 +1032,7 @@
 						   const float*							depthValues,
 						   std::vector<Fragment>&				fragmentBuffer)
 {
-	const int			numSamples		= renderTarget.colorBuffers[0].getNumSamples();
+	const int			numSamples		= renderTarget.getNumSamples();
 	const size_t		numOutputs		= program.fragmentShader->getOutputs().size();
 	FragmentProcessor	fragProcessor;
 
@@ -1090,7 +1090,7 @@
 			}
 
 			// Execute per-fragment ops and write
-			fragProcessor.render(renderTarget.colorBuffers[outputNdx], renderTarget.depthBuffer, renderTarget.stencilBuffer, &fragmentBuffer[0], fragCount, facetype, fragOpsState);
+			fragProcessor.render(renderTarget.getColorBuffer((int)outputNdx), renderTarget.getDepthBuffer(), renderTarget.getStencilBuffer(), &fragmentBuffer[0], fragCount, facetype, fragOpsState);
 		}
 	}
 }
@@ -1102,7 +1102,7 @@
 						 const tcu::IVec4&					renderTargetRect,
 						 RasterizationInternalBuffers&		buffers)
 {
-	const int			numSamples		= renderTarget.colorBuffers[0].getNumSamples();
+	const int			numSamples		= renderTarget.getNumSamples();
 	const float			depthClampMin	= de::min(state.viewport.zn, state.viewport.zf);
 	const float			depthClampMax	= de::max(state.viewport.zn, state.viewport.zf);
 	TriangleRasterizer	rasterizer		(renderTargetRect, numSamples, state.rasterization);
@@ -1123,7 +1123,7 @@
 	if (buffers.fragmentDepthBuffer && state.fragOps.polygonOffsetEnabled)
 	{
 		const float maximumDepthSlope			= findPrimitiveMaximumDepthSlope(triangle);
-		const float minimumResolvableDifference	= findPrimitiveMinimumResolvableDifference(triangle, renderTarget.depthBuffer);
+		const float minimumResolvableDifference	= findPrimitiveMinimumResolvableDifference(triangle, renderTarget.getDepthBuffer());
 
 		depthOffset = maximumDepthSlope * state.fragOps.polygonOffsetFactor + minimumResolvableDifference * state.fragOps.polygonOffsetUnits;
 	}
@@ -1170,7 +1170,7 @@
 						 const tcu::IVec4&					renderTargetRect,
 						 RasterizationInternalBuffers&		buffers)
 {
-	const int					numSamples			= renderTarget.colorBuffers[0].getNumSamples();
+	const int					numSamples			= renderTarget.getNumSamples();
 	const float					depthClampMin		= de::min(state.viewport.zn, state.viewport.zf);
 	const float					depthClampMax		= de::max(state.viewport.zn, state.viewport.zf);
 	const bool					msaa				= numSamples > 1;
@@ -1223,7 +1223,7 @@
 						 const tcu::IVec4&					renderTargetRect,
 						 RasterizationInternalBuffers&		buffers)
 {
-	const int			numSamples		= renderTarget.colorBuffers[0].getNumSamples();
+	const int			numSamples		= renderTarget.getNumSamples();
 	const float			depthClampMin	= de::min(state.viewport.zn, state.viewport.zf);
 	const float			depthClampMax	= de::max(state.viewport.zn, state.viewport.zf);
 	TriangleRasterizer	rasterizer1		(renderTargetRect, numSamples, state.rasterization);
@@ -1287,12 +1287,12 @@
 				const Program&						program,
 				const ContainerType&				list)
 {
-	const int						numSamples			= renderTarget.colorBuffers[0].getNumSamples();
+	const int						numSamples			= renderTarget.getNumSamples();
 	const int						numFragmentOutputs	= (int)program.fragmentShader->getOutputs().size();
 	const size_t					maxFragmentPackets	= 128;
 
 	const tcu::IVec4				viewportRect		= tcu::IVec4(state.viewport.rect.left, state.viewport.rect.bottom, state.viewport.rect.width, state.viewport.rect.height);
-	const tcu::IVec4				bufferRect			= getBufferSize(renderTarget.colorBuffers[0]);
+	const tcu::IVec4				bufferRect			= getBufferSize(renderTarget.getColorBuffer(0));
 	const tcu::IVec4				renderTargetRect	= rectIntersection(viewportRect, bufferRect);
 
 	// shared buffers for all primitives
@@ -1305,7 +1305,7 @@
 	RasterizationInternalBuffers	buffers;
 
 	// calculate depth only if we have a depth buffer
-	if (!isEmpty(renderTarget.depthBuffer))
+	if (!isEmpty(renderTarget.getDepthBuffer()))
 	{
 		depthValues.resize(maxFragmentPackets*4*numSamples);
 		depthBufferPointer = &depthValues[0];
@@ -1569,23 +1569,23 @@
 		return false;
 
 	// There is a fragment output sink for each output?
-	if ((size_t)command.renderTarget.numColorBuffers < command.program.fragmentShader->getOutputs().size())
+	if ((size_t)command.renderTarget.getNumColorBuffers() < command.program.fragmentShader->getOutputs().size())
 		return false;
 
 	// All destination buffers should have same number of samples and same size
-	for (int outputNdx = 0; outputNdx < command.renderTarget.numColorBuffers; ++outputNdx)
+	for (int outputNdx = 0; outputNdx < command.renderTarget.getNumColorBuffers(); ++outputNdx)
 	{
-		if (getBufferSize(command.renderTarget.colorBuffers[0]) != getBufferSize(command.renderTarget.colorBuffers[outputNdx]))
+		if (getBufferSize(command.renderTarget.getColorBuffer(0)) != getBufferSize(command.renderTarget.getColorBuffer(outputNdx)))
 			return false;
 
-		if (command.renderTarget.colorBuffers[0].getNumSamples() != command.renderTarget.colorBuffers[outputNdx].getNumSamples())
+		if (command.renderTarget.getNumSamples() != command.renderTarget.getColorBuffer(outputNdx).getNumSamples())
 			return false;
 	}
 
 	// All destination buffers should have same basic type as matching fragment output
 	for (size_t varyingNdx = 0; varyingNdx < command.program.fragmentShader->getOutputs().size(); ++varyingNdx)
 	{
-		const tcu::TextureChannelClass	colorbufferClass = tcu::getTextureChannelClass(command.renderTarget.colorBuffers[varyingNdx].raw().getFormat().type);
+		const tcu::TextureChannelClass	colorbufferClass = tcu::getTextureChannelClass(command.renderTarget.getColorBuffer((int)varyingNdx).raw().getFormat().type);
 		const GenericVecType			colorType		 = (colorbufferClass == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER) ? (rr::GENERICVECTYPE_INT32) : ((colorbufferClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER) ? (rr::GENERICVECTYPE_UINT32) : (rr::GENERICVECTYPE_FLOAT));
 
 		if (command.program.fragmentShader->getOutputs()[varyingNdx].type != colorType)
@@ -1643,6 +1643,22 @@
 
 } // anonymous
 
+RenderTarget::RenderTarget (const MultisamplePixelBufferAccess& colorMultisampleBuffer,
+							const MultisamplePixelBufferAccess& depthMultisampleBuffer,
+							const MultisamplePixelBufferAccess& stencilMultisampleBuffer)
+	: m_numColorBuffers	(1)
+	, m_depthBuffer		(MultisamplePixelBufferAccess::fromMultisampleAccess(tcu::getEffectiveDepthStencilAccess(depthMultisampleBuffer.raw(), tcu::Sampler::MODE_DEPTH)))
+	, m_stencilBuffer	(MultisamplePixelBufferAccess::fromMultisampleAccess(tcu::getEffectiveDepthStencilAccess(stencilMultisampleBuffer.raw(), tcu::Sampler::MODE_STENCIL)))
+{
+	m_colorBuffers[0] = colorMultisampleBuffer;
+}
+
+int RenderTarget::getNumSamples (void) const
+{
+	DE_ASSERT(m_numColorBuffers > 0);
+	return m_colorBuffers[0].getNumSamples();
+}
+
 DrawIndices::DrawIndices (const deUint32* ptr, int baseVertex_)
 	: indices	(ptr)
 	, indexType	(INDEXTYPE_UINT32)
diff --git a/framework/referencerenderer/rrRenderer.hpp b/framework/referencerenderer/rrRenderer.hpp
index f47e4fe..6655b5d 100644
--- a/framework/referencerenderer/rrRenderer.hpp
+++ b/framework/referencerenderer/rrRenderer.hpp
@@ -41,20 +41,22 @@
 		MAX_COLOR_BUFFERS	= 4
 	};
 
-	RenderTarget (const MultisamplePixelBufferAccess& colorMultisampleBuffer,
-				  const MultisamplePixelBufferAccess& depthMultisampleBuffer	= MultisamplePixelBufferAccess(),
-				  const MultisamplePixelBufferAccess& stencilMultisampleBuffer	= MultisamplePixelBufferAccess())
-		: numColorBuffers	(1)
-		, depthBuffer		(depthMultisampleBuffer)
-		, stencilBuffer		(stencilMultisampleBuffer)
-	{
-		colorBuffers[0] = colorMultisampleBuffer;
-	}
+											RenderTarget		(const MultisamplePixelBufferAccess& colorMultisampleBuffer,
+																 const MultisamplePixelBufferAccess& depthMultisampleBuffer		= MultisamplePixelBufferAccess(),
+																 const MultisamplePixelBufferAccess& stencilMultisampleBuffer	= MultisamplePixelBufferAccess());
 
-	MultisamplePixelBufferAccess			colorBuffers[MAX_COLOR_BUFFERS];
-	const int								numColorBuffers;
-	const MultisamplePixelBufferAccess		depthBuffer;
-	const MultisamplePixelBufferAccess		stencilBuffer;
+	int										getNumSamples 		(void) const;
+
+	const MultisamplePixelBufferAccess&		getColorBuffer		(int ndx) const	{ DE_ASSERT(de::inRange(ndx, 0, m_numColorBuffers));	return m_colorBuffers[ndx];	}
+	int										getNumColorBuffers	(void) const	{ return m_numColorBuffers; }
+	const MultisamplePixelBufferAccess&		getStencilBuffer	(void) const	{														return m_stencilBuffer;		}
+	const MultisamplePixelBufferAccess&		getDepthBuffer		(void) const	{														return m_depthBuffer;		}
+
+private:
+	MultisamplePixelBufferAccess			m_colorBuffers[MAX_COLOR_BUFFERS];
+	const int								m_numColorBuffers;
+	const MultisamplePixelBufferAccess		m_depthBuffer;
+	const MultisamplePixelBufferAccess		m_stencilBuffer;
 } DE_WARN_UNUSED_TYPE;
 
 struct Program
diff --git a/framework/referencerenderer/rrVertexAttrib.cpp b/framework/referencerenderer/rrVertexAttrib.cpp
index eaea7b3..796cad0 100644
--- a/framework/referencerenderer/rrVertexAttrib.cpp
+++ b/framework/referencerenderer/rrVertexAttrib.cpp
@@ -128,10 +128,10 @@
 	deInt32 aligned[4];
 	deMemcpy(aligned, ptr, size * sizeof(deInt32));
 
-				   dst[0] = aligned[0] / float(1 << 16);
-	if (size >= 2) dst[1] = aligned[1] / float(1 << 16);
-	if (size >= 3) dst[2] = aligned[2] / float(1 << 16);
-	if (size >= 4) dst[3] = aligned[3] / float(1 << 16);
+				   dst[0] = float(aligned[0]) / float(1 << 16);
+	if (size >= 2) dst[1] = float(aligned[1]) / float(1 << 16);
+	if (size >= 3) dst[2] = float(aligned[2]) / float(1 << 16);
+	if (size >= 4) dst[3] = float(aligned[3]) / float(1 << 16);
 }
 
 inline void readDouble (tcu::Vec4& dst, const int size, const void* ptr)
@@ -216,10 +216,10 @@
 	deUint32 aligned;
 	deMemcpy(&aligned, ptr, sizeof(deUint32));
 
-				   dst[Order::T0] = (float(extendSign<10>((aligned >>  0) & ((1 << 10) - 1)) * 2.0f + 1.0f) / float(range10));
-	if (size >= 2) dst[Order::T1] = (float(extendSign<10>((aligned >> 10) & ((1 << 10) - 1)) * 2.0f + 1.0f) / float(range10));
-	if (size >= 3) dst[Order::T2] = (float(extendSign<10>((aligned >> 20) & ((1 << 10) - 1)) * 2.0f + 1.0f) / float(range10));
-	if (size >= 4) dst[Order::T3] = (float(extendSign< 2>((aligned >> 30) & ((1 <<  2) - 1)) * 2.0f + 1.0f) / float(range2));
+				   dst[Order::T0] = (float(extendSign<10>((aligned >>  0) & ((1 << 10) - 1))) * 2.0f + 1.0f) / float(range10);
+	if (size >= 2) dst[Order::T1] = (float(extendSign<10>((aligned >> 10) & ((1 << 10) - 1))) * 2.0f + 1.0f) / float(range10);
+	if (size >= 3) dst[Order::T2] = (float(extendSign<10>((aligned >> 20) & ((1 << 10) - 1))) * 2.0f + 1.0f) / float(range10);
+	if (size >= 4) dst[Order::T3] = (float(extendSign< 2>((aligned >> 30) & ((1 <<  2) - 1))) * 2.0f + 1.0f) / float(range2);
 }
 
 // ordered readers
@@ -313,7 +313,7 @@
 		case VERTEXATTRIBTYPE_PURE_INT8:
 		case VERTEXATTRIBTYPE_PURE_INT16:
 		case VERTEXATTRIBTYPE_PURE_INT32:
-			DE_ASSERT(!"Invalid read");
+			DE_FATAL("Invalid read");
 
 		default:
 			DE_ASSERT(false);
@@ -359,7 +359,7 @@
 		case VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV_BGRA:
 		case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP_BGRA:
 		case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE_BGRA:
-			DE_ASSERT(!"Invalid read");
+			DE_FATAL("Invalid read");
 
 		default:
 			DE_ASSERT(false);
@@ -405,7 +405,7 @@
 		case VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV_BGRA:
 		case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP_BGRA:
 		case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE_BGRA:
-			DE_ASSERT(!"Invalid read");
+			DE_FATAL("Invalid read");
 
 		default:
 			DE_ASSERT(false);
@@ -419,27 +419,27 @@
 		case VERTEXATTRIBTYPE_FLOAT:									return 4;
 		case VERTEXATTRIBTYPE_HALF:										return 2;
 		case VERTEXATTRIBTYPE_FIXED:									return 4;
-		case VERTEXATTRIBTYPE_DOUBLE:									return sizeof(double);
+		case VERTEXATTRIBTYPE_DOUBLE:									return (int)sizeof(double);
 		case VERTEXATTRIBTYPE_NONPURE_UNORM8:							return 1;
 		case VERTEXATTRIBTYPE_NONPURE_UNORM16:							return 2;
 		case VERTEXATTRIBTYPE_NONPURE_UNORM32:							return 4;
-		case VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV:				return sizeof(deUint32)/4;
+		case VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV:				return (int)sizeof(deUint32)/4;
 		case VERTEXATTRIBTYPE_NONPURE_SNORM8_CLAMP:						return 1;
 		case VERTEXATTRIBTYPE_NONPURE_SNORM16_CLAMP:					return 2;
 		case VERTEXATTRIBTYPE_NONPURE_SNORM32_CLAMP:					return 4;
-		case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP:		return sizeof(deUint32)/4;
+		case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP:		return (int)sizeof(deUint32)/4;
 		case VERTEXATTRIBTYPE_NONPURE_SNORM8_SCALE:						return 1;
 		case VERTEXATTRIBTYPE_NONPURE_SNORM16_SCALE:					return 2;
 		case VERTEXATTRIBTYPE_NONPURE_SNORM32_SCALE:					return 4;
-		case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE:		return sizeof(deUint32)/4;
+		case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE:		return (int)sizeof(deUint32)/4;
 		case VERTEXATTRIBTYPE_NONPURE_UINT8:							return 1;
 		case VERTEXATTRIBTYPE_NONPURE_UINT16:							return 2;
 		case VERTEXATTRIBTYPE_NONPURE_UINT32:							return 4;
 		case VERTEXATTRIBTYPE_NONPURE_INT8:								return 1;
 		case VERTEXATTRIBTYPE_NONPURE_INT16:							return 2;
 		case VERTEXATTRIBTYPE_NONPURE_INT32:							return 4;
-		case VERTEXATTRIBTYPE_NONPURE_UINT_2_10_10_10_REV:				return sizeof(deUint32)/4;
-		case VERTEXATTRIBTYPE_NONPURE_INT_2_10_10_10_REV:				return sizeof(deUint32)/4;
+		case VERTEXATTRIBTYPE_NONPURE_UINT_2_10_10_10_REV:				return (int)sizeof(deUint32)/4;
+		case VERTEXATTRIBTYPE_NONPURE_INT_2_10_10_10_REV:				return (int)sizeof(deUint32)/4;
 		case VERTEXATTRIBTYPE_PURE_UINT8:								return 1;
 		case VERTEXATTRIBTYPE_PURE_UINT16:								return 2;
 		case VERTEXATTRIBTYPE_PURE_UINT32:								return 4;
@@ -447,9 +447,9 @@
 		case VERTEXATTRIBTYPE_PURE_INT16:								return 2;
 		case VERTEXATTRIBTYPE_PURE_INT32:								return 4;
 		case VERTEXATTRIBTYPE_NONPURE_UNORM8_BGRA:						return 1;
-		case VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV_BGRA:		return sizeof(deUint32)/4;
-		case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP_BGRA:	return sizeof(deUint32)/4;
-		case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE_BGRA:	return sizeof(deUint32)/4;
+		case VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV_BGRA:		return (int)sizeof(deUint32)/4;
+		case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP_BGRA:	return (int)sizeof(deUint32)/4;
+		case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE_BGRA:	return (int)sizeof(deUint32)/4;
 		default:
 			DE_ASSERT(false);
 			return 0;
diff --git a/modules/egl/CMakeLists.txt b/modules/egl/CMakeLists.txt
index 37a06fd..f038943 100644
--- a/modules/egl/CMakeLists.txt
+++ b/modules/egl/CMakeLists.txt
@@ -5,6 +5,8 @@
 	teglAndroidUtil.hpp
 	teglApiCase.cpp
 	teglApiCase.hpp
+	teglBufferAgeTests.hpp
+	teglBufferAgeTests.cpp
 	teglChooseConfigReference.cpp
 	teglChooseConfigReference.hpp
 	teglChooseConfigTests.cpp
@@ -39,6 +41,10 @@
 	teglInfoTests.hpp
 	teglNegativeApiTests.cpp
 	teglNegativeApiTests.hpp
+	teglPartialUpdateTests.cpp
+	teglPartialUpdateTests.hpp
+	teglNegativePartialUpdateTests.cpp
+	teglNegativePartialUpdateTests.hpp
 	teglRenderCase.cpp
 	teglRenderCase.hpp
 	teglRenderTests.cpp
@@ -83,6 +89,8 @@
 	teglNativeCoordMappingTests.cpp
 	teglResizeTests.hpp
 	teglResizeTests.cpp
+	teglSwapBuffersWithDamageTests.hpp
+	teglSwapBuffersWithDamageTests.cpp
 	)
 
 set(DEQP_EGL_LIBS
diff --git a/modules/egl/teglBufferAgeTests.cpp b/modules/egl/teglBufferAgeTests.cpp
new file mode 100644
index 0000000..727815a
--- /dev/null
+++ b/modules/egl/teglBufferAgeTests.cpp
@@ -0,0 +1,694 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program EGL Module
+ * ---------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * 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 Test EXT_buffer_age
+ *//*--------------------------------------------------------------------*/
+
+#include "teglBufferAgeTests.hpp"
+
+#include "tcuImageCompare.hpp"
+#include "tcuTestLog.hpp"
+#include "tcuSurface.hpp"
+#include "tcuTextureUtil.hpp"
+
+#include "egluNativeWindow.hpp"
+#include "egluUtil.hpp"
+#include "egluConfigFilter.hpp"
+
+#include "eglwLibrary.hpp"
+#include "eglwEnums.hpp"
+
+#include "gluDefs.hpp"
+#include "gluRenderContext.hpp"
+#include "gluShaderProgram.hpp"
+
+#include "glwDefs.hpp"
+#include "glwEnums.hpp"
+#include "glwFunctions.hpp"
+
+#include "deRandom.hpp"
+#include "deString.h"
+
+#include <string>
+#include <vector>
+#include <sstream>
+
+using std::string;
+using std::vector;
+using glw::GLubyte;
+using tcu::IVec2;
+
+using namespace eglw;
+
+namespace deqp
+{
+namespace egl
+{
+namespace
+{
+
+typedef	tcu::Vector<GLubyte, 3> Color;
+
+class GLES2Renderer;
+
+class ReferenceRenderer;
+
+class BufferAgeTest : public TestCase
+{
+public:
+	enum DrawType
+	{
+		DRAWTYPE_GLES2_CLEAR,
+		DRAWTYPE_GLES2_RENDER
+	};
+
+								BufferAgeTest	(EglTestContext& eglTestCtx, bool preserveColorBuffer, const vector<DrawType>& oddFrameDrawType,
+												 const vector<DrawType>& evenFrameDrawType, const char* name, const char* description);
+								~BufferAgeTest	(void);
+
+	void						init			(void);
+	void						deinit			(void);
+	IterateResult				iterate			(void);
+
+private:
+	void						initEGLSurface (EGLConfig config);
+	void						initEGLContext (EGLConfig config);
+
+	const int					m_seed;
+	const bool					m_preserveColorBuffer;
+	const vector<DrawType>		m_oddFrameDrawType;
+	const vector<DrawType>		m_evenFrameDrawType;
+
+	EGLDisplay					m_eglDisplay;
+	eglu::NativeWindow*			m_window;
+	EGLSurface					m_eglSurface;
+	EGLConfig					m_eglConfig;
+	EGLContext					m_eglContext;
+	glw::Functions				m_gl;
+
+	GLES2Renderer*				m_gles2Renderer;
+	ReferenceRenderer*			m_refRenderer;
+
+};
+
+struct ColoredRect
+{
+public:
+							ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_);
+	IVec2	 				bottomLeft;
+	IVec2 					topRight;
+	Color 					color;
+};
+
+ColoredRect::ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_)
+	: bottomLeft(bottomLeft_)
+	, topRight	(topRight_)
+	, color		(color_)
+{
+}
+
+struct DrawCommand
+{
+							DrawCommand (const BufferAgeTest::DrawType drawType_, const ColoredRect& rect_);
+	BufferAgeTest::DrawType drawType;
+	ColoredRect				rect;
+};
+
+DrawCommand::DrawCommand (const BufferAgeTest::DrawType drawType_, const ColoredRect& rect_)
+	: drawType(drawType_)
+	, rect    (rect_)
+{
+}
+
+struct Frame
+{
+						Frame (int width_, int height_);
+	int 				width;
+	int					height;
+	vector<DrawCommand> draws;
+};
+
+Frame::Frame (int width_, int height_)
+	: width(width_)
+	, height(height_)
+{
+}
+
+
+// (x1,y1) lie in the lower-left quadrant while (x2,y2) lie in the upper-right.
+// the coords are multiplied by 4 to amplify the minimial difference between coords to 4 (if not zero)
+// to avoid the situation where two edges are too close to each other which makes the rounding error
+// intoleratable by compareToReference()
+void generateRandomFrame (Frame* dst, const vector<BufferAgeTest::DrawType>& drawTypes, de::Random& rnd)
+{
+	for (size_t ndx = 0; ndx < drawTypes.size(); ndx++)
+	{
+		const int			x1			= rnd.getInt(0, (dst->width-1)/8) * 4;
+		const int			y1			= rnd.getInt(0, (dst->height-1)/8) * 4;
+		const int			x2			= rnd.getInt((dst->width-1)/8, (dst->width-1)/4) * 4;
+		const int			y2			= rnd.getInt((dst->height-1)/8, (dst->height-1)/4) * 4;
+		const GLubyte		r			= rnd.getUint8();
+		const GLubyte		g			= rnd.getUint8();
+		const GLubyte		b			= rnd.getUint8();
+		const ColoredRect	coloredRect	(IVec2(x1, y1), IVec2(x2, y2), Color(r, g, b));
+		const DrawCommand	drawCommand (drawTypes[ndx], coloredRect);
+		(*dst).draws.push_back(drawCommand);
+	}
+}
+
+typedef vector<Frame> FrameSequence;
+
+//helper function declaration
+EGLConfig		getEGLConfig					(const Library& egl, EGLDisplay eglDisplay, bool preserveColorBuffer);
+void			clearColorScreen				(const glw::Functions& gl, const tcu::Vec4& clearColor);
+void			clearColorReference				(tcu::Surface* ref, const tcu::Vec4& clearColor);
+void			readPixels						(const glw::Functions& gl, tcu::Surface* screen);
+float			windowToDeviceCoordinates		(int x, int length);
+bool			compareToReference				(tcu::TestLog& log, const tcu::Surface& reference, const tcu::Surface& buffer, int frameNdx, int bufferNum);
+vector<int> 	getFramesOnBuffer 				(const vector<int>& bufferAges, int frameNdx);
+
+class GLES2Renderer
+{
+public:
+							GLES2Renderer		(const glw::Functions& gl);
+							~GLES2Renderer		(void);
+	void					render				(int width, int height, const Frame& frame) const;
+
+private:
+							GLES2Renderer		(const GLES2Renderer&);
+	GLES2Renderer&			operator=			(const GLES2Renderer&);
+
+	const glw::Functions&	m_gl;
+	glu::ShaderProgram		m_glProgram;
+	glw::GLuint				m_coordLoc;
+	glw::GLuint				m_colorLoc;
+};
+
+// generate sources for vertex and fragment buffer
+glu::ProgramSources getSources (void)
+{
+	const char* const vertexShaderSource =
+		"attribute mediump vec4 a_pos;\n"
+		"attribute mediump vec4 a_color;\n"
+		"varying mediump vec4 v_color;\n"
+		"void main(void)\n"
+		"{\n"
+		"\tv_color = a_color;\n"
+		"\tgl_Position = a_pos;\n"
+		"}";
+
+	const char* const fragmentShaderSource =
+		"varying mediump vec4 v_color;\n"
+		"void main(void)\n"
+		"{\n"
+		"\tgl_FragColor = v_color;\n"
+		"}";
+
+	return glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource);
+}
+
+GLES2Renderer::GLES2Renderer (const glw::Functions& gl)
+	: m_gl		  (gl)
+	, m_glProgram (gl, getSources())
+	, m_coordLoc  ((glw::GLuint)-1)
+	, m_colorLoc  ((glw::GLuint)-1)
+{
+	m_colorLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_color");
+	m_coordLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_pos");
+	GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to get attribute locations");
+}
+
+GLES2Renderer::~GLES2Renderer (void)
+{
+}
+
+void GLES2Renderer::render (int width, int height, const Frame& frame) const
+{
+	for (size_t drawNdx = 0; drawNdx < frame.draws.size(); drawNdx++)
+	{
+		const ColoredRect& coloredRect = frame.draws[drawNdx].rect;
+		if (frame.draws[drawNdx].drawType == BufferAgeTest::DRAWTYPE_GLES2_RENDER)
+		{
+			float x1 = windowToDeviceCoordinates(coloredRect.bottomLeft.x(), width);
+			float y1 = windowToDeviceCoordinates(coloredRect.bottomLeft.y(), height);
+			float x2 = windowToDeviceCoordinates(coloredRect.topRight.x(), width);
+			float y2 = windowToDeviceCoordinates(coloredRect.topRight.y(), height);
+
+			const glw::GLfloat coords[] =
+			{
+				x1, y1, 0.0f, 1.0f,
+				x1, y2, 0.0f, 1.0f,
+				x2, y2, 0.0f, 1.0f,
+
+				x2, y2, 0.0f, 1.0f,
+				x2, y1, 0.0f, 1.0f,
+				x1, y1, 0.0f, 1.0f
+			};
+
+			const glw::GLubyte colors[] =
+			{
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+			};
+
+			m_gl.useProgram(m_glProgram.getProgram());
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
+
+			m_gl.enableVertexAttribArray(m_coordLoc);
+			m_gl.enableVertexAttribArray(m_colorLoc);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to enable attributes");
+
+			m_gl.vertexAttribPointer(m_coordLoc, 4, GL_FLOAT, GL_FALSE, 0, coords);
+			m_gl.vertexAttribPointer(m_colorLoc, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, colors);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to set attribute pointers");
+
+			m_gl.drawArrays(GL_TRIANGLES, 0, DE_LENGTH_OF_ARRAY(coords)/4);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "glDrawArrays(), failed");
+
+			m_gl.disableVertexAttribArray(m_coordLoc);
+			m_gl.disableVertexAttribArray(m_colorLoc);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to disable attributes");
+
+			m_gl.useProgram(0);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
+		}
+		else if (frame.draws[drawNdx].drawType == BufferAgeTest::DRAWTYPE_GLES2_CLEAR)
+		{
+			m_gl.enable(GL_SCISSOR_TEST);
+			m_gl.scissor(coloredRect.bottomLeft.x(), coloredRect.bottomLeft.y(),
+						 coloredRect.topRight.x()-coloredRect.bottomLeft.x(), coloredRect.topRight.y()-coloredRect.bottomLeft.y());
+			m_gl.clearColor(coloredRect.color.x()/255.0f, coloredRect.color.y()/255.0f, coloredRect.color.z()/255.0f, 1.0f);
+			m_gl.clear(GL_COLOR_BUFFER_BIT);
+			m_gl.disable(GL_SCISSOR_TEST);
+		}
+		else
+			DE_ASSERT(false);
+	}
+}
+
+class ReferenceRenderer
+{
+public:
+						ReferenceRenderer 	(void);
+	void				render			  	(tcu::Surface* target, const Frame& frame) const;
+private:
+						ReferenceRenderer	(const ReferenceRenderer&);
+	ReferenceRenderer&	operator=		  	(const ReferenceRenderer&);
+};
+
+ReferenceRenderer::ReferenceRenderer(void)
+{
+}
+
+void ReferenceRenderer::render (tcu::Surface* target, const Frame& frame) const
+{
+	for (size_t drawNdx = 0; drawNdx < frame.draws.size(); drawNdx++)
+	{
+		const ColoredRect& coloredRect = frame.draws[drawNdx].rect;
+		if (frame.draws[drawNdx].drawType == BufferAgeTest::DRAWTYPE_GLES2_RENDER || frame.draws[drawNdx].drawType == BufferAgeTest::DRAWTYPE_GLES2_CLEAR)
+		{
+			const tcu::UVec4 color(coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255);
+			tcu::clear(tcu::getSubregion(target->getAccess(), coloredRect.bottomLeft.x(), coloredRect.bottomLeft.y(),
+										 coloredRect.topRight.x()-coloredRect.bottomLeft.x(), coloredRect.topRight.y()-coloredRect.bottomLeft.y()), color);
+		}
+		else
+			DE_ASSERT(false);
+	}
+}
+
+BufferAgeTest::BufferAgeTest (EglTestContext& eglTestCtx, bool preserveColorBuffer, const vector<DrawType>& oddFrameDrawType, const vector<DrawType>& evenFrameDrawType,
+							  const char* name, const char* description)
+	: TestCase				(eglTestCtx, name, description)
+	, m_seed				(deStringHash(name))
+	, m_preserveColorBuffer (preserveColorBuffer)
+	, m_oddFrameDrawType	(oddFrameDrawType)
+	, m_evenFrameDrawType	(evenFrameDrawType)
+	, m_eglDisplay			(EGL_NO_DISPLAY)
+	, m_window				(DE_NULL)
+	, m_eglSurface			(EGL_NO_SURFACE)
+	, m_eglContext			(EGL_NO_CONTEXT)
+	, m_gles2Renderer		(DE_NULL)
+	, m_refRenderer			(DE_NULL)
+{
+}
+
+BufferAgeTest::~BufferAgeTest (void)
+{
+	deinit();
+}
+
+void BufferAgeTest::init (void)
+{
+	const Library&	egl	= m_eglTestCtx.getLibrary();
+
+	m_eglDisplay = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
+	m_eglConfig	 = getEGLConfig(m_eglTestCtx.getLibrary(), m_eglDisplay, m_preserveColorBuffer);
+
+	if (m_eglConfig == DE_NULL)
+		TCU_THROW(NotSupportedError, "No supported config found");
+
+	//create surface and context and make them current
+	initEGLSurface(m_eglConfig);
+	initEGLContext(m_eglConfig);
+
+	m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
+
+	if (eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_buffer_age") == false)
+		TCU_THROW(NotSupportedError, "EGL_EXT_buffer_age is not supported");
+
+	m_gles2Renderer = new GLES2Renderer(m_gl);
+	m_refRenderer   = new ReferenceRenderer();
+}
+
+void BufferAgeTest::deinit (void)
+{
+	const Library& egl = m_eglTestCtx.getLibrary();
+
+	delete m_refRenderer;
+	m_refRenderer = DE_NULL;
+
+	delete m_gles2Renderer;
+	m_gles2Renderer = DE_NULL;
+
+	if (m_eglContext != EGL_NO_CONTEXT)
+	{
+		egl.makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+		egl.destroyContext(m_eglDisplay, m_eglContext);
+		m_eglContext = EGL_NO_CONTEXT;
+	}
+
+	if (m_eglSurface != EGL_NO_SURFACE)
+	{
+		egl.destroySurface(m_eglDisplay, m_eglSurface);
+		m_eglSurface = EGL_NO_SURFACE;
+	}
+
+	if (m_eglDisplay != EGL_NO_DISPLAY)
+	{
+		egl.terminate(m_eglDisplay);
+		m_eglDisplay = EGL_NO_DISPLAY;
+	}
+
+	delete m_window;
+	m_window = DE_NULL;
+}
+
+void BufferAgeTest::initEGLSurface (EGLConfig config)
+{
+	const eglu::NativeWindowFactory& factory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+	m_window = factory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, config, DE_NULL,
+									eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
+	m_eglSurface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_window, m_eglDisplay, config, DE_NULL);
+}
+
+void BufferAgeTest::initEGLContext (EGLConfig config)
+{
+	const Library& 	egl 		 = m_eglTestCtx.getLibrary();
+	const EGLint 	attribList[] =
+	{
+		EGL_CONTEXT_CLIENT_VERSION, 2,
+		EGL_NONE
+	};
+
+	egl.bindAPI(EGL_OPENGL_ES_API);
+	m_eglContext = egl.createContext(m_eglDisplay, config, EGL_NO_CONTEXT, attribList);
+	EGLU_CHECK_MSG(egl, "eglCreateContext");
+	DE_ASSERT(m_eglSurface != EGL_NO_SURFACE);
+	egl.makeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
+	EGLU_CHECK_MSG(egl, "eglMakeCurrent");
+}
+
+// return indices of frames that have been written to the given buffer
+vector<int> getFramesOnBuffer (const vector<int>& bufferAges, int frameNdx)
+{
+	DE_ASSERT(frameNdx < (int)bufferAges.size());
+	vector<int> frameOnBuffer;
+	int 		age = bufferAges[frameNdx];
+	while (age != 0)
+	{
+		frameNdx = frameNdx - age;
+		DE_ASSERT(frameNdx >= 0);
+		frameOnBuffer.push_back(frameNdx);
+		age = bufferAges[frameNdx];
+	}
+
+	reverse(frameOnBuffer.begin(), frameOnBuffer.end());
+	return frameOnBuffer;
+}
+
+TestCase::IterateResult BufferAgeTest::iterate (void)
+{
+	de::Random 		rnd					(m_seed);
+	const Library&	egl					= m_eglTestCtx.getLibrary();
+	tcu::TestLog& 	log					= m_testCtx.getLog();
+	const int 		width				= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_WIDTH);
+	const int 		height				= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_HEIGHT);
+	const float 	clearRed			= rnd.getFloat();
+	const float 	clearGreen			= rnd.getFloat();
+	const float 	clearBlue			= rnd.getFloat();
+	const tcu::Vec4	clearColor			(clearRed, clearGreen, clearBlue, 1.0f);
+	const int 		numFrames			= 20;
+	FrameSequence 	frameSequence;
+	vector<int> 	bufferAges;
+
+	if (m_preserveColorBuffer)
+		EGLU_CHECK_CALL(egl, surfaceAttrib(m_eglDisplay, m_eglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED));
+	else
+		EGLU_CHECK_CALL(egl, surfaceAttrib(m_eglDisplay, m_eglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED));
+
+	for (int frameNdx = 0; frameNdx < numFrames; frameNdx++)
+	{
+		tcu::Surface					currentBuffer			(width, height);
+		tcu::Surface					refBuffer				(width, height);
+		Frame			   				newFrame				(width, height);
+		EGLint							currentBufferAge		= -1;
+
+		if (frameNdx % 2 == 0)
+			generateRandomFrame(&newFrame, m_evenFrameDrawType, rnd);
+		else
+			generateRandomFrame(&newFrame, m_oddFrameDrawType, rnd);
+
+		frameSequence.push_back(newFrame);
+
+		EGLU_CHECK_CALL(egl, querySurface(m_eglDisplay, m_eglSurface, EGL_BUFFER_AGE_EXT, &currentBufferAge));
+
+		if (currentBufferAge > frameNdx || currentBufferAge < 0) // invalid buffer age
+		{
+			std::ostringstream stream;
+			stream << "Fail, the age is invalid. Age: " << currentBufferAge << ", frameNdx: " << frameNdx;
+			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, stream.str().c_str());
+			return STOP;
+		}
+
+		if (frameNdx > 0 && m_preserveColorBuffer && currentBufferAge != 1)
+		{
+			std::ostringstream stream;
+			stream << "Fail, EGL_BUFFER_PRESERVED is set to true, but buffer age is: " << currentBufferAge << " (should be 1)";
+			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, stream.str().c_str());
+			return STOP;
+		}
+
+		bufferAges.push_back(currentBufferAge);
+		DE_ASSERT((int)bufferAges.size() == frameNdx+1);
+
+		// during first half, just keep rendering without reading pixel back to mimic ordinary use case
+		if (frameNdx < numFrames/2)
+		{
+			if (currentBufferAge == 0)
+				clearColorScreen(m_gl, clearColor);
+
+			m_gles2Renderer->render(width, height, newFrame);
+			EGLU_CHECK_CALL(egl, swapBuffers(m_eglDisplay, m_eglSurface));
+			continue;
+		}
+
+		// do verification in the second half
+		if (currentBufferAge > 0) //buffer contain previous content, need to verify
+		{
+			const vector<int> framesOnBuffer = getFramesOnBuffer(bufferAges, frameNdx);
+			readPixels(m_gl, &currentBuffer);
+			clearColorReference(&refBuffer, clearColor);
+
+			for (vector<int>::const_iterator it = framesOnBuffer.begin(); it != framesOnBuffer.end(); it++)
+				m_refRenderer->render(&refBuffer, frameSequence[*it]);
+
+			if (compareToReference(log, refBuffer, currentBuffer, frameNdx, frameNdx-currentBufferAge) == false)
+			{
+				m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail, buffer content is not well preserved when age > 0");
+				return STOP;
+			}
+		}
+		else // currentBufferAge == 0, content is undefined, clear the buffer, currentBufferAge < 0 is ruled out at the beginning
+		{
+			clearColorScreen(m_gl, clearColor);
+			clearColorReference(&refBuffer, clearColor);
+		}
+
+		m_gles2Renderer->render(width, height, newFrame);
+		m_refRenderer->render(&refBuffer, newFrame);
+
+		readPixels(m_gl, &currentBuffer);
+
+		if (compareToReference(log, refBuffer, currentBuffer, frameNdx, frameNdx) == false)
+		{
+			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail, render result is wrong");
+			return STOP;
+		}
+
+		EGLU_CHECK_CALL(egl, swapBuffers(m_eglDisplay, m_eglSurface));
+	}
+
+	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+	return STOP;
+}
+
+string generateDrawTypeName (const vector<BufferAgeTest::DrawType>& drawTypes)
+{
+	std::ostringstream stream;
+	if (drawTypes.size() == 0)
+		return string("_none");
+
+	for (size_t ndx = 0; ndx < drawTypes.size(); ndx++)
+	{
+		if (drawTypes[ndx] == BufferAgeTest::DRAWTYPE_GLES2_RENDER)
+			stream << "_render";
+		else if (drawTypes[ndx] == BufferAgeTest::DRAWTYPE_GLES2_CLEAR)
+			stream << "_clear";
+		else
+			DE_ASSERT(false);
+	}
+	return stream.str();
+}
+
+string generateTestName (const vector<BufferAgeTest::DrawType>& oddFrameDrawType, const vector<BufferAgeTest::DrawType>& evenFrameDrawType)
+{
+	return "odd" + generateDrawTypeName(oddFrameDrawType) + "_even" + generateDrawTypeName(evenFrameDrawType);
+}
+
+bool isWindow (const eglu::CandidateConfig& c)
+{
+	return (c.surfaceType() & EGL_WINDOW_BIT) == EGL_WINDOW_BIT;
+}
+
+bool isES2Renderable (const eglu::CandidateConfig& c)
+{
+	return (c.get(EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES2_BIT) == EGL_OPENGL_ES2_BIT;
+}
+
+bool hasPreserveSwap (const eglu::CandidateConfig& c)
+{
+	return (c.surfaceType() & EGL_SWAP_BEHAVIOR_PRESERVED_BIT) == EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+}
+
+EGLConfig getEGLConfig (const Library& egl, EGLDisplay eglDisplay, bool preserveColorBuffer)
+{
+	eglu::FilterList filters;
+ 	filters << isWindow << isES2Renderable;
+ 	if (preserveColorBuffer)
+ 		filters << hasPreserveSwap;
+ 	return eglu::chooseSingleConfig(egl, eglDisplay, filters);
+}
+
+void clearColorScreen (const glw::Functions& gl, const tcu::Vec4& clearColor)
+{
+	gl.clearColor(clearColor.x(), clearColor.y(), clearColor.z(), clearColor.w());
+	gl.clear(GL_COLOR_BUFFER_BIT);
+}
+
+void clearColorReference (tcu::Surface* ref, const tcu::Vec4& clearColor)
+{
+	tcu::clear(ref->getAccess(), clearColor);
+}
+
+void readPixels (const glw::Functions& gl, tcu::Surface* screen)
+{
+	gl.readPixels(0, 0, screen->getWidth(), screen->getHeight(),  GL_RGBA, GL_UNSIGNED_BYTE, screen->getAccess().getDataPtr());
+}
+
+float windowToDeviceCoordinates (int x, int length)
+{
+	return (2.0f * float(x) / float(length)) - 1.0f;
+}
+
+bool compareToReference (tcu::TestLog& log,	 const tcu::Surface& reference, const tcu::Surface& buffer, int frameNdx, int bufferNum)
+{
+	std::ostringstream stream;
+	stream << "FrameNdx = " << frameNdx << ", compare current buffer (numbered: " << bufferNum << ") to reference";
+	return tcu::intThresholdPositionDeviationCompare(log, "buffer age test", stream.str().c_str(), reference.getAccess(), buffer.getAccess(),
+													 tcu::UVec4(8, 8, 8, 0), tcu::IVec3(2,2,0), true, tcu::COMPARE_LOG_RESULT);
+}
+
+} // anonymous
+
+BufferAgeTests::BufferAgeTests (EglTestContext& eglTestCtx)
+	: TestCaseGroup(eglTestCtx, "buffer_age", "Color buffer age tests")
+{
+}
+
+void BufferAgeTests::init (void)
+{
+	const BufferAgeTest::DrawType clearRender[2] =
+	{
+		BufferAgeTest::DRAWTYPE_GLES2_CLEAR,
+		BufferAgeTest::DRAWTYPE_GLES2_RENDER
+	};
+
+	const BufferAgeTest::DrawType renderClear[2] =
+	{
+		BufferAgeTest::DRAWTYPE_GLES2_RENDER,
+		BufferAgeTest::DRAWTYPE_GLES2_CLEAR
+	};
+
+	vector< vector<BufferAgeTest::DrawType> > frameDrawTypes;
+	frameDrawTypes.push_back(vector<BufferAgeTest::DrawType> ());
+	frameDrawTypes.push_back(vector<BufferAgeTest::DrawType> (1, BufferAgeTest::DRAWTYPE_GLES2_CLEAR));
+	frameDrawTypes.push_back(vector<BufferAgeTest::DrawType> (1, BufferAgeTest::DRAWTYPE_GLES2_RENDER));
+	frameDrawTypes.push_back(vector<BufferAgeTest::DrawType> (2, BufferAgeTest::DRAWTYPE_GLES2_CLEAR));
+	frameDrawTypes.push_back(vector<BufferAgeTest::DrawType> (2, BufferAgeTest::DRAWTYPE_GLES2_RENDER));
+	frameDrawTypes.push_back(vector<BufferAgeTest::DrawType> (DE_ARRAY_BEGIN(clearRender), DE_ARRAY_END(clearRender)));
+	frameDrawTypes.push_back(vector<BufferAgeTest::DrawType> (DE_ARRAY_BEGIN(renderClear), DE_ARRAY_END(renderClear)));
+
+	for (int preserveNdx = 0; preserveNdx < 2; preserveNdx++)
+	{
+		const bool			 preserve 		= (preserveNdx == 0);
+		TestCaseGroup* const preserveGroup 	= new TestCaseGroup(m_eglTestCtx, (preserve ? "preserve" : "no_preserve"), "");
+
+		for (size_t evenNdx = 0; evenNdx < frameDrawTypes.size(); evenNdx++)
+		{
+			const vector<BufferAgeTest::DrawType>& evenFrameDrawType = frameDrawTypes[evenNdx];
+
+			for (size_t oddNdx = evenNdx; oddNdx < frameDrawTypes.size(); oddNdx++)
+			{
+				const vector<BufferAgeTest::DrawType>& 	oddFrameDrawType = frameDrawTypes[oddNdx];
+				const std::string 						name 			 = generateTestName(oddFrameDrawType, evenFrameDrawType);
+				preserveGroup->addChild(new BufferAgeTest(m_eglTestCtx, preserve, oddFrameDrawType, evenFrameDrawType, name.c_str(), ""));
+			}
+		}
+		addChild(preserveGroup);
+	}
+}
+
+} // egl
+} // deqp
diff --git a/modules/egl/teglBufferAgeTests.hpp b/modules/egl/teglBufferAgeTests.hpp
new file mode 100644
index 0000000..fadf31a
--- /dev/null
+++ b/modules/egl/teglBufferAgeTests.hpp
@@ -0,0 +1,48 @@
+#ifndef _TEGLBUFFERAGETESTS_HPP
+#define _TEGLBUFFERAGETESTS_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program EGL Module
+ * ---------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * 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 Test EXT_buffer_age
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "teglTestCase.hpp"
+
+namespace deqp
+{
+namespace egl
+{
+
+class BufferAgeTests : public TestCaseGroup
+{
+public:
+						BufferAgeTests	(EglTestContext& eglTestCtx);
+	void				init			(void);
+
+private:
+						BufferAgeTests  (const BufferAgeTests&);
+	BufferAgeTests&		operator=		(const BufferAgeTests&);
+};
+
+} // egl
+} // deqp
+
+#endif // _TEGLBUFFERAGETESTS_HPP
diff --git a/modules/egl/teglGLES2SharedRenderingPerfTests.cpp b/modules/egl/teglGLES2SharedRenderingPerfTests.cpp
index 65c92af..5e2dcc9 100644
--- a/modules/egl/teglGLES2SharedRenderingPerfTests.cpp
+++ b/modules/egl/teglGLES2SharedRenderingPerfTests.cpp
@@ -262,9 +262,9 @@
 	{
 		for (int y = 0; y < config.textureHeight; y++)
 		{
-			data.push_back((255*x)/255);
-			data.push_back((255*y)/255);
-			data.push_back((255*x*y)/(255*255));
+			data.push_back((deUint8)((255*x)/255));
+			data.push_back((deUint8)((255*y)/255));
+			data.push_back((deUint8)((255*x*y)/(255*255)));
 			data.push_back(255);
 		}
 	}
@@ -966,22 +966,22 @@
 
 	deviation = 0.0;
 	for (int resultNdx = 0; resultNdx < (int)resultsUs.size(); resultNdx++)
-		deviation += (resultsUs[resultNdx] - average) * (resultsUs[resultNdx] - average);
+		deviation += (double)((resultsUs[resultNdx] - average) * (resultsUs[resultNdx] - average));
 
-	deviation = std::sqrt((double)(deviation/resultsUs.size()));
+	deviation = std::sqrt(deviation/(double)resultsUs.size());
 
 	{
 		tcu::ScopedLogSection	section(log, "Statistics from results", "Statistics from results");
 
 		log << TestLog::Message
-		<< "Average: "					<< (average/1000.0)											<< "ms\n"
-		<< "Standart deviation: "		<< (deviation/1000.0)										<< "ms\n"
-		<< "Standart error of mean: "	<< ((deviation/std::sqrt((double)resultsUs.size()))/1000.0)	<< "ms\n"
-		<< "Median: "					<< (median/1000.0)											<< "ms\n"
+		<< "Average: "					<< ((double)average/1000.0)											<< "ms\n"
+		<< "Standard deviation: "		<< ((double)deviation/1000.0)										<< "ms\n"
+		<< "Standard error of mean: "	<< (((double)deviation/std::sqrt((double)resultsUs.size()))/1000.0)	<< "ms\n"
+		<< "Median: "					<< ((double)median/1000.0)											<< "ms\n"
 		<< TestLog::EndMessage;
 	}
 
-	testCtx.setTestResult(QP_TEST_RESULT_PASS, de::floatToString((float)(average/1000.0), 2).c_str());
+	testCtx.setTestResult(QP_TEST_RESULT_PASS, de::floatToString((float)((double)average/1000.0), 2).c_str());
 }
 
 void logTestConfig (TestLog& log, const TestConfig& config)
diff --git a/modules/egl/teglGLES2SharingTests.cpp b/modules/egl/teglGLES2SharingTests.cpp
index 0219e38..33b02b4 100644
--- a/modules/egl/teglGLES2SharingTests.cpp
+++ b/modules/egl/teglGLES2SharingTests.cpp
@@ -366,24 +366,24 @@
 
 	for (int i = 0; i < (int)m_buffer.size() / 4; i++)
 	{
-		indices.push_back(i*4);
-		indices.push_back(i*4 + 1);
-		indices.push_back(i*4 + 2);
-		indices.push_back(i*4 + 2);
-		indices.push_back(i*4 + 3);
-		indices.push_back(i*4);
+		indices.push_back((deUint16)(i*4));
+		indices.push_back((deUint16)(i*4 + 1));
+		indices.push_back((deUint16)(i*4 + 2));
+		indices.push_back((deUint16)(i*4 + 2));
+		indices.push_back((deUint16)(i*4 + 3));
+		indices.push_back((deUint16)(i*4));
 
-		coords.push_back(0.125f * (i % 16) - 1.0f);
-		coords.push_back(0.125f * ((int)(i / 16.0f)) - 1.0f);
+		coords.push_back(0.125f * (float)(i % 16) - 1.0f);
+		coords.push_back(0.125f * (float)((int)((float)i / 16.0f)) - 1.0f);
 
-		coords.push_back(0.125f * (i % 16) - 1.0f);
-		coords.push_back(0.125f * ((int)(i / 16.0f) + 1) - 1.0f);
+		coords.push_back(0.125f * (float)(i % 16) - 1.0f);
+		coords.push_back(0.125f * (float)((int)((float)i / 16.0f) + 1) - 1.0f);
 
-		coords.push_back(0.125f * ((i % 16) + 1) - 1.0f);
-		coords.push_back(0.125f * ((int)(i / 16.0f) + 1) - 1.0f);
+		coords.push_back(0.125f * (float)((i % 16) + 1) - 1.0f);
+		coords.push_back(0.125f * (float)((int)((float)i / 16.0f) + 1) - 1.0f);
 
-		coords.push_back(0.125f * ((i % 16) + 1) - 1.0f);
-		coords.push_back(0.125f * ((int)(i / 16.0f)) - 1.0f);
+		coords.push_back(0.125f * (float)((i % 16) + 1) - 1.0f);
+		coords.push_back(0.125f * (float)((int)((float)i / 16.0f)) - 1.0f);
 	}
 
 	int width = 240;
@@ -431,17 +431,17 @@
 		m_gl.readPixels(0, 0, screen->getWidth(), screen->getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, screen->getAccess().getDataPtr());
 		for (int i = 0; i < (int)m_buffer.size() / 4; i++)
 		{
-			float fx1 = 0.125f * (i % 16) - 1.0f;
-			float fy1 = 0.125f * ((int)(i / 16.0f)) - 1.0f;
-			float fx2 = 0.125f * ((i % 16) + 1) - 1.0f;
-			float fy2 = 0.125f * ((int)((i / 16.0f) + 1)) - 1.0f;
+			float fx1 = 0.125f * (float)(i % 16) - 1.0f;
+			float fy1 = 0.125f * (float)((int)((float)i / 16.0f)) - 1.0f;
+			float fx2 = 0.125f * (float)((i % 16) + 1) - 1.0f;
+			float fy2 = 0.125f * (float)((int)((float)i / 16.0f) + 1) - 1.0f;
 
-			int ox = deRoundFloatToInt32(width		/ 2.0f);
-			int oy = deRoundFloatToInt32(height		/ 2.0f);
-			int x1 = deRoundFloatToInt32((width		 * fx1 / 2.0f) + ox);
-			int y1 = deRoundFloatToInt32((height	 * fy1 / 2.0f) + oy);
-			int x2 = deRoundFloatToInt32((width		 * fx2 / 2.0f) + ox);
-			int y2 = deRoundFloatToInt32((height	 * fy2 / 2.0f) + oy);
+			int ox = deRoundFloatToInt32((float)width	/ 2.0f);
+			int oy = deRoundFloatToInt32((float)height	/ 2.0f);
+			int x1 = deRoundFloatToInt32(((float)width	 * fx1 / 2.0f) + (float)ox);
+			int y1 = deRoundFloatToInt32(((float)height	 * fy1 / 2.0f) + (float)oy);
+			int x2 = deRoundFloatToInt32(((float)width	 * fx2 / 2.0f) + (float)ox);
+			int y2 = deRoundFloatToInt32(((float)height	 * fy2 / 2.0f) + (float)oy);
 
 			for (int x = x1; x < x2; x++)
 			{
@@ -610,8 +610,8 @@
 		{
 			for (int y = 0; y < height; y++)
 			{
-				float t = ((float)x / (width - 1.0f));
-				float s = ((float)y / (height - 1.0f));
+				float t = ((float)x / ((float)width - 1.0f));
+				float s = ((float)y / ((float)height - 1.0f));
 				float lod = 0.0f;
 
 				tcu::Vec4 color = m_texture.sample(tcu::Sampler(tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::LINEAR, tcu::Sampler::LINEAR), t, s, lod);
@@ -741,17 +741,17 @@
 
 		tcu::clear(reference->getAccess(), tcu::IVec4(0xff, 0, 0, 0xff));
 
-		int x1 = (int)((width/2.0f) * (-0.9f) + (width/2.0f));
-		int x2 = (int)((width/2.0f) * 0.9f + (width/2.0f));
-		int y1 = (int)((height/2.0f) * (-0.9f) + (height/2.0f));
-		int y2 = (int)((height/2.0f) * 0.9f + (height/2.0f));
+		int x1 = (int)(((float)width/2.0f)  * (-0.9f) + ((float)width/2.0f));
+		int x2 = (int)(((float)width/2.0f)  *   0.9f  + ((float)width/2.0f));
+		int y1 = (int)(((float)height/2.0f) * (-0.9f) + ((float)height/2.0f));
+		int y2 = (int)(((float)height/2.0f) *   0.9f  + ((float)height/2.0f));
 
 		for (int x = x1; x <= x2; x++)
 		{
 			for (int y = y1; y <= y2; y++)
 			{
-				float t = ((float)(x-x1) / (x2 - x1));
-				float s = ((float)(y-y1) / (y2-y1));
+				float t = ((float)(x-x1) / (float)(x2-x1));
+				float s = ((float)(y-y1) / (float)(y2-y1));
 				bool isUpper = t > s;
 
 				tcu::Vec4 a(colors[0],		colors[1],		colors[2],		colors[3]);
@@ -1030,17 +1030,17 @@
 
 		tcu::clear(reference->getAccess(), tcu::IVec4(0xff, 0, 0, 0xff));
 
-		int x1 = (int)((width/2.0f) * (-0.9f) + (width/2.0f));
-		int x2 = (int)((width/2.0f) * 0.9f + (width/2.0f));
-		int y1 = (int)((height/2.0f) * (-0.9f) + (height/2.0f));
-		int y2 = (int)((height/2.0f) * 0.9f + (height/2.0f));
+		int x1 = (int)(((float)width/2.0f)  * (-0.9f) + ((float)width/2.0f));
+		int x2 = (int)(((float)width/2.0f)  *   0.9f  + ((float)width/2.0f));
+		int y1 = (int)(((float)height/2.0f) * (-0.9f) + ((float)height/2.0f));
+		int y2 = (int)(((float)height/2.0f) *   0.9f  + ((float)height/2.0f));
 
 		for (int x = x1; x <= x2; x++)
 		{
 			for (int y = y1; y <= y2; y++)
 			{
-				float t = ((float)(x-x1) / (x2 - x1));
-				float s = ((float)(y-y1) / (y2-y1));
+				float t = ((float)(x-x1) / (float)(x2-x1));
+				float s = ((float)(y-y1) / (float)(y2-y1));
 				bool isUpper = t > s;
 
 				tcu::Vec4 a(colors[0],		colors[1],		colors[2],		colors[3]);
diff --git a/modules/egl/teglGLES2SharingThreadedTests.cpp b/modules/egl/teglGLES2SharingThreadedTests.cpp
index 78da36b..2a44613 100644
--- a/modules/egl/teglGLES2SharingThreadedTests.cpp
+++ b/modules/egl/teglGLES2SharingThreadedTests.cpp
@@ -2258,7 +2258,7 @@
 
 void GLES2SharingRandomTest::addRandomOperation (GLES2ThreadTest::EGLResourceManager& resourceManager)
 {
-	int threadNdx	= m_random.getUint32() % m_threads.size();
+	int threadNdx	= m_random.getUint32() % (deUint32)m_threads.size();
 
 	std::vector<OperationId>	operations;
 	std::vector<float>			weights;
diff --git a/modules/egl/teglImageFormatTests.cpp b/modules/egl/teglImageFormatTests.cpp
index 1974e85..53832a9 100644
--- a/modules/egl/teglImageFormatTests.cpp
+++ b/modules/egl/teglImageFormatTests.cpp
@@ -533,7 +533,7 @@
 	for (int level = 0; level < DE_LENGTH_OF_ARRAY(depthLevelColors); level++)
 	{
 		const tcu::Vec4	color		= depthLevelColors[level];
-		const float		clipDepth	= ((level + 1) * 0.1f) * 2.0f - 1.0f; // depth in clip coords
+		const float		clipDepth	= ((float)(level + 1) * 0.1f) * 2.0f - 1.0f; // depth in clip coords
 
 		GLU_CHECK_GLW_CALL(gl, uniform4f(colorLoc, color.x(), color.y(), color.z(), color.w()));
 		GLU_CHECK_GLW_CALL(gl, uniform1f(depthLoc, clipDepth));
@@ -558,7 +558,7 @@
 
 			for (int level = 0; level < DE_LENGTH_OF_ARRAY(depthLevelColors); level++)
 			{
-				if ((level + 1) * 0.1f < refAccess.getPixDepth(x, y))
+				if ((float)(level + 1) * 0.1f < refAccess.getPixDepth(x, y))
 					result = depthLevelColors[level];
 			}
 
@@ -653,7 +653,7 @@
 	for (int level = 0; level < DE_LENGTH_OF_ARRAY(stencilLevelColors); level++)
 	{
 		const tcu::Vec4	color	= stencilLevelColors[level];
-		const int		stencil	= (int)(((level + 1) * 0.1f) * maxStencil);
+		const int		stencil	= (int)(((float)(level + 1) * 0.1f) * (float)maxStencil);
 
 		GLU_CHECK_GLW_CALL(gl, stencilFunc(GL_LESS, stencil, 0xFFFFFFFFu));
 		GLU_CHECK_GLW_CALL(gl, uniform4f(colorLoc, color.x(), color.y(), color.z(), color.w()));
@@ -676,7 +676,7 @@
 
 		for (int level = 0; level < DE_LENGTH_OF_ARRAY(stencilLevelColors); level++)
 		{
-			const int levelStencil = (int)(((level + 1) * 0.1f) * maxStencil);
+			const int levelStencil = (int)(((float)(level + 1) * 0.1f) * (float)maxStencil);
 			if (levelStencil < refAccess.getPixStencil(x, y))
 				result = stencilLevelColors[level];
 		}
diff --git a/modules/egl/teglImageTests.cpp b/modules/egl/teglImageTests.cpp
index b6ef160..69575f4 100644
--- a/modules/egl/teglImageTests.cpp
+++ b/modules/egl/teglImageTests.cpp
@@ -324,7 +324,7 @@
 			case EGL_NATIVE_BUFFER_ANDROID:
 				return createAndroidNativeImageSource(format);
 			default:
-				DE_ASSERT(!"Impossible");
+				DE_FATAL("Impossible");
 				return MovePtr<ImageSource>();
 		}
 	}
diff --git a/modules/egl/teglImageUtil.cpp b/modules/egl/teglImageUtil.cpp
index 825361e..0fecb60 100644
--- a/modules/egl/teglImageUtil.cpp
+++ b/modules/egl/teglImageUtil.cpp
@@ -344,8 +344,8 @@
 	for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(stencilValues); ++ndx)
 	{
 		const deUint32		stencil	= stencilValues[ndx] & stencilMask;
-		const tcu::IVec2	size	= tcu::IVec2((int)((DE_LENGTH_OF_ARRAY(stencilValues) - ndx) * (ref.getWidth() / float(DE_LENGTH_OF_ARRAY(stencilValues)))),
-												 (int)((DE_LENGTH_OF_ARRAY(stencilValues) - ndx) * (ref.getHeight() / float(DE_LENGTH_OF_ARRAY(stencilValues) + 4)))); // not symmetric
+		const tcu::IVec2	size	= tcu::IVec2((int)((float)(DE_LENGTH_OF_ARRAY(stencilValues) - ndx) * ((float)ref.getWidth() / float(DE_LENGTH_OF_ARRAY(stencilValues)))),
+												 (int)((float)(DE_LENGTH_OF_ARRAY(stencilValues) - ndx) * ((float)ref.getHeight() / float(DE_LENGTH_OF_ARRAY(stencilValues) + 4)))); // not symmetric
 
 		if (size.x() == 0 || size.y() == 0)
 			break;
@@ -377,9 +377,9 @@
 	GLU_CHECK_GLW_CALL(gl, enable(GL_SCISSOR_TEST));
 	for (int ndx = 0; ndx < NUM_STEPS; ++ndx)
 	{
-		const float			depth	= ndx / float(NUM_STEPS);
-		const tcu::IVec2	size	= tcu::IVec2((int)((NUM_STEPS - ndx) * (ref.getWidth() / float(NUM_STEPS))),
-												 (int)((NUM_STEPS - ndx) * (ref.getHeight() / float(NUM_STEPS + 4)))); // not symmetric
+		const float			depth	= (float)ndx / float(NUM_STEPS);
+		const tcu::IVec2	size	= tcu::IVec2((int)((float)(NUM_STEPS - ndx) * ((float)ref.getWidth() / float(NUM_STEPS))),
+												 (int)((float)(NUM_STEPS - ndx) * ((float)ref.getHeight() / float(NUM_STEPS + 4)))); // not symmetric
 
 		if (size.x() == 0 || size.y() == 0)
 			break;
@@ -419,8 +419,8 @@
 	GLU_CHECK_GLW_CALL(gl, enable(GL_SCISSOR_TEST));
 	for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(colorValues); ++ndx)
 	{
-		const tcu::IVec2	size	= tcu::IVec2((int)((DE_LENGTH_OF_ARRAY(colorValues) - ndx) * (ref.getWidth() / float(DE_LENGTH_OF_ARRAY(colorValues)))),
-												 (int)((DE_LENGTH_OF_ARRAY(colorValues) - ndx) * (ref.getHeight() / float(DE_LENGTH_OF_ARRAY(colorValues) + 4)))); // not symmetric
+		const tcu::IVec2	size	= tcu::IVec2((int)((float)(DE_LENGTH_OF_ARRAY(colorValues) - ndx) * ((float)ref.getWidth() / float(DE_LENGTH_OF_ARRAY(colorValues)))),
+												 (int)((float)(DE_LENGTH_OF_ARRAY(colorValues) - ndx) * ((float)ref.getHeight() / float(DE_LENGTH_OF_ARRAY(colorValues) + 4)))); // not symmetric
 
 		if (size.x() == 0 || size.y() == 0)
 			break;
@@ -474,7 +474,7 @@
 				initializeColorRbo(gl, rbo, *ref);
 				break;
 			default:
-				DE_ASSERT(!"Impossible");
+				DE_FATAL("Impossible");
 		}
 
 		gl.bindFramebuffer(GL_FRAMEBUFFER, 0);
diff --git a/modules/egl/teglMakeCurrentPerfTests.cpp b/modules/egl/teglMakeCurrentPerfTests.cpp
index 9bf82ed..af552f6 100644
--- a/modules/egl/teglMakeCurrentPerfTests.cpp
+++ b/modules/egl/teglMakeCurrentPerfTests.cpp
@@ -460,8 +460,8 @@
 		}
 
 		// Calculate mean and median
-		iterationTimeMeanUs		= ((float)(((double)totalTimeUs) / totalIterationCount));
-		iterationTimeMedianUs	= ((float)(((double)m_samples[m_samples.size() / 2]) / m_spec.iterationCount));
+		iterationTimeMeanUs		= ((float)(((double)totalTimeUs) / (double)totalIterationCount));
+		iterationTimeMedianUs	= ((float)(((double)m_samples[m_samples.size() / 2]) / (double)m_spec.iterationCount));
 
 		// Calculate variance
 		for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++)
@@ -478,7 +478,7 @@
 			iterationTimeMaxUs		= std::max<float>(iterationTimeMaxUs, iterationTimeUs);
 		}
 
-		iterationTimeVarianceUs /= m_samples.size();
+		iterationTimeVarianceUs /= (float)m_samples.size();
 
 		// Calculate skewness
 		for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++)
@@ -501,7 +501,7 @@
 			log << TestLog::Message << "Max: "			<< iterationTimeMaxUs		<< "us" << TestLog::EndMessage;
 		}
 
-		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, de::floatToString((float)(((double)totalTimeUs)/totalIterationCount), 2).c_str());
+		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, de::floatToString((float)(((double)totalTimeUs)/(double)totalIterationCount), 2).c_str());
 	}
 }
 
diff --git a/modules/egl/teglMemoryStressTests.cpp b/modules/egl/teglMemoryStressTests.cpp
index 269dcfe..2ad9cfb 100644
--- a/modules/egl/teglMemoryStressTests.cpp
+++ b/modules/egl/teglMemoryStressTests.cpp
@@ -449,7 +449,7 @@
 		}
 		else
 		{
-			float change = (min - max) / ((float)(max));
+			float change = (float)(min - max) / ((float)(max));
 
 			if (change > threshold)
 			{
diff --git a/modules/egl/teglNativeColorMappingTests.cpp b/modules/egl/teglNativeColorMappingTests.cpp
index 415a732..c116dab 100644
--- a/modules/egl/teglNativeColorMappingTests.cpp
+++ b/modules/egl/teglNativeColorMappingTests.cpp
@@ -258,10 +258,10 @@
 							  deMinu32(nativeBitDepth.z(), eglBitDepth.z()),
 							  deMinu32(nativeBitDepth.w(), eglBitDepth.w()));
 
-	const tcu::UVec4 uColor = tcu::UVec4((deUint32)(((1u << bitDepth.x()) - 1u) * color.x()),
-										 (deUint32)(((1u << bitDepth.y()) - 1u) * color.y()),
-										 (deUint32)(((1u << bitDepth.z()) - 1u) * color.z()),
-										 (deUint32)(((1u << bitDepth.w()) - 1u) * color.w()));
+	const tcu::UVec4 uColor = tcu::UVec4((deUint32)((float)((1u << bitDepth.x()) - 1u) * color.x()),
+										 (deUint32)((float)((1u << bitDepth.y()) - 1u) * color.y()),
+										 (deUint32)((float)((1u << bitDepth.z()) - 1u) * color.z()),
+										 (deUint32)((float)((1u << bitDepth.w()) - 1u) * color.w()));
 
 	tcu::TextureLevel reference(result.getFormat(), result.getWidth(), result.getHeight());
 
diff --git a/modules/egl/teglNativeCoordMappingTests.cpp b/modules/egl/teglNativeCoordMappingTests.cpp
index c704665..37c2c5d 100644
--- a/modules/egl/teglNativeCoordMappingTests.cpp
+++ b/modules/egl/teglNativeCoordMappingTests.cpp
@@ -220,8 +220,8 @@
 
 tcu::Vec2 toGLCoord (int width, int height, int x, int y)
 {
-	const float xf = (float(2.0f * x) / width) - 1.0f;
-	const float yf = (float(2.0f * y) / height) -  1.0f;
+	const float xf = ((2.0f * float(x)) / (float)width)  - 1.0f;
+	const float yf = ((2.0f * float(y)) / (float)height) - 1.0f;
 
 	return tcu::Vec2(xf, yf);
 }
diff --git a/modules/egl/teglNegativeApiTests.cpp b/modules/egl/teglNegativeApiTests.cpp
index 98e3f94..c2b7ebc 100644
--- a/modules/egl/teglNegativeApiTests.cpp
+++ b/modules/egl/teglNegativeApiTests.cpp
@@ -1362,7 +1362,7 @@
 				log << TestLog::Section("Test1", "EGL_BAD_PARAMETER is generated if engine is not a recognized marking engine and native rendering is supported by current surface");
 
 				eglWaitNative(-1);
-				expectEitherError(EGL_BAD_PARAMETER, EGL_NONE);
+				expectEitherError(EGL_BAD_PARAMETER, EGL_SUCCESS);
 
 				log << TestLog::EndSection;
 
diff --git a/modules/egl/teglNegativePartialUpdateTests.cpp b/modules/egl/teglNegativePartialUpdateTests.cpp
new file mode 100644
index 0000000..19d9d95
--- /dev/null
+++ b/modules/egl/teglNegativePartialUpdateTests.cpp
@@ -0,0 +1,487 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program EGL Module
+ * ---------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * 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 Test negative use case of KHR_partial_update
+ *//*--------------------------------------------------------------------*/
+
+#include "teglNegativePartialUpdateTests.hpp"
+
+#include "tcuTestLog.hpp"
+#include "tcuSurface.hpp"
+
+#include "egluNativeWindow.hpp"
+#include "egluUtil.hpp"
+#include "egluStrUtil.hpp"
+#include "egluConfigFilter.hpp"
+#include "egluCallLogWrapper.hpp"
+
+#include "eglwLibrary.hpp"
+#include "eglwEnums.hpp"
+
+using namespace eglu;
+using namespace eglw;
+using tcu::TestLog;
+
+namespace deqp
+{
+namespace egl
+{
+namespace
+{
+
+class NegativePartialUpdateTest : public TestCase
+{
+public:
+	enum SurfaceType
+	{
+		SURFACETYPE_WINDOW = 0,
+		SURFACETYPE_PBUFFER
+	};
+
+								NegativePartialUpdateTest		(EglTestContext& eglTestCtx, bool preserveBuffer, SurfaceType surfaceType, const char* name, const char* description);
+								~NegativePartialUpdateTest		(void);
+	void						init							(void);
+	void						deinit							(void);
+	virtual IterateResult		iterate							(void) = 0;
+
+protected:
+	void						expectError						(eglw::EGLenum error);
+	void						expectBoolean					(EGLBoolean expected, EGLBoolean got);
+	inline void					expectTrue						(eglw::EGLBoolean got) { expectBoolean(EGL_TRUE, got); }
+	inline void					expectFalse						(eglw::EGLBoolean got) { expectBoolean(EGL_FALSE, got); }
+
+	const bool					m_preserveBuffer;
+	SurfaceType					m_surfaceType;
+	EGLDisplay					m_eglDisplay;
+	EGLConfig					m_eglConfig;
+	NativeWindow*				m_window;
+	EGLSurface					m_eglSurface;
+	EGLContext					m_eglContext;
+};
+
+bool isWindow (const CandidateConfig& c)
+{
+	return (c.surfaceType() & EGL_WINDOW_BIT) == EGL_WINDOW_BIT;
+}
+
+bool isPbuffer (const CandidateConfig& c)
+{
+	return (c.surfaceType() & EGL_PBUFFER_BIT) == EGL_PBUFFER_BIT;
+}
+
+bool isES2Renderable (const CandidateConfig& c)
+{
+	return (c.get(EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES2_BIT) == EGL_OPENGL_ES2_BIT;
+}
+
+bool hasPreserveSwap (const CandidateConfig& c)
+{
+	return (c.surfaceType() & EGL_SWAP_BEHAVIOR_PRESERVED_BIT) == EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+}
+
+EGLConfig getEGLConfig (const Library& egl, EGLDisplay eglDisplay, NegativePartialUpdateTest::SurfaceType surfaceType, bool preserveBuffer)
+{
+	FilterList filters;
+	if (surfaceType == NegativePartialUpdateTest::SURFACETYPE_WINDOW)
+		filters << isWindow;
+	else if (surfaceType == NegativePartialUpdateTest::SURFACETYPE_PBUFFER)
+		filters << isPbuffer;
+	else
+		DE_FATAL("Invalid surfaceType");
+
+	filters << isES2Renderable;
+
+	if (preserveBuffer)
+		filters << hasPreserveSwap;
+
+	return chooseSingleConfig(egl, eglDisplay, filters);
+}
+
+EGLContext initAndMakeCurrentEGLContext (const Library& egl, EGLDisplay eglDisplay, EGLSurface eglSurface, EGLConfig eglConfig, const EGLint* attribList)
+{
+	EGLContext eglContext = EGL_NO_CONTEXT;
+
+	egl.bindAPI(EGL_OPENGL_ES_API);
+	eglContext = egl.createContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, attribList);
+	EGLU_CHECK_MSG(egl, "eglCreateContext");
+	TCU_CHECK(eglSurface != EGL_NO_SURFACE);
+	egl.makeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
+	EGLU_CHECK_MSG(egl, "eglMakeCurrent");
+
+	return eglContext;
+}
+
+NegativePartialUpdateTest::NegativePartialUpdateTest (EglTestContext& eglTestCtx, bool preserveBuffer, SurfaceType surfaceType, const char* name, const char* description)
+	: TestCase			(eglTestCtx, name, description)
+	, m_preserveBuffer	(preserveBuffer)
+	, m_surfaceType		(surfaceType)
+	, m_eglDisplay		(EGL_NO_DISPLAY)
+	, m_window			(DE_NULL)
+	, m_eglSurface		(EGL_NO_SURFACE)
+	, m_eglContext		(EGL_NO_CONTEXT)
+{
+}
+
+NegativePartialUpdateTest::~NegativePartialUpdateTest (void)
+{
+	deinit();
+}
+
+void NegativePartialUpdateTest::init (void)
+{
+	const Library&		egl						= m_eglTestCtx.getLibrary();
+	static const EGLint	contextAttribList[]		= { EGL_CONTEXT_CLIENT_VERSION, 2,	EGL_NONE };
+	const int			width					= 480;
+	const int			height					= 480;
+
+	m_eglDisplay = getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
+
+	if (!hasExtension(egl, m_eglDisplay, "EGL_KHR_partial_update"))
+		TCU_THROW(NotSupportedError, "EGL_KHR_partial_update is not supported");
+
+	m_eglConfig = getEGLConfig(egl, m_eglDisplay, m_surfaceType, m_preserveBuffer);
+
+	if (m_surfaceType == SURFACETYPE_PBUFFER)
+	{
+		const EGLint pbufferAttribList[] = { EGL_WIDTH, width, EGL_HEIGHT, height, EGL_NONE };
+		m_eglSurface = egl.createPbufferSurface(m_eglDisplay, m_eglConfig, pbufferAttribList);
+	}
+	else
+	{
+		const NativeWindowFactory&	factory	= selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+		m_window = factory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, m_eglConfig, DE_NULL,
+										WindowParams(width, height, parseWindowVisibility(m_testCtx.getCommandLine())));
+		m_eglSurface = createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_window, m_eglDisplay, m_eglConfig, DE_NULL);
+	}
+	m_eglContext = initAndMakeCurrentEGLContext(egl, m_eglDisplay, m_eglSurface, m_eglConfig, contextAttribList);
+}
+
+void NegativePartialUpdateTest::deinit (void)
+{
+	const Library& egl = m_eglTestCtx.getLibrary();
+
+	if (m_eglContext != EGL_NO_CONTEXT)
+	{
+		EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
+		EGLU_CHECK_CALL(egl, destroyContext(m_eglDisplay, m_eglContext));
+		m_eglContext = EGL_NO_CONTEXT;
+	}
+
+	if (m_eglSurface != EGL_NO_SURFACE)
+	{
+		EGLU_CHECK_CALL(egl, destroySurface(m_eglDisplay, m_eglSurface));
+		m_eglSurface = EGL_NO_SURFACE;
+	}
+
+	if (m_eglDisplay != EGL_NO_DISPLAY)
+	{
+		EGLU_CHECK_CALL(egl, terminate(m_eglDisplay));
+		m_eglDisplay = EGL_NO_DISPLAY;
+	}
+
+	delete m_window;
+	m_window = DE_NULL;
+}
+
+void NegativePartialUpdateTest::expectError (EGLenum expected)
+{
+	const EGLenum err = m_eglTestCtx.getLibrary().getError();
+
+	if (err != expected)
+	{
+		m_testCtx.getLog() << TestLog::Message << "// ERROR expected: " << eglu::getErrorStr(expected) << ", Got: " << eglu::getErrorStr(err) << TestLog::EndMessage;
+		if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
+			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid error");
+	}
+}
+
+void NegativePartialUpdateTest::expectBoolean (EGLBoolean expected, EGLBoolean got)
+{
+	if (expected != got)
+	{
+		m_testCtx.getLog() << TestLog::Message << "// ERROR expected: " << eglu::getBooleanStr(expected) <<  ", Got: " << eglu::getBooleanStr(got) << TestLog::EndMessage;
+		if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
+			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid value");
+	}
+}
+
+class NotPostableTest : public NegativePartialUpdateTest
+{
+public:
+							NotPostableTest (EglTestContext& context);
+	TestCase::IterateResult iterate			(void);
+};
+
+NotPostableTest::NotPostableTest (EglTestContext& context)
+	: NegativePartialUpdateTest (context, false, SURFACETYPE_PBUFFER, "not_postable_surface",  "Call setDamageRegion() on pbuffer")
+{
+}
+
+TestCase::IterateResult NotPostableTest::iterate (void)
+{
+	const Library&			egl				= m_eglTestCtx.getLibrary();
+	TestLog&				log				= m_testCtx.getLog();
+	CallLogWrapper			wrapper			(egl, log);
+	EGLint 					damageRegion[]	= { 10, 10, 10, 10 };
+	int						bufferAge		= -1;
+
+	wrapper.enableLogging(true);
+	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+	{
+		tcu::ScopedLogSection(log, "Test1", "If the surface is pbuffer (not postable) --> EGL_BAD_MATCH");
+		EGLU_CHECK_CALL(egl, surfaceAttrib(m_eglDisplay, m_eglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED));
+		EGLU_CHECK_CALL(egl, querySurface(m_eglDisplay, m_eglSurface, EGL_BUFFER_AGE_KHR, &bufferAge));
+		expectFalse(wrapper.eglSetDamageRegionKHR(m_eglDisplay, m_eglSurface, damageRegion, DE_LENGTH_OF_ARRAY(damageRegion)/4));
+		expectError(EGL_BAD_MATCH);
+	}
+
+	return STOP;
+}
+
+class NotCurrentSurfaceTest : public NegativePartialUpdateTest
+{
+public:
+							NotCurrentSurfaceTest	(EglTestContext& context);
+	TestCase::IterateResult iterate					(void);
+};
+
+NotCurrentSurfaceTest::NotCurrentSurfaceTest (EglTestContext& context)
+	: NegativePartialUpdateTest (context, false, SURFACETYPE_WINDOW, "not_current_surface",  "Call setDamageRegion() on pbuffer")
+{
+}
+
+TestCase::IterateResult NotCurrentSurfaceTest::iterate (void)
+{
+	const int 				impossibleBufferAge = -26084;
+	const Library&			egl					= m_eglTestCtx.getLibrary();
+	TestLog&				log					= m_testCtx.getLog();
+	CallLogWrapper			wrapper				(egl, log);
+	EGLint 					damageRegion[]		= { 10, 10, 10, 10 };
+	int						bufferAge			= impossibleBufferAge;
+
+	wrapper.enableLogging(true);
+	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+	egl.makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, m_eglContext);
+	{
+		tcu::ScopedLogSection(log, "Test2.1", "If query buffer age on a surface that is not the current draw surface --> EGL_BAD_SURFACE");
+		EGLU_CHECK_CALL(egl, surfaceAttrib(m_eglDisplay, m_eglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED));
+		expectFalse(wrapper.eglQuerySurface(m_eglDisplay, m_eglSurface, EGL_BUFFER_AGE_KHR, &bufferAge));
+		expectError(EGL_BAD_SURFACE);
+
+		if (bufferAge != impossibleBufferAge)
+		{
+			log << tcu::TestLog::Message << "On failure, eglQuerySurface shouldn't change buffer age but buffer age has been changed to " << bufferAge << tcu::TestLog::EndMessage;
+			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail, bufferAge shouldn't be changed");
+		}
+	}
+	{
+		tcu::ScopedLogSection(log, "Test2.2", "If call setDamageRegion() on a surface that is not the current draw surface --> EGL_BAD_MATCH");
+		expectFalse(wrapper.eglSetDamageRegionKHR(m_eglDisplay, m_eglSurface, damageRegion, 1));
+		expectError(EGL_BAD_MATCH);
+	}
+
+	return STOP;
+}
+
+class BufferPreservedTest : public NegativePartialUpdateTest
+{
+public:
+							BufferPreservedTest (EglTestContext& context);
+	TestCase::IterateResult iterate				(void);
+};
+
+BufferPreservedTest::BufferPreservedTest (EglTestContext& context)
+	: NegativePartialUpdateTest (context, true, SURFACETYPE_WINDOW, "buffer_preserved",  "Call setDamageRegion() on pbuffer")
+{
+}
+
+TestCase::IterateResult BufferPreservedTest::iterate (void)
+{
+	const Library&			egl				= m_eglTestCtx.getLibrary();
+	TestLog&				log				= m_testCtx.getLog();
+	CallLogWrapper			wrapper			(egl, log);
+	EGLint 					damageRegion[]	= { 10, 10, 10, 10 };
+	int						bufferAge		= -1;
+
+	wrapper.enableLogging(true);
+	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+	{
+		tcu::ScopedLogSection(log, "Test3", "If buffer_preserved --> EGL_BAD_MATCH");
+		EGLU_CHECK_CALL(egl, surfaceAttrib(m_eglDisplay, m_eglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED));
+		EGLU_CHECK_CALL(egl, querySurface(m_eglDisplay, m_eglSurface, EGL_BUFFER_AGE_KHR, &bufferAge));
+		expectFalse(wrapper.eglSetDamageRegionKHR(m_eglDisplay, m_eglSurface, damageRegion, DE_LENGTH_OF_ARRAY(damageRegion)/4));
+		expectError(EGL_BAD_MATCH);
+	}
+
+	return STOP;
+}
+
+class SetTwiceTest : public NegativePartialUpdateTest
+{
+public:
+							SetTwiceTest		(EglTestContext& context);
+	TestCase::IterateResult iterate				(void);
+};
+
+SetTwiceTest::SetTwiceTest (EglTestContext& context)
+	: NegativePartialUpdateTest (context, false, SURFACETYPE_WINDOW, "set_damage_region_twice",  "Call setDamageRegion() twice")
+{
+}
+
+TestCase::IterateResult SetTwiceTest::iterate (void)
+{
+	const Library&			egl				= m_eglTestCtx.getLibrary();
+	TestLog&				log				= m_testCtx.getLog();
+	CallLogWrapper			wrapper			(egl, log);
+	EGLint 					damageRegion[]	= { 10, 10, 10, 10 };
+	int						bufferAge		= -1;
+
+	wrapper.enableLogging(true);
+	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+	{
+		tcu::ScopedLogSection(log, "Test4", "If call setDamageRegion() twice --> EGL_BAD_ACCESS");
+		EGLU_CHECK_CALL(egl, surfaceAttrib(m_eglDisplay, m_eglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED));
+		EGLU_CHECK_CALL(egl, querySurface(m_eglDisplay, m_eglSurface, EGL_BUFFER_AGE_KHR, &bufferAge));
+		expectTrue(wrapper.eglSetDamageRegionKHR(m_eglDisplay, m_eglSurface, damageRegion, DE_LENGTH_OF_ARRAY(damageRegion)/4));
+		expectFalse(wrapper.eglSetDamageRegionKHR(m_eglDisplay, m_eglSurface, damageRegion, DE_LENGTH_OF_ARRAY(damageRegion)/4));
+		expectError(EGL_BAD_ACCESS);
+	}
+
+	return STOP;
+}
+
+
+class NoAgeTest : public NegativePartialUpdateTest
+{
+public:
+							NoAgeTest			(EglTestContext& context);
+	TestCase::IterateResult iterate				(void);
+};
+
+NoAgeTest::NoAgeTest (EglTestContext& context)
+	: NegativePartialUpdateTest (context, false, SURFACETYPE_WINDOW, "set_damage_region_before_query_age",  "Call setDamageRegion() without querying buffer age")
+{
+}
+
+TestCase::IterateResult NoAgeTest::iterate (void)
+{
+	const Library&			egl				= m_eglTestCtx.getLibrary();
+	TestLog&				log				= m_testCtx.getLog();
+	CallLogWrapper			wrapper			(egl, log);
+	EGLint 					damageRegion[]	= { 10, 10, 10, 10 };
+
+	wrapper.enableLogging(true);
+	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+	{
+		tcu::ScopedLogSection(log, "Test5", "If buffer age is not queried --> EGL_BAD_ACCESS");
+		EGLU_CHECK_CALL(egl, surfaceAttrib(m_eglDisplay, m_eglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED));
+		expectFalse(wrapper.eglSetDamageRegionKHR(m_eglDisplay, m_eglSurface, damageRegion, DE_LENGTH_OF_ARRAY(damageRegion)/4));
+		expectError(EGL_BAD_ACCESS);
+	}
+
+	return STOP;
+}
+
+class PassNullTest : public NegativePartialUpdateTest
+{
+public:
+							PassNullTest			(EglTestContext& context);
+	TestCase::IterateResult iterate					(void);
+};
+
+PassNullTest::PassNullTest (EglTestContext& context)
+	: NegativePartialUpdateTest (context, false, SURFACETYPE_WINDOW, "pass_null_0_as_params",  "Call setDamageRegion() with (NULL, 0)")
+{
+}
+
+TestCase::IterateResult PassNullTest::iterate (void)
+{
+	const Library&			egl				= m_eglTestCtx.getLibrary();
+	TestLog&				log				= m_testCtx.getLog();
+	CallLogWrapper			wrapper			(egl, log);
+	int						bufferAge		= -1;
+
+	wrapper.enableLogging(true);
+	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+	{
+		tcu::ScopedLogSection(log, "Test6", "If pass (null, 0) to setDamageRegion(), no error");
+		EGLU_CHECK_CALL(egl, surfaceAttrib(m_eglDisplay, m_eglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED));
+		EGLU_CHECK_CALL(egl, querySurface(m_eglDisplay, m_eglSurface, EGL_BUFFER_AGE_KHR, &bufferAge));
+		expectTrue(wrapper.eglSetDamageRegionKHR(m_eglDisplay, m_eglSurface, DE_NULL, 0));
+		expectError(EGL_SUCCESS);
+	}
+
+	return STOP;
+}
+
+class NotCurrentSurfaceTest2 : public NegativePartialUpdateTest
+{
+public:
+							NotCurrentSurfaceTest2	(EglTestContext& context);
+	TestCase::IterateResult iterate					(void);
+};
+
+NotCurrentSurfaceTest2::NotCurrentSurfaceTest2 (EglTestContext& context)
+	: NegativePartialUpdateTest (context, false, SURFACETYPE_WINDOW, "not_current_surface2",  "Call setDamageRegion() on pbuffer")
+{
+}
+
+TestCase::IterateResult NotCurrentSurfaceTest2::iterate (void)
+{
+	const Library&			egl				= m_eglTestCtx.getLibrary();
+	TestLog&				log				= m_testCtx.getLog();
+	CallLogWrapper			wrapper			(egl, log);
+	EGLint 					damageRegion[]	= { 10, 10, 10, 10 };
+	int						bufferAge		= -1;
+
+	wrapper.enableLogging(true);
+	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+	{
+		tcu::ScopedLogSection(log, "Test7", "If call setDamageRegion() on a surface that is not the current draw surface --> EGL_BAD_MATCH");
+		EGLU_CHECK_CALL(egl, surfaceAttrib(m_eglDisplay, m_eglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED));
+		EGLU_CHECK_CALL(egl, querySurface(m_eglDisplay, m_eglSurface, EGL_BUFFER_AGE_KHR, &bufferAge));
+		egl.makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, m_eglContext);
+		expectFalse(wrapper.eglSetDamageRegionKHR(m_eglDisplay, m_eglSurface, damageRegion, 1));
+		expectError(EGL_BAD_MATCH);
+	}
+
+	return STOP;
+}
+
+} // anonymous
+
+NegativePartialUpdateTests::NegativePartialUpdateTests (EglTestContext& eglTestCtx)
+	: TestCaseGroup(eglTestCtx, "negative_partial_update", "Negative partial update tests")
+{
+}
+
+void NegativePartialUpdateTests::init (void)
+{
+	addChild(new NotPostableTest(m_eglTestCtx));
+	addChild(new NotCurrentSurfaceTest(m_eglTestCtx));
+	addChild(new BufferPreservedTest(m_eglTestCtx));
+	addChild(new SetTwiceTest(m_eglTestCtx));
+	addChild(new NoAgeTest(m_eglTestCtx));
+	addChild(new PassNullTest(m_eglTestCtx));
+	addChild(new NotCurrentSurfaceTest2(m_eglTestCtx));
+}
+
+} // egl
+} // deqp
diff --git a/modules/egl/teglNegativePartialUpdateTests.hpp b/modules/egl/teglNegativePartialUpdateTests.hpp
new file mode 100644
index 0000000..100703e
--- /dev/null
+++ b/modules/egl/teglNegativePartialUpdateTests.hpp
@@ -0,0 +1,49 @@
+#ifndef _TEGLNEGATIVEPARTIALUPDATETESTS_HPP
+#define _TEGLNEGATIVEPARTIALUPDATETESTS_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program EGL Module
+ * ---------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * 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 Test Negative test for KHR_partial_update
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "teglTestCase.hpp"
+
+namespace deqp
+{
+namespace egl
+{
+
+class NegativePartialUpdateTests : public TestCaseGroup
+{
+public:
+								NegativePartialUpdateTests		(EglTestContext& eglTestCtx);
+	void						init							(void);
+
+private:
+								NegativePartialUpdateTests		(const NegativePartialUpdateTests&);
+	NegativePartialUpdateTests&	operator=						(const NegativePartialUpdateTests&);
+
+};
+
+} // egl
+} // deqp
+
+#endif // _TEGLNEGATIVEPARTIALUPDATETESTS_HPP
diff --git a/modules/egl/teglPartialUpdateTests.cpp b/modules/egl/teglPartialUpdateTests.cpp
new file mode 100644
index 0000000..ce48157
--- /dev/null
+++ b/modules/egl/teglPartialUpdateTests.cpp
@@ -0,0 +1,821 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program EGL Module
+ * ---------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * 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 Test KHR_partial_update
+ *//*--------------------------------------------------------------------*/
+
+#include "teglPartialUpdateTests.hpp"
+
+#include "tcuImageCompare.hpp"
+#include "tcuTestLog.hpp"
+#include "tcuSurface.hpp"
+#include "tcuTextureUtil.hpp"
+
+#include "egluNativeWindow.hpp"
+#include "egluUtil.hpp"
+#include "egluConfigFilter.hpp"
+
+#include "eglwLibrary.hpp"
+#include "eglwEnums.hpp"
+
+#include "gluDefs.hpp"
+#include "gluRenderContext.hpp"
+#include "gluShaderProgram.hpp"
+
+#include "glwDefs.hpp"
+#include "glwEnums.hpp"
+#include "glwFunctions.hpp"
+
+#include "deRandom.hpp"
+#include "deString.h"
+
+#include <string>
+#include <vector>
+#include <sstream>
+
+using std::string;
+using std::vector;
+using glw::GLubyte;
+using tcu::IVec2;
+
+using namespace eglw;
+
+namespace deqp
+{
+namespace egl
+{
+namespace
+{
+
+typedef	tcu::Vector<GLubyte, 3> Color;
+
+class GLES2Renderer;
+
+class ReferenceRenderer;
+
+class PartialUpdateTest : public TestCase
+{
+public:
+	enum DrawType
+	{
+		DRAWTYPE_GLES2_CLEAR,
+		DRAWTYPE_GLES2_RENDER
+	};
+
+								PartialUpdateTest		(EglTestContext& eglTestCtx,
+														 const vector<DrawType>& oddFrameDrawType,
+														 const vector<DrawType>& evenFrameDrawType,
+														 const char* name,
+														 const char* description);
+								~PartialUpdateTest		(void);
+
+	void						init					(void);
+	void						deinit					(void);
+	IterateResult				iterate					(void);
+
+private:
+	eglu::NativeWindow*			m_window;
+	EGLConfig					m_eglConfig;
+	EGLContext					m_eglContext;
+
+protected:
+	void						initEGLSurface			(EGLConfig config);
+	void						initEGLContext			(EGLConfig config);
+
+	const int					m_seed;
+	const vector<DrawType>	    m_oddFrameDrawType;
+	const vector<DrawType>		m_evenFrameDrawType;
+
+	bool 						m_supportBufferAge;
+	EGLDisplay					m_eglDisplay;
+	EGLSurface					m_eglSurface;
+	glw::Functions				m_gl;
+
+	GLES2Renderer*				m_gles2Renderer;
+	ReferenceRenderer*			m_refRenderer;
+};
+
+struct ColoredRect
+{
+public:
+								ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_);
+	IVec2	 					bottomLeft;
+	IVec2	 					topRight;
+	Color 						color;
+};
+
+ColoredRect::ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_)
+	: bottomLeft (bottomLeft_)
+	, topRight	 (topRight_)
+	, color		 (color_)
+{
+}
+
+struct DrawCommand
+{
+								DrawCommand (const PartialUpdateTest::DrawType drawType_, const ColoredRect& rect_);
+	PartialUpdateTest::DrawType	drawType;
+	ColoredRect					rect;
+};
+
+DrawCommand::DrawCommand (const PartialUpdateTest::DrawType drawType_, const ColoredRect& rect_)
+	: drawType	(drawType_)
+	, rect    	(rect_)
+{
+}
+
+struct Frame
+{
+								Frame (int width_, int height_);
+	int 						width;
+	int							height;
+	vector<DrawCommand> 		draws;
+};
+
+Frame::Frame (int width_, int height_)
+	: width (width_)
+	, height(height_)
+{
+}
+
+// (x1,y1) lie in the lower-left quadrant while (x2,y2) lie in the upper-right.
+// the coords are multiplied by 4 to amplify the minimial difference between coords to 4 (if not zero)
+// to avoid the situation where two edges are too close to each other which makes the rounding error
+// intoleratable by compareToReference()
+void generateRandomFrame (Frame& dst, const vector<PartialUpdateTest::DrawType>& drawTypes, de::Random& rnd)
+{
+	for (size_t ndx = 0; ndx < drawTypes.size(); ndx++)
+	{
+		const int			x1			= rnd.getInt(0, (dst.width-1)/8) * 4;
+		const int			y1			= rnd.getInt(0, (dst.height-1)/8) * 4;
+		const int			x2			= rnd.getInt((dst.width-1)/8, (dst.width-1)/4) * 4;
+		const int			y2			= rnd.getInt((dst.height-1)/8, (dst.height-1)/4) * 4;
+		const GLubyte		r			= rnd.getUint8();
+		const GLubyte		g			= rnd.getUint8();
+		const GLubyte		b			= rnd.getUint8();
+		const ColoredRect	coloredRect	(IVec2(x1, y1), IVec2(x2, y2), Color(r, g, b));
+		const DrawCommand	drawCommand	(drawTypes[ndx], coloredRect);
+
+		dst.draws.push_back(drawCommand);
+	}
+}
+
+typedef vector<Frame> FrameSequence;
+
+//helper function declaration
+EGLConfig		getEGLConfig					(const Library& egl, EGLDisplay eglDisplay);
+void			clearColorScreen				(const glw::Functions& gl, const tcu::Vec4& clearColor);
+void			clearColorReference				(tcu::Surface* ref, const tcu::Vec4& clearColor);
+void			readPixels						(const glw::Functions& gl, tcu::Surface* screen);
+float			windowToDeviceCoordinates		(int x, int length);
+bool			compareToReference				(tcu::TestLog& log, const tcu::Surface& reference, const tcu::Surface& buffer, int frameNdx, int bufferNum);
+vector<int> 	getFramesOnBuffer 				(const vector<int>& bufferAges, int frameNdx);
+
+class GLES2Renderer
+{
+public:
+							GLES2Renderer		(const glw::Functions& gl);
+							~GLES2Renderer		(void);
+	void					render				(int width, int height, const Frame& frame) const;
+
+private:
+							GLES2Renderer		(const GLES2Renderer&);
+	GLES2Renderer&			operator=			(const GLES2Renderer&);
+
+	const glw::Functions&	m_gl;
+	glu::ShaderProgram		m_glProgram;
+	glw::GLuint				m_coordLoc;
+	glw::GLuint				m_colorLoc;
+};
+
+// generate sources for vertex and fragment buffer
+glu::ProgramSources getSources (void)
+{
+	const char* const vertexShaderSource =
+		"attribute mediump vec2 a_pos;\n"
+		"attribute mediump vec4 a_color;\n"
+		"varying mediump vec4 v_color;\n"
+		"void main(void)\n"
+		"{\n"
+		"\tv_color = a_color;\n"
+		"\tgl_Position = vec4(a_pos, 0.0, 1.0);\n"
+		"}";
+
+	const char* const fragmentShaderSource =
+		"varying mediump vec4 v_color;\n"
+		"void main(void)\n"
+		"{\n"
+		"\tgl_FragColor = v_color;\n"
+		"}";
+
+	return glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource);
+}
+
+GLES2Renderer::GLES2Renderer (const glw::Functions& gl)
+	: m_gl				(gl)
+	, m_glProgram		(gl, getSources())
+	, m_coordLoc		((glw::GLuint)-1)
+	, m_colorLoc		((glw::GLuint)-1)
+{
+	m_colorLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_color");
+	m_coordLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_pos");
+	GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to get attribute locations");
+}
+
+GLES2Renderer::~GLES2Renderer (void)
+{
+}
+
+void GLES2Renderer::render (int width, int height, const Frame& frame) const
+{
+	for (size_t drawNdx = 0; drawNdx < frame.draws.size(); drawNdx++)
+	{
+		const ColoredRect& coloredRect = frame.draws[drawNdx].rect;
+
+		if (frame.draws[drawNdx].drawType == PartialUpdateTest::DRAWTYPE_GLES2_RENDER)
+		{
+			const float x1 = windowToDeviceCoordinates(coloredRect.bottomLeft.x(), width);
+			const float y1 = windowToDeviceCoordinates(coloredRect.bottomLeft.y(), height);
+			const float x2 = windowToDeviceCoordinates(coloredRect.topRight.x(), width);
+			const float y2 = windowToDeviceCoordinates(coloredRect.topRight.y(), height);
+
+			const glw::GLfloat coords[] =
+			{
+				x1, y1,
+				x1, y2,
+				x2, y2,
+
+				x2, y2,
+				x2, y1,
+				x1, y1,
+			};
+
+			const glw::GLubyte colors[] =
+			{
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+			};
+
+			m_gl.useProgram(m_glProgram.getProgram());
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
+
+			m_gl.enableVertexAttribArray(m_coordLoc);
+			m_gl.enableVertexAttribArray(m_colorLoc);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to enable attributes");
+
+			m_gl.vertexAttribPointer(m_coordLoc, 2, GL_FLOAT, GL_FALSE, 0, coords);
+			m_gl.vertexAttribPointer(m_colorLoc, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, colors);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to set attribute pointers");
+
+			m_gl.drawArrays(GL_TRIANGLES, 0, DE_LENGTH_OF_ARRAY(coords)/2);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "glDrawArrays(), failed");
+
+			m_gl.disableVertexAttribArray(m_coordLoc);
+			m_gl.disableVertexAttribArray(m_colorLoc);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to disable attributes");
+
+			m_gl.useProgram(0);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
+		}
+		else if (frame.draws[drawNdx].drawType == PartialUpdateTest::DRAWTYPE_GLES2_CLEAR)
+		{
+			m_gl.enable(GL_SCISSOR_TEST);
+			m_gl.scissor(coloredRect.bottomLeft.x(), coloredRect.bottomLeft.y(),
+						 coloredRect.topRight.x()-coloredRect.bottomLeft.x(), coloredRect.topRight.y()-coloredRect.bottomLeft.y());
+			m_gl.clearColor(coloredRect.color.x()/255.0f, coloredRect.color.y()/255.0f, coloredRect.color.z()/255.0f, 1.0f);
+			m_gl.clear(GL_COLOR_BUFFER_BIT);
+			m_gl.disable(GL_SCISSOR_TEST);
+		}
+		else
+			DE_FATAL("Invalid drawtype");
+	}
+}
+
+class ReferenceRenderer
+{
+public:
+						ReferenceRenderer		(void);
+	void				render					(tcu::Surface* target, const Frame& frame) const;
+private:
+						ReferenceRenderer		(const ReferenceRenderer&);
+	ReferenceRenderer&	operator=				(const ReferenceRenderer&);
+};
+
+ReferenceRenderer::ReferenceRenderer(void)
+{
+}
+
+void ReferenceRenderer::render (tcu::Surface* target, const Frame& frame) const
+{
+	for (size_t drawNdx = 0; drawNdx < frame.draws.size(); drawNdx++)
+	{
+		const ColoredRect& coloredRect = frame.draws[drawNdx].rect;
+		if (frame.draws[drawNdx].drawType == PartialUpdateTest::DRAWTYPE_GLES2_RENDER || frame.draws[drawNdx].drawType == PartialUpdateTest::DRAWTYPE_GLES2_CLEAR)
+		{
+			const tcu::UVec4 color(coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255);
+			tcu::clear(tcu::getSubregion(target->getAccess(), coloredRect.bottomLeft.x(), coloredRect.bottomLeft.y(),
+										 coloredRect.topRight.x()-coloredRect.bottomLeft.x(), coloredRect.topRight.y()-coloredRect.bottomLeft.y()), color);
+		}
+		else
+			DE_FATAL("Invalid drawtype");
+	}
+}
+
+PartialUpdateTest::PartialUpdateTest (EglTestContext& eglTestCtx,
+									  const vector<DrawType>& oddFrameDrawType,
+									  const vector<DrawType>& evenFrameDrawType,
+									  const char* name, const char* description)
+	: TestCase				(eglTestCtx, name, description)
+	, m_window				(DE_NULL)
+	, m_eglContext			(EGL_NO_CONTEXT)
+	, m_seed				(deStringHash(name))
+	, m_oddFrameDrawType	(oddFrameDrawType)
+	, m_evenFrameDrawType	(evenFrameDrawType)
+	, m_supportBufferAge	(false)
+	, m_eglDisplay			(EGL_NO_DISPLAY)
+	, m_eglSurface			(EGL_NO_SURFACE)
+	, m_gles2Renderer		(DE_NULL)
+	, m_refRenderer			(DE_NULL)
+{
+}
+
+PartialUpdateTest::~PartialUpdateTest (void)
+{
+	deinit();
+}
+
+void PartialUpdateTest::init (void)
+{
+	const Library&	egl	= m_eglTestCtx.getLibrary();
+
+	m_eglDisplay		= eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
+	m_eglConfig			= getEGLConfig(m_eglTestCtx.getLibrary(), m_eglDisplay);
+
+	//create surface and context and make them current
+	initEGLSurface(m_eglConfig);
+	initEGLContext(m_eglConfig);
+
+	m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
+
+	m_supportBufferAge = eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_buffer_age");
+
+	if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_KHR_partial_update"))
+		TCU_THROW(NotSupportedError, "EGL_KHR_partial_update is not supported");
+
+	m_gles2Renderer = new GLES2Renderer(m_gl);
+	m_refRenderer   = new ReferenceRenderer();
+}
+
+void PartialUpdateTest::deinit (void)
+{
+	const Library& egl = m_eglTestCtx.getLibrary();
+
+	delete m_refRenderer;
+	m_refRenderer = DE_NULL;
+
+	delete m_gles2Renderer;
+	m_gles2Renderer = DE_NULL;
+
+	if (m_eglContext != EGL_NO_CONTEXT)
+	{
+		egl.makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+		egl.destroyContext(m_eglDisplay, m_eglContext);
+		m_eglContext = EGL_NO_CONTEXT;
+	}
+
+	if (m_eglSurface != EGL_NO_SURFACE)
+	{
+		egl.destroySurface(m_eglDisplay, m_eglSurface);
+		m_eglSurface = EGL_NO_SURFACE;
+	}
+
+	if (m_eglDisplay != EGL_NO_DISPLAY)
+	{
+		egl.terminate(m_eglDisplay);
+		m_eglDisplay = EGL_NO_DISPLAY;
+	}
+
+	delete m_window;
+	m_window = DE_NULL;
+}
+
+void PartialUpdateTest::initEGLSurface (EGLConfig config)
+{
+	const eglu::NativeWindowFactory& factory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+	m_window = factory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, config, DE_NULL,
+									eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
+	m_eglSurface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_window, m_eglDisplay, config, DE_NULL);
+}
+
+void PartialUpdateTest::initEGLContext (EGLConfig config)
+{
+	const Library& 	egl 		 = m_eglTestCtx.getLibrary();
+	const EGLint 	attribList[] =
+	{
+		EGL_CONTEXT_CLIENT_VERSION, 2,
+		EGL_NONE
+	};
+
+	egl.bindAPI(EGL_OPENGL_ES_API);
+	m_eglContext = egl.createContext(m_eglDisplay, config, EGL_NO_CONTEXT, attribList);
+	EGLU_CHECK_MSG(egl, "eglCreateContext");
+	TCU_CHECK(m_eglSurface != EGL_NO_SURFACE);
+	egl.makeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
+	EGLU_CHECK_MSG(egl, "eglMakeCurrent");
+}
+
+// return indices of frames that have been written to the given buffer
+vector<int> getFramesOnBuffer (const vector<int>& bufferAges, int frameNdx)
+{
+	DE_ASSERT(frameNdx < (int)bufferAges.size());
+	vector<int> frameOnBuffer;
+	int 		age = bufferAges[frameNdx];
+	while (age != 0)
+	{
+		frameNdx = frameNdx - age;
+		DE_ASSERT(frameNdx >= 0);
+		frameOnBuffer.push_back(frameNdx);
+		age = bufferAges[frameNdx];
+	}
+
+	reverse(frameOnBuffer.begin(), frameOnBuffer.end());
+	return frameOnBuffer;
+}
+
+vector<EGLint> getDamageRegion (const Frame& frame, int marginLeft, int marginBottom, int marginRight, int marginTop)
+{
+	vector<EGLint> damageRegion;
+	for (size_t drawNdx = 0; drawNdx < frame.draws.size(); drawNdx++)
+	{
+		const ColoredRect& rect = frame.draws[drawNdx].rect;
+		damageRegion.push_back(rect.bottomLeft.x() - marginLeft);
+		damageRegion.push_back(rect.bottomLeft.y() - marginBottom);
+		damageRegion.push_back(rect.topRight.x() - rect.bottomLeft.x() + marginLeft + marginRight);
+		damageRegion.push_back(rect.topRight.y() - rect.bottomLeft.y() + marginBottom + marginTop);
+	}
+
+	DE_ASSERT(damageRegion.size() % 4 == 0);
+	return damageRegion;
+}
+
+TestCase::IterateResult PartialUpdateTest::iterate (void)
+{
+	de::Random 		rnd				(m_seed);
+	const Library&	egl				= m_eglTestCtx.getLibrary();
+	tcu::TestLog& 	log				= m_testCtx.getLog();
+	const int 		width			= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_WIDTH);
+	const int 		height			= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_HEIGHT);
+	const float 	clearRed		= rnd.getFloat();
+	const float 	clearGreen		= rnd.getFloat();
+	const float 	clearBlue		= rnd.getFloat();
+	const tcu::Vec4	clearColor		(clearRed, clearGreen, clearBlue, 1.0f);
+	const int 		numFrames		= 20;
+	FrameSequence 	frameSequence;
+	vector<int> 	bufferAges;
+	bool			hasPositiveAge  = false;
+
+	EGLU_CHECK_CALL(egl, surfaceAttrib(m_eglDisplay, m_eglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED));
+
+	for (int frameNdx = 0; frameNdx < numFrames; frameNdx++)
+	{
+		tcu::Surface	currentBuffer	 (width, height);
+		tcu::Surface	refBuffer		 (width, height);
+		Frame			newFrame		 (width, height);
+		EGLint			currentBufferAge = -1;
+		vector<EGLint>	damageRegion;
+
+		if (frameNdx % 2 == 0)
+			generateRandomFrame(newFrame, m_evenFrameDrawType, rnd);
+		else
+			generateRandomFrame(newFrame, m_oddFrameDrawType, rnd);
+
+		frameSequence.push_back(newFrame);
+
+		EGLU_CHECK_CALL(egl, querySurface(m_eglDisplay, m_eglSurface, EGL_BUFFER_AGE_KHR, &currentBufferAge));
+
+		if (currentBufferAge > frameNdx || currentBufferAge < 0) // invalid buffer age
+		{
+			std::ostringstream stream;
+			stream << "Fail, the age is invalid. Age: " << currentBufferAge << ", frameNdx: " << frameNdx;
+			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, stream.str().c_str());
+			return STOP;
+		}
+
+		bufferAges.push_back(currentBufferAge);
+		DE_ASSERT((int)bufferAges.size() == frameNdx+1);
+
+		if (currentBufferAge > 0)
+		{
+			hasPositiveAge = true;
+
+			if (m_supportBufferAge)
+				damageRegion = getDamageRegion(newFrame, 10, 10, 10, 10);
+			else
+				damageRegion = getDamageRegion(newFrame, 0, 0, 0, 0);
+
+			EGLU_CHECK_CALL(egl, setDamageRegionKHR(m_eglDisplay, m_eglSurface, &damageRegion[0], (EGLint)damageRegion.size()/4));
+		}
+		else
+		{
+			EGLU_CHECK_CALL(egl, setDamageRegionKHR(m_eglDisplay, m_eglSurface, NULL, 0));
+			clearColorScreen(m_gl, clearColor);
+		}
+
+		// during first half, just keep rendering without reading pixel back to mimic ordinary use case
+		if (frameNdx < numFrames/2)
+			m_gles2Renderer->render(width, height, newFrame);
+		else // do verification in the second half
+		{
+			const vector<int> framesOnBuffer = getFramesOnBuffer(bufferAges, frameNdx);
+
+			clearColorReference(&refBuffer, clearColor);
+
+			for (vector<int>::const_iterator it = framesOnBuffer.begin(); it != framesOnBuffer.end(); it++)
+				m_refRenderer->render(&refBuffer, frameSequence[*it]);
+
+			m_gles2Renderer->render(width, height, newFrame);
+			m_refRenderer->render(&refBuffer, newFrame);
+
+			readPixels(m_gl, &currentBuffer);
+
+			if (!compareToReference(log, refBuffer, currentBuffer, frameNdx, frameNdx))
+			{
+				string errorMessage("Fail, render result is wrong. Buffer age is ");
+				errorMessage += (m_supportBufferAge ? "supported" : "not supported");
+				m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, errorMessage.c_str());
+				return STOP;
+			}
+		}
+		EGLU_CHECK_CALL(egl, swapBuffers(m_eglDisplay, m_eglSurface));
+	}
+
+	if (!hasPositiveAge) // fraud behavior, pretend to support partial_update
+	{
+		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail, claim to support partial_update but buffer age is always 0");
+		return STOP;
+	}
+
+	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+	return STOP;
+}
+
+string generateDrawTypeName (const vector<PartialUpdateTest::DrawType>& drawTypes)
+{
+	std::ostringstream stream;
+	if (drawTypes.size() == 0)
+		return string("_none");
+
+	for (size_t ndx = 0; ndx < drawTypes.size(); ndx++)
+	{
+		if (drawTypes[ndx] == PartialUpdateTest::DRAWTYPE_GLES2_RENDER)
+			stream << "_render";
+		else if (drawTypes[ndx] == PartialUpdateTest::DRAWTYPE_GLES2_CLEAR)
+			stream << "_clear";
+		else
+			DE_ASSERT(false);
+	}
+	return stream.str();
+}
+
+string generateTestName (const vector<PartialUpdateTest::DrawType>& oddFrameDrawType, const vector<PartialUpdateTest::DrawType>& evenFrameDrawType)
+{
+	return "odd" + generateDrawTypeName(oddFrameDrawType) + "_even" + generateDrawTypeName(evenFrameDrawType);
+}
+
+bool isWindow (const eglu::CandidateConfig& c)
+{
+	return (c.surfaceType() & EGL_WINDOW_BIT) == EGL_WINDOW_BIT;
+}
+
+bool isES2Renderable (const eglu::CandidateConfig& c)
+{
+	return (c.get(EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES2_BIT) == EGL_OPENGL_ES2_BIT;
+}
+
+EGLConfig getEGLConfig (const Library& egl, EGLDisplay eglDisplay)
+{
+	eglu::FilterList filters;
+	filters << isWindow << isES2Renderable;
+	return eglu::chooseSingleConfig(egl, eglDisplay, filters);
+}
+
+void clearColorScreen (const glw::Functions& gl, const tcu::Vec4& clearColor)
+{
+	gl.clearColor(clearColor.x(), clearColor.y(), clearColor.z(), clearColor.w());
+	gl.clear(GL_COLOR_BUFFER_BIT);
+}
+
+void clearColorReference (tcu::Surface* ref, const tcu::Vec4& clearColor)
+{
+	tcu::clear(ref->getAccess(), clearColor);
+}
+
+void readPixels (const glw::Functions& gl, tcu::Surface* screen)
+{
+	gl.readPixels(0, 0, screen->getWidth(), screen->getHeight(),  GL_RGBA, GL_UNSIGNED_BYTE, screen->getAccess().getDataPtr());
+}
+
+float windowToDeviceCoordinates (int x, int length)
+{
+	return (2.0f * float(x) / float(length)) - 1.0f;
+}
+
+bool compareToReference (tcu::TestLog& log,	 const tcu::Surface& reference, const tcu::Surface& buffer, int frameNdx, int bufferNum)
+{
+	std::ostringstream stream;
+	stream << "FrameNdx = " << frameNdx << ", compare current buffer (numbered: " << bufferNum << ") to reference";
+	return tcu::intThresholdPositionDeviationCompare(log, "partial update test", stream.str().c_str(), reference.getAccess(), buffer.getAccess(),
+													 tcu::UVec4(8, 8, 8, 0), tcu::IVec3(2,2,0), true, tcu::COMPARE_LOG_RESULT);
+}
+
+class RenderOutsideDamageRegion : public PartialUpdateTest
+{
+public:
+								RenderOutsideDamageRegion		(EglTestContext& eglTestCtx);
+	TestCase::IterateResult		iterate							(void);
+};
+
+RenderOutsideDamageRegion::RenderOutsideDamageRegion (EglTestContext& eglTestCtx)
+	: PartialUpdateTest (eglTestCtx, vector<DrawType>(1, DRAWTYPE_GLES2_RENDER), vector<DrawType>(1, DRAWTYPE_GLES2_RENDER), "render_outside_damage_region", "")
+{
+}
+
+TestCase::IterateResult RenderOutsideDamageRegion::iterate (void)
+{
+	de::Random			rnd				(m_seed);
+	const Library&		egl				= m_eglTestCtx.getLibrary();
+	tcu::TestLog&		log				= m_testCtx.getLog();
+	const int			width			= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_WIDTH);
+	const int			height			= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_HEIGHT);
+	const float			clearRed		= rnd.getFloat();
+	const float			clearGreen		= rnd.getFloat();
+	const float			clearBlue		= rnd.getFloat();
+	const tcu::Vec4		clearColor		(clearRed, clearGreen, clearBlue, 1.0f);
+	tcu::Surface		currentBuffer	(width, height);
+	tcu::Surface		refBuffer		(width, height);
+	Frame				frame			(width, height);
+
+	generateRandomFrame(frame, m_evenFrameDrawType, rnd);
+
+	{
+		// render outside the region
+		EGLint		   bufferAge	= -1;
+		vector<EGLint> damageRegion = getDamageRegion(frame, 0, 0, 0, 0);
+
+		EGLU_CHECK_CALL(egl, querySurface(m_eglDisplay, m_eglSurface, EGL_BUFFER_AGE_KHR, &bufferAge));
+		EGLU_CHECK_CALL(egl, setDamageRegionKHR(m_eglDisplay, m_eglSurface, &damageRegion[0], (EGLint)damageRegion.size()/4));
+		clearColorScreen(m_gl, clearColor);
+		m_gles2Renderer->render(width, height, frame);
+
+		// next line will make the bug on Nexus 6 disappear
+		// readPixels(m_gl, &currentBuffer);
+	}
+
+	EGLU_CHECK_CALL(egl, swapBuffers(m_eglDisplay, m_eglSurface));
+
+	// render a new frame
+	clearColorScreen(m_gl, clearColor);
+	m_gles2Renderer->render(width, height, frame);
+	clearColorReference(&refBuffer, clearColor);
+	m_refRenderer->render(&refBuffer, frame);
+	readPixels(m_gl, &currentBuffer);
+
+	if (!compareToReference(log, refBuffer, currentBuffer, 0, 0))
+		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail, fail to recover after rendering outside damageRegion");
+	else
+		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+
+	return STOP;
+}
+
+class RenderBeforeSetDamageRegion : public PartialUpdateTest
+{
+public:
+								RenderBeforeSetDamageRegion		(EglTestContext& eglTestCtx);
+	TestCase::IterateResult		iterate							(void);
+};
+
+RenderBeforeSetDamageRegion::RenderBeforeSetDamageRegion (EglTestContext& eglTestCtx)
+	: PartialUpdateTest (eglTestCtx, vector<DrawType>(1, DRAWTYPE_GLES2_RENDER), vector<DrawType>(1, DRAWTYPE_GLES2_RENDER), "render_before_set_damage_region", "")
+{
+}
+
+TestCase::IterateResult RenderBeforeSetDamageRegion::iterate (void)
+{
+	de::Random			rnd				(m_seed);
+	const Library&		egl				= m_eglTestCtx.getLibrary();
+	tcu::TestLog&		log				= m_testCtx.getLog();
+	const int			width			= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_WIDTH);
+	const int			height			= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_HEIGHT);
+	const float			clearRed		= rnd.getFloat();
+	const float			clearGreen		= rnd.getFloat();
+	const float			clearBlue		= rnd.getFloat();
+	const tcu::Vec4		clearColor		(clearRed, clearGreen, clearBlue, 1.0f);
+	tcu::Surface		currentBuffer	(width, height);
+	tcu::Surface		refBuffer		(width, height);
+	Frame				frame			(width, height);
+
+	generateRandomFrame(frame, m_evenFrameDrawType, rnd);
+
+	{
+		// render before setDamageRegion
+		EGLint		   bufferAge	= -1;
+		vector<EGLint> damageRegion = getDamageRegion(frame, 0, 0, 0, 0);
+
+		m_gles2Renderer->render(width, height, frame);
+		EGLU_CHECK_CALL(egl, querySurface(m_eglDisplay, m_eglSurface, EGL_BUFFER_AGE_KHR, &bufferAge));
+		EGLU_CHECK_CALL(egl, setDamageRegionKHR(m_eglDisplay, m_eglSurface, &damageRegion[0], (EGLint)damageRegion.size()/4));
+
+		// next line will make the bug on Nexus 6 disappear
+		// readPixels(m_gl, &currentBuffer);
+	}
+
+	EGLU_CHECK_CALL(egl, swapBuffers(m_eglDisplay, m_eglSurface));
+
+	// render a new frame
+	clearColorScreen(m_gl, clearColor);
+	m_gles2Renderer->render(width, height, frame);
+	clearColorReference(&refBuffer, clearColor);
+	m_refRenderer->render(&refBuffer, frame);
+	readPixels(m_gl, &currentBuffer);
+
+	if (!compareToReference(log, refBuffer, currentBuffer, 0, 0))
+		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
+	else
+		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+
+	return STOP;
+}
+
+} // anonymous
+
+PartialUpdateTests::PartialUpdateTests (EglTestContext& eglTestCtx)
+	: TestCaseGroup(eglTestCtx, "partial_update", "Partial update tests")
+{
+}
+
+void PartialUpdateTests::init (void)
+{
+	const PartialUpdateTest::DrawType clearRender[2] =
+	{
+		PartialUpdateTest::DRAWTYPE_GLES2_CLEAR,
+		PartialUpdateTest::DRAWTYPE_GLES2_RENDER
+	};
+
+	const PartialUpdateTest::DrawType renderClear[2] =
+	{
+		PartialUpdateTest::DRAWTYPE_GLES2_RENDER,
+		PartialUpdateTest::DRAWTYPE_GLES2_CLEAR
+	};
+
+	vector< vector<PartialUpdateTest::DrawType> > frameDrawTypes;
+	frameDrawTypes.push_back(vector<PartialUpdateTest::DrawType> ());
+	frameDrawTypes.push_back(vector<PartialUpdateTest::DrawType> (1, PartialUpdateTest::DRAWTYPE_GLES2_CLEAR));
+	frameDrawTypes.push_back(vector<PartialUpdateTest::DrawType> (1, PartialUpdateTest::DRAWTYPE_GLES2_RENDER));
+	frameDrawTypes.push_back(vector<PartialUpdateTest::DrawType> (2, PartialUpdateTest::DRAWTYPE_GLES2_CLEAR));
+	frameDrawTypes.push_back(vector<PartialUpdateTest::DrawType> (2, PartialUpdateTest::DRAWTYPE_GLES2_RENDER));
+	frameDrawTypes.push_back(vector<PartialUpdateTest::DrawType> (DE_ARRAY_BEGIN(clearRender), DE_ARRAY_END(clearRender)));
+	frameDrawTypes.push_back(vector<PartialUpdateTest::DrawType> (DE_ARRAY_BEGIN(renderClear), DE_ARRAY_END(renderClear)));
+
+	for (size_t evenNdx = 0; evenNdx < frameDrawTypes.size(); evenNdx++)
+	{
+		const vector<PartialUpdateTest::DrawType>& evenFrameDrawType = frameDrawTypes[evenNdx];
+
+		for (size_t oddNdx = evenNdx; oddNdx < frameDrawTypes.size(); oddNdx++)
+		{
+			const vector<PartialUpdateTest::DrawType>& 	oddFrameDrawType = frameDrawTypes[oddNdx];
+			const std::string 							name 			 = generateTestName(oddFrameDrawType, evenFrameDrawType);
+			if (oddFrameDrawType.size() == 0 && evenFrameDrawType.size() == 0)
+				continue;
+
+			addChild(new PartialUpdateTest(m_eglTestCtx, oddFrameDrawType, evenFrameDrawType, name.c_str(), ""));
+		}
+	}
+	addChild(new RenderOutsideDamageRegion(m_eglTestCtx));
+	addChild(new RenderBeforeSetDamageRegion(m_eglTestCtx));
+}
+
+} // egl
+} // deqp
diff --git a/modules/egl/teglPartialUpdateTests.hpp b/modules/egl/teglPartialUpdateTests.hpp
new file mode 100644
index 0000000..fae8472
--- /dev/null
+++ b/modules/egl/teglPartialUpdateTests.hpp
@@ -0,0 +1,48 @@
+#ifndef _TEGLPARTIALUPDATETESTS_HPP
+#define _TEGLPARTIALUPDATETESTS_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program EGL Module
+ * ---------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * 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 Test KHR_partial_update
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "teglTestCase.hpp"
+
+namespace deqp
+{
+namespace egl
+{
+
+class PartialUpdateTests : public TestCaseGroup
+{
+public:
+						PartialUpdateTests		(EglTestContext& eglTestCtx);
+	void				init					(void);
+
+private:
+						PartialUpdateTests		(const PartialUpdateTests&);
+	PartialUpdateTests&	operator=				(const PartialUpdateTests&);
+};
+
+} // egl
+} // deqp
+
+#endif // _TEGLPARTIALUPDATETESTS_HPP
diff --git a/modules/egl/teglPreservingSwapTests.cpp b/modules/egl/teglPreservingSwapTests.cpp
index 4e3e384..d78077b 100644
--- a/modules/egl/teglPreservingSwapTests.cpp
+++ b/modules/egl/teglPreservingSwapTests.cpp
@@ -212,11 +212,11 @@
 		const int px	= width;
 		const int py	= height;
 
-		const int x1i	= (int)((px/2.0f) * x1 + ox);
-		const int y1i	= (int)((py/2.0f) * y1 + oy);
+		const int x1i	= (int)(((float)px/2.0f) * x1 + (float)ox);
+		const int y1i	= (int)(((float)py/2.0f) * y1 + (float)oy);
 
-		const int x2i	= (int)((px/2.0f) * x2 + ox);
-		const int y2i	= (int)((py/2.0f) * y2 + oy);
+		const int x2i	= (int)(((float)px/2.0f) * x2 + (float)ox);
+		const int y2i	= (int)(((float)py/2.0f) * y2 + (float)oy);
 
 		m_gl.enable(GL_SCISSOR_TEST);
 		m_gl.scissor(x1i, y1i, x2i-x1i, y2i-y1i);
@@ -501,11 +501,11 @@
 		const int px	= width;
 		const int py	= height;
 
-		const int x1i	= (int)((px/2.0f) * postSwapX1 + ox);
-		const int y1i	= (int)((py/2.0f) * postSwapY1 + oy);
+		const int x1i	= (int)(((float)px/2.0f) * postSwapX1 + (float)ox);
+		const int y1i	= (int)(((float)py/2.0f) * postSwapY1 + (float)oy);
 
-		const int x2i	= (int)((px/2.0f) * postSwapX2 + ox);
-		const int y2i	= (int)((py/2.0f) * postSwapY2 + oy);
+		const int x2i	= (int)(((float)px/2.0f) * postSwapX2 + (float)ox);
+		const int y2i	= (int)(((float)py/2.0f) * postSwapY2 + (float)oy);
 
 		if (m_readPixelsBeforeSwap)
 			isOk = isOk && compareToReference(log, "Compare pre-swap framebuffer to reference", "Compare pre-swap framebuffer to reference", preSwapFramebufferReference, preSwapFramebuffer, 0, 0, width, height);
diff --git a/modules/egl/teglSwapBuffersWithDamageTests.cpp b/modules/egl/teglSwapBuffersWithDamageTests.cpp
new file mode 100644
index 0000000..5a6181e
--- /dev/null
+++ b/modules/egl/teglSwapBuffersWithDamageTests.cpp
@@ -0,0 +1,719 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program EGL Module
+ * ---------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * 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 Test KHR_swap_buffer_with_damage
+ *//*--------------------------------------------------------------------*/
+
+#include "teglSwapBuffersWithDamageTests.hpp"
+
+#include "tcuImageCompare.hpp"
+#include "tcuSurface.hpp"
+#include "tcuTextureUtil.hpp"
+
+#include "egluNativeWindow.hpp"
+#include "egluUtil.hpp"
+#include "egluConfigFilter.hpp"
+
+#include "eglwLibrary.hpp"
+#include "eglwEnums.hpp"
+
+#include "gluDefs.hpp"
+#include "gluRenderContext.hpp"
+#include "gluShaderProgram.hpp"
+
+#include "glwDefs.hpp"
+#include "glwEnums.hpp"
+#include "glwFunctions.hpp"
+
+#include "deRandom.hpp"
+#include "deString.h"
+
+#include <string>
+#include <vector>
+#include <sstream>
+
+using std::string;
+using std::vector;
+using glw::GLubyte;
+using tcu::IVec2;
+
+using namespace eglw;
+
+namespace deqp
+{
+namespace egl
+{
+namespace
+{
+
+typedef	tcu::Vector<GLubyte, 3> Color;
+
+enum DrawType
+{
+    DRAWTYPE_GLES2_CLEAR,
+    DRAWTYPE_GLES2_RENDER
+};
+
+struct ColoredRect
+{
+public:
+				ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_);
+	IVec2		bottomLeft;
+	IVec2		topRight;
+	Color 		color;
+};
+
+ColoredRect::ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_)
+	: bottomLeft	(bottomLeft_)
+	, topRight		(topRight_)
+	, color			(color_)
+{
+}
+
+struct DrawCommand
+{
+				DrawCommand (DrawType drawType_, const ColoredRect& rect_);
+    DrawType	drawType;
+	ColoredRect	rect;
+};
+
+DrawCommand::DrawCommand (DrawType drawType_, const ColoredRect& rect_)
+	: drawType	(drawType_)
+	, rect		(rect_)
+{
+}
+
+struct Frame
+{
+						Frame (int width_, int height_);
+	int 				width;
+	int					height;
+	vector<DrawCommand> draws;
+};
+
+Frame::Frame (int width_, int height_)
+	: width (width_)
+	, height(height_)
+{
+}
+
+typedef vector<Frame> FrameSequence;
+
+//helper function declaration
+EGLConfig		getEGLConfig					(const Library& egl, EGLDisplay eglDisplay, bool preserveBuffer);
+void			clearColorScreen				(const glw::Functions& gl, const tcu::Vec4& clearColor);
+float			windowToDeviceCoordinates		(int x, int length);
+
+class GLES2Renderer
+{
+public:
+							GLES2Renderer		(const glw::Functions& gl);
+							~GLES2Renderer		(void);
+	void					render				(int width, int height, const Frame& frame) const;
+
+private:
+							GLES2Renderer		(const GLES2Renderer&);
+	GLES2Renderer&			operator=			(const GLES2Renderer&);
+
+	const glw::Functions&	m_gl;
+	glu::ShaderProgram		m_glProgram;
+	glw::GLuint				m_coordLoc;
+	glw::GLuint				m_colorLoc;
+};
+
+// generate sources for vertex and fragment buffer
+glu::ProgramSources getSources (void)
+{
+	const char* const vertexShaderSource =
+		"attribute mediump vec2 a_pos;\n"
+		"attribute mediump vec4 a_color;\n"
+		"varying mediump vec4 v_color;\n"
+		"void main(void)\n"
+		"{\n"
+		"\tv_color = a_color;\n"
+		"\tgl_Position = vec4(a_pos, 0.0, 1.0);\n"
+		"}";
+
+	const char* const fragmentShaderSource =
+		"varying mediump vec4 v_color;\n"
+		"void main(void)\n"
+		"{\n"
+		"\tgl_FragColor = v_color;\n"
+		"}";
+
+	return glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource);
+}
+
+GLES2Renderer::GLES2Renderer (const glw::Functions& gl)
+	: m_gl        (gl)
+	, m_glProgram (gl, getSources())
+	, m_coordLoc  ((glw::GLuint)-1)
+	, m_colorLoc  ((glw::GLuint)-1)
+{
+	m_colorLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_color");
+	m_coordLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_pos");
+	GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to get attribute locations");
+}
+
+GLES2Renderer::~GLES2Renderer (void)
+{
+}
+
+void GLES2Renderer::render (int width, int height, const Frame& frame) const
+{
+	for (size_t drawNdx = 0; drawNdx < frame.draws.size(); drawNdx++)
+	{
+		const ColoredRect& coloredRect = frame.draws[drawNdx].rect;
+
+		if (frame.draws[drawNdx].drawType == DRAWTYPE_GLES2_RENDER)
+		{
+			const float x1 = windowToDeviceCoordinates(coloredRect.bottomLeft.x(), width);
+			const float y1 = windowToDeviceCoordinates(coloredRect.bottomLeft.y(), height);
+			const float x2 = windowToDeviceCoordinates(coloredRect.topRight.x(), width);
+			const float y2 = windowToDeviceCoordinates(coloredRect.topRight.y(), height);
+
+			const glw::GLfloat coords[] =
+			{
+				x1, y1,
+				x1, y2,
+				x2, y2,
+
+				x2, y2,
+				x2, y1,
+				x1, y1,
+			};
+
+			const glw::GLubyte colors[] =
+			{
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+				coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255,
+			};
+
+			m_gl.useProgram(m_glProgram.getProgram());
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
+
+			m_gl.enableVertexAttribArray(m_coordLoc);
+			m_gl.enableVertexAttribArray(m_colorLoc);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to enable attributes");
+
+			m_gl.vertexAttribPointer(m_coordLoc, 2, GL_FLOAT, GL_FALSE, 0, coords);
+			m_gl.vertexAttribPointer(m_colorLoc, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, colors);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to set attribute pointers");
+
+			m_gl.drawArrays(GL_TRIANGLES, 0, DE_LENGTH_OF_ARRAY(coords)/2);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "glDrawArrays(), failed");
+
+			m_gl.disableVertexAttribArray(m_coordLoc);
+			m_gl.disableVertexAttribArray(m_colorLoc);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to disable attributes");
+
+			m_gl.useProgram(0);
+			GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
+		}
+		else if (frame.draws[drawNdx].drawType == DRAWTYPE_GLES2_CLEAR)
+		{
+			m_gl.enable(GL_SCISSOR_TEST);
+			m_gl.scissor(coloredRect.bottomLeft.x(), coloredRect.bottomLeft.y(),
+						 coloredRect.topRight.x()-coloredRect.bottomLeft.x(), coloredRect.topRight.y()-coloredRect.bottomLeft.y());
+			m_gl.clearColor(coloredRect.color.x()/255.0f, coloredRect.color.y()/255.0f, coloredRect.color.z()/255.0f, 1.0f);
+			m_gl.clear(GL_COLOR_BUFFER_BIT);
+			m_gl.disable(GL_SCISSOR_TEST);
+		}
+		else
+			DE_FATAL("Invalid drawtype");
+	}
+}
+
+class SwapBuffersWithDamageTest : public TestCase
+{
+public:
+								SwapBuffersWithDamageTest		(EglTestContext& eglTestCtx,
+																 const vector<DrawType>& frameDrawType,
+																 int iterationTimes,
+																 const char* name,
+																 const char* description);
+								~SwapBuffersWithDamageTest		(void);
+
+	virtual void				init							(void);
+	void						deinit							(void);
+	virtual IterateResult		iterate							(void);
+
+protected:
+	virtual EGLConfig			getConfig						(const Library& egl, EGLDisplay eglDisplay);
+	virtual void				checkExtension					(const Library& egl, EGLDisplay eglDisplay);
+	void						initEGLSurface					(EGLConfig config);
+	void						initEGLContext					(EGLConfig config);
+
+	eglu::NativeWindow*			m_window;
+	EGLConfig					m_eglConfig;
+	EGLContext					m_eglContext;
+	const int					m_seed;
+	const int					m_iterationTimes;
+	const vector<DrawType>	    m_frameDrawType;
+	EGLDisplay					m_eglDisplay;
+	EGLSurface					m_eglSurface;
+	glw::Functions				m_gl;
+	GLES2Renderer*				m_gles2Renderer;
+};
+
+SwapBuffersWithDamageTest::SwapBuffersWithDamageTest (EglTestContext& eglTestCtx, const vector<DrawType>& frameDrawType, int iterationTimes,  const char* name, const char* description)
+	: TestCase		  (eglTestCtx, name, description)
+	, m_window		  (DE_NULL)
+	, m_eglContext	  (EGL_NO_CONTEXT)
+	, m_seed		  (deStringHash(name))
+	, m_iterationTimes(iterationTimes)
+	, m_frameDrawType (frameDrawType)
+	, m_eglDisplay	  (EGL_NO_DISPLAY)
+	, m_eglSurface	  (EGL_NO_SURFACE)
+	, m_gles2Renderer (DE_NULL)
+{
+}
+
+SwapBuffersWithDamageTest::~SwapBuffersWithDamageTest (void)
+{
+	deinit();
+}
+
+EGLConfig SwapBuffersWithDamageTest::getConfig (const Library& egl, EGLDisplay eglDisplay)
+{
+	return getEGLConfig(egl, eglDisplay, false);
+}
+
+void SwapBuffersWithDamageTest::checkExtension (const Library& egl, EGLDisplay eglDisplay)
+{
+	if (!eglu::hasExtension(egl, eglDisplay, "EGL_KHR_swap_buffers_with_damage"))
+		TCU_THROW(NotSupportedError, "EGL_KHR_swap_buffers_with_damage is not supported");
+}
+
+void SwapBuffersWithDamageTest::init (void)
+{
+	const Library& egl = m_eglTestCtx.getLibrary();
+
+	m_eglDisplay = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
+	m_eglConfig  = getConfig(egl, m_eglDisplay);
+
+	checkExtension(egl, m_eglDisplay);
+
+	initEGLSurface(m_eglConfig);
+	initEGLContext(m_eglConfig);
+
+	m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
+	m_gles2Renderer = new GLES2Renderer(m_gl);
+}
+
+void SwapBuffersWithDamageTest::deinit (void)
+{
+	const Library& egl = m_eglTestCtx.getLibrary();
+
+	delete m_gles2Renderer;
+	m_gles2Renderer = DE_NULL;
+
+	if (m_eglContext != EGL_NO_CONTEXT)
+	{
+		egl.makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+		egl.destroyContext(m_eglDisplay, m_eglContext);
+		m_eglContext = EGL_NO_CONTEXT;
+	}
+
+	if (m_eglSurface != EGL_NO_SURFACE)
+	{
+		egl.destroySurface(m_eglDisplay, m_eglSurface);
+		m_eglSurface = EGL_NO_SURFACE;
+	}
+
+	if (m_eglDisplay != EGL_NO_DISPLAY)
+	{
+		egl.terminate(m_eglDisplay);
+		m_eglDisplay = EGL_NO_DISPLAY;
+	}
+
+	delete m_window;
+	m_window = DE_NULL;
+}
+
+void SwapBuffersWithDamageTest::initEGLSurface (EGLConfig config)
+{
+	const eglu::NativeWindowFactory& factory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+	m_window = factory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, config, DE_NULL,
+									eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
+	m_eglSurface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_window, m_eglDisplay, config, DE_NULL);
+}
+
+void SwapBuffersWithDamageTest::initEGLContext (EGLConfig config)
+{
+	const Library& 	egl 		 = m_eglTestCtx.getLibrary();
+	const EGLint 	attribList[] =
+	{
+		EGL_CONTEXT_CLIENT_VERSION, 2,
+		EGL_NONE
+	};
+
+	egl.bindAPI(EGL_OPENGL_ES_API);
+	m_eglContext = egl.createContext(m_eglDisplay, config, EGL_NO_CONTEXT, attribList);
+	EGLU_CHECK_MSG(egl, "eglCreateContext");
+	TCU_CHECK(m_eglSurface != EGL_NO_SURFACE);
+	egl.makeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
+	EGLU_CHECK_MSG(egl, "eglMakeCurrent");
+}
+
+FrameSequence	generateFrameSequence	(const vector<DrawType>& frameDrawType, de::Random& rnd, int numFrames, int width, int height);
+vector<EGLint>	getDamageRegion			(const Frame& frame);
+
+TestCase::IterateResult SwapBuffersWithDamageTest::iterate (void)
+{
+	de::Random			rnd				(m_seed);
+	const Library&		egl				= m_eglTestCtx.getLibrary();
+	const int			width			= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_WIDTH);
+	const int			height			= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_HEIGHT);
+	const float			clearRed		= rnd.getFloat();
+	const float			clearGreen		= rnd.getFloat();
+	const float			clearBlue		= rnd.getFloat();
+	const tcu::Vec4		clearColor		(clearRed, clearGreen, clearBlue, 1.0f);
+	const int			numFrames		= 24; // (width, height) = (480, 480) --> numFrame = 24, divisible
+	const FrameSequence frameSequence	= generateFrameSequence(m_frameDrawType, rnd, numFrames, width, height);
+
+	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+	EGLU_CHECK_CALL(egl, surfaceAttrib(m_eglDisplay, m_eglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED));
+
+	for (int iterationNdx = 0; iterationNdx < m_iterationTimes; iterationNdx++)
+	{
+		for (int currentFrameNdx = 0; currentFrameNdx < numFrames; currentFrameNdx++)
+		{
+			vector<EGLint>	damageRegion = getDamageRegion(frameSequence[currentFrameNdx]);
+
+			clearColorScreen(m_gl, clearColor);
+			for (int ndx = 0; ndx <= currentFrameNdx; ndx++)
+				m_gles2Renderer->render(width, height, frameSequence[ndx]);
+
+			EGLU_CHECK_CALL(egl, swapBuffersWithDamageKHR(m_eglDisplay, m_eglSurface, &damageRegion[0], (EGLint)damageRegion.size()/4));
+		}
+	}
+	return STOP;
+}
+
+class SwapBuffersWithDamageAndPreserveBufferTest : public SwapBuffersWithDamageTest
+{
+public:
+					SwapBuffersWithDamageAndPreserveBufferTest	(EglTestContext& eglTestCtx,
+																 const vector<DrawType>& frameDrawType,
+																 int itertionTimes,
+																 const char* name,
+																 const char* description);
+	IterateResult	iterate										(void);
+
+protected:
+	EGLConfig		getConfig									(const Library& egl, EGLDisplay eglDisplay);
+};
+
+SwapBuffersWithDamageAndPreserveBufferTest::SwapBuffersWithDamageAndPreserveBufferTest (EglTestContext& eglTestCtx,
+																						const vector<DrawType>& frameDrawType,
+																						int iterationTimes,
+																						const char* name,
+																						const char* description)
+	: SwapBuffersWithDamageTest (eglTestCtx, frameDrawType, iterationTimes, name, description)
+{
+}
+
+EGLConfig SwapBuffersWithDamageAndPreserveBufferTest::getConfig (const Library& egl, EGLDisplay eglDisplay)
+{
+	return getEGLConfig(egl, eglDisplay, true);
+}
+
+TestCase::IterateResult SwapBuffersWithDamageAndPreserveBufferTest::iterate (void)
+{
+
+	de::Random			rnd				(m_seed);
+	const Library&		egl				= m_eglTestCtx.getLibrary();
+	const int			width			= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_WIDTH);
+	const int			height			= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_HEIGHT);
+	const float			clearRed		= rnd.getFloat();
+	const float			clearGreen		= rnd.getFloat();
+	const float			clearBlue		= rnd.getFloat();
+	const tcu::Vec4		clearColor		(clearRed, clearGreen, clearBlue, 1.0f);
+	const int			numFrames		= 24; // (width, height) = (480, 480) --> numFrame = 24, divisible
+	const FrameSequence frameSequence	= generateFrameSequence(m_frameDrawType, rnd, numFrames, width, height);
+
+	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+	EGLU_CHECK_CALL(egl, surfaceAttrib(m_eglDisplay, m_eglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED));
+
+	for (int iterationNdx = 0; iterationNdx < m_iterationTimes; iterationNdx++)
+	{
+		clearColorScreen(m_gl, clearColor);
+		EGLU_CHECK_CALL(egl, swapBuffersWithDamageKHR(m_eglDisplay, m_eglSurface, DE_NULL, 0));
+
+		for (int frameNdx = 0; frameNdx < numFrames; frameNdx++)
+		{
+			const Frame&	currentFrame = frameSequence[frameNdx];
+			vector<EGLint>	damageRegion = getDamageRegion(currentFrame);
+
+			m_gles2Renderer->render(width, height, currentFrame);
+			EGLU_CHECK_CALL(egl, swapBuffersWithDamageKHR(m_eglDisplay, m_eglSurface, &damageRegion[0], (EGLint)damageRegion.size()/4));
+		}
+	}
+
+	return STOP;
+}
+
+class SwapBuffersWithDamageAndBufferAgeTest : public SwapBuffersWithDamageTest
+{
+public:
+					SwapBuffersWithDamageAndBufferAgeTest	(EglTestContext& eglTestCtx,
+															 const vector<DrawType>& frameDrawType,
+															 int iterationTimes,
+															 const char* name,
+															 const char* description);
+	IterateResult	iterate									(void);
+
+protected:
+	void			checkExtension							(const Library& egl, EGLDisplay eglDisplay);
+};
+
+SwapBuffersWithDamageAndBufferAgeTest::SwapBuffersWithDamageAndBufferAgeTest (EglTestContext& eglTestCtx,
+																			  const vector<DrawType>& frameDrawType,
+																			  int iterationTimes,
+																			  const char* name,
+																			  const char* description)
+	: SwapBuffersWithDamageTest (eglTestCtx, frameDrawType, iterationTimes, name, description)
+{
+}
+
+
+void SwapBuffersWithDamageAndBufferAgeTest::checkExtension (const Library& egl, EGLDisplay eglDisplay)
+{
+	if (!eglu::hasExtension(egl, eglDisplay, "EGL_KHR_swap_buffers_with_damage"))
+		TCU_THROW(NotSupportedError, "EGL_KHR_swap_buffers_with_damage is not supported");
+
+	if (!eglu::hasExtension(egl, eglDisplay, "EGL_EXT_buffer_age"))
+		TCU_THROW(NotSupportedError, "EGL_EXT_buffer_age not supported");
+}
+
+TestCase::IterateResult SwapBuffersWithDamageAndBufferAgeTest::iterate (void)
+{
+
+	de::Random			rnd				(m_seed);
+	const Library&		egl				= m_eglTestCtx.getLibrary();
+	const int			width			= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_WIDTH);
+	const int			height			= eglu::querySurfaceInt(egl, m_eglDisplay, m_eglSurface, EGL_HEIGHT);
+	const float			clearRed		= rnd.getFloat();
+	const float			clearGreen		= rnd.getFloat();
+	const float			clearBlue		= rnd.getFloat();
+	const tcu::Vec4		clearColor		(clearRed, clearGreen, clearBlue, 1.0f);
+	const int			numFrames		= 24; // (width, height) = (480, 480) --> numFrame = 24, divisible
+	const FrameSequence frameSequence	= generateFrameSequence(m_frameDrawType, rnd, numFrames, width, height);
+
+	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+	EGLU_CHECK_CALL(egl, surfaceAttrib(m_eglDisplay, m_eglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED));
+
+	for (int iterationNdx = 0; iterationNdx < m_iterationTimes; iterationNdx++)
+	{
+		for (int frameNdx = 0; frameNdx < numFrames; frameNdx++)
+		{
+			vector<EGLint>	damageRegion;
+			int				bufferAge		= -1;
+			int				startFrameNdx	= -1;
+			int				endFrameNdx		= frameNdx;
+
+			EGLU_CHECK_CALL(egl, querySurface(m_eglDisplay, m_eglSurface, EGL_BUFFER_AGE_EXT, &bufferAge));
+
+			if (bufferAge < 0) // invalid buffer age
+			{
+				std::ostringstream stream;
+				stream << "Fail, the age is invalid. Age: " << bufferAge << ", frameNdx: " << frameNdx;
+				m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, stream.str().c_str());
+				return STOP;
+			}
+
+			if (bufferAge == 0 || bufferAge > frameNdx)
+			{
+				clearColorScreen(m_gl, clearColor);
+				startFrameNdx = 0;
+			}
+			else
+				startFrameNdx = frameNdx-bufferAge+1;
+
+			for (int ndx = startFrameNdx; ndx <= endFrameNdx; ndx++)
+			{
+				const vector<EGLint> partialDamageRegion = getDamageRegion(frameSequence[ndx]);
+
+				damageRegion.insert(damageRegion.end(), partialDamageRegion.begin(), partialDamageRegion.end());
+				m_gles2Renderer->render(width, height, frameSequence[ndx]);
+			}
+
+			EGLU_CHECK_CALL(egl, swapBuffersWithDamageKHR(m_eglDisplay, m_eglSurface, &damageRegion[0], (EGLint)damageRegion.size()/4));
+		}
+	}
+	return STOP;
+}
+
+// generate a frame sequence with certain frame for visual verification
+FrameSequence generateFrameSequence (const vector<DrawType>& frameDrawType, de::Random& rnd, int numFrames, int width, int height)
+{
+	const int			frameDiff		= height / numFrames;
+	const GLubyte		r				= rnd.getUint8();
+	const GLubyte		g				= rnd.getUint8();
+	const GLubyte		b				= rnd.getUint8();
+	const Color			color			(r, g, b);
+	FrameSequence		frameSequence;
+
+	for (int frameNdx = 0; frameNdx < numFrames; frameNdx++)
+	{
+		Frame frame (width, height);
+
+		for (int rectNdx = 0; rectNdx < (int)frameDrawType.size(); rectNdx++)
+		{
+			const int			rectHeight		= frameDiff / (int)frameDrawType.size();
+			const ColoredRect	rect			(IVec2(0, frameNdx*frameDiff+rectNdx*rectHeight), IVec2(width, frameNdx*frameDiff+(rectNdx+1)*rectHeight), color);
+			const DrawCommand	drawCommand		(frameDrawType[rectNdx], rect);
+
+			frame.draws.push_back(drawCommand);
+		}
+		frameSequence.push_back(frame);
+	}
+	return frameSequence;
+}
+
+vector<EGLint> getDamageRegion (const Frame& frame)
+{
+	vector<EGLint> damageRegion;
+	for (size_t drawNdx = 0; drawNdx < frame.draws.size(); drawNdx++)
+	{
+		const ColoredRect& rect = frame.draws[drawNdx].rect;
+		damageRegion.push_back(rect.bottomLeft.x());
+		damageRegion.push_back(rect.bottomLeft.y());
+		damageRegion.push_back(rect.topRight.x() - rect.bottomLeft.x());
+		damageRegion.push_back(rect.topRight.y() - rect.bottomLeft.y());
+	}
+
+	DE_ASSERT(damageRegion.size() % 4 == 0);
+	return damageRegion;
+}
+
+string generateTestName (const vector<DrawType>& frameDrawType)
+{
+	std::ostringstream stream;
+
+	for (size_t ndx = 0; ndx < frameDrawType.size(); ndx++)
+	{
+		if (frameDrawType[ndx] == DRAWTYPE_GLES2_RENDER)
+			stream << "render";
+		else if (frameDrawType[ndx] == DRAWTYPE_GLES2_CLEAR)
+			stream << "clear";
+		else
+			DE_ASSERT(false);
+
+		if (ndx < frameDrawType.size()-1)
+			stream << "_";
+	}
+
+	return stream.str();
+}
+
+bool isWindow (const eglu::CandidateConfig& c)
+{
+	return (c.surfaceType() & EGL_WINDOW_BIT) == EGL_WINDOW_BIT;
+}
+
+bool isES2Renderable (const eglu::CandidateConfig& c)
+{
+	return (c.get(EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES2_BIT) == EGL_OPENGL_ES2_BIT;
+}
+
+bool hasPreserveSwap (const eglu::CandidateConfig& c)
+{
+	return (c.surfaceType() & EGL_SWAP_BEHAVIOR_PRESERVED_BIT) == EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+}
+
+EGLConfig getEGLConfig (const Library& egl, EGLDisplay eglDisplay, bool preserveBuffer)
+{
+	eglu::FilterList filters;
+
+	filters << isWindow << isES2Renderable;
+	if (preserveBuffer)
+		filters << hasPreserveSwap;
+
+	return eglu::chooseSingleConfig(egl, eglDisplay, filters);
+}
+
+void clearColorScreen (const glw::Functions& gl, const tcu::Vec4& clearColor)
+{
+	gl.clearColor(clearColor.x(), clearColor.y(), clearColor.z(), clearColor.w());
+	gl.clear(GL_COLOR_BUFFER_BIT);
+}
+
+float windowToDeviceCoordinates (int x, int length)
+{
+	return (2.0f * float(x) / float(length)) - 1.0f;
+}
+
+} // anonymous
+
+SwapBuffersWithDamageTests::SwapBuffersWithDamageTests (EglTestContext& eglTestCtx)
+	: TestCaseGroup(eglTestCtx, "swap_buffers_with_damage", "Swap buffers with damages tests")
+{
+}
+
+void SwapBuffersWithDamageTests::init (void)
+{
+	const DrawType clearRender[2] =
+	{
+		DRAWTYPE_GLES2_CLEAR,
+		DRAWTYPE_GLES2_RENDER
+	};
+
+	const DrawType renderClear[2] =
+	{
+		DRAWTYPE_GLES2_RENDER,
+		DRAWTYPE_GLES2_CLEAR
+	};
+
+	vector< vector<DrawType> > frameDrawTypes;
+	frameDrawTypes.push_back(vector<DrawType> (1, DRAWTYPE_GLES2_CLEAR));
+	frameDrawTypes.push_back(vector<DrawType> (1, DRAWTYPE_GLES2_RENDER));
+	frameDrawTypes.push_back(vector<DrawType> (2, DRAWTYPE_GLES2_CLEAR));
+	frameDrawTypes.push_back(vector<DrawType> (2, DRAWTYPE_GLES2_RENDER));
+	frameDrawTypes.push_back(vector<DrawType> (DE_ARRAY_BEGIN(clearRender), DE_ARRAY_END(clearRender)));
+	frameDrawTypes.push_back(vector<DrawType> (DE_ARRAY_BEGIN(renderClear), DE_ARRAY_END(renderClear)));
+
+	for (size_t drawTypeNdx = 0; drawTypeNdx < frameDrawTypes.size(); drawTypeNdx++)
+	{
+		string name = generateTestName(frameDrawTypes[drawTypeNdx]);
+		addChild(new SwapBuffersWithDamageTest(m_eglTestCtx, frameDrawTypes[drawTypeNdx], 4, name.c_str(), ""));
+	}
+
+	for (size_t drawTypeNdx = 0; drawTypeNdx < frameDrawTypes.size(); drawTypeNdx++)
+	{
+		string name = "preserve_buffer_" + generateTestName(frameDrawTypes[drawTypeNdx]);
+		addChild(new SwapBuffersWithDamageAndPreserveBufferTest(m_eglTestCtx, frameDrawTypes[drawTypeNdx], 4, name.c_str(), ""));
+	}
+
+	for (size_t drawTypeNdx = 0; drawTypeNdx < frameDrawTypes.size(); drawTypeNdx++)
+	{
+		string name = "buffer_age_" + generateTestName(frameDrawTypes[drawTypeNdx]);
+		addChild(new SwapBuffersWithDamageAndBufferAgeTest(m_eglTestCtx, frameDrawTypes[drawTypeNdx], 4, name.c_str(), ""));
+	}
+}
+
+} // egl
+} // deqp
diff --git a/modules/egl/teglSwapBuffersWithDamageTests.hpp b/modules/egl/teglSwapBuffersWithDamageTests.hpp
new file mode 100644
index 0000000..384a381
--- /dev/null
+++ b/modules/egl/teglSwapBuffersWithDamageTests.hpp
@@ -0,0 +1,48 @@
+#ifndef _TEGLSWAPBUFFERSWITHDAMAGETESTS_HPP
+#define _TEGLSWAPBUFFERSWITHDAMAGETESTS_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program EGL Module
+ * ---------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * 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 Test KHR_swap_buffers_with_damage
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "teglTestCase.hpp"
+
+namespace deqp
+{
+namespace egl
+{
+
+class SwapBuffersWithDamageTests : public TestCaseGroup
+{
+public:
+								SwapBuffersWithDamageTests		(EglTestContext& eglTestCtx);
+	void						init							(void);
+
+private:
+								SwapBuffersWithDamageTests		(const SwapBuffersWithDamageTests&);
+	SwapBuffersWithDamageTests&	operator=						(const SwapBuffersWithDamageTests&);
+};
+
+} // egl
+} // deqp
+
+#endif // _TEGLSWAPBUFFERSWITHDAMAGETESTS_HPP
diff --git a/modules/egl/teglTestPackage.cpp b/modules/egl/teglTestPackage.cpp
index 1336e14..7361506 100644
--- a/modules/egl/teglTestPackage.cpp
+++ b/modules/egl/teglTestPackage.cpp
@@ -56,6 +56,10 @@
 #include "teglNativeColorMappingTests.hpp"
 #include "teglNativeCoordMappingTests.hpp"
 #include "teglResizeTests.hpp"
+#include "teglBufferAgeTests.hpp"
+#include "teglPartialUpdateTests.hpp"
+#include "teglNegativePartialUpdateTests.hpp"
+#include "teglSwapBuffersWithDamageTests.hpp"
 
 namespace deqp
 {
@@ -124,6 +128,10 @@
 		addChild(new NativeCoordMappingTests	(m_eglTestCtx));
 		addChild(new ReusableSyncTests			(m_eglTestCtx));
 		addChild(new ResizeTests				(m_eglTestCtx));
+		addChild(new BufferAgeTests				(m_eglTestCtx));
+		addChild(new PartialUpdateTests			(m_eglTestCtx));
+		addChild(new NegativePartialUpdateTests	(m_eglTestCtx));
+		addChild(new SwapBuffersWithDamageTests	(m_eglTestCtx));
 	}
 };
 
diff --git a/modules/gles2/functional/es2fApiCase.cpp b/modules/gles2/functional/es2fApiCase.cpp
index ee5ba3c..a07d247 100644
--- a/modules/gles2/functional/es2fApiCase.cpp
+++ b/modules/gles2/functional/es2fApiCase.cpp
@@ -86,7 +86,12 @@
 
 void ApiCase::checkBooleans (deUint8 value, deUint8 expected)
 {
-	if (value != expected)
+	checkBooleans((deInt32)value, expected);
+}
+
+void ApiCase::checkBooleans (deInt32 value, deUint8 expected)
+{
+	if (value != (deInt32)expected)
 	{
 		m_log << tcu::TestLog::Message << "// ERROR: expected " << (expected	? "GL_TRUE" : "GL_FALSE") << tcu::TestLog::EndMessage;
 		if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
diff --git a/modules/gles2/functional/es2fApiCase.hpp b/modules/gles2/functional/es2fApiCase.hpp
index 9bbfd90..fee6e8e 100644
--- a/modules/gles2/functional/es2fApiCase.hpp
+++ b/modules/gles2/functional/es2fApiCase.hpp
@@ -50,6 +50,7 @@
 	void				expectError				(deUint32 error0, deUint32 error1);
 	void				getSupportedExtensions	(const deUint32 numSupportedValues, const deUint32 extension, std::vector<int>& values);
 	void				checkBooleans			(deUint8 value, deUint8 expected);
+	void				checkBooleans			(deInt32 value, deUint8 expected);
 
 	tcu::TestLog&		m_log;
 };
diff --git a/modules/gles2/functional/es2fBufferTestUtil.cpp b/modules/gles2/functional/es2fBufferTestUtil.cpp
index a94025b..59360d3 100644
--- a/modules/gles2/functional/es2fBufferTestUtil.cpp
+++ b/modules/gles2/functional/es2fBufferTestUtil.cpp
@@ -319,10 +319,10 @@
 	for (int y = 0; y < gridSizeY; y++)
 	for (int x = 0; x < gridSizeX; x++)
 	{
-		float	sx0			= (x+0) / (float)gridSizeX;
-		float	sy0			= (y+0) / (float)gridSizeY;
-		float	sx1			= (x+1) / (float)gridSizeX;
-		float	sy1			= (y+1) / (float)gridSizeY;
+		float	sx0			= (float)(x+0) / (float)gridSizeX;
+		float	sy0			= (float)(y+0) / (float)gridSizeY;
+		float	sx1			= (float)(x+1) / (float)gridSizeX;
+		float	sy1			= (float)(y+1) / (float)gridSizeY;
 		float	fx0			= 2.0f * sx0 - 1.0f;
 		float	fy0			= 2.0f * sy0 - 1.0f;
 		float	fx1			= 2.0f * sx1 - 1.0f;
@@ -388,8 +388,8 @@
 		for (int y = 0; y < VERIFY_QUAD_SIZE; y++)
 		for (int x = 0; x < VERIFY_QUAD_SIZE; x++)
 		{
-			float		fx		= (float)(x+0.5f) / (float)VERIFY_QUAD_SIZE;
-			float		fy		= (float)(y+0.5f) / (float)VERIFY_QUAD_SIZE;
+			float		fx		= ((float)x+0.5f) / (float)VERIFY_QUAD_SIZE;
+			float		fy		= ((float)y+0.5f) / (float)VERIFY_QUAD_SIZE;
 
 			bool		tri		= fx + fy <= 1.0f;
 			float		tx		= tri ? fx : (1.0f-fx);
diff --git a/modules/gles2/functional/es2fClippingTests.cpp b/modules/gles2/functional/es2fClippingTests.cpp
index 71e74b0..796cdef 100644
--- a/modules/gles2/functional/es2fClippingTests.cpp
+++ b/modules/gles2/functional/es2fClippingTests.cpp
@@ -1991,8 +1991,8 @@
 		const tcu::IVec3 r1		= outside[ndx1];
 		const tcu::IVec3 r2		= outside[ndx2];
 		const tcu::Vec4 p0		= tcu::Vec4(r0.x() * w0, r0.y() * w0, r0.z() * w0, w0);
-		const tcu::Vec4 p1		= tcu::Vec4(r1.x() * far * w1, r1.y() * far * w1, r1.z() * far * w1, w1);
-		const tcu::Vec4 p2		= tcu::Vec4(r2.x() * far * w2, r2.y() * far * w2, r2.z() * far * w2, w2);
+		const tcu::Vec4 p1		= tcu::Vec4(float(r1.x()) * far * w1, float(r1.y()) * far * w1, float(r1.z()) * far * w1, w1);
+		const tcu::Vec4 p2		= tcu::Vec4(float(r2.x()) * far * w2, float(r2.y()) * far * w2, float(r2.z()) * far * w2, w2);
 
 		const std::string name	= std::string("clip") +
 			(outside[ndx1].x() > 0 ? "_pos_x" : (outside[ndx1].x() < 0 ? "_neg_x" : "")) +
@@ -2023,9 +2023,9 @@
 		const tcu::IVec3 r0		= outside[ndx1];
 		const tcu::IVec3 r1		= outside[ndx2];
 		const tcu::IVec3 r2		= outside[ndx3];
-		const tcu::Vec4 p0		= tcu::Vec4(r0.x() * far * w0, r0.y() * far * w0, r0.z() * far * w0, w0);
-		const tcu::Vec4 p1		= tcu::Vec4(r1.x() * far * w1, r1.y() * far * w1, r1.z() * far * w1, w1);
-		const tcu::Vec4 p2		= tcu::Vec4(r2.x() * far * w2, r2.y() * far * w2, r2.z() * far * w2, w2);
+		const tcu::Vec4 p0		= tcu::Vec4(float(r0.x()) * far * w0, float(r0.y()) * far * w0, float(r0.z()) * far * w0, w0);
+		const tcu::Vec4 p1		= tcu::Vec4(float(r1.x()) * far * w1, float(r1.y()) * far * w1, float(r1.z()) * far * w1, w1);
+		const tcu::Vec4 p2		= tcu::Vec4(float(r2.x()) * far * w2, float(r2.y()) * far * w2, float(r2.z()) * far * w2, w2);
 
 		// ignore cases where polygon is along xz or yz planes
 		if (pointsOnLine(r0.swizzle(0, 1), r1.swizzle(0, 1), r2.swizzle(0, 1)))
diff --git a/modules/gles2/functional/es2fColorClearTest.cpp b/modules/gles2/functional/es2fColorClearTest.cpp
index 3a86e61..2c275c2 100644
--- a/modules/gles2/functional/es2fColorClearTest.cpp
+++ b/modules/gles2/functional/es2fColorClearTest.cpp
@@ -147,7 +147,7 @@
 		int		b = (int)(rnd.getUint32() & 0xFF);
 		int		a = m_testAlpha ? (int)(rnd.getUint32() & 0xFF) : 0xFF;
 		RGBA	clearCol(r, g, b, a);
-		gl.clearColor(r/255.0f, g/255.0f, b/255.0f, a/255.0f);
+		gl.clearColor(float(r)/255.0f, float(g)/255.0f, float(b)/255.0f, float(a)/255.0f);
 
 		// Mask.
 		deUint8	clearMask;
diff --git a/modules/gles2/functional/es2fDepthRangeTests.cpp b/modules/gles2/functional/es2fDepthRangeTests.cpp
index 4668d17..a59b1a0 100644
--- a/modules/gles2/functional/es2fDepthRangeTests.cpp
+++ b/modules/gles2/functional/es2fDepthRangeTests.cpp
@@ -228,7 +228,7 @@
 	// Render reference.
 	for (int y = 0; y < referenceFrame.getHeight(); y++)
 	{
-		float	yf		= ((float)y + 0.5f) / referenceFrame.getHeight();
+		float	yf		= ((float)y + 0.5f) / (float)referenceFrame.getHeight();
 		int		half	= de::clamp((int)((float)referenceFrame.getWidth()*0.5f + 0.5f), 0, referenceFrame.getWidth());
 
 		// Fill left half - comparison to constant 0.5
@@ -245,7 +245,7 @@
 		for (int x = half; x < referenceFrame.getWidth(); x++)
 		{
 			float	xf		= ((float)x + 0.5f) / (float)referenceFrame.getWidth();
-			float	xh		= ((float)x - half + 0.5f) / (float)(referenceFrame.getWidth()-half);
+			float	xh		= ((float)(x - half) + 0.5f) / (float)(referenceFrame.getWidth()-half);
 			float	rd		= 1.0f - (xh + yf) * 0.5f;
 			float	d		= depthRangeTransform(triQuadInterpolate(xf, yf, m_depthCoord), m_zNear, m_zFar);
 			bool	dpass	= compare(m_compareFunc, d, rd);
diff --git a/modules/gles2/functional/es2fDepthStencilClearTests.cpp b/modules/gles2/functional/es2fDepthStencilClearTests.cpp
index f1671dd..cbbcf99 100644
--- a/modules/gles2/functional/es2fDepthStencilClearTests.cpp
+++ b/modules/gles2/functional/es2fDepthStencilClearTests.cpp
@@ -324,7 +324,7 @@
 	if (m_testDepth)
 	{
 		int		numSteps	= DEPTH_STEPS;
-		float	step		= 2.0f / numSteps;
+		float	step		= 2.0f / (float)numSteps;
 
 		gl.enable	(GL_DEPTH_TEST);
 		gl.depthFunc(GL_LESS);
@@ -333,7 +333,7 @@
 
 		for (int ndx = 0; ndx < numSteps; ndx++)
 		{
-			float	d		= -1.0f + step*ndx;
+			float	d		= -1.0f + step*(float)ndx;
 			float	c		= (float)ndx / (float)(numSteps-1);
 			float	pos[]	=
 			{
diff --git a/modules/gles2/functional/es2fDepthStencilTests.cpp b/modules/gles2/functional/es2fDepthStencilTests.cpp
index c7cb9ca..793c7a3 100644
--- a/modules/gles2/functional/es2fDepthStencilTests.cpp
+++ b/modules/gles2/functional/es2fDepthStencilTests.cpp
@@ -271,10 +271,10 @@
 	// Compute depth values
 	{
 		int		numValues		= DE_LENGTH_OF_ARRAY(depthValues);
-		float	depthStep		= 2.0f/(numValues-1);
+		float	depthStep		= 2.0f/(float)(numValues-1);
 
 		for (int ndx = 0; ndx < numValues; ndx++)
-			depthValues[ndx] = -1.0f + depthStep*ndx;
+			depthValues[ndx] = -1.0f + depthStep*(float)ndx;
 	}
 
 	for (int y0 = 0; y0 < numL0CellsY; y0++)
@@ -322,7 +322,7 @@
 
 		cmd.params.visibleFace		= rr::FACETYPE_FRONT;
 		cmd.rect					= rr::WindowRectangle(0, 0, target.width, target.height);
-		cmd.color					= Vec4(0.0f, 0.0f, colorStep*ndx, 0.0f);
+		cmd.color					= Vec4(0.0f, 0.0f, colorStep*(float)ndx, 0.0f);
 		cmd.colorMask				= tcu::BVec4(false, false, true, false);
 		cmd.params.depth			= depthSteps[ndx]+epsilon;
 		cmd.params.depthTestEnabled	= true;
@@ -347,7 +347,7 @@
 
 		cmd.params.visibleFace							= rr::FACETYPE_FRONT;
 		cmd.rect										= rr::WindowRectangle(0, 0, target.width, target.height);
-		cmd.color										= Vec4(0.0f, colorStep*(ndx+1), 0.0f, 0.0f);
+		cmd.color										= Vec4(0.0f, colorStep*float(ndx+1), 0.0f, 0.0f);
 		cmd.colorMask									= tcu::BVec4(false, true, false, false);
 		cmd.params.stencilTestEnabled					= true;
 
diff --git a/modules/gles2/functional/es2fFboRenderTest.cpp b/modules/gles2/functional/es2fFboRenderTest.cpp
index 238e8a4..f573947 100644
--- a/modules/gles2/functional/es2fFboRenderTest.cpp
+++ b/modules/gles2/functional/es2fFboRenderTest.cpp
@@ -441,7 +441,7 @@
 			break;
 
 		case GL_TEXTURE_CUBE_MAP:
-			DE_ASSERT(!"TODO");
+			DE_FATAL("TODO");
 			break;
 
 		case GL_RENDERBUFFER:
diff --git a/modules/gles2/functional/es2fFloatStateQueryTests.cpp b/modules/gles2/functional/es2fFloatStateQueryTests.cpp
index 9f9939e..32c6439 100644
--- a/modules/gles2/functional/es2fFloatStateQueryTests.cpp
+++ b/modules/gles2/functional/es2fFloatStateQueryTests.cpp
@@ -132,7 +132,7 @@
 	if (!state.verifyValidity(testCtx))
 		return;
 
-	const GLboolean expectedGLState = reference ? GL_TRUE : GL_FALSE;
+	const GLboolean expectedGLState = reference != 0.0f ? GL_TRUE : GL_FALSE;
 
 	if (state != expectedGLState)
 	{
@@ -157,8 +157,8 @@
 
 	const GLboolean referenceAsGLBoolean[] =
 	{
-		reference0 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
-		reference1 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+		reference0 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+		reference1 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
 	};
 
 	StateQueryMemoryWriteGuard<GLboolean[2]> boolVector2;
@@ -186,10 +186,10 @@
 
 	const GLboolean referenceAsGLBoolean[] =
 	{
-		reference0 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
-		reference1 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
-		reference2 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
-		reference3 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+		reference0 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+		reference1 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+		reference2 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+		reference3 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
 	};
 
 	StateQueryMemoryWriteGuard<GLboolean[4]> boolVector4;
diff --git a/modules/gles2/functional/es2fMultisampleTests.cpp b/modules/gles2/functional/es2fMultisampleTests.cpp
index 2089165..9e7cc6a 100644
--- a/modules/gles2/functional/es2fMultisampleTests.cpp
+++ b/modules/gles2/functional/es2fMultisampleTests.cpp
@@ -512,7 +512,7 @@
 	for (int i = 0; i < numTriangles; i++)
 	{
 		float angle0 = 2.0f*DE_PI * (float)i			/ (float)numTriangles + 0.001f*(float)m_currentIteration;
-		float angle1 = 2.0f*DE_PI * (float)(i + 0.5f)	/ (float)numTriangles + 0.001f*(float)m_currentIteration;
+		float angle1 = 2.0f*DE_PI * ((float)i + 0.5f)	/ (float)numTriangles + 0.001f*(float)m_currentIteration;
 
 		renderTriangle(Vec2(0.0f, 0.0f),
 					   Vec2(deFloatCos(angle0)*0.95f, deFloatSin(angle0)*0.95f),
@@ -991,7 +991,7 @@
 		for (int i = 0; i < numTriangles; i++)
 		{
 			float angle0 = 2.0f*DE_PI * (float)i			/ (float)numTriangles;
-			float angle1 = 2.0f*DE_PI * (float)(i + 0.5f)	/ (float)numTriangles;
+			float angle1 = 2.0f*DE_PI * ((float)i + 0.5f)	/ (float)numTriangles;
 
 			renderTriangle(Vec2(0.0f, 0.0f),
 						   Vec2(deFloatCos(angle0)*0.95f, deFloatSin(angle0)*0.95f),
@@ -1406,7 +1406,7 @@
 		GLU_CHECK_CALL(glSampleCoverage((float)i / (float)(numTriangles-1), invertSampleCoverage ? GL_TRUE : GL_FALSE));
 
 		float angle0 = 2.0f*DE_PI * (float)i			/ (float)numTriangles;
-		float angle1 = 2.0f*DE_PI * (float)(i + 0.5f)	/ (float)numTriangles;
+		float angle1 = 2.0f*DE_PI * ((float)i + 0.5f)	/ (float)numTriangles;
 
 		renderTriangle(Vec2(0.0f, 0.0f),
 					   Vec2(deFloatCos(angle0)*0.95f, deFloatSin(angle0)*0.95f),
diff --git a/modules/gles2/functional/es2fPrerequisiteTests.cpp b/modules/gles2/functional/es2fPrerequisiteTests.cpp
index b2bf495..042eac0 100644
--- a/modules/gles2/functional/es2fPrerequisiteTests.cpp
+++ b/modules/gles2/functional/es2fPrerequisiteTests.cpp
@@ -138,7 +138,7 @@
 
 	};
 
-	glClearColor(r/255.0f, g/255.0f, b/255.0f, a/255.0f);
+	glClearColor(float(r)/255.0f, float(g)/255.0f, float(b)/255.0f, float(a)/255.0f);
 	glClear(GL_COLOR_BUFFER_BIT);
 
 	GLU_CHECK_MSG("CLES2 ClearColor failed.");
@@ -225,7 +225,7 @@
 	int b = (int)(deRandom_getUint32(&rnd) & 0xFF);
 
 	tcu::clear(refImage.getAccess(), tcu::IVec4(r, g, b, 255));
-	glClearColor(r/255.0f, g/255.0f, b/255.0f, 1.0f);
+	glClearColor(float(r)/255.0f, float(g)/255.0f, float(b)/255.0f, 1.0f);
 	glClear(GL_COLOR_BUFFER_BIT);
 
 	glu::readPixels(m_context.getRenderContext(), x, y, resImage.getAccess());
diff --git a/modules/gles2/functional/es2fRasterizationTests.cpp b/modules/gles2/functional/es2fRasterizationTests.cpp
index d4125da..e9529a9 100644
--- a/modules/gles2/functional/es2fRasterizationTests.cpp
+++ b/modules/gles2/functional/es2fRasterizationTests.cpp
@@ -1135,8 +1135,8 @@
 			for (int col = 0; col < numColumns; ++col)
 			for (int row = 0; row < numRows;    ++row)
 			{
-				const tcu::Vec2 center		= tcu::Vec2((row + 0.5f) / numRows * 2.0f - 1.0f, (col + 0.5f) / numColumns * 2.0f - 1.0f);
-				const float		rotation	= (iteration * numColumns * numRows + col * numRows + row) / (float)(m_iterationCount * numColumns * numRows) * DE_PI / 2.0f;
+				const tcu::Vec2 center		= tcu::Vec2(((float)row + 0.5f) / (float)numRows * 2.0f - 1.0f, ((float)col + 0.5f) / (float)numColumns * 2.0f - 1.0f);
+				const float		rotation	= float(iteration * numColumns * numRows + col * numRows + row) / (float)(m_iterationCount * numColumns * numRows) * DE_PI / 2.0f;
 				const tcu::Vec2 sideH		= quadSide * tcu::Vec2(deFloatCos(rotation), deFloatSin(rotation));
 				const tcu::Vec2 sideV		= tcu::Vec2(sideH.y(), -sideH.x());
 				const tcu::Vec2 quad[4]		=
@@ -1191,7 +1191,7 @@
 		{
 			const float		quadSide	= (m_caseType == FILLRULECASE_CLIPPED_PARTIAL) ? (1.0f) : (2.0f);
 			const tcu::Vec2 center		= (m_caseType == FILLRULECASE_CLIPPED_PARTIAL) ? (tcu::Vec2(0.5f, 0.5f)) : (tcu::Vec2(0.0f, 0.0f));
-			const float		rotation	= (iteration) / (float)(m_iterationCount - 1) * DE_PI / 2.0f;
+			const float		rotation	= (float)(iteration) / (float)(m_iterationCount - 1) * DE_PI / 2.0f;
 			const tcu::Vec2 sideH		= quadSide * tcu::Vec2(deFloatCos(rotation), deFloatSin(rotation));
 			const tcu::Vec2 sideV		= tcu::Vec2(sideH.y(), -sideH.x());
 			const tcu::Vec2 quad[4]		=
diff --git a/modules/gles2/functional/es2fReadPixelsTests.cpp b/modules/gles2/functional/es2fReadPixelsTests.cpp
index aadbd6f..b71274b 100644
--- a/modules/gles2/functional/es2fReadPixelsTests.cpp
+++ b/modules/gles2/functional/es2fReadPixelsTests.cpp
@@ -123,10 +123,10 @@
 
 	// Render reference
 
-	const int coordX1 = (int)((-0.5f * reference.getWidth()		/ 2.0f) + reference.getWidth() / 2.0f);
-	const int coordY1 = (int)((-0.5f * reference.getHeight()	/ 2.0f) + reference.getHeight() / 2.0f);
-	const int coordX2 = (int)(( 0.5f * reference.getWidth()		/ 2.0f) + reference.getWidth() / 2.0f);
-	const int coordY2 = (int)(( 0.5f * reference.getHeight()	/ 2.0f) + reference.getHeight() / 2.0f);
+	const int coordX1 = (int)((-0.5f * (float)reference.getWidth()	/ 2.0f) + (float)reference.getWidth() / 2.0f);
+	const int coordY1 = (int)((-0.5f * (float)reference.getHeight()	/ 2.0f) + (float)reference.getHeight() / 2.0f);
+	const int coordX2 = (int)(( 0.5f * (float)reference.getWidth()	/ 2.0f) + (float)reference.getWidth() / 2.0f);
+	const int coordY2 = (int)(( 0.5f * (float)reference.getHeight()	/ 2.0f) + (float)reference.getHeight() / 2.0f);
 
 	for (int x = 0; x < reference.getWidth(); x++)
 	{
@@ -149,7 +149,7 @@
 		GLU_CHECK_CALL(glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &glType));
 
 		if (glFormat != GL_RGBA && glFormat != GL_BGRA && glFormat != GL_RGB)
-			TCU_THROW(NotSupportedError, ("Unsupported IMPLEMENTATION_COLOR_READ_FORMAT: " + de::toString(glu::getPixelFormatStr(glFormat))).c_str());
+			TCU_THROW(NotSupportedError, ("Unsupported IMPLEMENTATION_COLOR_READ_FORMAT: " + de::toString(glu::getTextureFormatStr(glFormat))).c_str());
 		if (glu::getTypeName(glType) == DE_NULL)
 			TCU_THROW(NotSupportedError, ("Unsupported GL_IMPLEMENTATION_COLOR_READ_TYPE: " + de::toString(tcu::Format::Hex<4>(glType))).c_str());
 
@@ -179,7 +179,7 @@
 	GLint						glType;
 
 	getFormatInfo(format, glFormat, glType, pixelSize);
-	m_testCtx.getLog() << tcu::TestLog::Message << "Format: " << glu::getPixelFormatStr(glFormat) << ", Type: " << glu::getTypeStr(glType) << tcu::TestLog::EndMessage;
+	m_testCtx.getLog() << tcu::TestLog::Message << "Format: " << glu::getTextureFormatStr(glFormat) << ", Type: " << glu::getTypeStr(glType) << tcu::TestLog::EndMessage;
 
 	tcu::Texture2D reference(format, width, height);
 	reference.allocLevel(0);
@@ -205,7 +205,7 @@
 	render(reference);
 
 	std::vector<deUint8> pixelData;
-	const int rowPitch = m_alignment * deCeilFloatToInt32(pixelSize * width / (float)m_alignment);
+	const int rowPitch = m_alignment * deCeilFloatToInt32(float(pixelSize * width) / (float)m_alignment);
 
 	pixelData.resize(rowPitch * height, 0);
 
@@ -215,10 +215,10 @@
 	if (m_context.getRenderTarget().getNumSamples() > 1)
 	{
 		const tcu::IVec4	formatBitDepths	= tcu::getTextureFormatBitDepth(format);
-		const deUint8		redThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits,		formatBitDepths.x()))));
-		const deUint8		greenThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits,	formatBitDepths.y()))));
-		const deUint8		blueThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits,		formatBitDepths.z()))));
-		const deUint8		alphaThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits,	formatBitDepths.w()))));
+		const deUint8		redThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits,	formatBitDepths.x()))));
+		const deUint8		greenThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits,	formatBitDepths.y()))));
+		const deUint8		blueThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits,	formatBitDepths.z()))));
+		const deUint8		alphaThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits,	formatBitDepths.w()))));
 
 		// bilinearCompare only accepts RGBA, UINT8
 		tcu::Texture2D		referenceRGBA8	(tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), width, height);
@@ -238,10 +238,10 @@
 	else
 	{
 		const tcu::IVec4	formatBitDepths	= tcu::getTextureFormatBitDepth(format);
-		const float			redThreshold	= 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits,	formatBitDepths.x()));
-		const float			greenThreshold	= 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits,	formatBitDepths.y()));
-		const float			blueThreshold	= 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits,	formatBitDepths.z()));
-		const float			alphaThreshold	= 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits,	formatBitDepths.w()));
+		const float			redThreshold	= 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits,		formatBitDepths.x()));
+		const float			greenThreshold	= 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits,	formatBitDepths.y()));
+		const float			blueThreshold	= 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits,	formatBitDepths.z()));
+		const float			alphaThreshold	= 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits,	formatBitDepths.w()));
 
 		// Compare
 		if (tcu::floatThresholdCompare(m_testCtx.getLog(), "Result", "Result", reference.getLevel(0), tcu::PixelBufferAccess(format, width, height, 1, rowPitch, 0, &(pixelData[0])), tcu::Vec4(redThreshold, greenThreshold, blueThreshold, alphaThreshold), tcu::COMPARE_LOG_RESULT))
diff --git a/modules/gles2/functional/es2fShaderBuiltinVarTests.cpp b/modules/gles2/functional/es2fShaderBuiltinVarTests.cpp
index 9129c51..a987cc1 100644
--- a/modules/gles2/functional/es2fShaderBuiltinVarTests.cpp
+++ b/modules/gles2/functional/es2fShaderBuiltinVarTests.cpp
@@ -540,8 +540,8 @@
 			{
 				for (int xo = 0; xo < w; xo++)
 				{
-					const float			xf		= float(xo+0.5f) / float(w);
-					const float			yf		= float((h-yo-1)+0.5f) / float(h);
+					const float			xf		= (float(xo)+0.5f) / float(w);
+					const float			yf		= (float(h-yo-1)+0.5f) / float(h);
 					const tcu::Vec4		color	(xf, yf, 0.0f, 1.0f);
 					const int			dx		= x0+xo;
 					const int			dy		= y0+yo;
diff --git a/modules/gles2/functional/es2fShaderIndexingTests.cpp b/modules/gles2/functional/es2fShaderIndexingTests.cpp
index 634b864..8db875c 100644
--- a/modules/gles2/functional/es2fShaderIndexingTests.cpp
+++ b/modules/gles2/functional/es2fShaderIndexingTests.cpp
@@ -117,7 +117,7 @@
 	else if (dataType == TYPE_FLOAT_VEC3)	return evalArrayCoordsVec3;
 	else if (dataType == TYPE_FLOAT_VEC4)	return evalArrayCoordsVec4;
 
-	DE_ASSERT(!"Invalid data type.");
+	DE_FATAL("Invalid data type.");
 	return NULL;
 }
 
@@ -133,7 +133,7 @@
 	else if (dataType == TYPE_FLOAT_VEC3)	return evalArrayUniformVec3;
 	else if (dataType == TYPE_FLOAT_VEC4)	return evalArrayUniformVec4;
 
-	DE_ASSERT(!"Invalid data type.");
+	DE_FATAL("Invalid data type.");
 	return NULL;
 }
 
@@ -641,7 +641,7 @@
 	else if (dataType == TYPE_FLOAT_VEC3)	return evalSubscriptVec3;
 	else if (dataType == TYPE_FLOAT_VEC4)	return evalSubscriptVec4;
 
-	DE_ASSERT(!"Invalid data type.");
+	DE_FATAL("Invalid data type.");
 	return NULL;
 }
 
@@ -827,7 +827,7 @@
 	else if (dataType == TYPE_FLOAT_MAT3)	return evalSubscriptMat3;
 	else if (dataType == TYPE_FLOAT_MAT4)	return evalSubscriptMat4;
 
-	DE_ASSERT(!"Invalid data type.");
+	DE_FATAL("Invalid data type.");
 	return NULL;
 }
 
diff --git a/modules/gles2/functional/es2fShaderLoopTests.cpp b/modules/gles2/functional/es2fShaderLoopTests.cpp
index 8da0b44..db80378 100644
--- a/modules/gles2/functional/es2fShaderLoopTests.cpp
+++ b/modules/gles2/functional/es2fShaderLoopTests.cpp
@@ -199,7 +199,7 @@
 		case 3:	return evalLoop3Iters;
 	}
 
-	DE_ASSERT(!"Invalid loop iteration count.");
+	DE_FATAL("Invalid loop iteration count.");
 	return NULL;
 }
 
@@ -390,7 +390,7 @@
 	else
 	{
 		if (loopCountType == LOOPCOUNT_CONSTANT)
-			incrementStr = string("ndx += ") + de::toString(1.0f / numLoopIters);
+			incrementStr = string("ndx += ") + de::toString(1.0f / (float)numLoopIters);
 		else if (loopCountType == LOOPCOUNT_UNIFORM)
 			incrementStr = string("ndx += ") + getFloatFractionUniformName(numLoopIters);
 		else if (loopCountType == LOOPCOUNT_DYNAMIC)
diff --git a/modules/gles2/functional/es2fShaderOperatorTests.cpp b/modules/gles2/functional/es2fShaderOperatorTests.cpp
index 64f5854..e967d92 100644
--- a/modules/gles2/functional/es2fShaderOperatorTests.cpp
+++ b/modules/gles2/functional/es2fShaderOperatorTests.cpp
@@ -165,7 +165,7 @@
 // Reference for expression "in0++, in1 = in0 + in2, in2 = in1"
 inline Vec4		sequenceSideEffCase0 (const Vec4& in0, const Vec4& in1, const Vec4& in2)		{ DE_UNREF(in1); return in0 + 1.0f + in2; }
 // Reference for expression "in1++, in0 = float(in1), in1 = int(in0 + in2)"
-inline int		sequenceSideEffCase1 (float in0, int in1, float in2)							{ DE_UNREF(in0); return (int)(in1 + 1.0f + in2); }
+inline int		sequenceSideEffCase1 (float in0, int in1, float in2)							{ DE_UNREF(in0); return (int)(float(in1) + 1.0f + in2); }
 // Reference for expression "in1 = in0, in2++, in2 = in2 + vec2(in1), ivec2(in2)"
 inline IVec2	sequenceSideEffCase2 (bool in0, bool in1, const Vec2& in2)						{ DE_UNREF(in1); return (in2 + Vec2(1.0f) + Vec2((float)in0)).asInt(); }
 // Reference for expression "in0 = in0 + vec4(in2), in1 = in1 + ivec4(in0), in1++"
@@ -617,31 +617,31 @@
 Vector<T, Size> nop (const Vector<T, Size>& v) { return v; }
 
 #define DECLARE_UNARY_GENTYPE_FUNCS(FUNC_NAME)																			\
-	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].z()); }					\
+	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2)).x(); }			\
 	void eval_##FUNC_NAME##_vec2	(ShaderEvalContext& c) { c.color.yz()	= FUNC_NAME(c.in[0].swizzle(3, 1)); }		\
 	void eval_##FUNC_NAME##_vec3	(ShaderEvalContext& c) { c.color.xyz()	= FUNC_NAME(c.in[0].swizzle(2, 0, 1)); }	\
 	void eval_##FUNC_NAME##_vec4	(ShaderEvalContext& c) { c.color		= FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0)); }
 
 #define DECLARE_BINARY_GENTYPE_FUNCS(FUNC_NAME)																											\
-	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].z(),                 c.in[1].x()); }					\
+	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2),          c.in[1].swizzle(0)).x(); }			\
 	void eval_##FUNC_NAME##_vec2	(ShaderEvalContext& c) { c.color.yz()	= FUNC_NAME(c.in[0].swizzle(3, 1),       c.in[1].swizzle(1, 0)); }			\
 	void eval_##FUNC_NAME##_vec3	(ShaderEvalContext& c) { c.color.xyz()	= FUNC_NAME(c.in[0].swizzle(2, 0, 1),    c.in[1].swizzle(1, 2, 0)); }		\
 	void eval_##FUNC_NAME##_vec4	(ShaderEvalContext& c) { c.color		= FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0), c.in[1].swizzle(3, 2, 1, 0)); }
 
 #define DECLARE_TERNARY_GENTYPE_FUNCS(FUNC_NAME)																																	\
-	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].z(),                 c.in[1].x(),                 c.in[2].y()); }					\
+	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2),          c.in[1].swizzle(0),          c.in[2].swizzle(1)).x(); }		\
 	void eval_##FUNC_NAME##_vec2	(ShaderEvalContext& c) { c.color.yz()	= FUNC_NAME(c.in[0].swizzle(3, 1),       c.in[1].swizzle(1, 0),       c.in[2].swizzle(2, 1)); }			\
 	void eval_##FUNC_NAME##_vec3	(ShaderEvalContext& c) { c.color.xyz()	= FUNC_NAME(c.in[0].swizzle(2, 0, 1),    c.in[1].swizzle(1, 2, 0),    c.in[2].swizzle(3, 1, 2)); }		\
 	void eval_##FUNC_NAME##_vec4	(ShaderEvalContext& c) { c.color		= FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0), c.in[1].swizzle(3, 2, 1, 0), c.in[2].swizzle(0, 3, 2, 1)); }
 
 #define DECLARE_UNARY_SCALAR_GENTYPE_FUNCS(FUNC_NAME)																	\
-	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].z()); }					\
+	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2)); }			\
 	void eval_##FUNC_NAME##_vec2	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(3, 1)); }		\
 	void eval_##FUNC_NAME##_vec3	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2, 0, 1)); }	\
 	void eval_##FUNC_NAME##_vec4	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0)); }
 
 #define DECLARE_BINARY_SCALAR_GENTYPE_FUNCS(FUNC_NAME)																									\
-	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].z(),                 c.in[1].x()); }					\
+	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2),          c.in[1].swizzle(0)); }				\
 	void eval_##FUNC_NAME##_vec2	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(3, 1),       c.in[1].swizzle(1, 0)); }			\
 	void eval_##FUNC_NAME##_vec3	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2, 0, 1),    c.in[1].swizzle(1, 2, 0)); }		\
 	void eval_##FUNC_NAME##_vec4	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0), c.in[1].swizzle(3, 2, 1, 0)); }
diff --git a/modules/gles2/functional/es2fShaderTextureFunctionTests.cpp b/modules/gles2/functional/es2fShaderTextureFunctionTests.cpp
index 13a4428..b926401 100644
--- a/modules/gles2/functional/es2fShaderTextureFunctionTests.cpp
+++ b/modules/gles2/functional/es2fShaderTextureFunctionTests.cpp
@@ -24,6 +24,7 @@
 #include "es2fShaderTextureFunctionTests.hpp"
 #include "glsShaderRenderCase.hpp"
 #include "glsShaderLibrary.hpp"
+#include "glsTextureTestUtil.hpp"
 #include "gluTexture.hpp"
 #include "gluTextureUtil.hpp"
 #include "tcuTextureUtil.hpp"
@@ -181,12 +182,6 @@
 using tcu::IVec3;
 using tcu::IVec4;
 
-inline float computeLodFromDerivates (float dudx, float dvdx, float dudy, float dvdy)
-{
-	float p = de::max(deFloatSqrt(dudx*dudx + dvdx*dvdx), deFloatSqrt(dudy*dudy + dvdy*dvdy));
-	return deFloatLog2(p);
-}
-
 typedef void (*TexEvalFunc) (gls::ShaderEvalContext& c, const TexLookupParams& lookupParams);
 
 inline Vec4 texture2D		(const gls::ShaderEvalContext& c, float s, float t, float lod)			{ return c.textures[0].tex2D->sample(c.textures[0].sampler, s, t, lod);			}
@@ -343,7 +338,7 @@
 			m_texture2D = new glu::Texture2D(m_renderCtx, m_textureSpec.format, m_textureSpec.dataType, m_textureSpec.width, m_textureSpec.height);
 			for (int level = 0; level < m_textureSpec.numLevels; level++)
 			{
-				float	fA		= level*cStep;
+				float	fA		= float(level)*cStep;
 				float	fB		= 1.0f-fA;
 				Vec4	colorA	= cBias + cScale*Vec4(fA, fB, fA, fB);
 				Vec4	colorB	= cBias + cScale*Vec4(fB, fA, fB, fA);
@@ -354,9 +349,9 @@
 			m_texture2D->upload();
 
 			// Compute LOD.
-			float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*m_textureSpec.width	/ (float)viewportSize[0];
-			float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*m_textureSpec.height	/ (float)viewportSize[1];
-			m_lookupParams.lod = computeLodFromDerivates(dudx, 0.0f, 0.0f, dvdy);
+			float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width	/ (float)viewportSize[0];
+			float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height	/ (float)viewportSize[1];
+			m_lookupParams.lod = gls::TextureTestUtil::computeLodFromDerivates(gls::TextureTestUtil::LODMODE_EXACT, dudx, 0.0f, 0.0f, dvdy);
 
 			// Append to texture list.
 			m_textures.push_back(gls::TextureBinding(m_texture2D, m_textureSpec.sampler));
@@ -374,7 +369,7 @@
 			m_textureCube = new glu::TextureCube(m_renderCtx, m_textureSpec.format, m_textureSpec.dataType, m_textureSpec.width);
 			for (int level = 0; level < m_textureSpec.numLevels; level++)
 			{
-				float	fA		= level*cStep;
+				float	fA		= float(level)*cStep;
 				float	fB		= 1.0f-fA;
 				Vec2	f		(fA, fB);
 
@@ -399,10 +394,10 @@
 			tcu::CubeFaceFloatCoords	c00		= tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
 			tcu::CubeFaceFloatCoords	c10		= tcu::getCubeFaceCoords(Vec3(m_lookupSpec.maxCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
 			tcu::CubeFaceFloatCoords	c01		= tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.maxCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
-			float						dudx	= (c10.s - c00.s)*m_textureSpec.width	/ (float)viewportSize[0];
-			float						dvdy	= (c01.t - c00.t)*m_textureSpec.height	/ (float)viewportSize[1];
+			float						dudx	= (c10.s - c00.s)*(float)m_textureSpec.width	/ (float)viewportSize[0];
+			float						dvdy	= (c01.t - c00.t)*(float)m_textureSpec.height	/ (float)viewportSize[1];
 
-			m_lookupParams.lod = computeLodFromDerivates(dudx, 0.0f, 0.0f, dvdy);
+			m_lookupParams.lod = gls::TextureTestUtil::computeLodFromDerivates(gls::TextureTestUtil::LODMODE_EXACT, dudx, 0.0f, 0.0f, dvdy);
 
 			m_textures.push_back(gls::TextureBinding(m_textureCube, m_textureSpec.sampler));
 			break;
diff --git a/modules/gles2/functional/es2fTextureCompletenessTests.cpp b/modules/gles2/functional/es2fTextureCompletenessTests.cpp
index 3f06fd5..55443fe 100644
--- a/modules/gles2/functional/es2fTextureCompletenessTests.cpp
+++ b/modules/gles2/functional/es2fTextureCompletenessTests.cpp
@@ -60,7 +60,6 @@
 using gls::TextureTestUtil::TextureRenderer;
 using gls::TextureTestUtil::computeQuadTexCoord2D;
 using gls::TextureTestUtil::computeQuadTexCoordCube;
-using gls::TextureTestUtil::clear;
 
 static const GLenum s_cubeTargets[] =
 {
diff --git a/modules/gles2/functional/es2fTextureFormatTests.cpp b/modules/gles2/functional/es2fTextureFormatTests.cpp
index 9b8f4b2..918e888 100644
--- a/modules/gles2/functional/es2fTextureFormatTests.cpp
+++ b/modules/gles2/functional/es2fTextureFormatTests.cpp
@@ -112,7 +112,7 @@
 	tcu::TextureFormatInfo	spec	= tcu::getTextureFormatInfo(fmt);
 	std::ostringstream		fmtName;
 
-	fmtName << getPixelFormatStr(m_format) << ", " << getTypeStr(m_dataType);
+	fmtName << getTextureFormatStr(m_format) << ", " << getTypeStr(m_dataType);
 
 	log << TestLog::Message << "2D texture, " << fmtName.str() << ", " << m_width << "x" << m_height
 							<< ",\n  fill with " << formatGradient(&spec.valueMin, &spec.valueMax) << " gradient"
@@ -259,9 +259,9 @@
 	std::ostringstream		fmtName;
 
 	if (m_dataType)
-		fmtName << getPixelFormatStr(m_format) << ", " << getTypeStr(m_dataType);
+		fmtName << getTextureFormatStr(m_format) << ", " << getTypeStr(m_dataType);
 	else
-		fmtName << getPixelFormatStr(m_format);
+		fmtName << getTextureFormatStr(m_format);
 
 	log << TestLog::Message << "Cube map texture, " << fmtName.str() << ", " << m_width << "x" << m_height
 							<< ",\n  fill with " << formatGradient(&spec.valueMin, &spec.valueMax) << " gradient"
@@ -647,7 +647,7 @@
 		deUint32	format			= texFormats[formatNdx].format;
 		deUint32	dataType		= texFormats[formatNdx].dataType;
 		string	nameBase		= texFormats[formatNdx].name;
-		string	descriptionBase	= string(glu::getPixelFormatName(format)) + ", " + glu::getTypeName(dataType);
+		string	descriptionBase	= string(glu::getTextureFormatName(format)) + ", " + glu::getTypeName(dataType);
 
 		addChild(new Texture2DFormatCase	(m_testCtx, m_context.getRenderContext(),	(nameBase + "_2d_pot").c_str(),		(descriptionBase + ", GL_TEXTURE_2D").c_str(),			format, dataType, 128, 128));
 		addChild(new Texture2DFormatCase	(m_testCtx, m_context.getRenderContext(),	(nameBase + "_2d_npot").c_str(),	(descriptionBase + ", GL_TEXTURE_2D").c_str(),			format, dataType,  63, 112));
diff --git a/modules/gles2/functional/es2fVertexTextureTests.cpp b/modules/gles2/functional/es2fVertexTextureTests.cpp
index f86afad..432b2a4 100644
--- a/modules/gles2/functional/es2fVertexTextureTests.cpp
+++ b/modules/gles2/functional/es2fVertexTextureTests.cpp
@@ -248,13 +248,13 @@
 		for (int i = 0; i < DE_LENGTH_OF_ARRAY(quadVertices); i++)
 			m_positions.push_back(safeCoords(quadVertices[i], renderSize, Vec2(0.0f)) * 2.0f - 1.0f);
 
-		m_indices.push_back(firstNdx + 0);
-		m_indices.push_back(firstNdx + 1);
-		m_indices.push_back(firstNdx + 2);
+		m_indices.push_back(deUint16(firstNdx + 0));
+		m_indices.push_back(deUint16(firstNdx + 1));
+		m_indices.push_back(deUint16(firstNdx + 2));
 
-		m_indices.push_back(firstNdx + 1);
-		m_indices.push_back(firstNdx + 3);
-		m_indices.push_back(firstNdx + 2);
+		m_indices.push_back(deUint16(firstNdx + 1));
+		m_indices.push_back(deUint16(firstNdx + 3));
+		m_indices.push_back(deUint16(firstNdx + 2));
 	}
 
 	m_texCoords.reserve(m_gridSize*m_gridSize*4);
@@ -348,7 +348,7 @@
 			DE_ASSERT(deInBounds32(ix + region.x, 0, dst.getWidth()));
 			DE_ASSERT(deInBounds32(iy + region.y, 0, dst.getHeight()));
 
-			dst.setPixel(ix + region.x, iy + region.y, toRGBA(color));
+			dst.setPixel(ix + region.x, iy + region.y, tcu::RGBA(color));
 		}
 	}
 }
diff --git a/modules/gles2/performance/es2pDrawCallBatchingTests.cpp b/modules/gles2/performance/es2pDrawCallBatchingTests.cpp
index b2426aa..135e53c 100644
--- a/modules/gles2/performance/es2pDrawCallBatchingTests.cpp
+++ b/modules/gles2/performance/es2pDrawCallBatchingTests.cpp
@@ -175,9 +175,9 @@
 		{
 			for (int triangleNdx = 0; triangleNdx < m_spec.triangleCount; triangleNdx++)
 			{
-				m_dynamicIndexData.push_back(triangleNdx * 3);
-				m_dynamicIndexData.push_back(triangleNdx * 3 + 1);
-				m_dynamicIndexData.push_back(triangleNdx * 3 + 2);
+				m_dynamicIndexData.push_back(deUint8(triangleNdx * 3));
+				m_dynamicIndexData.push_back(deUint8(triangleNdx * 3 + 1));
+				m_dynamicIndexData.push_back(deUint8(triangleNdx * 3 + 2));
 			}
 		}
 	}
@@ -187,9 +187,9 @@
 		{
 			for (int triangleNdx = 0; triangleNdx < m_spec.triangleCount; triangleNdx++)
 			{
-				m_staticIndexData.push_back(triangleNdx * 3);
-				m_staticIndexData.push_back(triangleNdx * 3 + 1);
-				m_staticIndexData.push_back(triangleNdx * 3 + 2);
+				m_staticIndexData.push_back(deUint8(triangleNdx * 3));
+				m_staticIndexData.push_back(deUint8(triangleNdx * 3 + 1));
+				m_staticIndexData.push_back(deUint8(triangleNdx * 3 + 2));
 			}
 		}
 	}
@@ -277,18 +277,18 @@
 			{
 				int sign = (m_spec.triangleCount % 2 == 1 || i % 2 == 0 ? 1 : -1);
 
-				data.push_back(-127 * sign);
-				data.push_back(-127 * sign);
+				data.push_back(deInt8(-127 * sign));
+				data.push_back(deInt8(-127 * sign));
 				data.push_back(0);
 				data.push_back(127);
 
-				data.push_back(127 * sign);
-				data.push_back(-127 * sign);
+				data.push_back(deInt8(127 * sign));
+				data.push_back(deInt8(-127 * sign));
 				data.push_back(0);
 				data.push_back(127);
 
-				data.push_back(127 * sign);
-				data.push_back(127 * sign);
+				data.push_back(deInt8(127 * sign));
+				data.push_back(deInt8(127 * sign));
 				data.push_back(0);
 				data.push_back(127);
 			}
@@ -298,7 +298,7 @@
 			data.reserve(4 * 3 * m_spec.triangleCount * m_spec.drawCallCount);
 
 			for (int i = 0; i < 4 * 3 * m_spec.triangleCount * m_spec.drawCallCount; i++)
-				data.push_back(m_rnd.getUint32());
+				data.push_back((deInt8)m_rnd.getUint32());
 		}
 
 		m_staticAttributeDatas.push_back(data);
@@ -317,18 +317,18 @@
 			{
 				int sign = (i % 2 == 0 ? 1 : -1);
 
-				data.push_back(-127 * sign);
-				data.push_back(-127 * sign);
+				data.push_back(deInt8(-127 * sign));
+				data.push_back(deInt8(-127 * sign));
 				data.push_back(0);
 				data.push_back(127);
 
-				data.push_back(127 * sign);
-				data.push_back(-127 * sign);
+				data.push_back(deInt8(127 * sign));
+				data.push_back(deInt8(-127 * sign));
 				data.push_back(0);
 				data.push_back(127);
 
-				data.push_back(127 * sign);
-				data.push_back(127 * sign);
+				data.push_back(deInt8(127 * sign));
+				data.push_back(deInt8(127 * sign));
 				data.push_back(0);
 				data.push_back(127);
 			}
@@ -338,7 +338,7 @@
 			data.reserve(4 * 3 * m_spec.triangleCount * m_spec.drawCallCount);
 
 			for (int i = 0; i < 4 * 3 * m_spec.triangleCount * m_spec.drawCallCount; i++)
-				data.push_back(m_rnd.getUint32());
+				data.push_back((deInt8)m_rnd.getUint32());
 		}
 
 		m_dynamicAttributeDatas.push_back(data);
@@ -859,7 +859,7 @@
 	}
 	else if (m_state == STATE_SAMPLE)
 	{
-		if ((int)m_unbatchedSamplesUs.size() < m_unbatchedSampleCount && (m_unbatchedSamplesUs.size() / ((double)m_unbatchedSampleCount) < m_batchedSamplesUs.size() / ((double)m_batchedSampleCount) || (int)m_batchedSamplesUs.size() >= m_batchedSampleCount))
+		if ((int)m_unbatchedSamplesUs.size() < m_unbatchedSampleCount && ((double)m_unbatchedSamplesUs.size() / ((double)m_unbatchedSampleCount) < (double)m_batchedSamplesUs.size() / ((double)m_batchedSampleCount) || (int)m_batchedSamplesUs.size() >= m_batchedSampleCount))
 			m_unbatchedSamplesUs.push_back(renderUnbatched());
 		else if ((int)m_batchedSamplesUs.size() < m_batchedSampleCount)
 			m_batchedSamplesUs.push_back(renderBatched());
diff --git a/modules/gles2/performance/es2pShaderCompilationCases.cpp b/modules/gles2/performance/es2pShaderCompilationCases.cpp
index 7b3d436..7a921ba 100644
--- a/modules/gles2/performance/es2pShaderCompilationCases.cpp
+++ b/modules/gles2/performance/es2pShaderCompilationCases.cpp
@@ -285,7 +285,7 @@
 static string getShaderInfoLog (const glw::Functions& gl, deUint32 shader)
 {
 	string			result;
-	int				infoLogLen;
+	int				infoLogLen = 0;
 	vector<char>	infoLogBuf;
 
 	gl.getShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLen);
@@ -299,7 +299,7 @@
 static string getProgramInfoLog (const glw::Functions& gl, deUint32 program)
 {
 	string			result;
-	int				infoLogLen;
+	int				infoLogLen = 0;
 	vector<char>	infoLogBuf;
 
 	gl.getProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLen);
@@ -1710,7 +1710,7 @@
 bool ShaderCompilerCase::compileShader (deUint32 shader) const
 {
 	const glw::Functions& gl = m_context.getRenderContext().getFunctions();
-	GLint status;
+	GLint status = 0;
 	gl.compileShader(shader);
 	gl.getShaderiv(shader, GL_COMPILE_STATUS, &status);
 	return status != 0;
@@ -1719,7 +1719,7 @@
 bool ShaderCompilerCase::linkAndUseProgram (deUint32 program) const
 {
 	const glw::Functions& gl = m_context.getRenderContext().getFunctions();
-	GLint linkStatus;
+	GLint linkStatus = 0;
 
 	gl.linkProgram(program);
 	gl.getProgramiv(program, GL_LINK_STATUS, &linkStatus);
@@ -2028,10 +2028,10 @@
 			// Log this measurement.
 			log << TestLog::Float("Measurement" + de::toString(ndx) + "CompilationTime",
 								  "Measurement " + de::toString(ndx) + " compilation time",
-								  "ms", QP_KEY_TAG_TIME, timeWithoutDraw / 1000.0f)
+								  "ms", QP_KEY_TAG_TIME, (float)timeWithoutDraw / 1000.0f)
 				<< TestLog::Float("Measurement" + de::toString(ndx) + "SpecializationTime",
 								  "Measurement " + de::toString(ndx) + " specialization time",
-								  "ms", QP_KEY_TAG_TIME, specializationTime / 1000.0f);
+								  "ms", QP_KEY_TAG_TIME, (float)specializationTime / 1000.0f);
 		}
 
 		// Log some statistics.
@@ -2565,7 +2565,7 @@
 			// Log this measurement.
 			log << TestLog::Float("Measurement" + de::toString(ndx) + "Time",
 								  "Measurement " + de::toString(ndx) + " time",
-								  "ms", QP_KEY_TAG_TIME, measurements[ndx].totalTime()/1000.0f);
+								  "ms", QP_KEY_TAG_TIME, (float)measurements[ndx].totalTime()/1000.0f);
 		}
 
 		// Log some statistics.
diff --git a/modules/gles2/performance/es2pTextureCases.cpp b/modules/gles2/performance/es2pTextureCases.cpp
index 8a79ecc..1f4502e 100644
--- a/modules/gles2/performance/es2pTextureCases.cpp
+++ b/modules/gles2/performance/es2pTextureCases.cpp
@@ -120,7 +120,7 @@
 												  Vec4(p11.x(), p11.y(), 0.0f, 0.0f)));
 
 	log << TestLog::Message << "Size: " << width << "x" << height << TestLog::EndMessage;
-	log << TestLog::Message << "Format: " <<glu::getPixelFormatName(m_format) << " " << glu::getTypeName(m_dataType) << TestLog::EndMessage;
+	log << TestLog::Message << "Format: " <<glu::getTextureFormatName(m_format) << " " << glu::getTypeName(m_dataType) << TestLog::EndMessage;
 	log << TestLog::Message << "Coords: " << p00 << ", " << p10 << ", " << p01 << ", " << p11 << TestLog::EndMessage;
 	log << TestLog::Message << "Wrap: " << glu::getTextureWrapModeStr(m_wrapS) << " / " << glu::getTextureWrapModeStr(m_wrapT) << TestLog::EndMessage;
 	log << TestLog::Message << "Filter: " << glu::getTextureFilterStr(m_minFilter) << " / " << glu::getTextureFilterStr(m_magFilter) << TestLog::EndMessage;
diff --git a/modules/gles2/performance/es2pTextureCountTests.cpp b/modules/gles2/performance/es2pTextureCountTests.cpp
index 65584e9..fdc0cbb 100644
--- a/modules/gles2/performance/es2pTextureCountTests.cpp
+++ b/modules/gles2/performance/es2pTextureCountTests.cpp
@@ -75,7 +75,7 @@
 			deUint32	magFilter		= GL_NEAREST;
 			int			numTextures		= texCounts[cntNdx];
 			string		name			= string(texFormats[formatNdx].name) + "_" + de::toString(numTextures);
-			string		description 	= string(glu::getPixelFormatName(format)) + ", " + glu::getTypeName(dataType);
+			string		description 	= string(glu::getTextureFormatName(format)) + ", " + glu::getTypeName(dataType);
 
 			addChild(new Texture2DRenderCase(m_context, name.c_str(), description.c_str(), format, dataType, wrapS, wrapT, minFilter, magFilter, tcu::Mat3(), numTextures, false /* npot */));
 		}
diff --git a/modules/gles2/performance/es2pTextureFormatTests.cpp b/modules/gles2/performance/es2pTextureFormatTests.cpp
index 0bd3dfe..8ef14fb 100644
--- a/modules/gles2/performance/es2pTextureFormatTests.cpp
+++ b/modules/gles2/performance/es2pTextureFormatTests.cpp
@@ -74,7 +74,7 @@
 		deUint32	minFilter		= GL_NEAREST;
 		deUint32	magFilter		= GL_NEAREST;
 		int			numTextures		= 1;
-		string		descriptionBase	= string(glu::getPixelFormatName(format)) + ", " + glu::getTypeName(dataType);
+		string		descriptionBase	= string(glu::getTextureFormatName(format)) + ", " + glu::getTypeName(dataType);
 
 		addChild(new Texture2DRenderCase(m_context, nameBase.c_str(), descriptionBase.c_str(), format, dataType, wrapS, wrapT, minFilter, magFilter, tcu::Mat3(), numTextures, false /* npot */));
 	}
diff --git a/modules/gles2/performance/es2pTextureUploadTests.cpp b/modules/gles2/performance/es2pTextureUploadTests.cpp
index a2600f1..add6c02 100644
--- a/modules/gles2/performance/es2pTextureUploadTests.cpp
+++ b/modules/gles2/performance/es2pTextureUploadTests.cpp
@@ -261,7 +261,7 @@
 	vector<deUint64>::const_iterator middle	= first + (last - first) / 2;
 
 	deUint64 medianFrameTime			=  *middle;
-	double medianMTexelsPerSeconds		= (double)(m_texSize*m_texSize*measureState.numDrawCalls) / medianFrameTime;
+	double medianMTexelsPerSeconds		= (double)(m_texSize*m_texSize*measureState.numDrawCalls) / (double)medianFrameTime;
 	double medianTexelDrawDurationNs	= (double)medianFrameTime * 1000.0 / (double)(m_texSize*m_texSize*measureState.numDrawCalls);
 
 	deUint64	totalTime			= measureState.getTotalTime();
diff --git a/modules/gles2/scripts/gen-conversions.py b/modules/gles2/scripts/gen-conversions.py
index c664209..cffcffe 100644
--- a/modules/gles2/scripts/gen-conversions.py
+++ b/modules/gles2/scripts/gen-conversions.py
@@ -1,3 +1,25 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import sys
 import random
 import operator
diff --git a/modules/gles2/scripts/gen-keywords.py b/modules/gles2/scripts/gen-keywords.py
index c036011..3faf836 100644
--- a/modules/gles2/scripts/gen-keywords.py
+++ b/modules/gles2/scripts/gen-keywords.py
@@ -1,3 +1,25 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import sys
 from genutil import *
 
diff --git a/modules/gles2/scripts/gen-qualification_order.py b/modules/gles2/scripts/gen-qualification_order.py
index 327eda7..d35d056 100644
--- a/modules/gles2/scripts/gen-qualification_order.py
+++ b/modules/gles2/scripts/gen-qualification_order.py
@@ -1,3 +1,25 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import sys
 import itertools
 from collections import namedtuple
diff --git a/modules/gles2/scripts/gen-reserved_operators.py b/modules/gles2/scripts/gen-reserved_operators.py
index 11f33f7..4b3fc18 100644
--- a/modules/gles2/scripts/gen-reserved_operators.py
+++ b/modules/gles2/scripts/gen-reserved_operators.py
@@ -1,3 +1,25 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import sys
 from genutil import *
 
diff --git a/modules/gles2/scripts/gen-swizzles.py b/modules/gles2/scripts/gen-swizzles.py
index e0b0a5d..4b9da5e 100644
--- a/modules/gles2/scripts/gen-swizzles.py
+++ b/modules/gles2/scripts/gen-swizzles.py
@@ -1,3 +1,25 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import sys
 import random
 import operator
diff --git a/modules/gles2/stress/es2sSpecialFloatTests.cpp b/modules/gles2/stress/es2sSpecialFloatTests.cpp
index 9396c40..3602575 100644
--- a/modules/gles2/stress/es2sSpecialFloatTests.cpp
+++ b/modules/gles2/stress/es2sSpecialFloatTests.cpp
@@ -438,8 +438,8 @@
 		}
 
 		m_testCtx.getLog() << tcu::TestLog::Message
-			<< "Creating fbo. Texture internalFormat = " << glu::getPixelFormatStr(internalFormat)
-			<< ", format = " << glu::getPixelFormatStr(format)
+			<< "Creating fbo. Texture internalFormat = " << glu::getTextureFormatStr(internalFormat)
+			<< ", format = " << glu::getTextureFormatStr(format)
 			<< ", type = " << glu::getTypeStr(type)
 			<< tcu::TestLog::EndMessage;
 
@@ -624,13 +624,13 @@
 	{
 		const int baseNdx = (x * (DE_LENGTH_OF_ARRAY(s_specialFloats) - 1) + y) * 6;
 
-		indices[baseNdx + 0] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
-		indices[baseNdx + 1] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
-		indices[baseNdx + 2] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
+		indices[baseNdx + 0] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+		indices[baseNdx + 1] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+		indices[baseNdx + 2] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
 
-		indices[baseNdx + 3] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
-		indices[baseNdx + 4] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
-		indices[baseNdx + 5] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
+		indices[baseNdx + 3] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+		indices[baseNdx + 4] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+		indices[baseNdx + 5] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
 	}
 
 	m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a grid with the shader. Setting a_attr for each vertex to (special, special, 1, 1)." << tcu::TestLog::EndMessage;
@@ -843,13 +843,13 @@
 	{
 		const int baseNdx = (x * (DE_LENGTH_OF_ARRAY(s_specialFloats)) + y) * 6;
 
-		indices[baseNdx + 0] = (x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0);
-		indices[baseNdx + 1] = (x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1);
-		indices[baseNdx + 2] = (x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0);
+		indices[baseNdx + 0] = (deUint16)((x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0));
+		indices[baseNdx + 1] = (deUint16)((x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1));
+		indices[baseNdx + 2] = (deUint16)((x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0));
 
-		indices[baseNdx + 3] = (x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0);
-		indices[baseNdx + 4] = (x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1);
-		indices[baseNdx + 5] = (x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1);
+		indices[baseNdx + 3] = (deUint16)((x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0));
+		indices[baseNdx + 4] = (deUint16)((x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1));
+		indices[baseNdx + 5] = (deUint16)((x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1));
 	}
 
 	m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a grid with the shader. Setting u_special for vertex each tile to (special, special, 1, 1)." << tcu::TestLog::EndMessage;
@@ -1148,13 +1148,13 @@
 	{
 		const int baseNdx = (x * (DE_LENGTH_OF_ARRAY(s_specialFloats) - 1) + y) * 6;
 
-		indices[baseNdx + 0] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
-		indices[baseNdx + 1] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
-		indices[baseNdx + 2] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
+		indices[baseNdx + 0] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+		indices[baseNdx + 1] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+		indices[baseNdx + 2] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
 
-		indices[baseNdx + 3] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
-		indices[baseNdx + 4] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
-		indices[baseNdx + 5] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
+		indices[baseNdx + 3] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+		indices[baseNdx + 4] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+		indices[baseNdx + 5] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
 	}
 
 	m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a textured grid with the shader. Sampling from the texture using special floating point values." << tcu::TestLog::EndMessage;
@@ -1335,13 +1335,13 @@
 	{
 		const int baseNdx = y * 6;
 
-		indices[baseNdx + 0] = (y + 0) * 2;
-		indices[baseNdx + 1] = (y + 1) * 2;
-		indices[baseNdx + 2] = (y + 1) * 2 + 1;
+		indices[baseNdx + 0] = (deUint16)((y + 0) * 2);
+		indices[baseNdx + 1] = (deUint16)((y + 1) * 2);
+		indices[baseNdx + 2] = (deUint16)((y + 1) * 2 + 1);
 
-		indices[baseNdx + 3] = (y + 0) * 2;
-		indices[baseNdx + 4] = (y + 1) * 2 + 1;
-		indices[baseNdx + 5] = (y + 0) * 2 + 1;
+		indices[baseNdx + 3] = (deUint16)((y + 0) * 2);
+		indices[baseNdx + 4] = (deUint16)((y + 1) * 2 + 1);
+		indices[baseNdx + 5] = (deUint16)((y + 0) * 2 + 1);
 	}
 
 	// Draw grids
@@ -1531,13 +1531,13 @@
 	{
 		const int baseNdx = (x * numBlendFuncs + y) * 6;
 
-		indices[baseNdx + 0] = (x+0) * (numBlendFuncs + 1) + (y+0);
-		indices[baseNdx + 1] = (x+1) * (numBlendFuncs + 1) + (y+1);
-		indices[baseNdx + 2] = (x+1) * (numBlendFuncs + 1) + (y+0);
+		indices[baseNdx + 0] = (deUint16)((x+0) * (numBlendFuncs + 1) + (y+0));
+		indices[baseNdx + 1] = (deUint16)((x+1) * (numBlendFuncs + 1) + (y+1));
+		indices[baseNdx + 2] = (deUint16)((x+1) * (numBlendFuncs + 1) + (y+0));
 
-		indices[baseNdx + 3] = (x+0) * (numBlendFuncs + 1) + (y+0);
-		indices[baseNdx + 4] = (x+1) * (numBlendFuncs + 1) + (y+1);
-		indices[baseNdx + 5] = (x+0) * (numBlendFuncs + 1) + (y+1);
+		indices[baseNdx + 3] = (deUint16)((x+0) * (numBlendFuncs + 1) + (y+0));
+		indices[baseNdx + 4] = (deUint16)((x+1) * (numBlendFuncs + 1) + (y+1));
+		indices[baseNdx + 5] = (deUint16)((x+0) * (numBlendFuncs + 1) + (y+1));
 	}
 
 	// Draw tiles
@@ -1670,9 +1670,9 @@
 		gl.uniform4fv(uColorLoc, 1, color.getPtr());
 
 		deUint16 indices[3];
-		indices[0] = rnd.getInt(0, maxVertexIndex);
-		indices[1] = rnd.getInt(0, maxVertexIndex);
-		indices[2] = rnd.getInt(0, maxVertexIndex);
+		indices[0] = (deUint16)rnd.getInt(0, maxVertexIndex);
+		indices[1] = (deUint16)rnd.getInt(0, maxVertexIndex);
+		indices[2] = (deUint16)rnd.getInt(0, maxVertexIndex);
 
 		gl.drawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, indices);
 	}
diff --git a/modules/gles2/tes2CapabilityTests.cpp b/modules/gles2/tes2CapabilityTests.cpp
index b40a763..0e38b38 100644
--- a/modules/gles2/tes2CapabilityTests.cpp
+++ b/modules/gles2/tes2CapabilityTests.cpp
@@ -52,7 +52,7 @@
 
 	IterateResult iterate (void)
 	{
-		GLint value;
+		GLint value = 0;
 		GLU_CHECK_CALL(glGetIntegerv(m_param, &value));
 
 		m_testCtx.getLog() << TestLog::Message << glu::getParamQueryStr(m_param) << " = " << value << TestLog::EndMessage;
diff --git a/modules/gles3/functional/es3fASTCDecompressionCases.cpp b/modules/gles3/functional/es3fASTCDecompressionCases.cpp
index 9611fab..c668dfd 100644
--- a/modules/gles3/functional/es3fASTCDecompressionCases.cpp
+++ b/modules/gles3/functional/es3fASTCDecompressionCases.cpp
@@ -1387,10 +1387,10 @@
 				{
 					// Void extent block.
 					const bool		isVoidExtentHDR		= rnd.getBool();
-					const deUint16	r					= isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : rnd.getInt(0, 0xffff);
-					const deUint16	g					= isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : rnd.getInt(0, 0xffff);
-					const deUint16	b					= isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : rnd.getInt(0, 0xffff);
-					const deUint16	a					= isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : rnd.getInt(0, 0xffff);
+					const deUint16	r					= isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : (deUint16)rnd.getInt(0, 0xffff);
+					const deUint16	g					= isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : (deUint16)rnd.getInt(0, 0xffff);
+					const deUint16	b					= isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : (deUint16)rnd.getInt(0, 0xffff);
+					const deUint16	a					= isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : (deUint16)rnd.getInt(0, 0xffff);
 					generateVoidExtentBlock(VoidExtentParams(isVoidExtentHDR, r, g, b, a)).pushBytesToVector(dst);
 				}
 				else
diff --git a/modules/gles3/functional/es3fApiCase.cpp b/modules/gles3/functional/es3fApiCase.cpp
index 892ad35..fdc5d1b 100644
--- a/modules/gles3/functional/es3fApiCase.cpp
+++ b/modules/gles3/functional/es3fApiCase.cpp
@@ -88,7 +88,12 @@
 
 void ApiCase::checkBooleans (deUint8 value, deUint8 expected)
 {
-	if (value != expected)
+	checkBooleans((deInt32)value, expected);
+}
+
+void ApiCase::checkBooleans (deInt32 value, deUint8 expected)
+{
+	if (value != (deInt32)expected)
 	{
 		m_log << TestLog::Message << "// ERROR: expected " << (expected	? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
 		if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
diff --git a/modules/gles3/functional/es3fApiCase.hpp b/modules/gles3/functional/es3fApiCase.hpp
index b644282..9038a27 100644
--- a/modules/gles3/functional/es3fApiCase.hpp
+++ b/modules/gles3/functional/es3fApiCase.hpp
@@ -50,6 +50,7 @@
 	void				expectError				(deUint32 error0, deUint32 error1);
 	void				getSupportedExtensions	(const deUint32 numSupportedValues, const deUint32 extension, std::vector<int>& values);
 	void				checkBooleans			(deUint8 value, deUint8 expected);
+	void				checkBooleans			(deInt32 value, deUint8 expected);
 
 	tcu::TestLog&		m_log;
 };
diff --git a/modules/gles3/functional/es3fClippingTests.cpp b/modules/gles3/functional/es3fClippingTests.cpp
index 5368229..f2b45fa 100644
--- a/modules/gles3/functional/es3fClippingTests.cpp
+++ b/modules/gles3/functional/es3fClippingTests.cpp
@@ -1995,8 +1995,8 @@
 		const tcu::IVec3 r1		= outside[ndx1];
 		const tcu::IVec3 r2		= outside[ndx2];
 		const tcu::Vec4 p0		= tcu::Vec4(r0.x() * w0, r0.y() * w0, r0.z() * w0, w0);
-		const tcu::Vec4 p1		= tcu::Vec4(r1.x() * far * w1, r1.y() * far * w1, r1.z() * far * w1, w1);
-		const tcu::Vec4 p2		= tcu::Vec4(r2.x() * far * w2, r2.y() * far * w2, r2.z() * far * w2, w2);
+		const tcu::Vec4 p1		= tcu::Vec4(float(r1.x()) * far * w1, float(r1.y()) * far * w1, float(r1.z()) * far * w1, w1);
+		const tcu::Vec4 p2		= tcu::Vec4(float(r2.x()) * far * w2, float(r2.y()) * far * w2, float(r2.z()) * far * w2, w2);
 
 		const std::string name	= std::string("clip") +
 			(outside[ndx1].x() > 0 ? "_pos_x" : (outside[ndx1].x() < 0 ? "_neg_x" : "")) +
@@ -2027,9 +2027,9 @@
 		const tcu::IVec3 r0		= outside[ndx1];
 		const tcu::IVec3 r1		= outside[ndx2];
 		const tcu::IVec3 r2		= outside[ndx3];
-		const tcu::Vec4 p0		= tcu::Vec4(r0.x() * far * w0, r0.y() * far * w0, r0.z() * far * w0, w0);
-		const tcu::Vec4 p1		= tcu::Vec4(r1.x() * far * w1, r1.y() * far * w1, r1.z() * far * w1, w1);
-		const tcu::Vec4 p2		= tcu::Vec4(r2.x() * far * w2, r2.y() * far * w2, r2.z() * far * w2, w2);
+		const tcu::Vec4 p0		= tcu::Vec4(float(r0.x()) * far * w0, float(r0.y()) * far * w0, float(r0.z()) * far * w0, w0);
+		const tcu::Vec4 p1		= tcu::Vec4(float(r1.x()) * far * w1, float(r1.y()) * far * w1, float(r1.z()) * far * w1, w1);
+		const tcu::Vec4 p2		= tcu::Vec4(float(r2.x()) * far * w2, float(r2.y()) * far * w2, float(r2.z()) * far * w2, w2);
 
 		// ignore cases where polygon is along xz or yz planes
 		if (pointsOnLine(r0.swizzle(0, 1), r1.swizzle(0, 1), r2.swizzle(0, 1)))
diff --git a/modules/gles3/functional/es3fColorClearTest.cpp b/modules/gles3/functional/es3fColorClearTest.cpp
index 9a75ecd..8b8a28b 100644
--- a/modules/gles3/functional/es3fColorClearTest.cpp
+++ b/modules/gles3/functional/es3fColorClearTest.cpp
@@ -147,7 +147,7 @@
 		int		b = (int)(rnd.getUint32() & 0xFF);
 		int		a = m_testAlpha ? (int)(rnd.getUint32() & 0xFF) : 0xFF;
 		RGBA	clearCol(r, g, b, a);
-		gl.clearColor(r/255.0f, g/255.0f, b/255.0f, a/255.0f);
+		gl.clearColor(float(r)/255.0f, float(g)/255.0f, float(b)/255.0f, float(a)/255.0f);
 
 		// Mask.
 		deUint8	clearMask;
diff --git a/modules/gles3/functional/es3fCompressedTextureTests.cpp b/modules/gles3/functional/es3fCompressedTextureTests.cpp
index 648d8f4..f8e6297 100644
--- a/modules/gles3/functional/es3fCompressedTextureTests.cpp
+++ b/modules/gles3/functional/es3fCompressedTextureTests.cpp
@@ -85,7 +85,7 @@
 				if (tcu::isAstcSRGBFormat(format) && isBlockTestTypeHDROnly(astcTestType))
 					continue;
 
-				testTypeGroup->addChild(new ASTCBlockCase2D(m_context, getASTCFormatShortName(format).c_str(), glu::getCompressedTexFormatName(glu::getGLFormat(format)), astcTestType, format));
+				testTypeGroup->addChild(new ASTCBlockCase2D(m_context, getASTCFormatShortName(format).c_str(), glu::getCompressedTextureFormatName(glu::getGLFormat(format)), astcTestType, format));
 			}
 		}
 
@@ -102,7 +102,7 @@
 				if (!tcu::isAstcFormat(format))
 					continue;
 
-				blockSizeRemainderGroup->addChild(new ASTCBlockSizeRemainderCase2D(m_context, getASTCFormatShortName(format).c_str(), glu::getCompressedTexFormatName(glu::getGLFormat(format)), format));
+				blockSizeRemainderGroup->addChild(new ASTCBlockSizeRemainderCase2D(m_context, getASTCFormatShortName(format).c_str(), glu::getCompressedTextureFormatName(glu::getGLFormat(format)), format));
 			}
 		}
 	}
diff --git a/modules/gles3/functional/es3fDepthStencilClearTests.cpp b/modules/gles3/functional/es3fDepthStencilClearTests.cpp
index 112757b..0138bc8 100644
--- a/modules/gles3/functional/es3fDepthStencilClearTests.cpp
+++ b/modules/gles3/functional/es3fDepthStencilClearTests.cpp
@@ -327,7 +327,7 @@
 	if (m_testDepth)
 	{
 		int		numSteps	= DEPTH_STEPS;
-		float	step		= 2.0f / numSteps;
+		float	step		= 2.0f / (float)numSteps;
 
 		gl.enable	(GL_DEPTH_TEST);
 		gl.depthFunc(GL_LESS);
@@ -336,7 +336,7 @@
 
 		for (int ndx = 0; ndx < numSteps; ndx++)
 		{
-			float	d		= -1.0f + step*ndx;
+			float	d		= -1.0f + step*(float)ndx;
 			float	c		= (float)ndx / (float)(numSteps-1);
 			float	pos[]	=
 			{
diff --git a/modules/gles3/functional/es3fDepthStencilTests.cpp b/modules/gles3/functional/es3fDepthStencilTests.cpp
index 861d2a0..09958d8 100644
--- a/modules/gles3/functional/es3fDepthStencilTests.cpp
+++ b/modules/gles3/functional/es3fDepthStencilTests.cpp
@@ -271,10 +271,10 @@
 	// Compute depth values
 	{
 		int		numValues		= DE_LENGTH_OF_ARRAY(depthValues);
-		float	depthStep		= 2.0f/(numValues-1);
+		float	depthStep		= 2.0f/(float)(numValues-1);
 
 		for (int ndx = 0; ndx < numValues; ndx++)
-			depthValues[ndx] = -1.0f + depthStep*ndx;
+			depthValues[ndx] = -1.0f + depthStep*(float)ndx;
 	}
 
 	for (int y0 = 0; y0 < numL0CellsY; y0++)
@@ -322,7 +322,7 @@
 
 		cmd.params.visibleFace		= rr::FACETYPE_FRONT;
 		cmd.rect					= rr::WindowRectangle(0, 0, target.width, target.height);
-		cmd.color					= Vec4(0.0f, 0.0f, colorStep*ndx, 0.0f);
+		cmd.color					= Vec4(0.0f, 0.0f, colorStep*(float)ndx, 0.0f);
 		cmd.colorMask				= tcu::BVec4(false, false, true, false);
 		cmd.params.depth			= depthSteps[ndx]+epsilon;
 		cmd.params.depthTestEnabled	= true;
@@ -347,7 +347,7 @@
 
 		cmd.params.visibleFace							= rr::FACETYPE_FRONT;
 		cmd.rect										= rr::WindowRectangle(0, 0, target.width, target.height);
-		cmd.color										= Vec4(0.0f, colorStep*(ndx+1), 0.0f, 0.0f);
+		cmd.color										= Vec4(0.0f, colorStep*float(ndx+1), 0.0f, 0.0f);
 		cmd.colorMask									= tcu::BVec4(false, true, false, false);
 		cmd.params.stencilTestEnabled					= true;
 
diff --git a/modules/gles3/functional/es3fDrawTests.cpp b/modules/gles3/functional/es3fDrawTests.cpp
index efd8b48..f3a1e37 100644
--- a/modules/gles3/functional/es3fDrawTests.cpp
+++ b/modules/gles3/functional/es3fDrawTests.cpp
@@ -688,8 +688,8 @@
 	deInt32 offsetLocation	= ctx.getAttribLocation(programID, "a_offset");
 	deInt32 colorLocation	= ctx.getAttribLocation(programID, "a_color");
 
-	float cellW	= 2.0f / m_gridSide;
-	float cellH	= 2.0f / m_gridSide;
+	float cellW	= 2.0f / (float)m_gridSide;
+	float cellH	= 2.0f / (float)m_gridSide;
 	const tcu::Vec4 vertexPositions[] =
 	{
 		tcu::Vec4(0,		0,		0, 1),
@@ -710,7 +710,7 @@
 	std::vector<tcu::Vec4> offsets;
 	for (int x = 0; x < m_gridSide; ++x)
 	for (int y = 0; y < m_gridSide; ++y)
-		offsets.push_back(tcu::Vec4(x * cellW - 1.0f, y * cellW - 1.0f, 0, 0));
+		offsets.push_back(tcu::Vec4((float)x * cellW - 1.0f, (float)y * cellW - 1.0f, 0, 0));
 
 	std::vector<tcu::Vec4> colors;
 	for (int x = 0; x < m_gridSide; ++x)
@@ -780,22 +780,30 @@
 	tcu::Surface error			(image.getWidth(), image.getHeight());
 	bool isOk					= true;
 
-	for (int y = 1; y < image.getHeight()-1; y++)
-	for (int x = 1; x < image.getWidth()-1; x++)
+	for (int y = 0; y < image.getHeight(); y++)
+	for (int x = 0; x < image.getWidth(); x++)
 	{
-		const tcu::RGBA pixel = image.getPixel(x, y);
-		bool pixelOk = true;
+		if (x == 0 || y == 0 || y + 1 == image.getHeight() || x + 1 == image.getWidth())
+		{
+			// Background color might bleed in at the borders with msaa
+			error.setPixel(x, y, tcu::RGBA(0, 255, 0, 255));
+		}
+		else
+		{
+			const tcu::RGBA pixel = image.getPixel(x, y);
+			bool pixelOk = true;
 
-		// Any pixel with !(G ~= 255) is faulty (not a linear combinations of green and yellow)
-		if (de::abs(pixel.getGreen() - 255) > colorThreshold)
-			pixelOk = false;
+			// Any pixel with !(G ~= 255) is faulty (not a linear combinations of green and yellow)
+			if (de::abs(pixel.getGreen() - 255) > colorThreshold)
+				pixelOk = false;
 
-		// Any pixel with !(B ~= 0) is faulty (not a linear combinations of green and yellow)
-		if (de::abs(pixel.getBlue() - 0) > colorThreshold)
-			pixelOk = false;
+			// Any pixel with !(B ~= 0) is faulty (not a linear combinations of green and yellow)
+			if (de::abs(pixel.getBlue() - 0) > colorThreshold)
+				pixelOk = false;
 
-		error.setPixel(x, y, (pixelOk) ? (tcu::RGBA(0, 255, 0, 255)) : (tcu::RGBA(255, 0, 0, 255)));
-		isOk = isOk && pixelOk;
+			error.setPixel(x, y, (pixelOk) ? (tcu::RGBA(0, 255, 0, 255)) : (tcu::RGBA(255, 0, 0, 255)));
+			isOk = isOk && pixelOk;
+		}
 	}
 
 	if (!isOk)
diff --git a/modules/gles3/functional/es3fFboCompletenessTests.cpp b/modules/gles3/functional/es3fFboCompletenessTests.cpp
index 0e06a18..8e1b882 100644
--- a/modules/gles3/functional/es3fFboCompletenessTests.cpp
+++ b/modules/gles3/functional/es3fFboCompletenessTests.cpp
@@ -293,7 +293,7 @@
 			texCfg = &builder.makeConfig<Texture2DArray>();
 			break;
 		default:
-			DE_ASSERT(!"Impossible case");
+			DE_FATAL("Impossible case");
 	}
 	texCfg->internalFormat = getDefaultFormat(target, GL_TEXTURE);
 	texCfg->width = 64;
diff --git a/modules/gles3/functional/es3fFboInvalidateTests.cpp b/modules/gles3/functional/es3fFboInvalidateTests.cpp
index 7fc9f26..5bfd62a 100644
--- a/modules/gles3/functional/es3fFboInvalidateTests.cpp
+++ b/modules/gles3/functional/es3fFboInvalidateTests.cpp
@@ -706,7 +706,7 @@
 		IVec2					quadSizePixels			(m_numSamples == 0 ? getWidth() : de::min(128, getWidth()),
 														 m_numSamples == 0 ? getHeight() : de::min(128, getHeight()));
 		Vec2					quadNDCLeftBottomXY		(-1.0f, -1.0f);
-		Vec2					quadNDCSize				(2.0f*quadSizePixels.x()/getWidth(), 2.0f*quadSizePixels.y()/getHeight());
+		Vec2					quadNDCSize				(2.0f*(float)quadSizePixels.x()/(float)getWidth(), 2.0f*(float)quadSizePixels.y()/(float)getHeight());
 		Vec2					quadNDCRightTopXY		= quadNDCLeftBottomXY + quadNDCSize;
 		tcu::TextureFormat		depthStencilFmt			= m_depthStencilFmt != GL_NONE ? glu::mapGLInternalFormat(m_depthStencilFmt) : tcu::TextureFormat();
 		bool					depth					= depthStencilFmt.order == tcu::TextureFormat::D || depthStencilFmt.order == tcu::TextureFormat::DS;
@@ -1085,7 +1085,7 @@
 		IVec2					quadSizePixels			(m_numSamples == 0 ? getWidth() : de::min(128, getWidth()),
 														 m_numSamples == 0 ? getHeight() : de::min(128, getHeight()));
 		Vec2					quadNDCLeftBottomXY		(-1.0f, -1.0f);
-		Vec2					quadNDCSize				(2.0f*quadSizePixels.x()/getWidth(), 2.0f*quadSizePixels.y()/getHeight());
+		Vec2					quadNDCSize				(2.0f*(float)quadSizePixels.x()/(float)getWidth(), 2.0f*(float)quadSizePixels.y()/(float)getHeight());
 		Vec2					quadNDCRightTopXY		= quadNDCLeftBottomXY + quadNDCSize;
 		tcu::TextureFormat		depthStencilFmt			= m_depthStencilFmt != GL_NONE ? glu::mapGLInternalFormat(m_depthStencilFmt) : tcu::TextureFormat();
 		bool					depth					= depthStencilFmt.order == tcu::TextureFormat::D || depthStencilFmt.order == tcu::TextureFormat::DS;
diff --git a/modules/gles3/functional/es3fFboMultisampleTests.cpp b/modules/gles3/functional/es3fFboMultisampleTests.cpp
index 0072c2e..c29cdb8 100644
--- a/modules/gles3/functional/es3fFboMultisampleTests.cpp
+++ b/modules/gles3/functional/es3fFboMultisampleTests.cpp
@@ -187,7 +187,7 @@
 
 			for (int ndx = 0; ndx < numSteps; ndx++)
 			{
-				float d = -1.0f + step*ndx;
+				float d = -1.0f + step*(float)ndx;
 				float c = (float)ndx / (float)(numSteps-1);
 
 				flatShader.setColor(*getCurrentContext(), flatShaderID, Vec4(0.0f, 0.0f, c, 1.0f) * (colorFmtInfo.valueMax-colorFmtInfo.valueMin) + colorFmtInfo.valueMin);
diff --git a/modules/gles3/functional/es3fFboTestCase.cpp b/modules/gles3/functional/es3fFboTestCase.cpp
index 443b7dd..d72ef55 100644
--- a/modules/gles3/functional/es3fFboTestCase.cpp
+++ b/modules/gles3/functional/es3fFboTestCase.cpp
@@ -317,7 +317,7 @@
 			return 0;
 
 		default:
-			DE_ASSERT(!"Unknown format");
+			DE_FATAL("Unknown format");
 			return 0;
 	}
 }
diff --git a/modules/gles3/functional/es3fFboTestUtil.cpp b/modules/gles3/functional/es3fFboTestUtil.cpp
index cd8e7c7..5e2e4f2 100644
--- a/modules/gles3/functional/es3fFboTestUtil.cpp
+++ b/modules/gles3/functional/es3fFboTestUtil.cpp
@@ -1009,7 +1009,7 @@
 			return glu::TYPE_INT_VEC4;
 
 		default:
-			DE_ASSERT(!"Unknown format");
+			DE_FATAL("Unknown format");
 			return glu::TYPE_LAST;
 	}
 }
@@ -1032,7 +1032,7 @@
 			return tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::SIGNED_INT32);
 
 		default:
-			DE_ASSERT(!"Unknown format");
+			DE_FATAL("Unknown format");
 			return tcu::TextureFormat();
 	}
 }
diff --git a/modules/gles3/functional/es3fFloatStateQueryTests.cpp b/modules/gles3/functional/es3fFloatStateQueryTests.cpp
index 65f88a5..36a0615 100644
--- a/modules/gles3/functional/es3fFloatStateQueryTests.cpp
+++ b/modules/gles3/functional/es3fFloatStateQueryTests.cpp
@@ -134,7 +134,7 @@
 	if (!state.verifyValidity(testCtx))
 		return;
 
-	const GLboolean expectedGLState = reference ? GL_TRUE : GL_FALSE;
+	const GLboolean expectedGLState = reference != 0.0f ? GL_TRUE : GL_FALSE;
 
 	if (state != expectedGLState)
 	{
@@ -165,8 +165,8 @@
 
 	const GLboolean referenceAsGLBoolean[] =
 	{
-		reference0 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
-		reference1 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+		reference0 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+		reference1 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
 	};
 
 	if (boolVector2[0] != referenceAsGLBoolean[0] ||
@@ -194,10 +194,10 @@
 
 	const GLboolean referenceAsGLBoolean[] =
 	{
-		reference0 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
-		reference1 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
-		reference2 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
-		reference3 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+		reference0 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+		reference1 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+		reference2 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+		reference3 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
 	};
 
 	if (boolVector4[0] != referenceAsGLBoolean[0] ||
diff --git a/modules/gles3/functional/es3fFragDepthTests.cpp b/modules/gles3/functional/es3fFragDepthTests.cpp
index 5647765..d8d8dd8 100644
--- a/modules/gles3/functional/es3fFragDepthTests.cpp
+++ b/modules/gles3/functional/es3fFragDepthTests.cpp
@@ -235,7 +235,7 @@
 	// Render reference.
 	for (int y = 0; y < referenceFrame.getHeight(); y++)
 	{
-		float	yf		= ((float)y + 0.5f) / referenceFrame.getHeight();
+		float	yf		= ((float)y + 0.5f) / (float)referenceFrame.getHeight();
 		int		half	= de::clamp((int)((float)referenceFrame.getWidth()*0.5f + 0.5f), 0, referenceFrame.getWidth());
 
 		// Fill left half - comparison to constant 0.5
@@ -252,7 +252,7 @@
 		for (int x = half; x < referenceFrame.getWidth(); x++)
 		{
 			float	xf		= ((float)x + 0.5f) / (float)referenceFrame.getWidth();
-			float	xh		= ((float)x - half + 0.5f) / (float)(referenceFrame.getWidth()-half);
+			float	xh		= ((float)(x - half) + 0.5f) / (float)(referenceFrame.getWidth()-half);
 			float	rd		= 1.0f - (xh + yf) * 0.5f;
 			float	d		= m_evalFunc(Vec2(xf, yf));
 			bool	dpass	= compare(m_compareFunc, d, rd);
diff --git a/modules/gles3/functional/es3fFragmentOutputTests.cpp b/modules/gles3/functional/es3fFragmentOutputTests.cpp
index 1dc1415..45fca33 100644
--- a/modules/gles3/functional/es3fFragmentOutputTests.cpp
+++ b/modules/gles3/functional/es3fFragmentOutputTests.cpp
@@ -261,7 +261,7 @@
 
 	for (int ndx = 0; ndx < (int)m_fboSpec.size(); ndx++)
 		log << TestLog::Message << "COLOR_ATTACHMENT" << ndx << ": "
-								<< glu::getPixelFormatStr(m_fboSpec[ndx].format) << ", "
+								<< glu::getTextureFormatStr(m_fboSpec[ndx].format) << ", "
 								<< m_fboSpec[ndx].width << "x" << m_fboSpec[ndx].height << ", "
 								<< m_fboSpec[ndx].samples << " samples"
 			<< TestLog::EndMessage;
@@ -597,11 +597,11 @@
 		int	quadY	= quadNdx / (gridWidth-1);
 		int quadX	= quadNdx - quadY*(gridWidth-1);
 
-		indices[quadNdx*6+0] = quadX + quadY*gridWidth;
-		indices[quadNdx*6+1] = quadX + (quadY+1)*gridWidth;
-		indices[quadNdx*6+2] = quadX + quadY*gridWidth + 1;
+		indices[quadNdx*6+0] = deUint16(quadX + quadY*gridWidth);
+		indices[quadNdx*6+1] = deUint16(quadX + (quadY+1)*gridWidth);
+		indices[quadNdx*6+2] = deUint16(quadX + quadY*gridWidth + 1);
 		indices[quadNdx*6+3] = indices[quadNdx*6+1];
-		indices[quadNdx*6+4] = quadX + (quadY+1)*gridWidth + 1;
+		indices[quadNdx*6+4] = deUint16(quadX + (quadY+1)*gridWidth + 1);
 		indices[quadNdx*6+5] = indices[quadNdx*6+2];
 	}
 
diff --git a/modules/gles3/functional/es3fImplementationLimitTests.cpp b/modules/gles3/functional/es3fImplementationLimitTests.cpp
index 1e1e3d3..7b8fbea 100644
--- a/modules/gles3/functional/es3fImplementationLimitTests.cpp
+++ b/modules/gles3/functional/es3fImplementationLimitTests.cpp
@@ -298,7 +298,7 @@
 		// Log formats.
 		m_testCtx.getLog() << TestLog::Message << "Reported:" << TestLog::EndMessage;
 		for (vector<GLint>::const_iterator fmt = formats.begin(); fmt != formats.end(); fmt++)
-			m_testCtx.getLog() << TestLog::Message << glu::getCompressedTexFormatStr(*fmt) << TestLog::EndMessage;
+			m_testCtx.getLog() << TestLog::Message << glu::getCompressedTextureFormatStr(*fmt) << TestLog::EndMessage;
 
 		// Check that all required formats are in list.
 		{
@@ -311,7 +311,7 @@
 
 				if (!found)
 				{
-					m_testCtx.getLog() << TestLog::Message << "ERROR: " << glu::getCompressedTexFormatStr(fmt) << " is missing!" << TestLog::EndMessage;
+					m_testCtx.getLog() << TestLog::Message << "ERROR: " << glu::getCompressedTextureFormatStr(fmt) << " is missing!" << TestLog::EndMessage;
 					allFormatsOk = false;
 				}
 			}
diff --git a/modules/gles3/functional/es3fInstancedRenderingTests.cpp b/modules/gles3/functional/es3fInstancedRenderingTests.cpp
index aec9c25..f55afd6 100644
--- a/modules/gles3/functional/es3fInstancedRenderingTests.cpp
+++ b/modules/gles3/functional/es3fInstancedRenderingTests.cpp
@@ -336,14 +336,14 @@
 				int ndx11 = (y + 1)*(QUAD_GRID_SIZE + 1) + x + 1;
 
 				// Lower-left triangle of a quad.
-				m_gridIndices.push_back(ndx00);
-				m_gridIndices.push_back(ndx10);
-				m_gridIndices.push_back(ndx01);
+				m_gridIndices.push_back((deUint16)ndx00);
+				m_gridIndices.push_back((deUint16)ndx10);
+				m_gridIndices.push_back((deUint16)ndx01);
 
 				// Upper-right triangle of a quad.
-				m_gridIndices.push_back(ndx11);
-				m_gridIndices.push_back(ndx01);
-				m_gridIndices.push_back(ndx10);
+				m_gridIndices.push_back((deUint16)ndx11);
+				m_gridIndices.push_back((deUint16)ndx01);
+				m_gridIndices.push_back((deUint16)ndx10);
 			}
 	}
 	else
@@ -495,7 +495,7 @@
 			int numRows = glu::getDataTypeMatrixNumRows(m_rgbAttrType);
 			int numCols = glu::getDataTypeMatrixNumColumns(m_rgbAttrType);
 
-			glVertexAttribPointer(curLoc, numRows, GL_FLOAT, GL_FALSE, numCols*numRows*sizeof(float), attrPtr);
+			glVertexAttribPointer(curLoc, numRows, GL_FLOAT, GL_FALSE, numCols*numRows*(int)sizeof(float), attrPtr);
 		}
 		else
 			DE_ASSERT(DE_FALSE);
@@ -586,18 +586,18 @@
 			deInt32 intR = (deInt32)(r*FLOAT_INT_SCALE + FLOAT_INT_BIAS);
 			deInt32 intG = (deInt32)(g*FLOAT_INT_SCALE + FLOAT_INT_BIAS);
 			deInt32 intB = (deInt32)(b*FLOAT_INT_SCALE + FLOAT_INT_BIAS);
-			r = (float)(intR - FLOAT_INT_BIAS) / FLOAT_INT_SCALE;
-			g = (float)(intG - FLOAT_INT_BIAS) / FLOAT_INT_SCALE;
-			b = (float)(intB - FLOAT_INT_BIAS) / FLOAT_INT_SCALE;
+			r = ((float)intR - FLOAT_INT_BIAS) / FLOAT_INT_SCALE;
+			g = ((float)intG - FLOAT_INT_BIAS) / FLOAT_INT_SCALE;
+			b = ((float)intB - FLOAT_INT_BIAS) / FLOAT_INT_SCALE;
 		}
 		else if(glu::isDataTypeUintOrUVec(m_rgbAttrType))
 		{
 			deUint32 uintR = (deInt32)(r*FLOAT_UINT_SCALE + FLOAT_UINT_BIAS);
 			deUint32 uintG = (deInt32)(g*FLOAT_UINT_SCALE + FLOAT_UINT_BIAS);
 			deUint32 uintB = (deInt32)(b*FLOAT_UINT_SCALE + FLOAT_UINT_BIAS);
-			r = (float)(uintR - FLOAT_UINT_BIAS) / FLOAT_UINT_SCALE;
-			g = (float)(uintG - FLOAT_UINT_BIAS) / FLOAT_UINT_SCALE;
-			b = (float)(uintB - FLOAT_UINT_BIAS) / FLOAT_UINT_SCALE;
+			r = ((float)uintR - FLOAT_UINT_BIAS) / FLOAT_UINT_SCALE;
+			g = ((float)uintG - FLOAT_UINT_BIAS) / FLOAT_UINT_SCALE;
+			b = ((float)uintB - FLOAT_UINT_BIAS) / FLOAT_UINT_SCALE;
 		}
 
 		// Draw rectangle.
diff --git a/modules/gles3/functional/es3fMultisampleTests.cpp b/modules/gles3/functional/es3fMultisampleTests.cpp
index 64b4777..19ac82d 100644
--- a/modules/gles3/functional/es3fMultisampleTests.cpp
+++ b/modules/gles3/functional/es3fMultisampleTests.cpp
@@ -446,7 +446,7 @@
 			m_numSamples = m_fboParams.numSamples;
 		else
 		{
-			log << TestLog::Message << "Querying maximum number of samples for " << glu::getPixelFormatName(FBO_COLOR_FORMAT) << " with glGetInternalformativ()" << TestLog::EndMessage;
+			log << TestLog::Message << "Querying maximum number of samples for " << glu::getTextureFormatName(FBO_COLOR_FORMAT) << " with glGetInternalformativ()" << TestLog::EndMessage;
 			GLU_CHECK_CALL(glGetInternalformativ(GL_RENDERBUFFER, FBO_COLOR_FORMAT, GL_SAMPLES, 1, &m_numSamples));
 		}
 
@@ -497,7 +497,7 @@
 			GLint maxSampleCount = -1;
 			GLU_CHECK_CALL(glGetInternalformativ(GL_RENDERBUFFER, FBO_COLOR_FORMAT, GL_SAMPLES, 1, &maxSampleCount));
 			if (maxSampleCount < m_numSamples)
-				throw tcu::NotSupportedError(std::string("") + "Maximum sample count returned by glGetInternalformativ() for " + glu::getPixelFormatName(FBO_COLOR_FORMAT) + " is only " + de::toString(maxSampleCount));
+				throw tcu::NotSupportedError(std::string("") + "Maximum sample count returned by glGetInternalformativ() for " + glu::getTextureFormatName(FBO_COLOR_FORMAT) + " is only " + de::toString(maxSampleCount));
 			else
 				throw;
 		}
@@ -668,7 +668,7 @@
 	for (int i = 0; i < numTriangles; i++)
 	{
 		float angle0 = 2.0f*DE_PI * (float)i			/ (float)numTriangles + 0.001f*(float)m_currentIteration;
-		float angle1 = 2.0f*DE_PI * (float)(i + 0.5f)	/ (float)numTriangles + 0.001f*(float)m_currentIteration;
+		float angle1 = 2.0f*DE_PI * ((float)i + 0.5f)	/ (float)numTriangles + 0.001f*(float)m_currentIteration;
 
 		renderTriangle(Vec2(0.0f, 0.0f),
 					   Vec2(deFloatCos(angle0)*0.95f, deFloatSin(angle0)*0.95f),
@@ -1138,7 +1138,7 @@
 		for (int i = 0; i < numTriangles; i++)
 		{
 			float angle0 = 2.0f*DE_PI * (float)i			/ (float)numTriangles;
-			float angle1 = 2.0f*DE_PI * (float)(i + 0.5f)	/ (float)numTriangles;
+			float angle1 = 2.0f*DE_PI * ((float)i + 0.5f)	/ (float)numTriangles;
 
 			renderTriangle(Vec2(0.0f, 0.0f),
 						   Vec2(deFloatCos(angle0)*0.95f, deFloatSin(angle0)*0.95f),
@@ -1544,7 +1544,7 @@
 		GLU_CHECK_CALL(glSampleCoverage((float)i / (float)(numTriangles-1), invertSampleCoverage ? GL_TRUE : GL_FALSE));
 
 		float angle0 = 2.0f*DE_PI * (float)i			/ (float)numTriangles;
-		float angle1 = 2.0f*DE_PI * (float)(i + 0.5f)	/ (float)numTriangles;
+		float angle1 = 2.0f*DE_PI * ((float)i + 0.5f)	/ (float)numTriangles;
 
 		renderTriangle(Vec2(0.0f, 0.0f),
 					   Vec2(deFloatCos(angle0)*0.95f, deFloatSin(angle0)*0.95f),
diff --git a/modules/gles3/functional/es3fNegativeTextureApiTests.cpp b/modules/gles3/functional/es3fNegativeTextureApiTests.cpp
index a1c9bf8..3164300 100644
--- a/modules/gles3/functional/es3fNegativeTextureApiTests.cpp
+++ b/modules/gles3/functional/es3fNegativeTextureApiTests.cpp
@@ -512,7 +512,7 @@
 						const size_t 			blockBytes 	= getBlockSize(tcuFormat);
 						const vector<deUint8>	dummyData	(blockBytes);
 
-						glCompressedTexImage2D(GL_TEXTURE_2D, 0, format, blockPixels.x(), blockPixels.y(), 0, blockBytes, &dummyData[0]);
+						glCompressedTexImage2D(GL_TEXTURE_2D, 0, format, blockPixels.x(), blockPixels.y(), 0, (int)blockBytes, &dummyData[0]);
 						expectError(GL_INVALID_ENUM);
 					}
 					FOR_CUBE_FACES(faceGL,
@@ -521,7 +521,7 @@
 						const size_t 			blockBytes 	= getBlockSize(tcuFormat) * cubeSize; // We have a x * y grid of blocks
 						const vector<deUint8>	dummyData	(blockBytes);
 
-						glCompressedTexImage2D(faceGL, 0, format, cubeSize, cubeSize, 0, blockBytes, &dummyData[0]);
+						glCompressedTexImage2D(faceGL, 0, format, cubeSize, cubeSize, 0, (int)blockBytes, &dummyData[0]);
 						expectError(GL_INVALID_ENUM);
 					});
 				}
@@ -2692,7 +2692,7 @@
 					const size_t 				blockBytes 	= getBlockSize(tcuFormat);
 					const vector<deUint8>		dummyData	(blockBytes);
 
-					glCompressedTexImage3D(GL_TEXTURE_3D, 0, format, blockPixels.x(), blockPixels.y(), blockPixels.z(), 0, blockBytes, &dummyData[0]);
+					glCompressedTexImage3D(GL_TEXTURE_3D, 0, format, blockPixels.x(), blockPixels.y(), blockPixels.z(), 0, (int)blockBytes, &dummyData[0]);
 					expectError(requiredError);
 				}
 			}
diff --git a/modules/gles3/functional/es3fPrerequisiteTests.cpp b/modules/gles3/functional/es3fPrerequisiteTests.cpp
index 32e4dea..9ebc8f6 100644
--- a/modules/gles3/functional/es3fPrerequisiteTests.cpp
+++ b/modules/gles3/functional/es3fPrerequisiteTests.cpp
@@ -138,7 +138,7 @@
 
 	};
 
-	glClearColor(r/255.0f, g/255.0f, b/255.0f, a/255.0f);
+	glClearColor(float(r)/255.0f, float(g)/255.0f, float(b)/255.0f, float(a)/255.0f);
 	glClear(GL_COLOR_BUFFER_BIT);
 
 	GLU_CHECK_MSG("CLES2 ClearColor failed.");
@@ -225,7 +225,7 @@
 	int b = (int)(deRandom_getUint32(&rnd) & 0xFF);
 
 	tcu::clear(refImage.getAccess(), tcu::IVec4(r, g, b, 255));
-	glClearColor(r/255.0f, g/255.0f, b/255.0f, 1.0f);
+	glClearColor(float(r)/255.0f, float(g)/255.0f, float(b)/255.0f, 1.0f);
 	glClear(GL_COLOR_BUFFER_BIT);
 
 	glu::readPixels(m_context.getRenderContext(), x, y, resImage.getAccess());
diff --git a/modules/gles3/functional/es3fPrimitiveRestartTests.cpp b/modules/gles3/functional/es3fPrimitiveRestartTests.cpp
index 70389bd..d926aec 100644
--- a/modules/gles3/functional/es3fPrimitiveRestartTests.cpp
+++ b/modules/gles3/functional/es3fPrimitiveRestartTests.cpp
@@ -413,7 +413,7 @@
 
 			for (int i = 0; i < numVertices; i++)
 			{
-				float fx = -0.9f + 1.8f * ((i/3) + (i%3 == 2 ? 0.8f : 0.0f)) * 3 / numRows;
+				float fx = -0.9f + 1.8f * ((float)(i/3) + (i%3 == 2 ? 0.8f : 0.0f)) * 3 / numRows;
 				float fy = -0.9f + 1.8f * ((float)rowNdx + (i%3 == 0 ? 0.0f : 0.8f)) / numRows;
 
 				m_positions.push_back(fx);
diff --git a/modules/gles3/functional/es3fRasterizationTests.cpp b/modules/gles3/functional/es3fRasterizationTests.cpp
index aec11de..52286f9 100644
--- a/modules/gles3/functional/es3fRasterizationTests.cpp
+++ b/modules/gles3/functional/es3fRasterizationTests.cpp
@@ -1412,8 +1412,8 @@
 			for (int col = 0; col < numColumns; ++col)
 			for (int row = 0; row < numRows;    ++row)
 			{
-				const tcu::Vec2 center		= tcu::Vec2((row + 0.5f) / numRows * 2.0f - 1.0f, (col + 0.5f) / numColumns * 2.0f - 1.0f);
-				const float		rotation	= (iteration * numColumns * numRows + col * numRows + row) / (float)(m_iterationCount * numColumns * numRows) * DE_PI / 2.0f;
+				const tcu::Vec2 center		= tcu::Vec2(((float)row + 0.5f) / (float)numRows * 2.0f - 1.0f, ((float)col + 0.5f) / (float)numColumns * 2.0f - 1.0f);
+				const float		rotation	= (float)(iteration * numColumns * numRows + col * numRows + row) / (float)(m_iterationCount * numColumns * numRows) * DE_PI / 2.0f;
 				const tcu::Vec2 sideH		= quadSide * tcu::Vec2(deFloatCos(rotation), deFloatSin(rotation));
 				const tcu::Vec2 sideV		= tcu::Vec2(sideH.y(), -sideH.x());
 				const tcu::Vec2 quad[4]		=
@@ -1468,7 +1468,7 @@
 		{
 			const float		quadSide	= (m_caseType == FILLRULECASE_CLIPPED_PARTIAL) ? (1.0f) : (2.0f);
 			const tcu::Vec2 center		= (m_caseType == FILLRULECASE_CLIPPED_PARTIAL) ? (tcu::Vec2(0.5f, 0.5f)) : (tcu::Vec2(0.0f, 0.0f));
-			const float		rotation	= (iteration) / (float)(m_iterationCount - 1) * DE_PI / 2.0f;
+			const float		rotation	= (float)(iteration) / (float)(m_iterationCount - 1) * DE_PI / 2.0f;
 			const tcu::Vec2 sideH		= quadSide * tcu::Vec2(deFloatCos(rotation), deFloatSin(rotation));
 			const tcu::Vec2 sideV		= tcu::Vec2(sideH.y(), -sideH.x());
 			const tcu::Vec2 quad[4]		=
diff --git a/modules/gles3/functional/es3fReadPixelsTests.cpp b/modules/gles3/functional/es3fReadPixelsTests.cpp
index d074264..24b05ca 100644
--- a/modules/gles3/functional/es3fReadPixelsTests.cpp
+++ b/modules/gles3/functional/es3fReadPixelsTests.cpp
@@ -176,10 +176,10 @@
 
 	// Render reference
 
-	const int coordX1 = (int)((-0.5f * reference.getWidth()		/ 2.0f) + reference.getWidth() / 2.0f);
-	const int coordY1 = (int)((-0.5f * reference.getHeight()	/ 2.0f) + reference.getHeight() / 2.0f);
-	const int coordX2 = (int)(( 0.5f * reference.getWidth()		/ 2.0f) + reference.getWidth() / 2.0f);
-	const int coordY2 = (int)(( 0.5f * reference.getHeight()	/ 2.0f) + reference.getHeight() / 2.0f);
+	const int coordX1 = (int)((-0.5f * (float)reference.getWidth()	/ 2.0f) + (float)reference.getWidth() / 2.0f);
+	const int coordY1 = (int)((-0.5f * (float)reference.getHeight()	/ 2.0f) + (float)reference.getHeight() / 2.0f);
+	const int coordX2 = (int)(( 0.5f * (float)reference.getWidth()	/ 2.0f) + (float)reference.getWidth() / 2.0f);
+	const int coordY2 = (int)(( 0.5f * (float)reference.getHeight()	/ 2.0f) + (float)reference.getHeight() / 2.0f);
 
 	for (int x = 0; x < reference.getWidth(); x++)
 	{
@@ -209,7 +209,7 @@
 		GLU_CHECK_CALL(glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &m_type));
 
 		if (m_format != GL_RGBA && m_format != GL_BGRA && m_format != GL_RGB)
-			TCU_THROW(NotSupportedError, ("Unsupported IMPLEMENTATION_COLOR_READ_FORMAT: " + de::toString(glu::getPixelFormatStr(m_format))).c_str());
+			TCU_THROW(NotSupportedError, ("Unsupported IMPLEMENTATION_COLOR_READ_FORMAT: " + de::toString(glu::getTextureFormatStr(m_format))).c_str());
 		if (glu::getTypeName(m_type) == DE_NULL)
 			TCU_THROW(NotSupportedError, ("Unsupported GL_IMPLEMENTATION_COLOR_READ_TYPE: " + de::toString(tcu::Format::Hex<4>(m_type))).c_str());
 	}
@@ -311,7 +311,7 @@
 	render(reference);
 
 	const int rowWidth	= (m_rowLength == 0 ? m_width : m_rowLength) + m_skipPixels;
-	const int rowPitch	= m_alignment * deCeilFloatToInt32(pixelSize * rowWidth / (float)m_alignment);
+	const int rowPitch	= m_alignment * deCeilFloatToInt32(float(pixelSize * rowWidth) / (float)m_alignment);
 
 	pixelData.resize(rowPitch * (m_height + m_skipRows), 0);
 
@@ -330,7 +330,7 @@
 	int							pixelSize;
 
 	getFormatInfo(format, pixelSize);
-	m_testCtx.getLog() << tcu::TestLog::Message << "Format: " << glu::getPixelFormatStr(m_format) << ", Type: " << glu::getTypeStr(m_type) << tcu::TestLog::EndMessage;
+	m_testCtx.getLog() << tcu::TestLog::Message << "Format: " << glu::getTextureFormatStr(m_format) << ", Type: " << glu::getTypeStr(m_type) << tcu::TestLog::EndMessage;
 
 	tcu::Texture2D reference(format, m_width, m_height);
 	reference.allocLevel(0);
@@ -353,17 +353,17 @@
 	clearColor(reference, pixelData, pixelSize);
 
 	const int							rowWidth		= (m_rowLength == 0 ? m_width : m_rowLength);
-	const int							rowPitch		= m_alignment * deCeilFloatToInt32(pixelSize * rowWidth / (float)m_alignment);
+	const int							rowPitch		= m_alignment * deCeilFloatToInt32((float)(pixelSize * rowWidth) / (float)m_alignment);
 	const tcu::ConstPixelBufferAccess	resultAccess	= tcu::ConstPixelBufferAccess(format, m_width, m_height, 1, rowPitch, 0, &(pixelData[pixelSize * m_skipPixels + m_skipRows * rowPitch]));
 
 	// \note Renderbuffers are never multisampled
 	if (!m_useRenderBuffer && m_context.getRenderTarget().getNumSamples() > 1)
 	{
 		const tcu::IVec4	formatBitDepths	= tcu::getTextureFormatBitDepth(format);
-		const deUint8		redThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits,		formatBitDepths.x()))));
-		const deUint8		greenThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits,	formatBitDepths.y()))));
-		const deUint8		blueThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits,		formatBitDepths.z()))));
-		const deUint8		alphaThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits,	formatBitDepths.w()))));
+		const deUint8		redThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits,	formatBitDepths.x()))));
+		const deUint8		greenThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits,	formatBitDepths.y()))));
+		const deUint8		blueThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits,	formatBitDepths.z()))));
+		const deUint8		alphaThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits,	formatBitDepths.w()))));
 
 		// bilinearCompare only accepts RGBA, UINT8
 		tcu::Texture2D		referenceRGBA8	(tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), m_width, m_height);
@@ -383,10 +383,10 @@
 	else
 	{
 		const tcu::IVec4	formatBitDepths	= tcu::getTextureFormatBitDepth(format);
-		const float			redThreshold	= 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits,	formatBitDepths.x()));
-		const float			greenThreshold	= 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits,	formatBitDepths.y()));
-		const float			blueThreshold	= 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits,	formatBitDepths.z()));
-		const float			alphaThreshold	= 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits,	formatBitDepths.w()));
+		const float			redThreshold	= 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits,		formatBitDepths.x()));
+		const float			greenThreshold	= 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits,	formatBitDepths.y()));
+		const float			blueThreshold	= 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits,	formatBitDepths.z()));
+		const float			alphaThreshold	= 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits,	formatBitDepths.w()));
 
 		// Compare
 		if (tcu::floatThresholdCompare(m_testCtx.getLog(), "Result", "Result", reference.getLevel(0), resultAccess, tcu::Vec4(redThreshold, greenThreshold, blueThreshold, alphaThreshold), tcu::COMPARE_LOG_RESULT))
diff --git a/modules/gles3/functional/es3fShaderBuiltinVarTests.cpp b/modules/gles3/functional/es3fShaderBuiltinVarTests.cpp
index c6d3dff..7cb6f4f 100644
--- a/modules/gles3/functional/es3fShaderBuiltinVarTests.cpp
+++ b/modules/gles3/functional/es3fShaderBuiltinVarTests.cpp
@@ -566,8 +566,8 @@
 			{
 				for (int xo = 0; xo < w; xo++)
 				{
-					const float			xf		= float(xo+0.5f) / float(w);
-					const float			yf		= float((h-yo-1)+0.5f) / float(h);
+					const float			xf		= (float(xo)+0.5f) / float(w);
+					const float			yf		= (float(h-yo-1)+0.5f) / float(h);
 					const tcu::Vec4		color	(xf, yf, 0.0f, 1.0f);
 					const int			dx		= x0+xo;
 					const int			dy		= y0+yo;
@@ -831,8 +831,8 @@
 		const int	quadY		= quadNdx/maxQuadsX;
 		const int	quadX		= quadNdx%maxQuadsX;
 
-		const float	x0			= -1.0f + quadX*w;
-		const float	y0			= -1.0f + quadY*h;
+		const float	x0			= -1.0f + float(quadX)*w;
+		const float	y0			= -1.0f + float(quadY)*h;
 
 		if (triNdx%2 == 0)
 		{
diff --git a/modules/gles3/functional/es3fShaderDerivateTests.cpp b/modules/gles3/functional/es3fShaderDerivateTests.cpp
index f883276..70217b8 100644
--- a/modules/gles3/functional/es3fShaderDerivateTests.cpp
+++ b/modules/gles3/functional/es3fShaderDerivateTests.cpp
@@ -478,11 +478,11 @@
 		// * non-linearity may happen around zero or with very high function values due to subnorms not
 		//   behaving well.
 		const tcu::Vec4	functionValueForward	= (derivateFunc == DERIVATE_DFDX)
-													? (function.evaluateAt(x + 2.0f, y + 0.5f))
-													: (function.evaluateAt(x + 0.5f, y + 2.0f));
+													? (function.evaluateAt((float)x + 2.0f, (float)y + 0.5f))
+													: (function.evaluateAt((float)x + 0.5f, (float)y + 2.0f));
 		const tcu::Vec4	functionValueBackward	= (derivateFunc == DERIVATE_DFDX)
-													? (function.evaluateAt(x - 1.0f, y + 0.5f))
-													: (function.evaluateAt(x + 0.5f, y - 1.0f));
+													? (function.evaluateAt((float)x - 1.0f, (float)y + 0.5f))
+													: (function.evaluateAt((float)x + 0.5f, (float)y - 1.0f));
 
 		bool	anyComponentFailed				= false;
 
@@ -664,7 +664,7 @@
 	if (useFbo)
 	{
 		m_testCtx.getLog() << TestLog::Message
-						   << "Rendering to FBO, format = " << glu::getPixelFormatStr(fboFormat)
+						   << "Rendering to FBO, format = " << glu::getTextureFormatStr(fboFormat)
 						   << ", samples = " << m_numSamples
 						   << TestLog::EndMessage;
 
diff --git a/modules/gles3/functional/es3fShaderIndexingTests.cpp b/modules/gles3/functional/es3fShaderIndexingTests.cpp
index b7fe3ce..d51181e 100644
--- a/modules/gles3/functional/es3fShaderIndexingTests.cpp
+++ b/modules/gles3/functional/es3fShaderIndexingTests.cpp
@@ -110,7 +110,7 @@
 	else if (dataType == TYPE_FLOAT_VEC3)	return evalArrayCoordsVec3;
 	else if (dataType == TYPE_FLOAT_VEC4)	return evalArrayCoordsVec4;
 
-	DE_ASSERT(!"Invalid data type.");
+	DE_FATAL("Invalid data type.");
 	return NULL;
 }
 
@@ -126,7 +126,7 @@
 	else if (dataType == TYPE_FLOAT_VEC3)	return evalArrayUniformVec3;
 	else if (dataType == TYPE_FLOAT_VEC4)	return evalArrayUniformVec4;
 
-	DE_ASSERT(!"Invalid data type.");
+	DE_FATAL("Invalid data type.");
 	return NULL;
 }
 
@@ -595,7 +595,7 @@
 	else if (dataType == TYPE_FLOAT_VEC3)	return evalSubscriptVec3;
 	else if (dataType == TYPE_FLOAT_VEC4)	return evalSubscriptVec4;
 
-	DE_ASSERT(!"Invalid data type.");
+	DE_FATAL("Invalid data type.");
 	return NULL;
 }
 
@@ -794,7 +794,7 @@
 		case TYPE_FLOAT_MAT4:		return evalSubscriptMat4;
 
 		default:
-			DE_ASSERT(!"Invalid data type.");
+			DE_FATAL("Invalid data type.");
 			return DE_NULL;
 	}
 }
diff --git a/modules/gles3/functional/es3fShaderLoopTests.cpp b/modules/gles3/functional/es3fShaderLoopTests.cpp
index dd5b24e..d76bf6a 100644
--- a/modules/gles3/functional/es3fShaderLoopTests.cpp
+++ b/modules/gles3/functional/es3fShaderLoopTests.cpp
@@ -196,7 +196,7 @@
 		case 3:	return evalLoop3Iters;
 	}
 
-	DE_ASSERT(!"Invalid loop iteration count.");
+	DE_FATAL("Invalid loop iteration count.");
 	return NULL;
 }
 
@@ -362,7 +362,7 @@
 	else
 	{
 		if (loopCountType == LOOPCOUNT_CONSTANT)
-			incrementStr = string("ndx += ") + de::toString(1.0f / numLoopIters);
+			incrementStr = string("ndx += ") + de::toString(1.0f / (float)numLoopIters);
 		else if (loopCountType == LOOPCOUNT_UNIFORM)
 			incrementStr = string("ndx += ") + getFloatFractionUniformName(numLoopIters);
 		else if (loopCountType == LOOPCOUNT_DYNAMIC)
diff --git a/modules/gles3/functional/es3fShaderMatrixTests.cpp b/modules/gles3/functional/es3fShaderMatrixTests.cpp
index 1f0a5ee..2a945cf 100644
--- a/modules/gles3/functional/es3fShaderMatrixTests.cpp
+++ b/modules/gles3/functional/es3fShaderMatrixTests.cpp
@@ -1666,10 +1666,10 @@
 	for (int attribNdx = 0; attribNdx < 4; attribNdx++)
 	{
 		m_userAttribTransforms[attribNdx] = Mat4(0.0f);
-		m_userAttribTransforms[attribNdx](                  0, 3) = 0.2f;						// !< prevent matrix*vec from going into zero (assuming vec.w != 0)
-		m_userAttribTransforms[attribNdx](                  1, 3) = 0.1f;						// !<
-		m_userAttribTransforms[attribNdx](                  2, 3) = 0.4f + 0.15f * attribNdx;	// !<
-		m_userAttribTransforms[attribNdx](                  3, 3) = 0.7f;						// !<
+		m_userAttribTransforms[attribNdx](                  0, 3) = 0.2f;								// !< prevent matrix*vec from going into zero (assuming vec.w != 0)
+		m_userAttribTransforms[attribNdx](                  1, 3) = 0.1f;								// !<
+		m_userAttribTransforms[attribNdx](                  2, 3) = 0.4f + 0.15f * float(attribNdx);	// !<
+		m_userAttribTransforms[attribNdx](                  3, 3) = 0.7f;								// !<
 		m_userAttribTransforms[attribNdx]((0 + attribNdx) % 4, 0) = 1.0f;
 		m_userAttribTransforms[attribNdx]((1 + attribNdx) % 4, 1) = 1.0f;
 		m_userAttribTransforms[attribNdx]((2 + attribNdx) % 4, 2) = 1.0f;
diff --git a/modules/gles3/functional/es3fShaderOperatorTests.cpp b/modules/gles3/functional/es3fShaderOperatorTests.cpp
index 3f24038..4ead3ea 100644
--- a/modules/gles3/functional/es3fShaderOperatorTests.cpp
+++ b/modules/gles3/functional/es3fShaderOperatorTests.cpp
@@ -208,7 +208,7 @@
 // Reference for expression "in0++, in1 = in0 + in2, in2 = in1"
 inline Vec4		sequenceSideEffCase0 (const Vec4& in0, const Vec4& in1, const Vec4& in2)		{ DE_UNREF(in1); return in0 + 1.0f + in2; }
 // Reference for expression "in1++, in0 = float(in1), in1 = uint(in0 + in2)"
-inline deUint32	sequenceSideEffCase1 (float in0, deUint32 in1, float in2)						{ DE_UNREF(in0); return (deUint32)(in1 + 1.0f + in2); }
+inline deUint32	sequenceSideEffCase1 (float in0, deUint32 in1, float in2)						{ DE_UNREF(in0); return (deUint32)(float(in1) + 1.0f + in2); }
 // Reference for expression "in1 = in0, in2++, in2 = in2 + vec2(in1), ivec2(in2)"
 inline IVec2	sequenceSideEffCase2 (bool in0, bool in1, const Vec2& in2)						{ DE_UNREF(in1); return (in2 + Vec2(1.0f) + Vec2((float)in0)).asInt(); }
 // Reference for expression "in0 = in0 + vec4(in2), in1 = in1 + ivec4(in0), in1++"
@@ -898,31 +898,31 @@
 Vector<T, Size> nop (const Vector<T, Size>& v) { return v; }
 
 #define DECLARE_UNARY_GENTYPE_FUNCS(FUNC_NAME)																			\
-	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].z()); }					\
+	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2)).x(); }		\
 	void eval_##FUNC_NAME##_vec2	(ShaderEvalContext& c) { c.color.yz()	= FUNC_NAME(c.in[0].swizzle(3, 1)); }		\
 	void eval_##FUNC_NAME##_vec3	(ShaderEvalContext& c) { c.color.xyz()	= FUNC_NAME(c.in[0].swizzle(2, 0, 1)); }	\
 	void eval_##FUNC_NAME##_vec4	(ShaderEvalContext& c) { c.color		= FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0)); }
 
 #define DECLARE_BINARY_GENTYPE_FUNCS(FUNC_NAME)																											\
-	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].z(),                 c.in[1].x()); }					\
+	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2),          c.in[1].swizzle(0)).x(); }			\
 	void eval_##FUNC_NAME##_vec2	(ShaderEvalContext& c) { c.color.yz()	= FUNC_NAME(c.in[0].swizzle(3, 1),       c.in[1].swizzle(1, 0)); }			\
 	void eval_##FUNC_NAME##_vec3	(ShaderEvalContext& c) { c.color.xyz()	= FUNC_NAME(c.in[0].swizzle(2, 0, 1),    c.in[1].swizzle(1, 2, 0)); }		\
 	void eval_##FUNC_NAME##_vec4	(ShaderEvalContext& c) { c.color		= FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0), c.in[1].swizzle(3, 2, 1, 0)); }
 
 #define DECLARE_TERNARY_GENTYPE_FUNCS(FUNC_NAME)																																	\
-	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].z(),                 c.in[1].x(),                 c.in[2].y()); }					\
+	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2),          c.in[1].swizzle(0),          c.in[2].swizzle(1)).x(); }		\
 	void eval_##FUNC_NAME##_vec2	(ShaderEvalContext& c) { c.color.yz()	= FUNC_NAME(c.in[0].swizzle(3, 1),       c.in[1].swizzle(1, 0),       c.in[2].swizzle(2, 1)); }			\
 	void eval_##FUNC_NAME##_vec3	(ShaderEvalContext& c) { c.color.xyz()	= FUNC_NAME(c.in[0].swizzle(2, 0, 1),    c.in[1].swizzle(1, 2, 0),    c.in[2].swizzle(3, 1, 2)); }		\
 	void eval_##FUNC_NAME##_vec4	(ShaderEvalContext& c) { c.color		= FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0), c.in[1].swizzle(3, 2, 1, 0), c.in[2].swizzle(0, 3, 2, 1)); }
 
 #define DECLARE_UNARY_SCALAR_GENTYPE_FUNCS(FUNC_NAME)																	\
-	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].z()); }					\
+	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2)); }			\
 	void eval_##FUNC_NAME##_vec2	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(3, 1)); }		\
 	void eval_##FUNC_NAME##_vec3	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2, 0, 1)); }	\
 	void eval_##FUNC_NAME##_vec4	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0)); }
 
 #define DECLARE_BINARY_SCALAR_GENTYPE_FUNCS(FUNC_NAME)																									\
-	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].z(),                 c.in[1].x()); }					\
+	void eval_##FUNC_NAME##_float	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2),          c.in[1].swizzle(0)); }				\
 	void eval_##FUNC_NAME##_vec2	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(3, 1),       c.in[1].swizzle(1, 0)); }			\
 	void eval_##FUNC_NAME##_vec3	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(2, 0, 1),    c.in[1].swizzle(1, 2, 0)); }		\
 	void eval_##FUNC_NAME##_vec4	(ShaderEvalContext& c) { c.color.x()	= FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0), c.in[1].swizzle(3, 2, 1, 0)); }
@@ -1717,7 +1717,7 @@
 		<< BuiltinFuncInfo("tanh",			"tanh",			GT,	Value(GT, -1.5f, 5.5f),		notUsed,					notUsed,					0.5f, 0.5f,		PRECMASK_LOWP,				FLOAT_GENTYPE_FUNCS(tanh) )
 		<< BuiltinFuncInfo("asinh",			"asinh",		GT,	Value(GT, -1.0f, 1.0f),		notUsed,					notUsed,					1.0f, 0.0f,		PRECMASK_MEDIUMP_HIGHP,		FLOAT_GENTYPE_FUNCS(asinh) )
 		<< BuiltinFuncInfo("acosh",			"acosh",		GT,	Value(GT, 1.0f, 2.2f),		notUsed,					notUsed,					1.0f, 0.0f,		PRECMASK_MEDIUMP_HIGHP,		FLOAT_GENTYPE_FUNCS(acosh) )
-		<< BuiltinFuncInfo("atanh",			"atanh",		GT,	Value(GT, -1.0f, 1.0f),		notUsed,					notUsed,					1.0f, 0.0f,		PRECMASK_MEDIUMP_HIGHP,		FLOAT_GENTYPE_FUNCS(atanh) )
+		<< BuiltinFuncInfo("atanh",			"atanh",		GT,	Value(GT, -0.99f, 0.99f),	notUsed,					notUsed,					1.0f, 0.0f,		PRECMASK_MEDIUMP_HIGHP,		FLOAT_GENTYPE_FUNCS(atanh) )
 	);
 
 	// 8.2 Exponential Functions.
diff --git a/modules/gles3/functional/es3fShaderPackingFunctionTests.cpp b/modules/gles3/functional/es3fShaderPackingFunctionTests.cpp
index 2fd78a0..bc5141b 100644
--- a/modules/gles3/functional/es3fShaderPackingFunctionTests.cpp
+++ b/modules/gles3/functional/es3fShaderPackingFunctionTests.cpp
@@ -668,7 +668,7 @@
 					const int		s			= rnd.getBool() ? 1 : -1;
 					const int		exp			= rnd.getInt(minExp, maxExp);
 					const deUint32	mantissa	= rnd.getUint32() & ((1<<mantBits)-1);
-					const deUint16	value		= tcu::Float16::construct(s, exp ? exp : 1 /* avoid denorm */, (1u<<10) | mantissa).bits();
+					const deUint16	value		= tcu::Float16::construct(s, exp ? exp : 1 /* avoid denorm */, (deUint16)((1u<<10) | mantissa)).bits();
 
 					inVal |= value << (16*c);
 				}
diff --git a/modules/gles3/functional/es3fShaderPrecisionTests.cpp b/modules/gles3/functional/es3fShaderPrecisionTests.cpp
index e4ae760..2ca18da 100644
--- a/modules/gles3/functional/es3fShaderPrecisionTests.cpp
+++ b/modules/gles3/functional/es3fShaderPrecisionTests.cpp
@@ -331,8 +331,8 @@
 	{
 		const deUint64	refBits				= tcu::Float64(reference).bits();
 		const deUint64	resBits				= tcu::Float64(result).bits();
-		const deUint64	accurateRefBits		= refBits >> maskBits;
-		const deUint64	accurateResBits		= resBits >> maskBits;
+		const deUint64	accurateRefBits		= maskBits < 64 ? refBits >> (deUint64)maskBits : 0u;
+		const deUint64	accurateResBits		= maskBits < 64 ? resBits >> (deUint64)maskBits : 0u;
 		const deUint64	ulpDiff				= (deUint64)de::abs((deInt64)accurateRefBits - (deInt64)accurateResBits);
 
 		if (ulpDiff > (deUint64)roundingUlpError)
@@ -559,11 +559,6 @@
 	m_renderbuffer	= 0;
 }
 
-inline int extendTo32Bit (int value, int bits)
-{
-	return (value & ((1<<(bits-1))-1)) | (((value & (1<<(bits-1))) << (32-bits)) >> (32-bits));
-}
-
 ShaderIntPrecisionCase::IterateResult ShaderIntPrecisionCase::iterate (void)
 {
 	// Constant data.
@@ -604,10 +599,10 @@
 	// Compute values and reference.
 	for (int testNdx = 0; testNdx < m_numTestsPerIter; testNdx++)
 	{
-		int		in0			= extendTo32Bit(((isMaxRangeA ? (int)m_rnd.getUint32() : m_rnd.getInt(m_rangeA.x(), m_rangeA.y())) & mask), m_bits);
-		int		in1			= extendTo32Bit(((isMaxRangeB ? (int)m_rnd.getUint32() : m_rnd.getInt(m_rangeB.x(), m_rangeB.y())) & mask), m_bits);
+		int		in0			= deSignExtendTo32(((isMaxRangeA ? (int)m_rnd.getUint32() : m_rnd.getInt(m_rangeA.x(), m_rangeA.y())) & mask), m_bits);
+		int		in1			= deSignExtendTo32(((isMaxRangeB ? (int)m_rnd.getUint32() : m_rnd.getInt(m_rangeB.x(), m_rangeB.y())) & mask), m_bits);
 		int		refMasked	= m_evalFunc(in0, in1) & mask;
-		int		refOut		= extendTo32Bit(refMasked, m_bits);
+		int		refOut		= deSignExtendTo32(refMasked, m_bits);
 
 		log << TestLog::Message << "iter " << m_iterNdx << ", test " << testNdx << ": "
 								<< "in0 = " << in0 << ", in1 = " << in1 << ", ref out = " << refOut << " / " << tcu::toHex(refMasked)
diff --git a/modules/gles3/functional/es3fShaderTextureFunctionTests.cpp b/modules/gles3/functional/es3fShaderTextureFunctionTests.cpp
index 45444d5..c6e6735 100644
--- a/modules/gles3/functional/es3fShaderTextureFunctionTests.cpp
+++ b/modules/gles3/functional/es3fShaderTextureFunctionTests.cpp
@@ -24,6 +24,7 @@
 #include "es3fShaderTextureFunctionTests.hpp"
 #include "glsShaderRenderCase.hpp"
 #include "glsShaderLibrary.hpp"
+#include "glsTextureTestUtil.hpp"
 #include "gluTexture.hpp"
 #include "gluTextureUtil.hpp"
 #include "gluPixelTransfer.hpp"
@@ -50,6 +51,8 @@
 namespace
 {
 
+using gls::TextureTestUtil::computeLodFromDerivates;
+
 enum Function
 {
 	FUNCTION_TEXTURE = 0,		//!< texture(), textureOffset()
@@ -237,86 +240,20 @@
 using tcu::IVec3;
 using tcu::IVec4;
 
-enum LodMode
-{
-	LODMODE_EXACT = 0,
-	LODMODE_MIN_BOUND,
-	LODMODE_MAX_BOUND,
-
-	LODMODE_LAST
-};
-
-static const LodMode DEFAULT_LOD_MODE = LODMODE_EXACT;
-
-inline float computeLodFromDerivates (float dudx, float dvdx, float dudy, float dvdy)
-{
-	const LodMode	mode	= DEFAULT_LOD_MODE;
-	float			p;
-
-	switch (mode)
-	{
-		case LODMODE_EXACT:
-			p = de::max(deFloatSqrt(dudx*dudx + dvdx*dvdx), deFloatSqrt(dudy*dudy + dvdy*dvdy));
-			break;
-
-		case LODMODE_MIN_BOUND:
-		case LODMODE_MAX_BOUND:
-		{
-			float mu = de::max(deFloatAbs(dudx), deFloatAbs(dudy));
-			float mv = de::max(deFloatAbs(dvdx), deFloatAbs(dvdy));
-
-			p = mode == LODMODE_MIN_BOUND ? de::max(mu, mv) : mu + mv;
-			break;
-		}
-
-		default:
-			DE_ASSERT(DE_FALSE);
-	}
-
-	return deFloatLog2(p);
-}
-
-inline float computeLodFromDerivates (float dudx, float dvdx, float dwdx, float dudy, float dvdy, float dwdy)
-{
-	const LodMode	mode	= DEFAULT_LOD_MODE;
-	float			p;
-
-	switch (mode)
-	{
-		case LODMODE_EXACT:
-			p = de::max(deFloatSqrt(dudx*dudx + dvdx*dvdx + dwdx*dwdx), deFloatSqrt(dudy*dudy + dvdy*dvdy + dwdy*dwdy));
-			break;
-
-		case LODMODE_MIN_BOUND:
-		case LODMODE_MAX_BOUND:
-		{
-			float mu = de::max(deFloatAbs(dudx), deFloatAbs(dudy));
-			float mv = de::max(deFloatAbs(dvdx), deFloatAbs(dvdy));
-			float mw = de::max(deFloatAbs(dwdx), deFloatAbs(dwdy));
-
-			p = mode == LODMODE_MIN_BOUND ? de::max(de::max(mu, mv), mw) : (mu + mv + mw);
-			break;
-		}
-
-		default:
-			DE_ASSERT(DE_FALSE);
-	}
-
-	return deFloatLog2(p);
-}
+static const gls::TextureTestUtil::LodMode DEFAULT_LOD_MODE = gls::TextureTestUtil::LODMODE_EXACT;
 
 inline float computeLodFromGrad2D (const gls::ShaderEvalContext& c)
 {
 	float w = (float)c.textures[0].tex2D->getWidth();
 	float h = (float)c.textures[0].tex2D->getHeight();
-	return computeLodFromDerivates(c.in[1].x()*w, c.in[1].y()*h, c.in[2].x()*w, c.in[2].y()*h);
+	return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*w, c.in[1].y()*h, c.in[2].x()*w, c.in[2].y()*h);
 }
 
 inline float computeLodFromGrad2DArray (const gls::ShaderEvalContext& c)
 {
 	float w = (float)c.textures[0].tex2DArray->getWidth();
 	float h = (float)c.textures[0].tex2DArray->getHeight();
-	return computeLodFromDerivates(c.in[1].x()*w, c.in[1].y()*h, c.in[2].x()*w, c.in[2].y()*h);
+	return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*w, c.in[1].y()*h, c.in[2].x()*w, c.in[2].y()*h);
 }
 
 inline float computeLodFromGrad3D (const gls::ShaderEvalContext& c)
@@ -324,7 +261,7 @@
 	float w = (float)c.textures[0].tex3D->getWidth();
 	float h = (float)c.textures[0].tex3D->getHeight();
 	float d = (float)c.textures[0].tex3D->getDepth();
-	return computeLodFromDerivates(c.in[1].x()*w, c.in[1].y()*h, c.in[1].z()*d, c.in[2].x()*w, c.in[2].y()*h, c.in[2].z()*d);
+	return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*w, c.in[1].y()*h, c.in[1].z()*d, c.in[2].x()*w, c.in[2].y()*h, c.in[2].z()*d);
 }
 
 inline float computeLodFromGradCube (const gls::ShaderEvalContext& c)
@@ -334,7 +271,7 @@
 	float d = (float)c.textures[0].texCube->getSize();
 	float s = d/(2.0f*m);
 	float t = d/(2.0f*m);
-	return computeLodFromDerivates(c.in[1].x()*s, c.in[1].y()*t, c.in[2].x()*s, c.in[2].y()*t);
+	return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*s, c.in[1].y()*t, c.in[2].x()*s, c.in[2].y()*t);
 }
 
 typedef void (*TexEvalFunc) (gls::ShaderEvalContext& c, const TexLookupParams& lookupParams);
@@ -647,7 +584,7 @@
 			m_texture2D = new glu::Texture2D(m_renderCtx, m_textureSpec.format, m_textureSpec.width, m_textureSpec.height);
 			for (int level = 0; level < m_textureSpec.numLevels; level++)
 			{
-				float	fA		= level*levelStep;
+				float	fA		= float(level)*levelStep;
 				float	fB		= 1.0f-fA;
 				Vec4	colorA	= cBias + cScale*Vec4(fA, fB, fA, fB);
 				Vec4	colorB	= cBias + cScale*Vec4(fB, fA, fB, fA);
@@ -658,9 +595,9 @@
 			m_texture2D->upload();
 
 			// Compute LOD.
-			float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*m_textureSpec.width	/ (float)viewportSize[0];
-			float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*m_textureSpec.height	/ (float)viewportSize[1];
-			m_lookupParams.lod = computeLodFromDerivates(dudx, 0.0f, 0.0f, dvdy);
+			float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width	/ (float)viewportSize[0];
+			float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height	/ (float)viewportSize[1];
+			m_lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f, 0.0f, dvdy);
 
 			// Append to texture list.
 			m_textures.push_back(gls::TextureBinding(m_texture2D, m_textureSpec.sampler));
@@ -679,7 +616,7 @@
 			m_textureCube = new glu::TextureCube(m_renderCtx, m_textureSpec.format, m_textureSpec.width);
 			for (int level = 0; level < m_textureSpec.numLevels; level++)
 			{
-				float	fA		= level*levelStep;
+				float	fA		= float(level)*levelStep;
 				float	fB		= 1.0f-fA;
 				Vec2	f		(fA, fB);
 
@@ -716,10 +653,10 @@
 			tcu::CubeFaceFloatCoords	c00		= tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
 			tcu::CubeFaceFloatCoords	c10		= tcu::getCubeFaceCoords(Vec3(m_lookupSpec.maxCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
 			tcu::CubeFaceFloatCoords	c01		= tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.maxCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
-			float						dudx	= (c10.s - c00.s)*m_textureSpec.width	/ (float)viewportSize[0];
-			float						dvdy	= (c01.t - c00.t)*m_textureSpec.height	/ (float)viewportSize[1];
+			float						dudx	= (c10.s - c00.s)*(float)m_textureSpec.width	/ (float)viewportSize[0];
+			float						dvdy	= (c01.t - c00.t)*(float)m_textureSpec.height	/ (float)viewportSize[1];
 
-			m_lookupParams.lod = computeLodFromDerivates(dudx, 0.0f, 0.0f, dvdy);
+			m_lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f, 0.0f, dvdy);
 
 			m_textures.push_back(gls::TextureBinding(m_textureCube, m_textureSpec.sampler));
 			break;
@@ -741,7 +678,7 @@
 
 				for (int layer = 0; layer < levelAccess.getDepth(); layer++)
 				{
-					float	fA		= layer*layerStep + level*levelStep;
+					float	fA		= (float)layer*layerStep + (float)level*levelStep;
 					float	fB		= 1.0f-fA;
 					Vec4	colorA	= cBias + cScale*Vec4(fA, fB, fA, fB);
 					Vec4	colorB	= cBias + cScale*Vec4(fB, fA, fB, fA);
@@ -752,9 +689,9 @@
 			m_texture2DArray->upload();
 
 			// Compute LOD.
-			float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*m_textureSpec.width	/ (float)viewportSize[0];
-			float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*m_textureSpec.height	/ (float)viewportSize[1];
-			m_lookupParams.lod = computeLodFromDerivates(dudx, 0.0f, 0.0f, dvdy);
+			float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width	/ (float)viewportSize[0];
+			float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height	/ (float)viewportSize[1];
+			m_lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f, 0.0f, dvdy);
 
 			// Append to texture list.
 			m_textures.push_back(gls::TextureBinding(m_texture2DArray, m_textureSpec.sampler));
@@ -771,7 +708,7 @@
 			m_texture3D = new glu::Texture3D(m_renderCtx, m_textureSpec.format, m_textureSpec.width, m_textureSpec.height, m_textureSpec.depth);
 			for (int level = 0; level < m_textureSpec.numLevels; level++)
 			{
-				float	fA		= level*levelStep;
+				float	fA		= (float)level*levelStep;
 				float	fB		= 1.0f-fA;
 				Vec4	colorA	= cBias + cScale*Vec4(fA, fB, fA, fB);
 				Vec4	colorB	= cBias + cScale*Vec4(fB, fA, fB, fA);
@@ -782,11 +719,11 @@
 			m_texture3D->upload();
 
 			// Compute LOD.
-			float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*m_textureSpec.width		/ (float)viewportSize[0];
-			float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*m_textureSpec.height		/ (float)viewportSize[1];
-			float dwdx = (m_lookupSpec.maxCoord[2]-m_lookupSpec.minCoord[2])*0.5f*proj*m_textureSpec.depth	/ (float)viewportSize[0];
-			float dwdy = (m_lookupSpec.maxCoord[2]-m_lookupSpec.minCoord[2])*0.5f*proj*m_textureSpec.depth	/ (float)viewportSize[1];
-			m_lookupParams.lod = computeLodFromDerivates(dudx, 0.0f, dwdx, 0.0f, dvdy, dwdy);
+			float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width		/ (float)viewportSize[0];
+			float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height		/ (float)viewportSize[1];
+			float dwdx = (m_lookupSpec.maxCoord[2]-m_lookupSpec.minCoord[2])*0.5f*proj*(float)m_textureSpec.depth	/ (float)viewportSize[0];
+			float dwdy = (m_lookupSpec.maxCoord[2]-m_lookupSpec.minCoord[2])*0.5f*proj*(float)m_textureSpec.depth	/ (float)viewportSize[1];
+			m_lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f, dwdx, 0.0f, dvdy, dwdy);
 
 			// Append to texture list.
 			m_textures.push_back(gls::TextureBinding(m_texture3D, m_textureSpec.sampler));
diff --git a/modules/gles3/functional/es3fTextureFormatTests.cpp b/modules/gles3/functional/es3fTextureFormatTests.cpp
index 629fe84..ce4f6b6 100644
--- a/modules/gles3/functional/es3fTextureFormatTests.cpp
+++ b/modules/gles3/functional/es3fTextureFormatTests.cpp
@@ -125,9 +125,9 @@
 	std::ostringstream		fmtName;
 
 	if (m_dataType)
-		fmtName << glu::getPixelFormatStr(m_format) << ", " << glu::getTypeStr(m_dataType);
+		fmtName << glu::getTextureFormatStr(m_format) << ", " << glu::getTypeStr(m_dataType);
 	else
-		fmtName << glu::getPixelFormatStr(m_format);
+		fmtName << glu::getTextureFormatStr(m_format);
 
 	log << TestLog::Message << "2D texture, " << fmtName.str() << ", " << m_width << "x" << m_height
 							<< ",\n  fill with " << formatGradient(&spec.valueMin, &spec.valueMax) << " gradient"
@@ -290,9 +290,9 @@
 	std::ostringstream		fmtName;
 
 	if (m_dataType)
-		fmtName << glu::getPixelFormatStr(m_format) << ", " << glu::getTypeStr(m_dataType);
+		fmtName << glu::getTextureFormatStr(m_format) << ", " << glu::getTypeStr(m_dataType);
 	else
-		fmtName << glu::getPixelFormatStr(m_format);
+		fmtName << glu::getTextureFormatStr(m_format);
 
 	log << TestLog::Message << "Cube map texture, " << fmtName.str() << ", " << m_width << "x" << m_height
 							<< ",\n  fill with " << formatGradient(&spec.valueMin, &spec.valueMax) << " gradient"
@@ -1302,7 +1302,7 @@
 		deUint32	format			= texFormats[formatNdx].format;
 		deUint32	dataType		= texFormats[formatNdx].dataType;
 		string	nameBase		= texFormats[formatNdx].name;
-		string	descriptionBase	= string(glu::getPixelFormatName(format)) + ", " + glu::getTypeName(dataType);
+		string	descriptionBase	= string(glu::getTextureFormatName(format)) + ", " + glu::getTypeName(dataType);
 
 		unsizedGroup->addChild(new Texture2DFormatCase			(m_testCtx, m_context.getRenderContext(),	(nameBase + "_2d_pot").c_str(),			(descriptionBase + ", GL_TEXTURE_2D").c_str(),			format, dataType, 128, 128));
 		unsizedGroup->addChild(new Texture2DFormatCase			(m_testCtx, m_context.getRenderContext(),	(nameBase + "_2d_npot").c_str(),		(descriptionBase + ", GL_TEXTURE_2D").c_str(),			format, dataType,  63, 112));
@@ -1389,7 +1389,7 @@
 	{
 		deUint32	internalFormat	= sizedColorFormats[formatNdx].internalFormat;
 		string	nameBase		= sizedColorFormats[formatNdx].name;
-		string	descriptionBase	= glu::getPixelFormatName(internalFormat);
+		string	descriptionBase	= glu::getTextureFormatName(internalFormat);
 
 		sized2DGroup->addChild		(new Texture2DFormatCase		(m_testCtx, m_context.getRenderContext(),	(nameBase + "_pot").c_str(),	(descriptionBase + ", GL_TEXTURE_2D").c_str(),			internalFormat, 128, 128));
 		sized2DGroup->addChild		(new Texture2DFormatCase		(m_testCtx, m_context.getRenderContext(),	(nameBase + "_npot").c_str(),	(descriptionBase + ", GL_TEXTURE_2D").c_str(),			internalFormat,  63, 112));
@@ -1405,7 +1405,7 @@
 	{
 		deUint32	internalFormat	= sizedDepthStencilFormats[formatNdx].internalFormat;
 		string	nameBase		= sizedDepthStencilFormats[formatNdx].name;
-		string	descriptionBase	= glu::getPixelFormatName(internalFormat);
+		string	descriptionBase	= glu::getTextureFormatName(internalFormat);
 
 		sized2DGroup->addChild		(new Texture2DFormatCase		(m_testCtx, m_context.getRenderContext(),	(nameBase + "_pot").c_str(),	(descriptionBase + ", GL_TEXTURE_2D").c_str(),			internalFormat, 128, 128));
 		sized2DGroup->addChild		(new Texture2DFormatCase		(m_testCtx, m_context.getRenderContext(),	(nameBase + "_npot").c_str(),	(descriptionBase + ", GL_TEXTURE_2D").c_str(),			internalFormat,  63, 112));
diff --git a/modules/gles3/functional/es3fTextureSpecificationTests.cpp b/modules/gles3/functional/es3fTextureSpecificationTests.cpp
index 92765ab..8e5b0ec 100644
--- a/modules/gles3/functional/es3fTextureSpecificationTests.cpp
+++ b/modules/gles3/functional/es3fTextureSpecificationTests.cpp
@@ -658,7 +658,7 @@
 	void createTexture (void)
 	{
 		deUint32			tex			= 0;
-		tcu::TextureLevel	levelData	(m_texFormat);
+		tcu::TextureLevel	levelData	(glu::mapGLTransferFormat(m_format, m_dataType));
 		de::Random			rnd			(deStringHash(getName()));
 
 		glGenTextures(1, &tex);
@@ -713,7 +713,7 @@
 	void createTexture (void)
 	{
 		deUint32			tex			= 0;
-		tcu::TextureLevel	levelData	(m_texFormat);
+		tcu::TextureLevel	levelData	(glu::mapGLTransferFormat(m_format, m_dataType));
 		de::Random			rnd			(deStringHash(getName()));
 
 		glGenTextures(1, &tex);
@@ -757,9 +757,9 @@
 	void createTexture (void)
 	{
 		deUint32				tex			= 0;
-		tcu::TextureLevel		levelData	(m_texFormat);
 		de::Random				rnd			(deStringHash(getName()));
 		glu::TransferFormat		transferFmt	= glu::getTransferFormat(m_texFormat);
+		tcu::TextureLevel		levelData	(glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
 
 		glGenTextures(1, &tex);
 		glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
@@ -796,9 +796,9 @@
 	void createTexture (void)
 	{
 		deUint32				tex			= 0;
-		tcu::TextureLevel		levelData	(m_texFormat);
 		de::Random				rnd			(deStringHash(getName()));
 		glu::TransferFormat		transferFmt	= glu::getTransferFormat(m_texFormat);
+		tcu::TextureLevel		levelData	(glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
 
 		glGenTextures(1, &tex);
 		glBindTexture(GL_TEXTURE_3D, tex);
@@ -849,7 +849,7 @@
 	void createTexture (void)
 	{
 		deUint32			tex			= 0;
-		tcu::TextureLevel	levelData	(m_texFormat);
+		tcu::TextureLevel	levelData	(glu::mapGLTransferFormat(m_format, m_dataType));
 		de::Random			rnd			(deStringHash(getName()));
 
 		glGenTextures(1, &tex);
@@ -909,7 +909,7 @@
 	void createTexture (void)
 	{
 		deUint32			tex			= 0;
-		tcu::TextureLevel	levelData	(m_texFormat);
+		tcu::TextureLevel	levelData	(glu::mapGLTransferFormat(m_format, m_dataType));
 		de::Random			rnd			(deStringHash(getName()));
 
 		glGenTextures(1, &tex);
@@ -2128,7 +2128,7 @@
 		tcu::TextureFormat		fmt				= glu::mapGLInternalFormat(m_internalFormat);
 		glu::TransferFormat		transferFmt		= glu::getTransferFormat(fmt);
 		deUint32				tex				= 0;
-		tcu::TextureLevel		levelData		(fmt);
+		tcu::TextureLevel		levelData		(glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
 		de::Random				rnd				(deStringHash(getName()));
 
 		glGenTextures(1, &tex);
@@ -2170,7 +2170,7 @@
 		tcu::TextureFormat		fmt				= glu::mapGLInternalFormat(m_internalFormat);
 		glu::TransferFormat		transferFmt		= glu::getTransferFormat(fmt);
 		deUint32				tex				= 0;
-		tcu::TextureLevel		levelData		(fmt);
+		tcu::TextureLevel		levelData		(glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
 		de::Random				rnd				(deStringHash(getName()));
 
 		glGenTextures(1, &tex);
@@ -2214,9 +2214,9 @@
 	void createTexture (void)
 	{
 		deUint32				tex			= 0;
-		tcu::TextureLevel		levelData	(m_texFormat);
 		de::Random				rnd			(deStringHash(getName()));
 		glu::TransferFormat		transferFmt	= glu::getTransferFormat(m_texFormat);
+		tcu::TextureLevel		levelData	(glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
 
 		glGenTextures	(1, &tex);
 		glBindTexture	(GL_TEXTURE_2D_ARRAY, tex);
@@ -2255,9 +2255,9 @@
 	void createTexture (void)
 	{
 		deUint32				tex			= 0;
-		tcu::TextureLevel		levelData	(m_texFormat);
 		de::Random				rnd			(deStringHash(getName()));
 		glu::TransferFormat		transferFmt	= glu::getTransferFormat(m_texFormat);
+		tcu::TextureLevel		levelData	(glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
 
 		glGenTextures	(1, &tex);
 		glBindTexture	(GL_TEXTURE_3D, tex);
@@ -3032,7 +3032,7 @@
 	{
 		glu::TransferFormat	fmt			= glu::getTransferFormat(m_texFormat);
 		deUint32			tex			= 0;
-		tcu::TextureLevel	levelData	(m_texFormat);
+		tcu::TextureLevel	levelData	(glu::mapGLTransferFormat(fmt.format, fmt.dataType));
 
 		glGenTextures(1, &tex);
 		glBindTexture(GL_TEXTURE_2D, tex);
@@ -3079,7 +3079,7 @@
 	{
 		glu::TransferFormat	fmt			= glu::getTransferFormat(m_texFormat);
 		deUint32			tex			= 0;
-		tcu::TextureLevel	levelData	(m_texFormat);
+		tcu::TextureLevel	levelData	(glu::mapGLTransferFormat(fmt.format, fmt.dataType));
 
 		glGenTextures(1, &tex);
 		glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
@@ -3126,7 +3126,7 @@
 		glu::TransferFormat	fmt			= glu::getTransferFormat(m_texFormat);
 		de::Random			rnd			(deStringHash(getName()));
 		deUint32			tex			= 0;
-		tcu::TextureLevel	levelData	(m_texFormat);
+		tcu::TextureLevel	levelData	(glu::mapGLTransferFormat(fmt.format, fmt.dataType));
 
 		glGenTextures(1, &tex);
 		glBindTexture(GL_TEXTURE_2D, tex);
@@ -3196,7 +3196,7 @@
 		glu::TransferFormat	fmt			= glu::getTransferFormat(m_texFormat);
 		de::Random			rnd			(deStringHash(getName()));
 		deUint32			tex			= 0;
-		tcu::TextureLevel	levelData	(m_texFormat);
+		tcu::TextureLevel	levelData	(glu::mapGLTransferFormat(fmt.format, fmt.dataType));
 
 		glGenTextures(1, &tex);
 		glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
diff --git a/modules/gles3/functional/es3fTransformFeedbackTests.cpp b/modules/gles3/functional/es3fTransformFeedbackTests.cpp
index 6ddd9c8..f50d4a4 100644
--- a/modules/gles3/functional/es3fTransformFeedbackTests.cpp
+++ b/modules/gles3/functional/es3fTransformFeedbackTests.cpp
@@ -440,12 +440,12 @@
 
 	// Add position.
 	attributes.push_back(Attribute("a_position", glu::VarType(glu::TYPE_FLOAT_VEC4, glu::PRECISION_HIGHP), inputStride));
-	inputStride += 4*sizeof(deUint32);
+	inputStride += 4*(int)sizeof(deUint32);
 
 	if (usePointSize)
 	{
 		attributes.push_back(Attribute("a_pointSize", glu::VarType(glu::TYPE_FLOAT, glu::PRECISION_HIGHP), inputStride));
-		inputStride += 1*sizeof(deUint32);
+		inputStride += 1*(int)sizeof(deUint32);
 	}
 
 	// Compute attribute vector.
@@ -457,7 +457,7 @@
 			string			name	= getAttributeName(var->name.c_str(), vecIter.getPath());
 
 			attributes.push_back(Attribute(name, type, inputStride));
-			inputStride += glu::getDataTypeScalarSize(type.getBasicType())*sizeof(deUint32);
+			inputStride += glu::getDataTypeScalarSize(type.getBasicType())*(int)sizeof(deUint32);
 		}
 	}
 }
@@ -516,7 +516,7 @@
 			}
 		}
 
-		accumulatedSize += output.type.getScalarSize()*sizeof(deUint32);
+		accumulatedSize += output.type.getScalarSize()*(int)sizeof(deUint32);
 	}
 }
 
@@ -776,7 +776,7 @@
 		if (!isOk)
 			break;
 
-		outOffset += numComponents*sizeof(deUint32);
+		outOffset += numComponents*(int)sizeof(deUint32);
 	}
 
 	return isOk;
@@ -959,13 +959,13 @@
 	if (m_bufferMode == GL_SEPARATE_ATTRIBS)
 	{
 		for (vector<Output>::const_iterator outIter = m_transformFeedbackOutputs.begin(); outIter != m_transformFeedbackOutputs.end(); outIter++)
-			m_bufferStrides.push_back(outIter->type.getScalarSize()*sizeof(deUint32));
+			m_bufferStrides.push_back(outIter->type.getScalarSize()*(int)sizeof(deUint32));
 	}
 	else
 	{
 		int totalSize = 0;
 		for (vector<Output>::const_iterator outIter = m_transformFeedbackOutputs.begin(); outIter != m_transformFeedbackOutputs.end(); outIter++)
-			totalSize += outIter->type.getScalarSize()*sizeof(deUint32);
+			totalSize += outIter->type.getScalarSize()*(int)sizeof(deUint32);
 
 		m_bufferStrides.push_back(totalSize);
 	}
diff --git a/modules/gles3/functional/es3fVertexArrayObjectTests.cpp b/modules/gles3/functional/es3fVertexArrayObjectTests.cpp
index 776239e..ae9183f 100644
--- a/modules/gles3/functional/es3fVertexArrayObjectTests.cpp
+++ b/modules/gles3/functional/es3fVertexArrayObjectTests.cpp
@@ -327,13 +327,13 @@
 	{
 		switch (buffer.type)
 		{
-			case GL_FLOAT:			stride = buffer.componentCount * sizeof(GLfloat);	break;
-			case GL_INT:			stride = buffer.componentCount * sizeof(GLint);		break;
-			case GL_UNSIGNED_INT:	stride = buffer.componentCount * sizeof(GLuint);	break;
-			case GL_SHORT:			stride = buffer.componentCount * sizeof(GLshort);	break;
-			case GL_UNSIGNED_SHORT:	stride = buffer.componentCount * sizeof(GLushort);	break;
-			case GL_BYTE:			stride = buffer.componentCount * sizeof(GLbyte);	break;
-			case GL_UNSIGNED_BYTE:	stride = buffer.componentCount * sizeof(GLubyte);	break;
+			case GL_FLOAT:			stride = buffer.componentCount * (int)sizeof(GLfloat);	break;
+			case GL_INT:			stride = buffer.componentCount * (int)sizeof(GLint);	break;
+			case GL_UNSIGNED_INT:	stride = buffer.componentCount * (int)sizeof(GLuint);	break;
+			case GL_SHORT:			stride = buffer.componentCount * (int)sizeof(GLshort);	break;
+			case GL_UNSIGNED_SHORT:	stride = buffer.componentCount * (int)sizeof(GLushort);	break;
+			case GL_BYTE:			stride = buffer.componentCount * (int)sizeof(GLbyte);	break;
+			case GL_UNSIGNED_BYTE:	stride = buffer.componentCount * (int)sizeof(GLubyte);	break;
 
 			default:
 				stride = 0;
@@ -376,7 +376,7 @@
 
 				case GL_SHORT:
 				{
-					GLshort v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+					GLshort v = (GLshort)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
 					deMemcpy(componentItr, &v, sizeof(v));
 					componentItr += sizeof(v);
 					break;
@@ -384,7 +384,7 @@
 
 				case GL_UNSIGNED_SHORT:
 				{
-					GLushort v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+					GLushort v = (GLushort)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
 					deMemcpy(componentItr, &v, sizeof(v));
 					componentItr += sizeof(v);
 					break;
@@ -392,7 +392,7 @@
 
 				case GL_BYTE:
 				{
-					GLbyte v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+					GLbyte v = (GLbyte)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
 					deMemcpy(componentItr, &v, sizeof(v));
 					componentItr += sizeof(v);
 					break;
@@ -400,7 +400,7 @@
 
 				case GL_UNSIGNED_BYTE:
 				{
-					GLubyte v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+					GLubyte v = (GLubyte)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
 					deMemcpy(componentItr, &v, sizeof(v));
 					componentItr += sizeof(v);
 					break;
@@ -437,12 +437,12 @@
 
 			switch (state.attributes[0].type)
 			{
-				case GL_SHORT:			scale  = (1.0f/((1u<<14)-1));	break;
-				case GL_UNSIGNED_SHORT:	scale  = (1.0f/((1u<<15)-1));	break;
-				case GL_INT:			scale  = (1.0f/((1u<<30)-1));	break;
-				case GL_UNSIGNED_INT:	scale  = (1.0f/((1u<<31)-1));	break;
-				case GL_BYTE:			scale  = (1.0f/((1u<<6)-1));	break;
-				case GL_UNSIGNED_BYTE:	scale  = (1.0f/((1u<<7)-1));	break;
+				case GL_SHORT:			scale  = (1.0f/float((1u<<14)-1u));	break;
+				case GL_UNSIGNED_SHORT:	scale  = (1.0f/float((1u<<15)-1u));	break;
+				case GL_INT:			scale  = (1.0f/float((1u<<30)-1u));	break;
+				case GL_UNSIGNED_INT:	scale  = (1.0f/float((1u<<31)-1u));	break;
+				case GL_BYTE:			scale  = (1.0f/float((1u<<6)-1u));	break;
+				case GL_UNSIGNED_BYTE:	scale  = (1.0f/float((1u<<7)-1u));	break;
 
 				default:
 					DE_ASSERT(DE_FALSE);
@@ -455,12 +455,12 @@
 
 			switch (state.attributes[0].type)
 			{
-				case GL_SHORT:			scale  = (0.5f/((1u<<14)-1));	break;
-				case GL_UNSIGNED_SHORT:	scale  = (0.5f/((1u<<15)-1));	break;
-				case GL_INT:			scale  = (0.5f/((1u<<30)-1));	break;
-				case GL_UNSIGNED_INT:	scale  = (0.5f/((1u<<31)-1));	break;
-				case GL_BYTE:			scale  = (0.5f/((1u<<6)-1));	break;
-				case GL_UNSIGNED_BYTE:	scale  = (0.5f/((1u<<7)-1));	break;
+				case GL_SHORT:			scale  = (0.5f/float((1u<<14)-1u));	break;
+				case GL_UNSIGNED_SHORT:	scale  = (0.5f/float((1u<<15)-1u));	break;
+				case GL_INT:			scale  = (0.5f/float((1u<<30)-1u));	break;
+				case GL_UNSIGNED_INT:	scale  = (0.5f/float((1u<<31)-1u));	break;
+				case GL_BYTE:			scale  = (0.5f/float((1u<<6)-1u));	break;
+				case GL_UNSIGNED_BYTE:	scale  = (0.5f/float((1u<<7)-1u));	break;
 
 				default:
 					DE_ASSERT(DE_FALSE);
@@ -483,12 +483,12 @@
 
 		switch (state.attributes[0].type)
 		{
-			case GL_SHORT:			scale  = (1.0f/((1u<<14)-1));	break;
-			case GL_UNSIGNED_SHORT:	scale  = (1.0f/((1u<<15)-1));	break;
-			case GL_INT:			scale  = (1.0f/((1u<<30)-1));	break;
-			case GL_UNSIGNED_INT:	scale  = (1.0f/((1u<<31)-1));	break;
-			case GL_BYTE:			scale  = (1.0f/((1u<<6)-1));	break;
-			case GL_UNSIGNED_BYTE:	scale  = (1.0f/((1u<<7)-1));	break;
+			case GL_SHORT:			scale  = (1.0f/float((1u<<14)-1u));	break;
+			case GL_UNSIGNED_SHORT:	scale  = (1.0f/float((1u<<15)-1u));	break;
+			case GL_INT:			scale  = (1.0f/float((1u<<30)-1u));	break;
+			case GL_UNSIGNED_INT:	scale  = (1.0f/float((1u<<31)-1u));	break;
+			case GL_BYTE:			scale  = (1.0f/float((1u<<6)-1u));	break;
+			case GL_UNSIGNED_BYTE:	scale  = (1.0f/float((1u<<7)-1u));	break;
 
 			default:
 				DE_ASSERT(DE_FALSE);
@@ -512,18 +512,18 @@
 
 			switch (state.attributes[0].type)
 			{
-				case GL_SHORT:			scale  = (1.0f/((1u<<14)-1));	break;
-				case GL_UNSIGNED_SHORT:	scale  = (1.0f/((1u<<15)-1));	break;
-				case GL_INT:			scale  = (1.0f/((1u<<30)-1));	break;
-				case GL_UNSIGNED_INT:	scale  = (1.0f/((1u<<31)-1));	break;
-				case GL_BYTE:			scale  = (1.0f/((1u<<6)-1));	break;
-				case GL_UNSIGNED_BYTE:	scale  = (1.0f/((1u<<7)-1));	break;
+				case GL_SHORT:			scale  = (1.0f/float((1u<<14)-1u));	break;
+				case GL_UNSIGNED_SHORT:	scale  = (1.0f/float((1u<<15)-1u));	break;
+				case GL_INT:			scale  = (1.0f/float((1u<<30)-1u));	break;
+				case GL_UNSIGNED_INT:	scale  = (1.0f/float((1u<<31)-1u));	break;
+				case GL_BYTE:			scale  = (1.0f/float((1u<<6)-1u));	break;
+				case GL_UNSIGNED_BYTE:	scale  = (1.0f/float((1u<<7)-1u));	break;
 
 				default:
 					DE_ASSERT(DE_FALSE);
 			}
 
-			scale *= 0.5;
+			scale *= 0.5f;
 
 			vertexShaderStream
 				<< "\tgl_Position = vec4(" << scale << " * " <<  "a_attrib0.xyz, 1.0);\n"
@@ -903,13 +903,13 @@
 	{
 		switch (buffer.type)
 		{
-			case GL_FLOAT:			stride = buffer.componentCount * sizeof(GLfloat);	break;
-			case GL_INT:			stride = buffer.componentCount * sizeof(GLint);		break;
-			case GL_UNSIGNED_INT:	stride = buffer.componentCount * sizeof(GLuint);	break;
-			case GL_SHORT:			stride = buffer.componentCount * sizeof(GLshort);	break;
-			case GL_UNSIGNED_SHORT:	stride = buffer.componentCount * sizeof(GLushort);	break;
-			case GL_BYTE:			stride = buffer.componentCount * sizeof(GLbyte);	break;
-			case GL_UNSIGNED_BYTE:	stride = buffer.componentCount * sizeof(GLubyte);	break;
+			case GL_FLOAT:			stride = buffer.componentCount * (int)sizeof(GLfloat);	break;
+			case GL_INT:			stride = buffer.componentCount * (int)sizeof(GLint);	break;
+			case GL_UNSIGNED_INT:	stride = buffer.componentCount * (int)sizeof(GLuint);	break;
+			case GL_SHORT:			stride = buffer.componentCount * (int)sizeof(GLshort);	break;
+			case GL_UNSIGNED_SHORT:	stride = buffer.componentCount * (int)sizeof(GLushort);	break;
+			case GL_BYTE:			stride = buffer.componentCount * (int)sizeof(GLbyte);	break;
+			case GL_UNSIGNED_BYTE:	stride = buffer.componentCount * (int)sizeof(GLubyte);	break;
 
 			default:
 				stride = 0;
@@ -944,7 +944,7 @@
 
 				case GL_UNSIGNED_INT:
 				{
-					GLuint v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+					GLuint v = (GLuint)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
 					deMemcpy(componentItr, &v, sizeof(v));
 					componentItr += sizeof(v);
 					break;
@@ -952,7 +952,7 @@
 
 				case GL_SHORT:
 				{
-					GLshort v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+					GLshort v = (GLshort)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
 					deMemcpy(componentItr, &v, sizeof(v));
 					componentItr += sizeof(v);
 					break;
@@ -960,7 +960,7 @@
 
 				case GL_UNSIGNED_SHORT:
 				{
-					GLushort v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+					GLushort v = (GLushort)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
 					deMemcpy(componentItr, &v, sizeof(v));
 					componentItr += sizeof(v);
 					break;
@@ -968,7 +968,7 @@
 
 				case GL_BYTE:
 				{
-					GLbyte v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+					GLbyte v = (GLbyte)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
 					deMemcpy(componentItr, &v, sizeof(v));
 					componentItr += sizeof(v);
 					break;
@@ -976,7 +976,7 @@
 
 				case GL_UNSIGNED_BYTE:
 				{
-					GLubyte v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+					GLubyte v = (GLubyte)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
 					deMemcpy(componentItr, &v, sizeof(v));
 					componentItr += sizeof(v);
 					break;
@@ -1013,12 +1013,12 @@
 
 			switch (state.attributes[0].type)
 			{
-				case GL_SHORT:			scale  = (1.0f/((1u<<14)-1));	break;
-				case GL_UNSIGNED_SHORT:	scale  = (1.0f/((1u<<15)-1));	break;
-				case GL_INT:			scale  = (1.0f/((1u<<30)-1));	break;
-				case GL_UNSIGNED_INT:	scale  = (1.0f/((1u<<31)-1));	break;
-				case GL_BYTE:			scale  = (1.0f/((1u<<6)-1));	break;
-				case GL_UNSIGNED_BYTE:	scale  = (1.0f/((1u<<7)-1));	break;
+				case GL_SHORT:			scale  = (1.0f/float((1u<<14)-1u));	break;
+				case GL_UNSIGNED_SHORT:	scale  = (1.0f/float((1u<<15)-1u));	break;
+				case GL_INT:			scale  = (1.0f/float((1u<<30)-1u));	break;
+				case GL_UNSIGNED_INT:	scale  = (1.0f/float((1u<<31)-1u));	break;
+				case GL_BYTE:			scale  = (1.0f/float((1u<<6)-1u));	break;
+				case GL_UNSIGNED_BYTE:	scale  = (1.0f/float((1u<<7)-1u));	break;
 
 				default:
 					DE_ASSERT(DE_FALSE);
@@ -1031,12 +1031,12 @@
 
 			switch (state.attributes[0].type)
 			{
-				case GL_SHORT:			scale  = (0.5f/((1u<<14)-1));	break;
-				case GL_UNSIGNED_SHORT:	scale  = (0.5f/((1u<<15)-1));	break;
-				case GL_INT:			scale  = (0.5f/((1u<<30)-1));	break;
-				case GL_UNSIGNED_INT:	scale  = (0.5f/((1u<<31)-1));	break;
-				case GL_BYTE:			scale  = (0.5f/((1u<<6)-1));	break;
-				case GL_UNSIGNED_BYTE:	scale  = (0.5f/((1u<<7)-1));	break;
+				case GL_SHORT:			scale  = (0.5f/float((1u<<14)-1u));	break;
+				case GL_UNSIGNED_SHORT:	scale  = (0.5f/float((1u<<15)-1u));	break;
+				case GL_INT:			scale  = (0.5f/float((1u<<30)-1u));	break;
+				case GL_UNSIGNED_INT:	scale  = (0.5f/float((1u<<31)-1u));	break;
+				case GL_BYTE:			scale  = (0.5f/float((1u<<6)-1u));	break;
+				case GL_UNSIGNED_BYTE:	scale  = (0.5f/float((1u<<7)-1u));	break;
 
 				default:
 					DE_ASSERT(DE_FALSE);
@@ -1059,12 +1059,12 @@
 
 		switch (state.attributes[0].type)
 		{
-			case GL_SHORT:			scale  = (1.0f/((1u<<14)-1));	break;
-			case GL_UNSIGNED_SHORT:	scale  = (1.0f/((1u<<15)-1));	break;
-			case GL_INT:			scale  = (1.0f/((1u<<30)-1));	break;
-			case GL_UNSIGNED_INT:	scale  = (1.0f/((1u<<31)-1));	break;
-			case GL_BYTE:			scale  = (1.0f/((1u<<6)-1));	break;
-			case GL_UNSIGNED_BYTE:	scale  = (1.0f/((1u<<7)-1));	break;
+			case GL_SHORT:			scale  = (1.0f/float((1u<<14)-1u));	break;
+			case GL_UNSIGNED_SHORT:	scale  = (1.0f/float((1u<<15)-1u));	break;
+			case GL_INT:			scale  = (1.0f/float((1u<<30)-1u));	break;
+			case GL_UNSIGNED_INT:	scale  = (1.0f/float((1u<<31)-1u));	break;
+			case GL_BYTE:			scale  = (1.0f/float((1u<<6)-1u));	break;
+			case GL_UNSIGNED_BYTE:	scale  = (1.0f/float((1u<<7)-1u));	break;
 
 
 			default:
@@ -1089,18 +1089,18 @@
 
 			switch (state.attributes[0].type)
 			{
-				case GL_SHORT:			scale  = (1.0f/((1u<<14)-1));	break;
-				case GL_UNSIGNED_SHORT:	scale  = (1.0f/((1u<<15)-1));	break;
-				case GL_INT:			scale  = (1.0f/((1u<<30)-1));	break;
-				case GL_UNSIGNED_INT:	scale  = (1.0f/((1u<<31)-1));	break;
-				case GL_BYTE:			scale  = (1.0f/((1u<<6)-1));	break;
-				case GL_UNSIGNED_BYTE:	scale  = (1.0f/((1u<<7)-1));	break;
+				case GL_SHORT:			scale  = (1.0f/float((1u<<14)-1u));	break;
+				case GL_UNSIGNED_SHORT:	scale  = (1.0f/float((1u<<15)-1u));	break;
+				case GL_INT:			scale  = (1.0f/float((1u<<30)-1u));	break;
+				case GL_UNSIGNED_INT:	scale  = (1.0f/float((1u<<31)-1u));	break;
+				case GL_BYTE:			scale  = (1.0f/float((1u<<6)-1u));	break;
+				case GL_UNSIGNED_BYTE:	scale  = (1.0f/float((1u<<7)-1u));	break;
 
 				default:
 					DE_ASSERT(DE_FALSE);
 			}
 
-			scale *= 0.5;
+			scale *= 0.5f;
 
 			vertexShaderStream
 				<< "\tgl_Position = vec4(" << scale << " * " <<  "vec3(a_attrib0.xyz), 1.0);\n"
diff --git a/modules/gles3/functional/es3fVertexTextureTests.cpp b/modules/gles3/functional/es3fVertexTextureTests.cpp
index 7528abf..a2cd1c0 100644
--- a/modules/gles3/functional/es3fVertexTextureTests.cpp
+++ b/modules/gles3/functional/es3fVertexTextureTests.cpp
@@ -298,13 +298,13 @@
 		for (int i = 0; i < DE_LENGTH_OF_ARRAY(quadVertices); i++)
 			m_positions.push_back(safeCoords(quadVertices[i], renderSize, Vec2(0.0f)) * 2.0f - 1.0f);
 
-		m_indices.push_back(firstNdx + 0);
-		m_indices.push_back(firstNdx + 1);
-		m_indices.push_back(firstNdx + 2);
+		m_indices.push_back(deUint16(firstNdx + 0));
+		m_indices.push_back(deUint16(firstNdx + 1));
+		m_indices.push_back(deUint16(firstNdx + 2));
 
-		m_indices.push_back(firstNdx + 1);
-		m_indices.push_back(firstNdx + 3);
-		m_indices.push_back(firstNdx + 2);
+		m_indices.push_back(deUint16(firstNdx + 1));
+		m_indices.push_back(deUint16(firstNdx + 3));
+		m_indices.push_back(deUint16(firstNdx + 2));
 	}
 
 	m_texCoords.reserve(m_gridSize*m_gridSize*4);
@@ -444,7 +444,7 @@
 			DE_ASSERT(deInBounds32(ix + region.x, 0, dst.getWidth()));
 			DE_ASSERT(deInBounds32(iy + region.y, 0, dst.getHeight()));
 
-			dst.setPixel(ix + region.x, iy + region.y, toRGBA(color));
+			dst.setPixel(ix + region.x, iy + region.y, tcu::RGBA(color));
 		}
 	}
 }
diff --git a/modules/gles3/performance/es3pBufferDataUploadTests.cpp b/modules/gles3/performance/es3pBufferDataUploadTests.cpp
index d4dfa16..cc82fd5 100644
--- a/modules/gles3/performance/es3pBufferDataUploadTests.cpp
+++ b/modules/gles3/performance/es3pBufferDataUploadTests.cpp
@@ -509,9 +509,9 @@
 	if (numBytes < 1024)
 		buf << numBytes << " byte(s)";
 	else if (numBytes < 1024 * 1024)
-		buf << de::floatToString(numBytes/1024.0f, 1) << " KiB";
+		buf << de::floatToString((float)numBytes/1024.0f, 1) << " KiB";
 	else
-		buf << de::floatToString(numBytes/1024.0f/1024.0f, 1) << " MiB";
+		buf << de::floatToString((float)numBytes/1024.0f/1024.0f, 1) << " MiB";
 
 	return buf.str();
 }
@@ -582,7 +582,7 @@
 				bestTime = sectionTimes[sectionNdx];
 
 			// Detect if write takes 50% longer than it should, and warm up if that happened
-			if (sectionNdx != numSections-1 && (float)sectionTimes[sectionNdx] > 1.5f * bestTime)
+			if (sectionNdx != numSections-1 && (float)sectionTimes[sectionNdx] > 1.5f * (float)bestTime)
 			{
 				deYield();
 				tcu::warmupCPU();
@@ -652,7 +652,7 @@
 	DE_ASSERT(position >= 0.0f);
 	DE_ASSERT(position <= 1.0f);
 
-	const float	floatNdx			= ((int)values.size() - 1) * position;
+	const float	floatNdx			= (float)(values.size() - 1) * position;
 	const int	lowerNdx			= (int)deFloatFloor(floatNdx);
 	const int	higherNdx			= lowerNdx + 1;
 	const float	interpolationFactor = floatNdx - (float)lowerNdx;
@@ -698,8 +698,8 @@
 
 		for (int ndx = 0; ndx < (int)samples.size(); ++ndx)
 		{
-			const float timeInSeconds = values[ndx] / 1000.0f / 1000.0f;
-			processingRates[ndx] = samples[ndx].*predictor / timeInSeconds;
+			const float timeInSeconds = (float)values[ndx] / 1000.0f / 1000.0f;
+			processingRates[ndx] = (float)(samples[ndx].*predictor) / timeInSeconds;
 		}
 
 		std::sort(processingRates.begin(), processingRates.end());
@@ -713,7 +713,7 @@
 
 		for (int ndx = 0; ndx < (int)samples.size(); ++ndx)
 		{
-			const float prediction	= samples[ndx].*predictor * fit.coefficient + fit.offset;
+			const float prediction	= (float)(samples[ndx].*predictor) * fit.coefficient + fit.offset;
 			const float actual		= (float)values[ndx];
 			timeDiffs[ndx] = actual - prediction;
 		}
@@ -730,7 +730,7 @@
 
 		for (int ndx = 0; ndx < (int)samples.size(); ++ndx)
 		{
-			const float prediction	= samples[ndx].*predictor * fit.coefficient + fit.offset;
+			const float prediction	= (float)(samples[ndx].*predictor) * fit.coefficient + fit.offset;
 			const float actual		= (float)values[ndx];
 
 			// Ignore cases where we predict negative times, or if
@@ -1082,7 +1082,7 @@
 
 	for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
 	{
-		const float bucketNdxFloat	= (samples[sampleNdx].allocatedSize - minBufferSize) / (float)(maxBufferSize - minBufferSize) * numBuckets;
+		const float bucketNdxFloat	= (float)(samples[sampleNdx].allocatedSize - minBufferSize) / (float)(maxBufferSize - minBufferSize) * (float)numBuckets;
 		const int bucketNdx			= de::clamp((int)deFloatFloor(bucketNdxFloat), 0, numBuckets-1);
 
 		buckets[bucketNdx].push_back(samples[sampleNdx]);
@@ -1373,7 +1373,7 @@
 
 	for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
 	{
-		const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].writtenSize);
+		const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].writtenSize);
 		log	<< tcu::TestLog::Sample
 			<< samples[sampleNdx].writtenSize
 			<< samples[sampleNdx].bufferSize
@@ -1401,7 +1401,7 @@
 
 	for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
 	{
-		const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].writtenSize);
+		const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].writtenSize);
 		log	<< tcu::TestLog::Sample
 			<< samples[sampleNdx].writtenSize
 			<< samples[sampleNdx].bufferSize
@@ -1432,7 +1432,7 @@
 
 	for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
 	{
-		const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].writtenSize);
+		const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].writtenSize);
 		log	<< tcu::TestLog::Sample
 			<< samples[sampleNdx].writtenSize
 			<< samples[sampleNdx].bufferSize
@@ -1464,7 +1464,7 @@
 
 	for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
 	{
-		const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].writtenSize);
+		const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].writtenSize);
 		log	<< tcu::TestLog::Sample
 			<< samples[sampleNdx].writtenSize
 			<< samples[sampleNdx].bufferSize
@@ -1497,7 +1497,7 @@
 
 	for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
 	{
-		const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].writtenSize);
+		const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].writtenSize);
 		log	<< tcu::TestLog::Sample
 			<< samples[sampleNdx].writtenSize
 			<< samples[sampleNdx].bufferSize
@@ -1527,7 +1527,7 @@
 
 	for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
 	{
-		const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].renderDataSize);
+		const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].renderDataSize);
 		log	<< tcu::TestLog::Sample
 			<< samples[sampleNdx].renderDataSize
 			<< samples[sampleNdx].numVertices
@@ -1556,7 +1556,7 @@
 
 	for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
 	{
-		const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].renderDataSize);
+		const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].renderDataSize);
 		log	<< tcu::TestLog::Sample
 			<< samples[sampleNdx].renderDataSize
 			<< samples[sampleNdx].numVertices
@@ -1588,7 +1588,7 @@
 
 	for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
 	{
-		const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].renderDataSize);
+		const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].renderDataSize);
 		log	<< tcu::TestLog::Sample
 			<< samples[sampleNdx].renderDataSize
 			<< samples[sampleNdx].uploadedDataSize
@@ -1623,7 +1623,7 @@
 
 	for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
 	{
-		const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].renderDataSize);
+		const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].renderDataSize);
 		log	<< tcu::TestLog::Sample
 			<< samples[sampleNdx].renderDataSize
 			<< samples[sampleNdx].uploadedDataSize
@@ -1659,7 +1659,7 @@
 
 	for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
 	{
-		const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].renderDataSize);
+		const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].renderDataSize);
 		log	<< tcu::TestLog::Sample
 			<< samples[sampleNdx].renderDataSize
 			<< samples[sampleNdx].uploadedDataSize
@@ -1681,7 +1681,7 @@
 static UploadSampleAnalyzeResult analyzeSampleResults (tcu::TestLog& log, const std::vector<UploadSampleResult<SampleType> >& samples, bool logBucketPerformance)
 {
 	// Assume data is linear with some outliers, fit a line
-	const LineParametersWithConfidence									theilSenFitting						= fitLineToSamples(samples);
+	const LineParametersWithConfidence						theilSenFitting						= fitLineToSamples(samples);
 	const typename SampleTypeTraits<SampleType>::StatsType	resultStats							= calculateSampleStatistics(theilSenFitting, samples);
 	float													approximatedTransferRate;
 	float													approximatedTransferRateNoConstant;
@@ -1709,8 +1709,8 @@
 
 			// Print a nice result summary
 
-			const int												bucketRangeMin	= minBufferSize + (int)(( bucketNdx    / (float)numBuckets) * (maxBufferSize - minBufferSize));
-			const int												bucketRangeMax	= minBufferSize + (int)(((bucketNdx+1) / (float)numBuckets) * (maxBufferSize - minBufferSize));
+			const int												bucketRangeMin	= minBufferSize + (int)(((float) bucketNdx    / (float)numBuckets) * (float)(maxBufferSize - minBufferSize));
+			const int												bucketRangeMax	= minBufferSize + (int)(((float)(bucketNdx+1) / (float)numBuckets) * (float)(maxBufferSize - minBufferSize));
 			const typename SampleTypeTraits<SampleType>::StatsType	stats			= calculateSampleStatistics(theilSenFitting, buckets[bucketNdx]);
 			const tcu::ScopedLogSection								section			(log, "BufferSizeRange", std::string("Transfer performance with buffer size in range [").append(getHumanReadableByteSize(bucketRangeMin).append(", ").append(getHumanReadableByteSize(bucketRangeMax).append("]"))));
 
@@ -1752,13 +1752,13 @@
 		const tcu::ScopedLogSection	section(log, "Results", "Results");
 
 		const int	medianBufferSize					= (samples.front().bufferSize + samples.back().bufferSize) / 2;
-		const float	approximatedTransferTime			= (theilSenFitting.offset + theilSenFitting.coefficient * medianBufferSize) / 1000.0f / 1000.0f;
-		const float	approximatedTransferTimeNoConstant	= (theilSenFitting.coefficient * medianBufferSize) / 1000.0f / 1000.0f;
+		const float	approximatedTransferTime			= (theilSenFitting.offset + theilSenFitting.coefficient * (float)medianBufferSize) / 1000.0f / 1000.0f;
+		const float	approximatedTransferTimeNoConstant	= (theilSenFitting.coefficient * (float)medianBufferSize) / 1000.0f / 1000.0f;
 		const float	sampleLinearity						= calculateSampleFitLinearity(samples);
 		const float	sampleTemporalStability				= calculateSampleTemporalStability(samples);
 
-		approximatedTransferRateNoConstant				= medianBufferSize / approximatedTransferTimeNoConstant;
-		approximatedTransferRate						= medianBufferSize / approximatedTransferTime;
+		approximatedTransferRateNoConstant				= (float)medianBufferSize / approximatedTransferTimeNoConstant;
+		approximatedTransferRate						= (float)medianBufferSize / approximatedTransferTime;
 
 		log	<< tcu::TestLog::Float("ResultLinearity", "Sample linearity", "%", QP_KEY_TAG_QUALITY, sampleLinearity * 100.0f)
 			<< tcu::TestLog::Float("SampleTemporalStability", "Sample temporal stability", "%", QP_KEY_TAG_QUALITY, sampleTemporalStability * 100.0f)
@@ -1790,7 +1790,7 @@
 static RenderSampleAnalyzeResult analyzeSampleResults (tcu::TestLog& log, const std::vector<RenderSampleResult<SampleType> >& samples)
 {
 	// Assume data is linear with some outliers, fit a line
-	const LineParametersWithConfidence									theilSenFitting						= fitLineToSamples(samples);
+	const LineParametersWithConfidence						theilSenFitting						= fitLineToSamples(samples);
 	const typename SampleTypeTraits<SampleType>::StatsType	resultStats							= calculateSampleStatistics(theilSenFitting, samples);
 	float													approximatedProcessingRate;
 	float													approximatedProcessingRateNoConstant;
@@ -1819,13 +1819,13 @@
 		const tcu::ScopedLogSection	section(log, "Results", "Results");
 
 		const int	medianDataSize						= (samples.front().renderDataSize + samples.back().renderDataSize) / 2;
-		const float	approximatedRenderTime				= (theilSenFitting.offset + theilSenFitting.coefficient * medianDataSize) / 1000.0f / 1000.0f;
-		const float	approximatedRenderTimeNoConstant	= (theilSenFitting.coefficient * medianDataSize) / 1000.0f / 1000.0f;
+		const float	approximatedRenderTime				= (theilSenFitting.offset + theilSenFitting.coefficient * (float)medianDataSize) / 1000.0f / 1000.0f;
+		const float	approximatedRenderTimeNoConstant	= (theilSenFitting.coefficient * (float)medianDataSize) / 1000.0f / 1000.0f;
 		const float	sampleLinearity						= calculateSampleFitLinearity(samples);
 		const float	sampleTemporalStability				= calculateSampleTemporalStability(samples);
 
-		approximatedProcessingRateNoConstant			= medianDataSize / approximatedRenderTimeNoConstant;
-		approximatedProcessingRate						= medianDataSize / approximatedRenderTime;
+		approximatedProcessingRateNoConstant			= (float)medianDataSize / approximatedRenderTimeNoConstant;
+		approximatedProcessingRate						= (float)medianDataSize / approximatedRenderTime;
 
 		log	<< tcu::TestLog::Float("ResultLinearity", "Sample linearity", "%", QP_KEY_TAG_QUALITY, sampleLinearity * 100.0f)
 			<< tcu::TestLog::Float("SampleTemporalStability", "Sample temporal stability", "%", QP_KEY_TAG_QUALITY, sampleTemporalStability * 100.0f)
@@ -1945,9 +1945,9 @@
 	// choose buffer sizes
 	for (int sampleNdx = 0; sampleNdx < m_numSamples; ++sampleNdx)
 	{
-		const int rawBufferSize			= (int)deFloatFloor(bufferSizeMin + (bufferSizeMax - bufferSizeMin) * ((float)(sampleNdx + 1) / m_numSamples));
+		const int rawBufferSize			= (int)deFloatFloor((float)bufferSizeMin + (float)(bufferSizeMax - bufferSizeMin) * ((float)(sampleNdx + 1) / (float)m_numSamples));
 		const int bufferSize			= deAlign32(rawBufferSize, 16);
-		const int allocatedBufferSize	= deAlign32((m_allocateLargerBuffer) ? ((int)(bufferSize * 1.5f)) : (bufferSize), 16);
+		const int allocatedBufferSize	= deAlign32((m_allocateLargerBuffer) ? ((int)((float)bufferSize * 1.5f)) : (bufferSize), 16);
 
 		m_results[sampleNdx].bufferSize		= bufferSize;
 		m_results[sampleNdx].allocatedSize	= allocatedBufferSize;
@@ -3435,7 +3435,7 @@
 	// make sure our zeroBuffer is large enough
 	if (m_respecifySize)
 	{
-		const int largerBufferSize = deAlign32((int)(m_bufferSizeMax * m_sizeDifferenceFactor), 4*4);
+		const int largerBufferSize = deAlign32((int)((float)m_bufferSizeMax * m_sizeDifferenceFactor), 4*4);
 		m_zeroData.resize(largerBufferSize, 0x00);
 	}
 }
@@ -3452,7 +3452,7 @@
 	const int					drawEnd				= deAlign32(bufferSize * 3 / 4, 4*4);
 
 	const glw::Functions&		gl					= m_context.getRenderContext().getFunctions();
-	const int					largerBufferSize	= deAlign32((int)(bufferSize * m_sizeDifferenceFactor), 4*4);
+	const int					largerBufferSize	= deAlign32((int)((float)bufferSize * m_sizeDifferenceFactor), 4*4);
 	const int					newBufferSize		= (m_respecifySize) ? (largerBufferSize) : (bufferSize);
 	deUint64					startTime;
 	deUint64					endTime;
@@ -3892,10 +3892,10 @@
 	for (int cellZ = 0; cellZ < scene.gridLayers; ++cellZ)
 	{
 		const tcu::Vec4	color		= (((cellX + cellY + cellZ) % 2) == 0) ? (green) : (yellow);
-		const float		cellLeft	= (float(cellX  ) / scene.gridWidth  - 0.5f) * 2.0f;
-		const float		cellRight	= (float(cellX+1) / scene.gridWidth  - 0.5f) * 2.0f;
-		const float		cellTop		= (float(cellY+1) / scene.gridHeight - 0.5f) * 2.0f;
-		const float		cellBottom	= (float(cellY  ) / scene.gridHeight - 0.5f) * 2.0f;
+		const float		cellLeft	= (float(cellX  ) / (float)scene.gridWidth  - 0.5f) * 2.0f;
+		const float		cellRight	= (float(cellX+1) / (float)scene.gridWidth  - 0.5f) * 2.0f;
+		const float		cellTop		= (float(cellY+1) / (float)scene.gridHeight - 0.5f) * 2.0f;
+		const float		cellBottom	= (float(cellY  ) / (float)scene.gridHeight - 0.5f) * 2.0f;
 
 		vertexData[(cellY * scene.gridWidth * scene.gridLayers + cellX * scene.gridLayers + cellZ) * 12 +  0] = color;
 		vertexData[(cellY * scene.gridWidth * scene.gridLayers + cellX * scene.gridLayers + cellZ) * 12 +  1] = tcu::Vec4(cellLeft, cellTop, 0.0f, 1.0f);
@@ -4635,7 +4635,7 @@
 	deYield();
 
 	// "Render" something and wait for it
-	gl.clearColor(0.0f, 1.0f, m_sampleNdx / float(m_numSamples), 1.0f);
+	gl.clearColor(0.0f, 1.0f, float(m_sampleNdx) / float(m_numSamples), 1.0f);
 	gl.clear(GL_COLOR_BUFFER_BIT);
 
 	// wait for results
@@ -4763,13 +4763,13 @@
 	// log
 	{
 		const char* const	targetFunctionName		= (m_drawMethod == DRAWMETHOD_DRAW_ARRAYS) ? ("drawArrays") : ("drawElements");
-		const int			perVertexSize			= (m_targetBuffer == TARGETBUFFER_INDEX) ? (sizeof(deUint32)) : (sizeof(tcu::Vec4[2]));
+		const int			perVertexSize			= (m_targetBuffer == TARGETBUFFER_INDEX) ? ((int)sizeof(deUint32)) : ((int)sizeof(tcu::Vec4[2]));
 		const int			fullMinUploadSize		= RenderCase<SampleType>::getMinWorkloadSize() * perVertexSize;
 		const int			fullMaxUploadSize		= RenderCase<SampleType>::getMaxWorkloadSize() * perVertexSize;
 		const int			minUploadSize			= (m_uploadRange == UPLOADRANGE_FULL) ? (fullMinUploadSize) : (deAlign32(fullMinUploadSize/2, 4));
 		const int			maxUploadSize			= (m_uploadRange == UPLOADRANGE_FULL) ? (fullMaxUploadSize) : (deAlign32(fullMaxUploadSize/2, 4));
-		const int			minUnrelatedUploadSize	= RenderCase<SampleType>::getMinWorkloadSize() * sizeof(tcu::Vec4[2]);
-		const int			maxUnrelatedUploadSize	= RenderCase<SampleType>::getMaxWorkloadSize() * sizeof(tcu::Vec4[2]);
+		const int			minUnrelatedUploadSize	= RenderCase<SampleType>::getMinWorkloadSize() * (int)sizeof(tcu::Vec4[2]);
+		const int			maxUnrelatedUploadSize	= RenderCase<SampleType>::getMaxWorkloadSize() * (int)sizeof(tcu::Vec4[2]);
 
 		m_testCtx.getLog()
 			<< tcu::TestLog::Message
@@ -4939,7 +4939,7 @@
 
 			// upload to 25% - 75% range
 			target	= GL_ELEMENT_ARRAY_BUFFER;
-			size	= (glw::GLsizeiptr)deAlign32((glw::GLsizeiptr)((int)(indexData.size() * sizeof(deUint32))) / 2, 4);
+			size	= (glw::GLsizeiptr)deAlign32((deInt32)(indexData.size() * sizeof(deUint32)) / 2, 4);
 			offset	= (glw::GLintptr)deAlign32((int)size / 2, 4);
 			source	= (const deUint8*)&indexData[0] + offset;
 		}
@@ -5275,7 +5275,7 @@
 		{
 			// upload to 25% - 75% range
 			target	= GL_ELEMENT_ARRAY_BUFFER;
-			size	= (glw::GLsizeiptr)deAlign32((glw::GLsizeiptr)((int)(indexData.size() * sizeof(deUint32))) / 2, 4);
+			size	= (glw::GLsizeiptr)deAlign32((deInt32)(indexData.size() * sizeof(deUint32)) / 2, 4);
 			offset	= (glw::GLintptr)deAlign32((int)size / 2, 4);
 			source	= (const deUint8*)&indexData[0] + offset;
 		}
@@ -6007,7 +6007,7 @@
 		const int		upperIndex		= (int)(std::upper_bound(allSamples.begin(), allSamples.end(), testSample, comparer) - allSamples.begin());
 		const int		lowerRank		= lowerIndex + 1;	// convert zero-indexed to rank
 		const int		upperRank		= upperIndex;		// convert zero-indexed to rank, upperIndex is last equal + 1
-		const float		rankMidpoint	= (lowerRank + upperRank) / 2.0f;
+		const float		rankMidpoint	= (float)(lowerRank + upperRank) / 2.0f;
 
 		sum += rankMidpoint;
 	}
@@ -6031,14 +6031,14 @@
 	{
 		const float					R1		= sumOfRanks(orderedObservationsA, allSamples, comparer);
 
-		const float					U1		= n1*n2 + n1*(n1 + 1)/2 - R1;
-		const float					U2		= (n1 * n2) - U1;
+		const float					U1		= (float)(n1*n2 + n1*(n1 + 1)/2) - R1;
+		const float					U2		= (float)(n1 * n2) - U1;
 		const float					U		= de::min(U1, U2);
 
 		// \note: sample sizes might not be large enough to expect normal distribution but we do it anyway
 
-		const float					mU		= n1*n2 / 2.0f;
-		const float					sigmaU	= deFloatSqrt((n1*n2*(n1+n2+1)) / 12.0f);
+		const float					mU		= (float)(n1 * n2) / 2.0f;
+		const float					sigmaU	= deFloatSqrt((float)(n1*n2*(n1+n2+1)) / 12.0f);
 		const float					z		= (U - mU) / sigmaU;
 
 		DistributionCompareResult	result;
@@ -6063,8 +6063,8 @@
 		// thresholds
 		if (diff <= (float)absoluteThreshold)
 			return false;
-		if (diff <= a*relativeThreshold ||
-			diff <= b*relativeThreshold)
+		if (diff <= float(a)*relativeThreshold ||
+			diff <= float(b)*relativeThreshold)
 			return false;
 
 		// cmp
@@ -6163,7 +6163,7 @@
 	lineFit = theilSenSiegelLinearRegression(dataPoints, 0.6f);
 
 	// Difference of more than 25% of the offset along the whole sample range
-	if (de::abs(lineFit.coefficient) * numDataPoints > de::abs(lineFit.offset) * 0.25f)
+	if (de::abs(lineFit.coefficient) * (float)numDataPoints > de::abs(lineFit.offset) * 0.25f)
 	{
 		m_testCtx.getLog()
 			<< tcu::TestLog::Message
diff --git a/modules/gles3/performance/es3pDepthTests.cpp b/modules/gles3/performance/es3pDepthTests.cpp
index b1a715c..d10f8d5 100644
--- a/modules/gles3/performance/es3pDepthTests.cpp
+++ b/modules/gles3/performance/es3pDepthTests.cpp
@@ -921,8 +921,8 @@
 														10, // Max iteration frames
 														20.0f, // Iteration shortcut threshold ms
 														20, // Max iterations
-														10.0f, // Target frame time
-														15.0f, // Frame time cap
+														33.0f, // Target frame time
+														40.0f, // Frame time cap
 														1000.0f // Target measurement duration
 														));
 
diff --git a/modules/gles3/performance/es3pShaderCompilationCases.cpp b/modules/gles3/performance/es3pShaderCompilationCases.cpp
index c646d8f..8c80cd7 100644
--- a/modules/gles3/performance/es3pShaderCompilationCases.cpp
+++ b/modules/gles3/performance/es3pShaderCompilationCases.cpp
@@ -285,7 +285,7 @@
 static string getShaderInfoLog (const glw::Functions& gl, deUint32 shader)
 {
 	string			result;
-	int				infoLogLen;
+	int				infoLogLen = 0;
 	vector<char>	infoLogBuf;
 
 	gl.getShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLen);
@@ -299,7 +299,7 @@
 static string getProgramInfoLog (const glw::Functions& gl, deUint32 program)
 {
 	string			result;
-	int				infoLogLen;
+	int				infoLogLen = 0;
 	vector<char>	infoLogBuf;
 
 	gl.getProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLen);
@@ -1730,7 +1730,7 @@
 bool ShaderCompilerCase::compileShader (deUint32 shader) const
 {
 	const glw::Functions& gl = m_context.getRenderContext().getFunctions();
-	GLint status;
+	GLint status = 0;
 	gl.compileShader(shader);
 	gl.getShaderiv(shader, GL_COMPILE_STATUS, &status);
 	return status != 0;
@@ -1739,7 +1739,7 @@
 bool ShaderCompilerCase::linkAndUseProgram (deUint32 program) const
 {
 	const glw::Functions& gl = m_context.getRenderContext().getFunctions();
-	GLint linkStatus;
+	GLint linkStatus = 0;
 
 	gl.linkProgram(program);
 	gl.getProgramiv(program, GL_LINK_STATUS, &linkStatus);
@@ -2048,10 +2048,10 @@
 			// Log this measurement.
 			log << TestLog::Float("Measurement" + de::toString(ndx) + "CompilationTime",
 								  "Measurement " + de::toString(ndx) + " compilation time",
-								  "ms", QP_KEY_TAG_TIME, timeWithoutDraw / 1000.0f)
+								  "ms", QP_KEY_TAG_TIME, (float)timeWithoutDraw / 1000.0f)
 				<< TestLog::Float("Measurement" + de::toString(ndx) + "SpecializationTime",
 								  "Measurement " + de::toString(ndx) + " specialization time",
-								  "ms", QP_KEY_TAG_TIME, specializationTime / 1000.0f);
+								  "ms", QP_KEY_TAG_TIME, (float)specializationTime / 1000.0f);
 		}
 
 		// Log some statistics.
@@ -2585,7 +2585,7 @@
 			// Log this measurement.
 			log << TestLog::Float("Measurement" + de::toString(ndx) + "Time",
 								  "Measurement " + de::toString(ndx) + " time",
-								  "ms", QP_KEY_TAG_TIME, measurements[ndx].totalTime()/1000.0f);
+								  "ms", QP_KEY_TAG_TIME, (float)measurements[ndx].totalTime()/1000.0f);
 		}
 
 		// Log some statistics.
diff --git a/modules/gles3/performance/es3pTextureCases.cpp b/modules/gles3/performance/es3pTextureCases.cpp
index a80086e..ef6f4f2 100644
--- a/modules/gles3/performance/es3pTextureCases.cpp
+++ b/modules/gles3/performance/es3pTextureCases.cpp
@@ -128,7 +128,7 @@
 												  Vec4(p11.x(), p11.y(), 0.0f, 0.0f)));
 
 	log << TestLog::Message << "Size: " << width << "x" << height << TestLog::EndMessage;
-	log << TestLog::Message << "Format: " <<glu::getPixelFormatName(m_internalFormat) << TestLog::EndMessage;
+	log << TestLog::Message << "Format: " <<glu::getTextureFormatName(m_internalFormat) << TestLog::EndMessage;
 	log << TestLog::Message << "Coords: " << p00 << ", " << p10 << ", " << p01 << ", " << p11 << TestLog::EndMessage;
 	log << TestLog::Message << "Wrap: " << glu::getTextureWrapModeStr(m_wrapS) << " / " << glu::getTextureWrapModeStr(m_wrapT) << TestLog::EndMessage;
 	log << TestLog::Message << "Filter: " << glu::getTextureFilterStr(m_minFilter) << " / " << glu::getTextureFilterStr(m_magFilter) << TestLog::EndMessage;
diff --git a/modules/gles3/performance/es3pTextureCountTests.cpp b/modules/gles3/performance/es3pTextureCountTests.cpp
index 8ead678..bed2660 100644
--- a/modules/gles3/performance/es3pTextureCountTests.cpp
+++ b/modules/gles3/performance/es3pTextureCountTests.cpp
@@ -76,7 +76,7 @@
 			deUint32	magFilter		= GL_NEAREST;
 			int			numTextures		= texCounts[cntNdx];
 			string		name			= string(texFormats[formatNdx].name) + "_" + de::toString(numTextures);
-			string		description 	= glu::getPixelFormatName(format);
+			string		description 	= glu::getTextureFormatName(format);
 
 			addChild(new Texture2DRenderCase(m_context, name.c_str(), description.c_str(), format, wrapS, wrapT, minFilter, magFilter, tcu::Mat3(), numTextures, false /* npot */));
 		}
diff --git a/modules/gles3/performance/es3pTextureFormatTests.cpp b/modules/gles3/performance/es3pTextureFormatTests.cpp
index 2488db7..4e636fb 100644
--- a/modules/gles3/performance/es3pTextureFormatTests.cpp
+++ b/modules/gles3/performance/es3pTextureFormatTests.cpp
@@ -113,7 +113,7 @@
 		deUint32	minFilter		= GL_NEAREST;
 		deUint32	magFilter		= GL_NEAREST;
 		int			numTextures		= 1;
-		string		descriptionBase	= glu::getPixelFormatName(format);
+		string		descriptionBase	= glu::getTextureFormatName(format);
 
 		addChild(new Texture2DRenderCase(m_context, nameBase.c_str(), descriptionBase.c_str(), format, wrapS, wrapT, minFilter, magFilter, tcu::Mat3(), numTextures, false /* npot */));
 	}
diff --git a/modules/gles3/scripts/gen-conversions.py b/modules/gles3/scripts/gen-conversions.py
index 1acc046..fa1e90b 100644
--- a/modules/gles3/scripts/gen-conversions.py
+++ b/modules/gles3/scripts/gen-conversions.py
@@ -1,3 +1,25 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import sys
 import random
 import operator
diff --git a/modules/gles3/scripts/gen-invalid-texture-funcs.py b/modules/gles3/scripts/gen-invalid-texture-funcs.py
index 9cc5f99..28aa9fb 100644
--- a/modules/gles3/scripts/gen-invalid-texture-funcs.py
+++ b/modules/gles3/scripts/gen-invalid-texture-funcs.py
@@ -1,3 +1,25 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import sys
 import string
 from genutil import *
diff --git a/modules/gles3/scripts/gen-keywords.py b/modules/gles3/scripts/gen-keywords.py
index 04876de..09d486a 100644
--- a/modules/gles3/scripts/gen-keywords.py
+++ b/modules/gles3/scripts/gen-keywords.py
@@ -1,3 +1,25 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import sys
 from genutil import *
 
diff --git a/modules/gles3/scripts/gen-qualification_order.py b/modules/gles3/scripts/gen-qualification_order.py
index 4bb5fc6..a57489a 100644
--- a/modules/gles3/scripts/gen-qualification_order.py
+++ b/modules/gles3/scripts/gen-qualification_order.py
@@ -1,3 +1,25 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import sys
 import itertools
 from collections import namedtuple
diff --git a/modules/gles3/scripts/gen-swizzles.py b/modules/gles3/scripts/gen-swizzles.py
index 70ba842..7b0bd78 100644
--- a/modules/gles3/scripts/gen-swizzles.py
+++ b/modules/gles3/scripts/gen-swizzles.py
@@ -1,3 +1,25 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import sys
 import random
 import operator
diff --git a/modules/gles3/scripts/gen-uniform-blocks.py b/modules/gles3/scripts/gen-uniform-blocks.py
index f2ad3d9..969a9f6 100644
--- a/modules/gles3/scripts/gen-uniform-blocks.py
+++ b/modules/gles3/scripts/gen-uniform-blocks.py
@@ -1,3 +1,25 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 from genutil import *
 
 allCases = []
diff --git a/modules/gles3/stress/es3sSpecialFloatTests.cpp b/modules/gles3/stress/es3sSpecialFloatTests.cpp
index dc2fca9..64ba419 100644
--- a/modules/gles3/stress/es3sSpecialFloatTests.cpp
+++ b/modules/gles3/stress/es3sSpecialFloatTests.cpp
@@ -450,8 +450,8 @@
 		}
 
 		m_testCtx.getLog() << tcu::TestLog::Message
-			<< "Creating fbo. Texture internalFormat = " << glu::getPixelFormatStr(internalFormat)
-			<< ", format = " << glu::getPixelFormatStr(format)
+			<< "Creating fbo. Texture internalFormat = " << glu::getTextureFormatStr(internalFormat)
+			<< ", format = " << glu::getTextureFormatStr(format)
 			<< ", type = " << glu::getTypeStr(type)
 			<< tcu::TestLog::EndMessage;
 
@@ -636,13 +636,13 @@
 	{
 		const int baseNdx = (x * (DE_LENGTH_OF_ARRAY(s_specialFloats) - 1) + y) * 6;
 
-		indices[baseNdx + 0] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
-		indices[baseNdx + 1] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
-		indices[baseNdx + 2] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
+		indices[baseNdx + 0] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+		indices[baseNdx + 1] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+		indices[baseNdx + 2] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
 
-		indices[baseNdx + 3] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
-		indices[baseNdx + 4] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
-		indices[baseNdx + 5] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
+		indices[baseNdx + 3] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+		indices[baseNdx + 4] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+		indices[baseNdx + 5] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
 	}
 
 	m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a grid with the shader. Setting a_attr for each vertex to (special, special, 1, 1)." << tcu::TestLog::EndMessage;
@@ -858,13 +858,13 @@
 	{
 		const int baseNdx = (x * (DE_LENGTH_OF_ARRAY(s_specialFloats)) + y) * 6;
 
-		indices[baseNdx + 0] = (x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0);
-		indices[baseNdx + 1] = (x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1);
-		indices[baseNdx + 2] = (x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0);
+		indices[baseNdx + 0] = (deUint16)((x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0));
+		indices[baseNdx + 1] = (deUint16)((x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1));
+		indices[baseNdx + 2] = (deUint16)((x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0));
 
-		indices[baseNdx + 3] = (x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0);
-		indices[baseNdx + 4] = (x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1);
-		indices[baseNdx + 5] = (x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1);
+		indices[baseNdx + 3] = (deUint16)((x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0));
+		indices[baseNdx + 4] = (deUint16)((x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1));
+		indices[baseNdx + 5] = (deUint16)((x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1));
 	}
 
 	m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a grid with the shader. Setting u_special for vertex each tile to (special, special, 1, 1)." << tcu::TestLog::EndMessage;
@@ -1188,13 +1188,13 @@
 	{
 		const int baseNdx = (x * (gridSize - 1) + y) * 6;
 
-		indices[baseNdx + 0] = (x+0) * gridSize + (y+0);
-		indices[baseNdx + 1] = (x+1) * gridSize + (y+1);
-		indices[baseNdx + 2] = (x+1) * gridSize + (y+0);
+		indices[baseNdx + 0] = (deUint16)((x+0) * gridSize + (y+0));
+		indices[baseNdx + 1] = (deUint16)((x+1) * gridSize + (y+1));
+		indices[baseNdx + 2] = (deUint16)((x+1) * gridSize + (y+0));
 
-		indices[baseNdx + 3] = (x+0) * gridSize + (y+0);
-		indices[baseNdx + 4] = (x+1) * gridSize + (y+1);
-		indices[baseNdx + 5] = (x+0) * gridSize + (y+1);
+		indices[baseNdx + 3] = (deUint16)((x+0) * gridSize + (y+0));
+		indices[baseNdx + 4] = (deUint16)((x+1) * gridSize + (y+1));
+		indices[baseNdx + 5] = (deUint16)((x+0) * gridSize + (y+1));
 	}
 
 	m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a textured grid with the shader." << tcu::TestLog::EndMessage;
@@ -1503,13 +1503,13 @@
 	{
 		const int baseNdx = (x * (DE_LENGTH_OF_ARRAY(s_specialFloats) - 1) + y) * 6;
 
-		indices[baseNdx + 0] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
-		indices[baseNdx + 1] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
-		indices[baseNdx + 2] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
+		indices[baseNdx + 0] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+		indices[baseNdx + 1] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+		indices[baseNdx + 2] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
 
-		indices[baseNdx + 3] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
-		indices[baseNdx + 4] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
-		indices[baseNdx + 5] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
+		indices[baseNdx + 3] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+		indices[baseNdx + 4] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+		indices[baseNdx + 5] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
 	}
 
 	m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a textured grid with the shader. Sampling from the texture using special floating point values." << tcu::TestLog::EndMessage;
@@ -1698,13 +1698,13 @@
 	{
 		const int baseNdx = y * 6;
 
-		indices[baseNdx + 0] = (y + 0) * 2;
-		indices[baseNdx + 1] = (y + 1) * 2;
-		indices[baseNdx + 2] = (y + 1) * 2 + 1;
+		indices[baseNdx + 0] = (deUint16)((y + 0) * 2);
+		indices[baseNdx + 1] = (deUint16)((y + 1) * 2);
+		indices[baseNdx + 2] = (deUint16)((y + 1) * 2 + 1);
 
-		indices[baseNdx + 3] = (y + 0) * 2;
-		indices[baseNdx + 4] = (y + 1) * 2 + 1;
-		indices[baseNdx + 5] = (y + 0) * 2 + 1;
+		indices[baseNdx + 3] = (deUint16)((y + 0) * 2);
+		indices[baseNdx + 4] = (deUint16)((y + 1) * 2 + 1);
+		indices[baseNdx + 5] = (deUint16)((y + 0) * 2 + 1);
 	}
 
 	// Draw grids
@@ -1899,13 +1899,13 @@
 	{
 		const int baseNdx = (x * numBlendFuncs + y) * 6;
 
-		indices[baseNdx + 0] = (x+0) * (numBlendFuncs + 1) + (y+0);
-		indices[baseNdx + 1] = (x+1) * (numBlendFuncs + 1) + (y+1);
-		indices[baseNdx + 2] = (x+1) * (numBlendFuncs + 1) + (y+0);
+		indices[baseNdx + 0] = (deUint16)((x+0) * (numBlendFuncs + 1) + (y+0));
+		indices[baseNdx + 1] = (deUint16)((x+1) * (numBlendFuncs + 1) + (y+1));
+		indices[baseNdx + 2] = (deUint16)((x+1) * (numBlendFuncs + 1) + (y+0));
 
-		indices[baseNdx + 3] = (x+0) * (numBlendFuncs + 1) + (y+0);
-		indices[baseNdx + 4] = (x+1) * (numBlendFuncs + 1) + (y+1);
-		indices[baseNdx + 5] = (x+0) * (numBlendFuncs + 1) + (y+1);
+		indices[baseNdx + 3] = (deUint16)((x+0) * (numBlendFuncs + 1) + (y+0));
+		indices[baseNdx + 4] = (deUint16)((x+1) * (numBlendFuncs + 1) + (y+1));
+		indices[baseNdx + 5] = (deUint16)((x+0) * (numBlendFuncs + 1) + (y+1));
 	}
 
 	// Draw tiles
@@ -2038,9 +2038,9 @@
 		gl.uniform4fv(uColorLoc, 1, color.getPtr());
 
 		deUint16 indices[3];
-		indices[0] = rnd.getInt(0, maxVertexIndex);
-		indices[1] = rnd.getInt(0, maxVertexIndex);
-		indices[2] = rnd.getInt(0, maxVertexIndex);
+		indices[0] = (deUint16)rnd.getInt(0, maxVertexIndex);
+		indices[1] = (deUint16)rnd.getInt(0, maxVertexIndex);
+		indices[2] = (deUint16)rnd.getInt(0, maxVertexIndex);
 
 		gl.drawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, indices);
 	}
diff --git a/modules/gles31/functional/es31fAdvancedBlendTests.cpp b/modules/gles31/functional/es31fAdvancedBlendTests.cpp
index 0c5ae99..041c7aa 100644
--- a/modules/gles31/functional/es31fAdvancedBlendTests.cpp
+++ b/modules/gles31/functional/es31fAdvancedBlendTests.cpp
@@ -276,7 +276,7 @@
 		const int		numSamples	= m_rtType == RENDERTARGETTYPE_MSAA_FBO ? 4 : 0;
 
 		m_testCtx.getLog() << TestLog::Message << "Using FBO of size (" << m_renderWidth << ", " << m_renderHeight << ") with format "
-											   << glu::getPixelFormatStr(format) << " and " << numSamples << " samples"
+											   << glu::getTextureFormatStr(format) << " and " << numSamples << " samples"
 						   << TestLog::EndMessage;
 
 		gl.genRenderbuffers(1, &m_colorRbo);
diff --git a/modules/gles31/functional/es31fCopyImageTests.cpp b/modules/gles31/functional/es31fCopyImageTests.cpp
index 5991250..5d0fb8c 100644
--- a/modules/gles31/functional/es31fCopyImageTests.cpp
+++ b/modules/gles31/functional/es31fCopyImageTests.cpp
@@ -176,9 +176,9 @@
 	string enumName;
 
 	if (glu::isCompressedFormat(format))
-		enumName = glu::getCompressedTexFormatStr(format).toString().substr(14); // Strip GL_COMPRESSED_
+		enumName = glu::getCompressedTextureFormatStr(format).toString().substr(14); // Strip GL_COMPRESSED_
 	else
-		enumName = glu::getPixelFormatStr(format).toString().substr(3); // Strip GL_
+		enumName = glu::getUncompressedTextureFormatStr(format).toString().substr(3); // Strip GL_
 
 	return de::toLower(enumName);
 }
@@ -657,16 +657,7 @@
 		{
 			const tcu::ConstPixelBufferAccess texelAccess (format, 1, 1, 1, &(texelBlock[0]));
 
-			if (isFloatFormat(info.getFormat()))
-			{
-				const tcu::Vec4 color = texelAccess.getPixel(0, 0, 0);
-
-				gl.clearBufferfv(GL_COLOR, 0, (const float*)&color);
-				GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to clear renderbuffer.");
-
-				tcu::clear(refAccess, (tcu::isSRGB(format) ? tcu::linearToSRGB(color) : color));
-			}
-			else if (isIntFormat(info.getFormat()))
+			if (isIntFormat(info.getFormat()))
 			{
 				const tcu::IVec4 color = texelAccess.getPixelInt(0, 0, 0);
 
@@ -688,13 +679,27 @@
 			}
 			else
 			{
-				const tcu::Vec4 color = texelAccess.getPixel(0, 0, 0);
+				const tcu::Vec4 rawColor	= texelAccess.getPixel(0, 0, 0);
+				const tcu::Vec4 linearColor	= (tcu::isSRGB(format) ? tcu::sRGBToLinear(rawColor) : rawColor);
 
-				gl.clearColor(color.x(), color.y(), color.z(), color.w());
-				gl.clear(GL_COLOR_BUFFER_BIT);
+				// rawColor bit pattern has been chosen to be "safe" in the destination format. For sRGB
+				// formats, the clear color is in linear space. Since we want the resulting bit pattern
+				// to be safe after implementation linear->sRGB transform, we must apply the inverting
+				// transform to the clear color.
+
+				if (isFloatFormat(info.getFormat()))
+				{
+					gl.clearBufferfv(GL_COLOR, 0, (const float*)&linearColor);
+				}
+				else
+				{
+					// fixed-point
+					gl.clearColor(linearColor.x(), linearColor.y(), linearColor.z(), linearColor.w());
+					gl.clear(GL_COLOR_BUFFER_BIT);
+				}
 				GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to clear renderbuffer.");
 
-				tcu::clear(refAccess, (tcu::isSRGB(format) ? tcu::linearToSRGB(color) : color));
+				tcu::clear(refAccess, rawColor);
 			}
 		}
 	}
@@ -1061,7 +1066,7 @@
 		for (int slice = 0; slice < levelSize.z(); slice++)
 		{
 			const RandomViewport	viewport		(renderContext.getRenderTarget(), levelSize.x(), levelSize.y(), rng.getUint32());
-			const float				r				= (float(slice) + 0.5f) / levelSize.z();
+			const float				r				= (float(slice) + 0.5f) / (float)levelSize.z();
 			tcu::Surface			renderedFrame	(viewport.width, viewport.height);
 			tcu::Surface			referenceFrame	(viewport.width, viewport.height);
 			vector<float>			texCoord;
@@ -1796,13 +1801,16 @@
 		  const IVec3&	dstPos_,
 		  int			dstLevel_,
 
-		  const IVec3&	size_)
+		  const IVec3&	size_,
+		  const IVec3&	dstSize_)
 		: srcPos	(srcPos_)
 		, srcLevel	(srcLevel_)
 
 		, dstPos	(dstPos_)
 		, dstLevel	(dstLevel_)
+
 		, size		(size_)
+		, dstSize	(dstSize_)
 	{
 	}
 
@@ -1811,6 +1819,7 @@
 	IVec3	dstPos;
 	int		dstLevel;
 	IVec3	size;
+	IVec3	dstSize;	//!< used only for logging
 };
 
 int getLastFullLevel (const ImageInfo& info)
@@ -1867,7 +1876,7 @@
 		const int	copyBlockHeight			= de::max((2 * (maxCopyBlockSize.y() / 4)) - 1, 1);
 		const int	copyBlockDepth			= de::max((2 * (maxCopyBlockSize.z() / 4)) - 1, 1);
 
-		// Copy NPOT block from (0,0,0) to other corner on dst
+		// Copy NPOT block to (0,0,0) from other corner on src
 		{
 			const IVec3	copyBlockSize	(copyBlockWidth, copyBlockHeight, copyBlockDepth);
 			const IVec3	srcBlockPos		(srcCompleteBlockSize - copyBlockSize);
@@ -1875,12 +1884,13 @@
 
 			const IVec3	srcPos			(srcBlockPos * srcBlockPixelSize);
 			const IVec3	dstPos			(dstBlockPos * dstBlockPixelSize);
-			const IVec3 copySize		(copyBlockSize * srcBlockPixelSize);
+			const IVec3 srcCopySize		(copyBlockSize * srcBlockPixelSize);
+			const IVec3 dstCopySize		(copyBlockSize * dstBlockPixelSize);
 
-			copies.push_back(Copy(srcPos, srcLevel, dstPos, dstLevel, copySize));
+			copies.push_back(Copy(srcPos, srcLevel, dstPos, dstLevel, srcCopySize, dstCopySize));
 		}
 
-		// Copy NPOT block to (0,0,0) from other corner on src
+		// Copy NPOT block from (0,0,0) to other corner on dst
 		{
 			const IVec3	copyBlockSize	(copyBlockWidth, copyBlockHeight, copyBlockDepth);
 			const IVec3	srcBlockPos		(0, 0, 0);
@@ -1888,12 +1898,13 @@
 
 			const IVec3	srcPos			(srcBlockPos * srcBlockPixelSize);
 			const IVec3	dstPos			(dstBlockPos * dstBlockPixelSize);
-			const IVec3 copySize		(copyBlockSize * srcBlockPixelSize);
+			const IVec3 srcCopySize		(copyBlockSize * srcBlockPixelSize);
+			const IVec3 dstCopySize		(copyBlockSize * dstBlockPixelSize);
 
-			copies.push_back(Copy(srcPos, srcLevel, dstPos, dstLevel, copySize));
+			copies.push_back(Copy(srcPos, srcLevel, dstPos, dstLevel, srcCopySize, dstCopySize));
 		}
 
-		// Copy NPOT block to (0,0,0) from other corner on src
+		// Copy NPOT block near the corner with high coordinates
 		{
 			const IVec3	copyBlockSize	(copyBlockWidth, copyBlockHeight, copyBlockDepth);
 			const IVec3	srcBlockPos		(tcu::max((srcCompleteBlockSize / 4) * 4 - copyBlockSize, IVec3(0)));
@@ -1901,9 +1912,10 @@
 
 			const IVec3	srcPos			(srcBlockPos * srcBlockPixelSize);
 			const IVec3	dstPos			(dstBlockPos * dstBlockPixelSize);
-			const IVec3 copySize		(copyBlockSize * srcBlockPixelSize);
+			const IVec3 srcCopySize		(copyBlockSize * srcBlockPixelSize);
+			const IVec3 dstCopySize		(copyBlockSize * dstBlockPixelSize);
 
-			copies.push_back(Copy(srcPos, srcLevel, dstPos, dstLevel, copySize));
+			copies.push_back(Copy(srcPos, srcLevel, dstPos, dstLevel, srcCopySize, dstCopySize));
 		}
 	}
 }
@@ -1925,8 +1937,12 @@
 	{
 		const Copy& copy = copies[copyNdx];
 
-		log << TestLog::Message << "Copying block " << copy.size << " from source image position " << copy.srcPos << " and mipmap level " << copy.srcLevel
-								<< " to destination image position " << copy.dstPos << " and mipmap level " << copy.dstLevel << TestLog::EndMessage;
+		log	<< TestLog::Message
+			<< "Copying area with size " << copy.size
+			<< " from source image position " << copy.srcPos << " and mipmap level " << copy.srcLevel
+			<< " to destination image position " << copy.dstPos << " and mipmap level " << copy.dstLevel << ". "
+			<< "Size in destination format is " << copy.dstSize
+			<< TestLog::EndMessage;
 
 		copyImage(gl, *dstImage, dstImageLevels, m_dstImageInfo, copy.dstLevel, copy.dstPos,
 					  *srcImage, srcImageLevels, m_srcImageInfo, copy.srcLevel, copy.srcPos, copy.size);
diff --git a/modules/gles31/functional/es31fDebugTests.cpp b/modules/gles31/functional/es31fDebugTests.cpp
index 6a497ac..e8acd2c 100644
--- a/modules/gles31/functional/es31fDebugTests.cpp
+++ b/modules/gles31/functional/es31fDebugTests.cpp
@@ -830,7 +830,7 @@
 {
 	DE_UNREF(source);
 	DE_UNREF(type);
-	DE_ASSERT(!"GetErrorCase cannot handle anything other than error codes");
+	DE_FATAL("GetErrorCase cannot handle anything other than error codes");
 }
 
 void GetErrorCase::expectError (glw::GLenum error0, glw::GLenum error1)
@@ -1644,8 +1644,8 @@
 	const glw::Functions&	gl			= m_context.getRenderContext().getFunctions();
 	const char*	const		msg			= "This is a debug label";
 	GLuint					object		= 0;
+	int						outlen		= -1;
 	char					buffer[64];
-	int						outlen		= 0;
 
 	switch(m_identifier)
 	{
@@ -1706,7 +1706,7 @@
 			break;
 
 		default:
-			DE_ASSERT(!"Invalid identifier");
+			DE_FATAL("Invalid identifier");
 	}
 
 	gl.objectLabel(m_identifier, object, -1, msg);
@@ -1742,7 +1742,7 @@
 		case GL_FRAMEBUFFER:		gl.deleteFramebuffers(1, &object);			break;
 
 		default:
-			DE_ASSERT(!"Invalid identifier");
+			DE_FATAL("Invalid identifier");
 	}
 
 	return STOP;
@@ -1787,8 +1787,8 @@
 
 	const glw::Functions&	gl			= m_context.getRenderContext().getFunctions();
 	const char*	const		msg			= "This is a debug label";
+	int						outlen		= -1;
 	char					buffer[64];
-	int						outlen		= 0;
 
 	glw::GLsync				sync		= gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
 	GLU_EXPECT_NO_ERROR(gl.getError(), "fenceSync");
@@ -1835,10 +1835,10 @@
 
 	const glw::Functions&	gl			= m_context.getRenderContext().getFunctions();
 	tcu::ResultCollector	result		(m_testCtx.getLog(), " // ERROR: ");
+	int						outlen		= -1;
 	GLuint					shader;
 	glw::GLsync				sync;
 	char					buffer[64];
-	int						outlen;
 
 	sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
 	GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
@@ -1917,10 +1917,10 @@
 	const glw::Functions&	gl			= m_context.getRenderContext().getFunctions();
 	tcu::ResultCollector	result		(m_testCtx.getLog(), " // ERROR: ");
 	const char*	const		msg			= "This is a debug label";
+	int						outlen		= -1;
 	GLuint					shader;
 	glw::GLsync				sync;
 	char					buffer[64];
-	int						outlen;
 
 	sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
 	GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
@@ -2011,10 +2011,10 @@
 	tcu::ResultCollector	result		(m_testCtx.getLog(), " // ERROR: ");
 	const char*	const		msg			= "This is a debug label";
 	const char*	const		clipMsg		= "This is a de";
+	int						outlen		= -1;
 	GLuint					shader;
 	glw::GLsync				sync;
 	char					buffer[64];
-	int						outlen;
 
 	sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
 	GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
@@ -2120,10 +2120,10 @@
 	const glw::Functions&	gl			= m_context.getRenderContext().getFunctions();
 	tcu::ResultCollector	result		(m_testCtx.getLog(), " // ERROR: ");
 	const char*	const		msg			= "This is a debug label";
+	int						outlen		= -1;
 	GLuint					shader;
 	glw::GLsync				sync;
 	char					buffer[64];
-	int						outlen;
 
 	sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
 	GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
@@ -2349,9 +2349,9 @@
 	const glw::Functions&	gl			= m_context.getRenderContext().getFunctions();
 	tcu::ResultCollector	result		(m_testCtx.getLog(), " // ERROR: ");
 	int						maxLabelLen	= -1;
+	int						outlen		= -1;
 	GLuint					shader;
 	glw::GLsync				sync;
-	int						outlen;
 
 	gl.getIntegerv(GL_MAX_LABEL_LENGTH, &maxLabelLen);
 	GLS_COLLECT_GL_ERROR(result, gl.getError(), "GL_MAX_LABEL_LENGTH");
@@ -2476,9 +2476,9 @@
 	const glw::Functions&	gl			= m_context.getRenderContext().getFunctions();
 	tcu::ResultCollector	result		(m_testCtx.getLog(), " // ERROR: ");
 	const char*	const		msg			= "This is a debug label";
+	int						outlen		= -1;
 	GLuint					shader;
 	glw::GLsync				sync;
-	int						outlen;
 
 	sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
 	GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
@@ -2864,7 +2864,7 @@
 		case CASETYPE_GETERROR: return new GetErrorCase(ctx, name, desc, function);
 
 		default:
-			DE_ASSERT(!"Invalid type");
+			DE_FATAL("Invalid type");
 	}
 
 	return DE_NULL;
diff --git a/modules/gles31/functional/es31fDrawTests.cpp b/modules/gles31/functional/es31fDrawTests.cpp
index 0664137..f8c4f5b 100644
--- a/modules/gles31/functional/es31fDrawTests.cpp
+++ b/modules/gles31/functional/es31fDrawTests.cpp
@@ -820,8 +820,8 @@
 	deInt32 offsetLocation	= ctx.getAttribLocation(programID, "a_offset");
 	deInt32 colorLocation	= ctx.getAttribLocation(programID, "a_color");
 
-	float cellW	= 2.0f / m_gridSide;
-	float cellH	= 2.0f / m_gridSide;
+	float cellW	= 2.0f / (float)m_gridSide;
+	float cellH	= 2.0f / (float)m_gridSide;
 	const tcu::Vec4 vertexPositions[] =
 	{
 		tcu::Vec4(0,		0,		0, 1),
@@ -842,7 +842,7 @@
 	std::vector<tcu::Vec4> offsets;
 	for (int x = 0; x < m_gridSide; ++x)
 	for (int y = 0; y < m_gridSide; ++y)
-		offsets.push_back(tcu::Vec4(x * cellW - 1.0f, y * cellW - 1.0f, 0, 0));
+		offsets.push_back(tcu::Vec4((float)x * cellW - 1.0f, (float)y * cellW - 1.0f, 0, 0));
 
 	std::vector<tcu::Vec4> colors;
 	for (int x = 0; x < m_gridSide; ++x)
@@ -1034,7 +1034,7 @@
 	, m_computeCmd		(computeCmd)
 	, m_computeData		(computeData)
 	, m_computeIndices	(computeIndices)
-	, m_commandSize		((method==DRAWMETHOD_DRAWARRAYS) ? (sizeof(DrawArraysCommand)) : (sizeof(DrawElementsCommand)))
+	, m_commandSize		((method==DRAWMETHOD_DRAWARRAYS) ? ((int)sizeof(DrawArraysCommand)) : ((int)sizeof(DrawElementsCommand)))
 	, m_numDrawCmds		(drawCallCount)
 	, m_gridSize		(gridSize)
 	, m_cmdBufferID		(0)
@@ -1410,8 +1410,8 @@
 		for (int y = 0; y < m_gridSize; ++y)
 		for (int x = 0; x < m_gridSize; ++x)
 		{
-			const float 		posX		= (x / (float)m_gridSize) * 2.0f - 1.0f;
-			const float 		posY		= (y / (float)m_gridSize) * 2.0f - 1.0f;
+			const float 		posX		= ((float)x / (float)m_gridSize) * 2.0f - 1.0f;
+			const float 		posY		= ((float)y / (float)m_gridSize) * 2.0f - 1.0f;
 			const float			cellSize	= 2.0f / (float)m_gridSize;
 			const tcu::Vec4&	color		= ((x + y)%2) ? (yellow) : (green);
 
@@ -1444,8 +1444,8 @@
 		for (int y = 0; y < m_gridSize+1; ++y)
 		for (int x = 0; x < m_gridSize+1; ++x)
 		{
-			const float 		posX		= (x / (float)m_gridSize) * 2.0f - 1.0f;
-			const float 		posY		= (y / (float)m_gridSize) * 2.0f - 1.0f;
+			const float 		posX		= ((float)x / (float)m_gridSize) * 2.0f - 1.0f;
+			const float 		posY		= ((float)y / (float)m_gridSize) * 2.0f - 1.0f;
 
 			buffer[(y * (m_gridSize+1) + x) * 4 + 0] = tcu::Vec4(posX, posY, 0.0f, 1.0f);
 			buffer[(y * (m_gridSize+1) + x) * 4 + 1] = green;
@@ -1502,8 +1502,8 @@
 	// Setup buffers
 
 	gl.bindBuffer(GL_ARRAY_BUFFER, m_dataBufferID);
-	gl.vertexAttribPointer(positionLoc, 4, GL_FLOAT, GL_FALSE, 8 * sizeof(float), DE_NULL);
-	gl.vertexAttribPointer(colorLoc,    4, GL_FLOAT, GL_FALSE, 8 * sizeof(float), ((const deUint8*)DE_NULL) + 4*sizeof(float));
+	gl.vertexAttribPointer(positionLoc, 4, GL_FLOAT, GL_FALSE, 8 * (int)sizeof(float), DE_NULL);
+	gl.vertexAttribPointer(colorLoc,    4, GL_FLOAT, GL_FALSE, 8 * (int)sizeof(float), ((const deUint8*)DE_NULL) + 4*sizeof(float));
 	gl.enableVertexAttribArray(positionLoc);
 	gl.enableVertexAttribArray(colorLoc);
 
diff --git a/modules/gles31/functional/es31fFboTestCase.cpp b/modules/gles31/functional/es31fFboTestCase.cpp
index 4d03eab..4497508 100644
--- a/modules/gles31/functional/es31fFboTestCase.cpp
+++ b/modules/gles31/functional/es31fFboTestCase.cpp
@@ -322,7 +322,7 @@
 			return 0;
 
 		default:
-			DE_ASSERT(!"Unknown format");
+			DE_FATAL("Unknown format");
 			return 0;
 	}
 }
diff --git a/modules/gles31/functional/es31fFboTestUtil.cpp b/modules/gles31/functional/es31fFboTestUtil.cpp
index 0febea7..1170cca 100644
--- a/modules/gles31/functional/es31fFboTestUtil.cpp
+++ b/modules/gles31/functional/es31fFboTestUtil.cpp
@@ -557,7 +557,7 @@
 			return glu::TYPE_INT_VEC4;
 
 		default:
-			DE_ASSERT(!"Unknown format");
+			DE_FATAL("Unknown format");
 			return glu::TYPE_LAST;
 	}
 }
@@ -580,7 +580,7 @@
 			return tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::SIGNED_INT32);
 
 		default:
-			DE_ASSERT(!"Unknown format");
+			DE_FATAL("Unknown format");
 			return tcu::TextureFormat();
 	}
 }
diff --git a/modules/gles31/functional/es31fGeometryShaderTests.cpp b/modules/gles31/functional/es31fGeometryShaderTests.cpp
index e75eb28..2f4e60c 100644
--- a/modules/gles31/functional/es31fGeometryShaderTests.cpp
+++ b/modules/gles31/functional/es31fGeometryShaderTests.cpp
@@ -835,8 +835,8 @@
 
 		for (int ndx = 0; ndx < emitCount / 2; ++ndx)
 		{
-			output.EmitVertex(vertex->position + tcu::Vec4(2 * ndx * colWidth, 0.0,       0.0, 0.0), vertex->pointSize, vertex->outputs, packets[packetNdx].primitiveIDIn);
-			output.EmitVertex(vertex->position + tcu::Vec4(2 * ndx * colWidth, rowHeight, 0.0, 0.0), vertex->pointSize, vertex->outputs, packets[packetNdx].primitiveIDIn);
+			output.EmitVertex(vertex->position + tcu::Vec4(2 * (float)ndx * colWidth, 0.0,       0.0, 0.0), vertex->pointSize, vertex->outputs, packets[packetNdx].primitiveIDIn);
+			output.EmitVertex(vertex->position + tcu::Vec4(2 * (float)ndx * colWidth, rowHeight, 0.0, 0.0), vertex->pointSize, vertex->outputs, packets[packetNdx].primitiveIDIn);
 		}
 		output.EndPrimitive();
 	}
@@ -1283,7 +1283,7 @@
 		else if (m_test == READ_TEXTURE)
 		{
 			const int			primitiveNdx	= (m_instanced) ? (invocationID) : ((int)vertex->outputs[0].get<float>().x());
-			const tcu::Vec2		texCoord		= tcu::Vec2(1.0f / 8.0f + primitiveNdx / 4.0f, 0.5f);
+			const tcu::Vec2		texCoord		= tcu::Vec2(1.0f / 8.0f + (float)primitiveNdx / 4.0f, 0.5f);
 			const tcu::Vec4		texColor		= m_sampler.sampler.tex2D->sample(texCoord.x(), texCoord.y(), 0.0f);
 
 			DE_ASSERT(primitiveNdx >= 0);
@@ -1940,29 +1940,37 @@
 		const int		colorComponentThreshold	= 20;
 		bool			testResult				= true;
 
-		for (int x = 1; x + 1 < m_viewportSize.x(); ++x)
-		for (int y = 1; y + 1 < m_viewportSize.y(); ++y)
+		for (int x = 0; x < m_viewportSize.x(); ++x)
+		for (int y = 0; y < m_viewportSize.y(); ++y)
 		{
-			bool found = false;
-			const tcu::RGBA refcolor = m_refResult->getPixel(x, y);
-
-			// Got to find similar pixel near this pixel (3x3 kernel)
-			for (int dx = -1; dx <= 1; ++dx)
-			for (int dy = -1; dy <= 1; ++dy)
+			if (x == 0 || y == 0 || x + 1 == m_viewportSize.x() || y + 1 == m_viewportSize.y())
 			{
-				const tcu::RGBA		testColor	= m_glResult->getPixel(x + dx, y + dy);
-				const tcu::IVec4	colDiff		= tcu::abs(testColor.toIVec() - refcolor.toIVec());
-
-				const int			maxColDiff	= de::max(de::max(colDiff.x(), colDiff.y()), colDiff.z()); // check RGB channels
-
-				if (maxColDiff <= colorComponentThreshold)
-					found = true;
+				// Mark edge pixels as correct since their neighbourhood is undefined
+				errorMask.setPixel(x, y, green);
 			}
+			else
+			{
+				const tcu::RGBA	refcolor	= m_refResult->getPixel(x, y);
+				bool			found		= false;
 
-			if (!found)
-				testResult = false;
+				// Got to find similar pixel near this pixel (3x3 kernel)
+				for (int dx = -1; dx <= 1; ++dx)
+				for (int dy = -1; dy <= 1; ++dy)
+				{
+					const tcu::RGBA		testColor	= m_glResult->getPixel(x + dx, y + dy);
+					const tcu::IVec4	colDiff		= tcu::abs(testColor.toIVec() - refcolor.toIVec());
 
-			errorMask.setPixel(x, y, (found) ? (green) : (red));
+					const int			maxColDiff	= de::max(de::max(colDiff.x(), colDiff.y()), colDiff.z()); // check RGB channels
+
+					if (maxColDiff <= colorComponentThreshold)
+						found = true;
+				}
+
+				if (!found)
+					testResult = false;
+
+				errorMask.setPixel(x, y, (found) ? (green) : (red));
+			}
 		}
 
 		if (testResult)
@@ -2456,7 +2464,7 @@
 
 	for (int ndx = 0; ndx < m_primitiveCount; ++ndx)
 	{
-		m_vertexPosData[ndx] = tcu::Vec4(-1.0f, ((float)ndx) / m_primitiveCount * 2.0f - 1.0f, 0.0f, 1.0f);
+		m_vertexPosData[ndx] = tcu::Vec4(-1.0f, ((float)ndx) / (float)m_primitiveCount * 2.0f - 1.0f, 0.0f, 1.0f);
 		m_vertexAttrData[ndx] = (ndx % 2 == 0) ? tcu::Vec4(1, 1, 1, 1) : tcu::Vec4(1, 0, 0, 1);
 	}
 
@@ -3346,7 +3354,7 @@
 			if (layerNdx == 0)
 				return verifyEmptyImage(layer);
 			else
-				return verifyImageSingleColoredRow(layer, layerNdx / (float)m_numLayers, white);
+				return verifyImageSingleColoredRow(layer, (float)layerNdx / (float)m_numLayers, white);
 
 		case TEST_LAYER_ID:
 		{
@@ -3388,7 +3396,7 @@
 {
 	DE_ASSERT(rowWidthRatio > 0.0f);
 
-	const int		barLength			= (int)(rowWidthRatio*layer.getWidth());
+	const int		barLength			= (int)(rowWidthRatio * (float)layer.getWidth());
 	const int		barLengthThreshold	= 1;
 	tcu::Surface	errorMask			(layer.getWidth(), layer.getHeight());
 	bool			allPixelsOk			= true;
@@ -4589,12 +4597,12 @@
 		gl.bindBuffer(GL_ARRAY_BUFFER, *buffer);
 		gl.bufferData(GL_ARRAY_BUFFER, (int)sizeof(vertexData), vertexData, GL_STATIC_DRAW);
 
-		gl.vertexAttribPointer(positionLocation, 4, GL_FLOAT, GL_FALSE, 2 * sizeof(tcu::Vec4), DE_NULL);
+		gl.vertexAttribPointer(positionLocation, 4, GL_FLOAT, GL_FALSE, 2 * (int)sizeof(tcu::Vec4), DE_NULL);
 		gl.enableVertexAttribArray(positionLocation);
 
 		if (oneLocation != -1)
 		{
-			gl.vertexAttribPointer(oneLocation, 4, GL_FLOAT, GL_FALSE, 2 * sizeof(tcu::Vec4), (const tcu::Vec4*)DE_NULL + 1);
+			gl.vertexAttribPointer(oneLocation, 4, GL_FLOAT, GL_FALSE, 2 * (int)sizeof(tcu::Vec4), (const tcu::Vec4*)DE_NULL + 1);
 			gl.enableVertexAttribArray(oneLocation);
 		}
 
@@ -5360,7 +5368,7 @@
 		};
 
 		const glw::Functions&	gl				= m_context.getRenderContext().getFunctions();
-		const int				feedbackSize	= 8 * sizeof(float[4]);
+		const int				feedbackSize	= 8 * (int)sizeof(float[4]);
 
 		m_vao = new glu::VertexArray(m_context.getRenderContext());
 		gl.bindVertexArray(**m_vao);
diff --git a/modules/gles31/functional/es31fMultisampleTests.cpp b/modules/gles31/functional/es31fMultisampleTests.cpp
index 028eef2..4a77f95 100644
--- a/modules/gles31/functional/es31fMultisampleTests.cpp
+++ b/modules/gles31/functional/es31fMultisampleTests.cpp
@@ -101,7 +101,7 @@
 	for (int ndx = 0; ndx < numWords - 1; ++ndx)
 		mask[ndx] = 0xFFFFFFFF;
 
-	mask[numWords - 1] = (deUint32)((1ULL << topWordBits) - (deUint32)1);
+	mask[numWords - 1] = deBitMask32(0, (int)topWordBits);
 	return mask;
 }
 
@@ -490,7 +490,7 @@
 	for (int triNdx = 0; triNdx < numTriangles; triNdx++)
 	{
 		const float	angle0	= 2.0f*DE_PI * (float)triNdx			/ (float)numTriangles;
-		const float	angle1	= 2.0f*DE_PI * (float)(triNdx + 0.5f)	/ (float)numTriangles;
+		const float	angle1	= 2.0f*DE_PI * ((float)triNdx + 0.5f)	/ (float)numTriangles;
 		const Vec4	color	= Vec4(0.4f + (float)triNdx/(float)numTriangles*0.6f,
 		                           0.5f + (float)triNdx/(float)numTriangles*0.3f,
 		                           0.6f - (float)triNdx/(float)numTriangles*0.5f,
@@ -499,7 +499,7 @@
 
 		const int			wordCount		= getEffectiveSampleMaskWordCount(m_numSamples - 1);
 		const GLbitfield	finalWordBits	= m_numSamples - 32 * ((m_numSamples-1) / 32);
-		const GLbitfield	finalWordMask	= (GLbitfield)(1ULL << finalWordBits) - 1UL;
+		const GLbitfield	finalWordMask	= (GLbitfield)deBitMask32(0, (int)finalWordBits);
 
 		for (int wordNdx = 0; wordNdx < wordCount; ++wordNdx)
 		{
@@ -809,7 +809,7 @@
 			{
 				const int			wordCount		= getEffectiveSampleMaskWordCount(m_numSamples - 1);
 				const GLbitfield	finalWordBits	= m_numSamples - 32 * ((m_numSamples-1) / 32);
-				const GLbitfield	finalWordMask	= (GLbitfield)(1ULL << finalWordBits) - 1UL;
+				const GLbitfield	finalWordMask	= (GLbitfield)deBitMask32(0, (int)finalWordBits);
 
 				for (int wordNdx = 0; wordNdx < wordCount; ++wordNdx)
 				{
@@ -936,7 +936,7 @@
 
 			const int			wordCount		= getEffectiveSampleMaskWordCount(m_numSamples - 1);
 			const GLbitfield	finalWordBits	= m_numSamples - 32 * ((m_numSamples-1) / 32);
-			const GLbitfield	finalWordMask	= (GLbitfield)(1ULL << finalWordBits) - 1UL;
+			const GLbitfield	finalWordMask	= (GLbitfield)deBitMask32(0, (int)finalWordBits);
 
 			for (int wordNdx = 0; wordNdx < wordCount; ++wordNdx)
 			{
diff --git a/modules/gles31/functional/es31fPrimitiveBoundingBoxTests.cpp b/modules/gles31/functional/es31fPrimitiveBoundingBoxTests.cpp
index ea8109a..d25314e 100644
--- a/modules/gles31/functional/es31fPrimitiveBoundingBoxTests.cpp
+++ b/modules/gles31/functional/es31fPrimitiveBoundingBoxTests.cpp
@@ -108,10 +108,10 @@
 	tcu::Vec4	vertexBox;
 	tcu::IVec4	pixelBox;
 
-	vertexBox.x() = (bbox.min.x() * 0.5f + 0.5f) * viewportSize.x();
-	vertexBox.y() = (bbox.min.y() * 0.5f + 0.5f) * viewportSize.y();
-	vertexBox.z() = (bbox.max.x() * 0.5f + 0.5f) * viewportSize.x();
-	vertexBox.w() = (bbox.max.y() * 0.5f + 0.5f) * viewportSize.y();
+	vertexBox.x() = (bbox.min.x() * 0.5f + 0.5f) * (float)viewportSize.x();
+	vertexBox.y() = (bbox.min.y() * 0.5f + 0.5f) * (float)viewportSize.y();
+	vertexBox.z() = (bbox.max.x() * 0.5f + 0.5f) * (float)viewportSize.x();
+	vertexBox.w() = (bbox.max.y() * 0.5f + 0.5f) * (float)viewportSize.y();
 
 	pixelBox.x() = deFloorFloatToInt32(vertexBox.x() - size/2.0f);
 	pixelBox.y() = deFloorFloatToInt32(vertexBox.y() - size/2.0f);
@@ -775,10 +775,10 @@
 	tcu::Vec4	vertexBox;
 	tcu::IVec4	pixelBox;
 
-	vertexBox.x() = (patternPos.x() * 0.5f + 0.5f) * viewportSize.x();
-	vertexBox.y() = (patternPos.y() * 0.5f + 0.5f) * viewportSize.y();
-	vertexBox.z() = ((patternPos.x() + patternSize.x()) * 0.5f + 0.5f) * viewportSize.x();
-	vertexBox.w() = ((patternPos.y() + patternSize.y()) * 0.5f + 0.5f) * viewportSize.y();
+	vertexBox.x() = (patternPos.x() * 0.5f + 0.5f) * (float)viewportSize.x();
+	vertexBox.y() = (patternPos.y() * 0.5f + 0.5f) * (float)viewportSize.y();
+	vertexBox.z() = ((patternPos.x() + patternSize.x()) * 0.5f + 0.5f) * (float)viewportSize.x();
+	vertexBox.w() = ((patternPos.y() + patternSize.y()) * 0.5f + 0.5f) * (float)viewportSize.y();
 
 	if (roundDir == ROUND_INWARDS)
 	{
@@ -1230,17 +1230,17 @@
 		const int			cellY		= cellNdx / m_gridSize;
 		const tcu::Vec4&	cellColor	= ((cellX+cellY)%2 == 0) ? (green) : (yellow);
 
-		data[(ndx * 6 + 0) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((cellX+0) / float(m_gridSize), (cellY+0) / float(m_gridSize), 0.0f, 1.0f);
+		data[(ndx * 6 + 0) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(cellX+0) / float(m_gridSize), float(cellY+0) / float(m_gridSize), 0.0f, 1.0f);
 		data[(ndx * 6 + 0) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = cellColor;
-		data[(ndx * 6 + 1) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((cellX+1) / float(m_gridSize), (cellY+1) / float(m_gridSize), 0.0f, 1.0f);
+		data[(ndx * 6 + 1) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(cellX+1) / float(m_gridSize), float(cellY+1) / float(m_gridSize), 0.0f, 1.0f);
 		data[(ndx * 6 + 1) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = cellColor;
-		data[(ndx * 6 + 2) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((cellX+0) / float(m_gridSize), (cellY+1) / float(m_gridSize), 0.0f, 1.0f);
+		data[(ndx * 6 + 2) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(cellX+0) / float(m_gridSize), float(cellY+1) / float(m_gridSize), 0.0f, 1.0f);
 		data[(ndx * 6 + 2) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = cellColor;
-		data[(ndx * 6 + 3) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((cellX+0) / float(m_gridSize), (cellY+0) / float(m_gridSize), 0.0f, 1.0f);
+		data[(ndx * 6 + 3) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(cellX+0) / float(m_gridSize), float(cellY+0) / float(m_gridSize), 0.0f, 1.0f);
 		data[(ndx * 6 + 3) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = cellColor;
-		data[(ndx * 6 + 4) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((cellX+1) / float(m_gridSize), (cellY+0) / float(m_gridSize), 0.0f, 1.0f);
+		data[(ndx * 6 + 4) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(cellX+1) / float(m_gridSize), float(cellY+0) / float(m_gridSize), 0.0f, 1.0f);
 		data[(ndx * 6 + 4) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = cellColor;
-		data[(ndx * 6 + 5) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((cellX+1) / float(m_gridSize), (cellY+1) / float(m_gridSize), 0.0f, 1.0f);
+		data[(ndx * 6 + 5) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(cellX+1) / float(m_gridSize), float(cellY+1) / float(m_gridSize), 0.0f, 1.0f);
 		data[(ndx * 6 + 5) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = cellColor;
 	}
 }
@@ -1702,8 +1702,8 @@
 	{
 		const IterationConfig& config = generateRandomConfig((0xDEDEDEu * (deUint32)iteration) ^ (0xABAB13 * attemptNdx), renderTargetSize);
 
-		if (config.viewportSize.x() * (config.patternSize.x() * 0.5f) > 2.5f * m_patternSide * m_wideLineLineWidth &&
-			config.viewportSize.y() * (config.patternSize.y() * 0.5f) > 2.5f * m_patternSide * m_wideLineLineWidth)
+		if ((float)config.viewportSize.x() * (config.patternSize.x() * 0.5f) > 2.5f * (float)m_patternSide * (float)m_wideLineLineWidth &&
+			(float)config.viewportSize.y() * (config.patternSize.y() * 0.5f) > 2.5f * (float)m_patternSide * (float)m_wideLineLineWidth)
 		{
 			return config;
 		}
@@ -1735,16 +1735,16 @@
 
 		if (direction)
 		{
-			data[(ndx * 2 + 0) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(minorCoord / float(m_patternSide), majorCoord / float(m_patternSide), 0.0f, 1.0f);
+			data[(ndx * 2 + 0) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(minorCoord) / float(m_patternSide), float(majorCoord) / float(m_patternSide), 0.0f, 1.0f);
 			data[(ndx * 2 + 0) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = green;
-			data[(ndx * 2 + 1) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(minorCoord / float(m_patternSide), (majorCoord + 1) / float(m_patternSide), 0.0f, 1.0f);
+			data[(ndx * 2 + 1) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(minorCoord) / float(m_patternSide), float(majorCoord + 1) / float(m_patternSide), 0.0f, 1.0f);
 			data[(ndx * 2 + 1) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = green;
 		}
 		else
 		{
-			data[(ndx * 2 + 0) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(majorCoord / float(m_patternSide), minorCoord / float(m_patternSide), 0.0f, 1.0f);
+			data[(ndx * 2 + 0) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(majorCoord) / float(m_patternSide), float(minorCoord) / float(m_patternSide), 0.0f, 1.0f);
 			data[(ndx * 2 + 0) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = blue;
-			data[(ndx * 2 + 1) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((majorCoord + 1) / float(m_patternSide), minorCoord / float(m_patternSide), 0.0f, 1.0f);
+			data[(ndx * 2 + 1) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(majorCoord + 1) / float(m_patternSide), float(minorCoord) / float(m_patternSide), 0.0f, 1.0f);
 			data[(ndx * 2 + 1) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = blue;
 		}
 	}
@@ -1773,7 +1773,7 @@
 	if (m_isWideLineCase)
 		gl.lineWidth((float)m_wideLineLineWidth);
 
-	gl.uniform1f(gl.getUniformLocation(m_program->getProgram(), "u_lineWidth"), (m_isWideLineCase) ? (m_wideLineLineWidth) : (1.0f));
+	gl.uniform1f(gl.getUniformLocation(m_program->getProgram(), "u_lineWidth"), (m_isWideLineCase) ? ((float)m_wideLineLineWidth) : (1.0f));
 
 	m_testCtx.getLog() << tcu::TestLog::Message << "Rendering pattern." << tcu::TestLog::EndMessage;
 
@@ -1790,7 +1790,7 @@
 	const glw::Functions&	gl						= m_context.getRenderContext().getFunctions();
 	const bool				isMsaa					= m_context.getRenderTarget().getNumSamples() > 1;
 	const ProjectedBBox		projectedBBox			= projectBoundingBox(config.bbox);
-	const float				lineWidth				= (m_isWideLineCase) ? (m_wideLineLineWidth) : (1.0f);
+	const float				lineWidth				= (m_isWideLineCase) ? ((float)m_wideLineLineWidth) : (1.0f);
 	const tcu::IVec4		viewportBBoxArea		= getViewportBoundingBoxArea(projectedBBox, config.viewportSize, lineWidth);
 	const tcu::IVec4		viewportPatternArea		= getViewportPatternArea(config.patternPos, config.patternSize, config.viewportSize, ROUND_INWARDS);
 	const tcu::IVec2		expectedHorizontalLines	= getNumberOfLinesRange(viewportBBoxArea.y(), viewportBBoxArea.w(), config.patternPos.y(), config.patternSize.y(), config.viewportSize.y(), DIRECTION_VERTICAL);
@@ -1926,18 +1926,18 @@
 
 	for (int lineNdx = patternStartNdx; lineNdx < patternEndNdx; ++lineNdx)
 	{
-		const float linePos		= (patternStart + (lineNdx / float(m_patternSide)) * patternSize) * 0.5f + 0.5f;
-		const float lineWidth	= (m_isWideLineCase) ? (m_wideLineLineWidth) : (1.0f);
+		const float linePos		= (patternStart + (float(lineNdx) / float(m_patternSide)) * patternSize) * 0.5f + 0.5f;
+		const float lineWidth	= (m_isWideLineCase) ? ((float)m_wideLineLineWidth) : (1.0f);
 
-		if (linePos * viewportArea > queryAreaBegin + 1.0f &&
-			linePos * viewportArea < queryAreaEnd   - 1.0f)
+		if (linePos * (float)viewportArea > (float)queryAreaBegin + 1.0f &&
+			linePos * (float)viewportArea < (float)queryAreaEnd   - 1.0f)
 		{
 			// line center is within the area
 			++numLinesMin;
 			++numLinesMax;
 		}
-		else if (linePos * viewportArea > queryAreaBegin - lineWidth*0.5f - 1.0f &&
-		         linePos * viewportArea < queryAreaEnd   + lineWidth*0.5f + 1.0f)
+		else if (linePos * (float)viewportArea > (float)queryAreaBegin - lineWidth*0.5f - 1.0f &&
+		         linePos * (float)viewportArea < (float)queryAreaEnd   + lineWidth*0.5f + 1.0f)
 		{
 			// line could leak into area
 			++numLinesMax;
@@ -1952,8 +1952,8 @@
 	const bool numLinesOk	= checkAreaNumLines(access, tcu::IVec4(rowBegin, row, rowEnd - rowBegin, 1), messageLimitCounter, SCAN_ROW_COMPONENT_NDX, numLines);
 	const bool lineWidthOk	= checkLineWidths(access, tcu::IVec2(rowBegin, row), tcu::IVec2(rowEnd, row), SCAN_ROW_COMPONENT_NDX, messageLimitCounter);
 
-	return	(numLinesOk		? (deUint8)SCANRESULT_NUM_LINES_OK_BIT	: 0u) |
-			(lineWidthOk	? (deUint8)SCANRESULT_LINE_WIDTH_OK_BIT	: 0u);
+	return	(deUint8)((numLinesOk	? (deUint8)SCANRESULT_NUM_LINES_OK_BIT	: 0u) |
+					  (lineWidthOk	? (deUint8)SCANRESULT_LINE_WIDTH_OK_BIT	: 0u));
 }
 
 deUint8 LineRenderCase::scanColumn (const tcu::ConstPixelBufferAccess& access, int column, int columnBegin, int columnEnd, const tcu::IVec2& numLines, int& messageLimitCounter) const
@@ -1961,8 +1961,8 @@
 	const bool numLinesOk	= checkAreaNumLines(access, tcu::IVec4(column, columnBegin, 1, columnEnd - columnBegin), messageLimitCounter, SCAN_COL_COMPONENT_NDX, numLines);
 	const bool lineWidthOk	= checkLineWidths(access, tcu::IVec2(column, columnBegin), tcu::IVec2(column, columnEnd), SCAN_COL_COMPONENT_NDX, messageLimitCounter);
 
-	return	(numLinesOk		? (deUint8)SCANRESULT_NUM_LINES_OK_BIT	: 0u) |
-			(lineWidthOk	? (deUint8)SCANRESULT_LINE_WIDTH_OK_BIT	: 0u);
+	return	(deUint8)((numLinesOk	? (deUint8)SCANRESULT_NUM_LINES_OK_BIT	: 0u) |
+					  (lineWidthOk	? (deUint8)SCANRESULT_LINE_WIDTH_OK_BIT	: 0u));
 }
 
 bool LineRenderCase::checkAreaNumLines (const tcu::ConstPixelBufferAccess& access, const tcu::IVec4& area, int& messageLimitCounter, int componentNdx, const tcu::IVec2& numLines) const
@@ -2567,12 +2567,12 @@
 
 		if (direction)
 		{
-			m_attribData[ndx * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(minorCoord / float(m_numStripes), majorCoord / float(m_numStripes), 0.0f, 1.0f);
+			m_attribData[ndx * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(minorCoord) / float(m_numStripes), float(majorCoord) / float(m_numStripes), 0.0f, 1.0f);
 			m_attribData[ndx * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = green;
 		}
 		else
 		{
-			m_attribData[ndx * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((majorCoord + 0.5f) / float(m_numStripes), (minorCoord + 0.5f) / float(m_numStripes), 0.0f, 1.0f);
+			m_attribData[ndx * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(((float)majorCoord + 0.5f) / float(m_numStripes), ((float)minorCoord + 0.5f) / float(m_numStripes), 0.0f, 1.0f);
 			m_attribData[ndx * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = blue;
 		}
 	}
@@ -2791,7 +2791,8 @@
 		else
 		{
 			// transform to viewport coords
-			const tcu::IVec2 pixelCenter(deRoundFloatToInt32((refPoint.center.x() * 0.5f + 0.5f) * viewport.getWidth()), deRoundFloatToInt32((refPoint.center.y() * 0.5f + 0.5f) * viewport.getHeight()));
+			const tcu::IVec2 pixelCenter(deRoundFloatToInt32((refPoint.center.x() * 0.5f + 0.5f) * (float)viewport.getWidth()),
+										 deRoundFloatToInt32((refPoint.center.y() * 0.5f + 0.5f) * (float)viewport.getHeight()));
 
 			// find rasterized point in the result
 			if (pixelCenter.x() < 1 || pixelCenter.y() < 1 || pixelCenter.x() >= viewport.getWidth()-1 || pixelCenter.y() >= viewport.getHeight()-1)
@@ -2850,10 +2851,10 @@
 			// point fully in the bounding box
 			anyError |= !verifyWidePoint(viewport, refPoint, bbox, POINT_FULL, logFloodCounter);
 		}
-		else if (refPoint.center.x() >= bbox.min.x() + refPoint.size / 2.0f &&
-				 refPoint.center.y() >= bbox.min.y() - refPoint.size / 2.0f &&
-				 refPoint.center.x() <= bbox.max.x() + refPoint.size / 2.0f &&
-				 refPoint.center.y() <= bbox.max.y() - refPoint.size / 2.0f)
+		else if (refPoint.center.x() >= bbox.min.x() + (float)refPoint.size / 2.0f &&
+				 refPoint.center.y() >= bbox.min.y() - (float)refPoint.size / 2.0f &&
+				 refPoint.center.x() <= bbox.max.x() + (float)refPoint.size / 2.0f &&
+				 refPoint.center.y() <= bbox.max.y() - (float)refPoint.size / 2.0f)
 		{
 			// point leaks into bounding box
 			anyError |= !verifyWidePoint(viewport, refPoint, bbox, POINT_PARTIAL, logFloodCounter);
@@ -2873,8 +2874,8 @@
 														 de::max(viewportBBoxArea.y(), 0),
 														 de::min(viewportBBoxArea.z(), viewport.getWidth()),
 														 de::min(viewportBBoxArea.w(), viewport.getHeight()));
-	const tcu::IVec2	pointPos			= tcu::IVec2(deRoundFloatToInt32((refPoint.center.x()*0.5f + 0.5f) * viewport.getWidth()),
-														 deRoundFloatToInt32((refPoint.center.y()*0.5f + 0.5f) * viewport.getHeight()));
+	const tcu::IVec2	pointPos			= tcu::IVec2(deRoundFloatToInt32((refPoint.center.x()*0.5f + 0.5f) * (float)viewport.getWidth()),
+														 deRoundFloatToInt32((refPoint.center.y()*0.5f + 0.5f) * (float)viewport.getHeight()));
 
 	// find any fragment within the point that is inside the bbox, start search at the center
 
@@ -3604,8 +3605,8 @@
 		m_layers.resize(m_numLayers);
 		for (int layerNdx = 0; layerNdx < m_numLayers; ++layerNdx)
 		{
-			m_layers[layerNdx].zOffset	= ((float)layerNdx / m_numLayers) * 2.0f - 1.0f;
-			m_layers[layerNdx].zScale	= (2.0f / m_numLayers);
+			m_layers[layerNdx].zOffset	= ((float)layerNdx / (float)m_numLayers) * 2.0f - 1.0f;
+			m_layers[layerNdx].zScale	= (2.0f / (float)m_numLayers);
 			m_layers[layerNdx].color1	= (layerNdx == 0) ? (tcu::Vec4(0.0f, 1.0f, 0.0f, 1.0f)) : (tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
 			m_layers[layerNdx].color2	= (layerNdx == 0) ? (tcu::Vec4(1.0f, 1.0f, 0.0f, 1.0f)) : (tcu::Vec4(1.0f, 0.0f, 1.0f, 1.0f));
 		}
@@ -3861,12 +3862,12 @@
 		const int			cellY		= cellNdx / m_gridSize;
 		const tcu::Vec4&	cellColor	= ((cellX+cellY)%2 == 0) ? (color1) : (color2);
 
-		data[ndx * 6 * 2 +  0] = tcu::Vec4((cellX+0) / float(m_gridSize) * 2.0f - 1.0f, (cellY+0) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f);	data[ndx * 6 * 2 +  1] = cellColor;
-		data[ndx * 6 * 2 +  2] = tcu::Vec4((cellX+1) / float(m_gridSize) * 2.0f - 1.0f, (cellY+1) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f);	data[ndx * 6 * 2 +  3] = cellColor;
-		data[ndx * 6 * 2 +  4] = tcu::Vec4((cellX+0) / float(m_gridSize) * 2.0f - 1.0f, (cellY+1) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f);	data[ndx * 6 * 2 +  5] = cellColor;
-		data[ndx * 6 * 2 +  6] = tcu::Vec4((cellX+0) / float(m_gridSize) * 2.0f - 1.0f, (cellY+0) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f);	data[ndx * 6 * 2 +  7] = cellColor;
-		data[ndx * 6 * 2 +  8] = tcu::Vec4((cellX+1) / float(m_gridSize) * 2.0f - 1.0f, (cellY+0) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f);	data[ndx * 6 * 2 +  9] = cellColor;
-		data[ndx * 6 * 2 + 10] = tcu::Vec4((cellX+1) / float(m_gridSize) * 2.0f - 1.0f, (cellY+1) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f);	data[ndx * 6 * 2 + 11] = cellColor;
+		data[ndx * 6 * 2 +  0] = tcu::Vec4(float(cellX+0) / float(m_gridSize) * 2.0f - 1.0f, float(cellY+0) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f);	data[ndx * 6 * 2 +  1] = cellColor;
+		data[ndx * 6 * 2 +  2] = tcu::Vec4(float(cellX+1) / float(m_gridSize) * 2.0f - 1.0f, float(cellY+1) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f);	data[ndx * 6 * 2 +  3] = cellColor;
+		data[ndx * 6 * 2 +  4] = tcu::Vec4(float(cellX+0) / float(m_gridSize) * 2.0f - 1.0f, float(cellY+1) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f);	data[ndx * 6 * 2 +  5] = cellColor;
+		data[ndx * 6 * 2 +  6] = tcu::Vec4(float(cellX+0) / float(m_gridSize) * 2.0f - 1.0f, float(cellY+0) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f);	data[ndx * 6 * 2 +  7] = cellColor;
+		data[ndx * 6 * 2 +  8] = tcu::Vec4(float(cellX+1) / float(m_gridSize) * 2.0f - 1.0f, float(cellY+0) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f);	data[ndx * 6 * 2 +  9] = cellColor;
+		data[ndx * 6 * 2 + 10] = tcu::Vec4(float(cellX+1) / float(m_gridSize) * 2.0f - 1.0f, float(cellY+1) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f);	data[ndx * 6 * 2 + 11] = cellColor;
 
 		// Fill Z with random values (fake Z)
 		for (int vtxNdx = 0; vtxNdx < 6; ++vtxNdx)
@@ -4580,15 +4581,15 @@
 
 		if (cellSide)
 		{
-			data[ndx * 3 + 0] = tcu::Vec4((cellX+0) / float(gridSize), ((cellY+0) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
-			data[ndx * 3 + 1] = tcu::Vec4((cellX+1) / float(gridSize), ((cellY+1) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
-			data[ndx * 3 + 2] = tcu::Vec4((cellX+0) / float(gridSize), ((cellY+1) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
+			data[ndx * 3 + 0] = tcu::Vec4(float(cellX+0) / float(gridSize), (float(cellY+0) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
+			data[ndx * 3 + 1] = tcu::Vec4(float(cellX+1) / float(gridSize), (float(cellY+1) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
+			data[ndx * 3 + 2] = tcu::Vec4(float(cellX+0) / float(gridSize), (float(cellY+1) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
 		}
 		else
 		{
-			data[ndx * 3 + 0] = tcu::Vec4((cellX+0) / float(gridSize), ((cellY+0) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
-			data[ndx * 3 + 1] = tcu::Vec4((cellX+1) / float(gridSize), ((cellY+0) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
-			data[ndx * 3 + 2] = tcu::Vec4((cellX+1) / float(gridSize), ((cellY+1) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
+			data[ndx * 3 + 0] = tcu::Vec4(float(cellX+0) / float(gridSize), (float(cellY+0) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
+			data[ndx * 3 + 1] = tcu::Vec4(float(cellX+1) / float(gridSize), (float(cellY+0) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
+			data[ndx * 3 + 2] = tcu::Vec4(float(cellX+1) / float(gridSize), (float(cellY+1) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
 		}
 	}
 
@@ -4620,8 +4621,8 @@
 
 bool ViewportCallOrderCase::verifyImage (const tcu::PixelBufferAccess& result)
 {
-	const tcu::IVec2	insideBorder	(deCeilFloatToInt32(0.25f * result.getWidth()) + 1, deFloorFloatToInt32(0.5f * result.getWidth()) - 1);
-	const tcu::IVec2	outsideBorder	(deFloorFloatToInt32(0.25f * result.getWidth()) - 1, deCeilFloatToInt32(0.5f * result.getWidth()) + 1);
+	const tcu::IVec2	insideBorder	(deCeilFloatToInt32(0.25f * (float)result.getWidth()) + 1, deFloorFloatToInt32(0.5f * (float)result.getWidth()) - 1);
+	const tcu::IVec2	outsideBorder	(deFloorFloatToInt32(0.25f * (float)result.getWidth()) - 1, deCeilFloatToInt32(0.5f * (float)result.getWidth()) + 1);
 	tcu::Surface		errorMask		(result.getWidth(), result.getHeight());
 	bool				anyError		= false;
 
diff --git a/modules/gles31/functional/es31fSSBOLayoutCase.cpp b/modules/gles31/functional/es31fSSBOLayoutCase.cpp
index 4741fe4..b265614 100644
--- a/modules/gles31/functional/es31fSSBOLayoutCase.cpp
+++ b/modules/gles31/functional/es31fSSBOLayoutCase.cpp
@@ -329,7 +329,7 @@
 
 int getDataTypeByteSize (glu::DataType type)
 {
-	return glu::getDataTypeScalarSize(type)*sizeof(deUint32);
+	return glu::getDataTypeScalarSize(type)*(int)sizeof(deUint32);
 }
 
 int getDataTypeByteAlignment (glu::DataType type)
@@ -339,12 +339,12 @@
 		case glu::TYPE_FLOAT:
 		case glu::TYPE_INT:
 		case glu::TYPE_UINT:
-		case glu::TYPE_BOOL:		return 1*sizeof(deUint32);
+		case glu::TYPE_BOOL:		return 1*(int)sizeof(deUint32);
 
 		case glu::TYPE_FLOAT_VEC2:
 		case glu::TYPE_INT_VEC2:
 		case glu::TYPE_UINT_VEC2:
-		case glu::TYPE_BOOL_VEC2:	return 2*sizeof(deUint32);
+		case glu::TYPE_BOOL_VEC2:	return 2*(int)sizeof(deUint32);
 
 		case glu::TYPE_FLOAT_VEC3:
 		case glu::TYPE_INT_VEC3:
@@ -354,7 +354,7 @@
 		case glu::TYPE_FLOAT_VEC4:
 		case glu::TYPE_INT_VEC4:
 		case glu::TYPE_UINT_VEC4:
-		case glu::TYPE_BOOL_VEC4:	return 4*sizeof(deUint32);
+		case glu::TYPE_BOOL_VEC4:	return 4*(int)sizeof(deUint32);
 
 		default:
 			DE_ASSERT(false);
@@ -370,7 +370,7 @@
 
 int computeStd140BaseAlignment (const VarType& type, deUint32 layoutFlags)
 {
-	const int vec4Alignment = sizeof(deUint32)*4;
+	const int vec4Alignment = (int)sizeof(deUint32)*4;
 
 	if (type.isBasicType())
 	{
@@ -597,7 +597,7 @@
 		const int		topLevelArraySize	= varType.getArraySize() == VarType::UNSIZED_ARRAY ? 0 : varType.getArraySize();
 		const string	prefix				= blockPrefix + bufVar.getName() + "[0]";
 		const bool		isStd140			= (blockLayoutFlags & LAYOUT_STD140) != 0;
-		const int		vec4Align			= sizeof(deUint32)*4;
+		const int		vec4Align			= (int)sizeof(deUint32)*4;
 		const int		baseAlignment		= isStd140 ? computeStd140BaseAlignment(varType, combinedFlags)
 													   : computeStd430BaseAlignment(varType, combinedFlags);
 		int				curOffset			= deAlign32(baseOffset, baseAlignment);
diff --git a/modules/gles31/functional/es31fSampleShadingTests.cpp b/modules/gles31/functional/es31fSampleShadingTests.cpp
index a05b968..c38729d 100644
--- a/modules/gles31/functional/es31fSampleShadingTests.cpp
+++ b/modules/gles31/functional/es31fSampleShadingTests.cpp
@@ -312,7 +312,7 @@
 		// Minimum number of samples is max(ceil(<mss> * <samples>),1). Decrease mss with epsilon to prevent
 		// ceiling to a too large sample count.
 		const float epsilon	= 0.25f / (float)m_numTargetSamples;
-		const float ratio	= (sampleCount / (float)m_numTargetSamples) - epsilon;
+		const float ratio	= ((float)sampleCount / (float)m_numTargetSamples) - epsilon;
 
 		gl.enable(GL_SAMPLE_SHADING);
 		gl.minSampleShading(ratio);
@@ -321,12 +321,12 @@
 		m_testCtx.getLog()
 			<< tcu::TestLog::Message
 			<< "Setting MIN_SAMPLE_SHADING_VALUE = " << ratio << "\n"
-			<< "Requested sample count: shadingValue * numSamples = " << ratio << " * " << m_numTargetSamples << " = " << (ratio * m_numTargetSamples) << "\n"
-			<< "Minimum sample count: ceil(shadingValue * numSamples) = ceil(" << (ratio * m_numTargetSamples) << ") = " << sampleCount
+			<< "Requested sample count: shadingValue * numSamples = " << ratio << " * " << m_numTargetSamples << " = " << (ratio * (float)m_numTargetSamples) << "\n"
+			<< "Minimum sample count: ceil(shadingValue * numSamples) = ceil(" << (ratio * (float)m_numTargetSamples) << ") = " << sampleCount
 			<< tcu::TestLog::EndMessage;
 
 		// can't fail with reasonable values of numSamples
-		DE_ASSERT(deFloatCeil(ratio * m_numTargetSamples) == float(sampleCount));
+		DE_ASSERT(deFloatCeil(ratio * (float)m_numTargetSamples) == float(sampleCount));
 	}
 }
 
diff --git a/modules/gles31/functional/es31fSampleVariableTests.cpp b/modules/gles31/functional/es31fSampleVariableTests.cpp
index 3172a5e..14b2c31 100644
--- a/modules/gles31/functional/es31fSampleVariableTests.cpp
+++ b/modules/gles31/functional/es31fSampleVariableTests.cpp
@@ -154,7 +154,7 @@
 	, m_distanceThreshold			(0.0f)
 {
 	// approximate Bates distribution as normal
-	const float variance			= (1.0f / (12.0f * m_numSamples));
+	const float variance			= (1.0f / (12.0f * (float)m_numSamples));
 	const float standardDeviation	= deFloatSqrt(variance);
 
 	// 95% of means of sample positions are within 2 standard deviations if
@@ -168,7 +168,7 @@
 	DE_UNREF(position);
 	DE_ASSERT(m_isStatisticallySignificant);
 
-	const tcu::Vec2	avgPosition				(testColor.getGreen() / 255.0f, testColor.getBlue() / 255.0f);
+	const tcu::Vec2	avgPosition				((float)testColor.getGreen() / 255.0f, (float)testColor.getBlue() / 255.0f);
 	const tcu::Vec2	distanceFromCenter		= tcu::abs(avgPosition - tcu::Vec2(0.5f, 0.5f));
 
 	return distanceFromCenter.x() < m_distanceThreshold && distanceFromCenter.y() < m_distanceThreshold;
@@ -557,7 +557,7 @@
 	{
 		// sample id should be sample index
 		const int threshold = 255 / 4 / m_numTargetSamples + 1;
-		const float sampleIdColor = sampleNdx / (float)m_numTargetSamples;
+		const float sampleIdColor = (float)sampleNdx / (float)m_numTargetSamples;
 
 		m_testCtx.getLog() << tcu::TestLog::Message << "Verifying sample " << (sampleNdx+1) << "/" << (int)resultBuffers.size() << tcu::TestLog::EndMessage;
 		allOk &= verifyImageWithVerifier(resultBuffers[sampleNdx], m_testCtx.getLog(), ColorVerifier(tcu::Vec3(0.0f, sampleIdColor, 1.0f), tcu::IVec3(1, threshold, 1)), false);
@@ -737,7 +737,7 @@
 			for (int sampleNdx = 0; sampleNdx < (int)resultBuffers.size(); ++sampleNdx)
 			{
 				const tcu::RGBA color = resultBuffers[sampleNdx].getPixel(x, y);
-				samplePositions[sampleNdx] = tcu::Vec2(color.getGreen() / 255.0f, color.getBlue() / 255.0f);
+				samplePositions[sampleNdx] = tcu::Vec2((float)color.getGreen() / 255.0f, (float)color.getBlue() / 255.0f);
 			}
 
 			// Just check there are no two samples with same positions
@@ -1534,7 +1534,7 @@
 			for (int sampleNdx = 0; sampleNdx < (int)resultBuffers.size(); ++sampleNdx)
 			{
 				const tcu::RGBA color = resultBuffers[sampleNdx].getPixel(x, y);
-				maskBitIndices[sampleNdx] = (int)deFloatRound(color.getGreen() / 255.0f * m_numTargetSamples);
+				maskBitIndices[sampleNdx] = (int)deFloatRound((float)color.getGreen() / 255.0f * (float)m_numTargetSamples);
 			}
 
 			// just check there are no two invocations with the same bit index
@@ -1748,16 +1748,16 @@
 			deUint16			high;
 
 			{
-				int redBits		= (int)deFloatRound(lowColor.getRed() / 255.0f * 31);
-				int greenBits	= (int)deFloatRound(lowColor.getGreen() / 255.0f * 63);
-				int blueBits	= (int)deFloatRound(lowColor.getBlue() / 255.0f * 31);
+				int redBits		= (int)deFloatRound((float)lowColor.getRed() / 255.0f * 31);
+				int greenBits	= (int)deFloatRound((float)lowColor.getGreen() / 255.0f * 63);
+				int blueBits	= (int)deFloatRound((float)lowColor.getBlue() / 255.0f * 31);
 
 				low = (deUint16)(redBits | (greenBits << 5) | (blueBits << 11));
 			}
 			{
-				int redBits		= (int)deFloatRound(highColor.getRed() / 255.0f * 31);
-				int greenBits	= (int)deFloatRound(highColor.getGreen() / 255.0f * 63);
-				int blueBits	= (int)deFloatRound(highColor.getBlue() / 255.0f * 31);
+				int redBits		= (int)deFloatRound((float)highColor.getRed() / 255.0f * 31);
+				int greenBits	= (int)deFloatRound((float)highColor.getGreen() / 255.0f * 63);
+				int blueBits	= (int)deFloatRound((float)highColor.getBlue() / 255.0f * 31);
 
 				high = (deUint16)(redBits | (greenBits << 5) | (blueBits << 11));
 			}
diff --git a/modules/gles31/functional/es31fSeparateShaderTests.cpp b/modules/gles31/functional/es31fSeparateShaderTests.cpp
index 71c7be2..6c389d3 100644
--- a/modules/gles31/functional/es31fSeparateShaderTests.cpp
+++ b/modules/gles31/functional/es31fSeparateShaderTests.cpp
@@ -138,7 +138,7 @@
 		return getDataTypeVector(scalarType, size);
 	}
 
-	DE_ASSERT(!"Impossible");
+	DE_FATAL("Impossible");
 	return TYPE_INVALID;
 }
 
@@ -163,7 +163,7 @@
 		case VARYINGINTERPOLATION_CENTROID:	return glu::INTERPOLATION_CENTROID;
 		case VARYINGINTERPOLATION_DEFAULT:	return glu::INTERPOLATION_LAST;		//!< Last means no qualifier, i.e. default
 		default:
-			DE_ASSERT(!"Invalid interpolation");
+			DE_FATAL("Invalid interpolation");
 			return glu::INTERPOLATION_LAST;
 	}
 }
@@ -179,7 +179,7 @@
 		case glu::INTERPOLATION_CENTROID:	return VARYINGINTERPOLATION_CENTROID;
 		case glu::INTERPOLATION_LAST:		return VARYINGINTERPOLATION_DEFAULT;		//!< Last means no qualifier, i.e. default
 		default:
-			DE_ASSERT(!"Invalid interpolation");
+			DE_FATAL("Invalid interpolation");
 			return VARYINGINTERPOLATION_LAST;
 	}
 }
@@ -218,7 +218,7 @@
 		}
 
 		default:
-			DE_ASSERT(!"Impossible");
+			DE_FATAL("Impossible");
 	}
 
 	if (isDataTypeScalarOrVector(basicType))
@@ -238,7 +238,7 @@
 				oss << exp;
 				break;
 			default:
-				DE_ASSERT(!"Impossible");
+				DE_FATAL("Impossible");
 		}
 	}
 	else if (isDataTypeMatrix(basicType))
@@ -262,7 +262,7 @@
 		}
 	}
 	else
-		DE_ASSERT(!"Impossible");
+		DE_FATAL("Impossible");
 }
 
 // Representation for the varyings between vertex and fragment shaders
@@ -432,7 +432,7 @@
 				break;
 
 			default:
-				DE_ASSERT(!"Impossible");
+				DE_FATAL("Impossible");
 		}
 	}
 
@@ -671,9 +671,9 @@
 ProgramParams genProgramParams (Random& rnd)
 {
 	const deUint32	vtxSeed		= rnd.getUint32();
-	const GLfloat	vtxScale	= rnd.getInt(8, 16) / 16.0f;
+	const GLfloat	vtxScale	= (float)rnd.getInt(8, 16) / 16.0f;
 	const deUint32	frgSeed		= rnd.getUint32();
-	const GLfloat	frgScale	= rnd.getInt(0, 16) / 16.0f;
+	const GLfloat	frgScale	= (float)rnd.getInt(0, 16) / 16.0f;
 
 	return ProgramParams(vtxSeed, vtxScale, frgSeed, frgScale);
 }
@@ -842,7 +842,7 @@
 				msg << "randomly either by name or by location.\n";
 				break;
 			default:
-				DE_ASSERT(!"Impossible");
+				DE_FATAL("Impossible");
 		}
 
 		msg << "In the vertex shader the varyings are qualified ";
@@ -1157,7 +1157,7 @@
 			case glu::SHADERTYPE_FRAGMENT:
 				return createShaderProgram(DE_NULL, &src, true);
 			default:
-				DE_ASSERT(!"Impossible case");
+				DE_FATAL("Impossible case");
 		}
 	}
 	return MovePtr<ProgramWrapper>(); // Shut up compiler warnings.
@@ -1756,7 +1756,7 @@
 				desc << "Varyings have same name, ";
 				break;
 			default:
-				DE_ASSERT(!"Impossible");
+				DE_FATAL("Impossible");
 		}
 
 		describeInterpolation("vertex", vtxInterp, name, desc);
diff --git a/modules/gles31/functional/es31fShaderMultisampleInterpolationTests.cpp b/modules/gles31/functional/es31fShaderMultisampleInterpolationTests.cpp
index f9ef47b..aea088f 100644
--- a/modules/gles31/functional/es31fShaderMultisampleInterpolationTests.cpp
+++ b/modules/gles31/functional/es31fShaderMultisampleInterpolationTests.cpp
@@ -781,26 +781,26 @@
 	m_renderSceneDescription = "triangle fan of narrow triangles";
 
 	m_renderAttribs["a_position"].offset = 0;
-	m_renderAttribs["a_position"].stride = sizeof(float[4]) * 3;
-	m_renderAttribs["a_barycentricsA"].offset = sizeof(float[4]);
-	m_renderAttribs["a_barycentricsA"].stride = sizeof(float[4]) * 3;
-	m_renderAttribs["a_barycentricsB"].offset = sizeof(float[4]) * 2;
-	m_renderAttribs["a_barycentricsB"].stride = sizeof(float[4]) * 3;
+	m_renderAttribs["a_position"].stride = (int)sizeof(float[4]) * 3;
+	m_renderAttribs["a_barycentricsA"].offset = (int)sizeof(float[4]);
+	m_renderAttribs["a_barycentricsA"].stride = (int)sizeof(float[4]) * 3;
+	m_renderAttribs["a_barycentricsB"].offset = (int)sizeof(float[4]) * 2;
+	m_renderAttribs["a_barycentricsB"].stride = (int)sizeof(float[4]) * 3;
 
 	for (int triangleNdx = 0; triangleNdx < numTriangles; ++triangleNdx)
 	{
-		const float angle		= ((float)triangleNdx) / numTriangles * 2.0f * DE_PI;
-		const float nextAngle	= ((float)triangleNdx + 1.0f) / numTriangles * 2.0f * DE_PI;
+		const float angle		= ((float)triangleNdx) / (float)numTriangles * 2.0f * DE_PI;
+		const float nextAngle	= ((float)triangleNdx + 1.0f) / (float)numTriangles * 2.0f * DE_PI;
 
 		data[(triangleNdx * 3 + 0) * 3 + 0] = tcu::Vec4(0.2f, -0.3f, 0.0f, 1.0f);
 		data[(triangleNdx * 3 + 0) * 3 + 1] = tcu::Vec4(1.0f,  0.0f, 0.0f, 0.0f);
 		data[(triangleNdx * 3 + 0) * 3 + 2] = tcu::Vec4(1.0f,  0.0f, 0.0f, 0.0f);
 
-		data[(triangleNdx * 3 + 1) * 3 + 0] = tcu::Vec4(2.0f * cos(angle), 2.0f * sin(angle), 0.0f, 1.0f);
+		data[(triangleNdx * 3 + 1) * 3 + 0] = tcu::Vec4(2.0f * deFloatCos(angle), 2.0f * deFloatSin(angle), 0.0f, 1.0f);
 		data[(triangleNdx * 3 + 1) * 3 + 1] = tcu::Vec4(0.0f,  1.0f, 0.0f, 0.0f);
 		data[(triangleNdx * 3 + 1) * 3 + 2] = tcu::Vec4(0.0f,  1.0f, 0.0f, 0.0f);
 
-		data[(triangleNdx * 3 + 2) * 3 + 0] = tcu::Vec4(2.0f * cos(nextAngle), 2.0f * sin(nextAngle), 0.0f, 1.0f);
+		data[(triangleNdx * 3 + 2) * 3 + 0] = tcu::Vec4(2.0f * deFloatCos(nextAngle), 2.0f * deFloatSin(nextAngle), 0.0f, 1.0f);
 		data[(triangleNdx * 3 + 2) * 3 + 1] = tcu::Vec4(0.0f,  0.0f, 1.0f, 0.0f);
 		data[(triangleNdx * 3 + 2) * 3 + 2] = tcu::Vec4(0.0f,  0.0f, 1.0f, 0.0f);
 	}
diff --git a/modules/gles31/functional/es31fShaderPackingFunctionTests.cpp b/modules/gles31/functional/es31fShaderPackingFunctionTests.cpp
index c8129e5..deaf761 100644
--- a/modules/gles31/functional/es31fShaderPackingFunctionTests.cpp
+++ b/modules/gles31/functional/es31fShaderPackingFunctionTests.cpp
@@ -672,7 +672,7 @@
 					const int		s			= rnd.getBool() ? 1 : -1;
 					const int		exp			= rnd.getInt(minExp, maxExp);
 					const deUint32	mantissa	= rnd.getUint32() & ((1<<mantBits)-1);
-					const deUint16	value		= tcu::Float16::construct(s, exp ? exp : 1 /* avoid denorm */, (1u<<10) | mantissa).bits();
+					const deUint16	value		= tcu::Float16::construct(s, exp ? exp : 1 /* avoid denorm */, (deUint16)((1u<<10) | mantissa)).bits();
 
 					inVal |= value << (16*c);
 				}
diff --git a/modules/gles31/functional/es31fStencilTexturingTests.cpp b/modules/gles31/functional/es31fStencilTexturingTests.cpp
index 80cc264..8175946 100644
--- a/modules/gles31/functional/es31fStencilTexturingTests.cpp
+++ b/modules/gles31/functional/es31fStencilTexturingTests.cpp
@@ -111,12 +111,12 @@
 		positions[rectNdx*4 + 2] = Vec2(x0, y1);
 		positions[rectNdx*4 + 3] = Vec2(x1, y1);
 
-		indices[rectNdx*6 + 0] = rectNdx*4 + 0;
-		indices[rectNdx*6 + 1] = rectNdx*4 + 1;
-		indices[rectNdx*6 + 2] = rectNdx*4 + 2;
-		indices[rectNdx*6 + 3] = rectNdx*4 + 2;
-		indices[rectNdx*6 + 4] = rectNdx*4 + 1;
-		indices[rectNdx*6 + 5] = rectNdx*4 + 3;
+		indices[rectNdx*6 + 0] = (deUint16)(rectNdx*4 + 0);
+		indices[rectNdx*6 + 1] = (deUint16)(rectNdx*4 + 1);
+		indices[rectNdx*6 + 2] = (deUint16)(rectNdx*4 + 2);
+		indices[rectNdx*6 + 3] = (deUint16)(rectNdx*4 + 2);
+		indices[rectNdx*6 + 4] = (deUint16)(rectNdx*4 + 1);
+		indices[rectNdx*6 + 5] = (deUint16)(rectNdx*4 + 3);
 	}
 }
 
@@ -493,7 +493,7 @@
 	{
 		const char* reqExt = "GL_OES_texture_stencil8";
 		if (!ctxInfo.isExtensionSupported(reqExt))
-			throw tcu::NotSupportedError(glu::getPixelFormatStr(format).toString() + " requires " + reqExt);
+			throw tcu::NotSupportedError(glu::getTextureFormatStr(format).toString() + " requires " + reqExt);
 	}
 	else
 	{
@@ -515,7 +515,7 @@
 {
 public:
 	UploadTex2DCase (Context& context, const char* name, deUint32 format)
-		: TestCase	(context, name, glu::getPixelFormatName(format))
+		: TestCase	(context, name, glu::getTextureFormatName(format))
 		, m_format	(format)
 	{
 	}
@@ -570,7 +570,7 @@
 {
 public:
 	UploadTex2DArrayCase (Context& context, const char* name, deUint32 format)
-		: TestCase	(context, name, glu::getPixelFormatName(format))
+		: TestCase	(context, name, glu::getTextureFormatName(format))
 		, m_format	(format)
 	{
 	}
@@ -656,7 +656,7 @@
 {
 public:
 	UploadTexCubeCase (Context& context, const char* name, deUint32 format)
-		: TestCase	(context, name, glu::getPixelFormatName(format))
+		: TestCase	(context, name, glu::getTextureFormatName(format))
 		, m_format	(format)
 	{
 	}
@@ -745,7 +745,7 @@
 {
 public:
 	RenderTex2DCase (Context& context, const char* name, deUint32 format)
-		: TestCase	(context, name, glu::getPixelFormatName(format))
+		: TestCase	(context, name, glu::getTextureFormatName(format))
 		, m_format	(format)
 	{
 	}
@@ -802,7 +802,7 @@
 {
 public:
 	ClearTex2DCase (Context& context, const char* name, deUint32 format)
-		: TestCase	(context, name, glu::getPixelFormatName(format))
+		: TestCase	(context, name, glu::getTextureFormatName(format))
 		, m_format	(format)
 	{
 	}
@@ -876,7 +876,7 @@
 {
 public:
 	CompareModeCase (Context& context, const char* name, deUint32 format)
-		: TestCase	(context, name, glu::getPixelFormatName(format))
+		: TestCase	(context, name, glu::getTextureFormatName(format))
 		, m_format	(format)
 	{
 	}
@@ -935,7 +935,7 @@
 {
 public:
 	BaseLevelCase (Context& context, const char* name, deUint32 format)
-		: TestCase	(context, name, glu::getPixelFormatName(format))
+		: TestCase	(context, name, glu::getTextureFormatName(format))
 		, m_format	(format)
 	{
 	}
diff --git a/modules/gles31/functional/es31fSynchronizationTests.cpp b/modules/gles31/functional/es31fSynchronizationTests.cpp
index 7c13068..d84b6cb 100644
--- a/modules/gles31/functional/es31fSynchronizationTests.cpp
+++ b/modules/gles31/functional/es31fSynchronizationTests.cpp
@@ -207,7 +207,7 @@
 	if (m_storage == STORAGE_BUFFER)
 	{
 		const int				bufferElements	= m_workWidth * m_workHeight * m_elementsPerInvocation;
-		const int				bufferSize		= bufferElements * sizeof(deUint32);
+		const int				bufferSize		= bufferElements * (int)sizeof(deUint32);
 		std::vector<deUint32>	zeroBuffer		(bufferElements, 0);
 
 		m_testCtx.getLog() << tcu::TestLog::Message << "Allocating zero-filled buffer for storage, size " << bufferElements << " elements, " << bufferSize << " bytes." << tcu::TestLog::EndMessage;
@@ -220,7 +220,7 @@
 	else if (m_storage == STORAGE_IMAGE)
 	{
 		const int				bufferElements	= m_workWidth * m_workHeight * m_elementsPerInvocation;
-		const int				bufferSize		= bufferElements * sizeof(deUint32);
+		const int				bufferSize		= bufferElements * (int)sizeof(deUint32);
 
 		m_testCtx.getLog() << tcu::TestLog::Message << "Allocating image for storage, size " << m_workWidth << "x" << m_workHeight * m_elementsPerInvocation << ", " << bufferSize << " bytes." << tcu::TestLog::EndMessage;
 
@@ -247,7 +247,7 @@
 
 	{
 		const int				bufferElements	= m_workWidth * m_workHeight;
-		const int				bufferSize		= bufferElements * sizeof(deUint32);
+		const int				bufferSize		= bufferElements * (int)sizeof(deUint32);
 		std::vector<deInt32>	negativeBuffer	(bufferElements, -1);
 
 		m_testCtx.getLog() << tcu::TestLog::Message << "Allocating -1 filled buffer for results, size " << bufferElements << " elements, " << bufferSize << " bytes." << tcu::TestLog::EndMessage;
@@ -1628,7 +1628,7 @@
 	if (m_storage == STORAGE_BUFFER)
 	{
 		const int		numElements		= m_invocationGridSize * m_invocationGridSize * m_perInvocationSize;
-		const int		bufferSize		= numElements * ((m_formatInteger) ? (sizeof(deInt32)) : (sizeof(glw::GLfloat)));
+		const int		bufferSize		= numElements * (int)((m_formatInteger) ? (sizeof(deInt32)) : (sizeof(glw::GLfloat)));
 		glw::GLuint		retVal			= 0;
 
 		m_testCtx.getLog() << tcu::TestLog::Message << "Creating buffer #" << friendlyName << ", size " << bufferSize << " bytes." << tcu::TestLog::EndMessage;
diff --git a/modules/gles31/functional/es31fTessellationGeometryInteractionTests.cpp b/modules/gles31/functional/es31fTessellationGeometryInteractionTests.cpp
index 4fbcaaf..5fcb276 100644
--- a/modules/gles31/functional/es31fTessellationGeometryInteractionTests.cpp
+++ b/modules/gles31/functional/es31fTessellationGeometryInteractionTests.cpp
@@ -1233,7 +1233,7 @@
 		// This minimal error could result in a difference in rounding => allow one additional pixel in deviation
 
 		const int			rasterDeviation	= 2;
-		const tcu::IVec2	rasterPos		((int)deFloatRound((vertices[ndx].x() * 0.5f + 0.5f) * image.getWidth()), (int)deFloatRound((vertices[ndx].y() * 0.5f + 0.5f) * image.getHeight()));
+		const tcu::IVec2	rasterPos		((int)deFloatRound((vertices[ndx].x() * 0.5f + 0.5f) * (float)image.getWidth()), (int)deFloatRound((vertices[ndx].y() * 0.5f + 0.5f) * (float)image.getHeight()));
 
 		// Find produced rasterization results
 		bool				found			= false;
diff --git a/modules/gles31/functional/es31fTessellationTests.cpp b/modules/gles31/functional/es31fTessellationTests.cpp
index 18fecb1..73e2cf3 100644
--- a/modules/gles31/functional/es31fTessellationTests.cpp
+++ b/modules/gles31/functional/es31fTessellationTests.cpp
@@ -1062,7 +1062,7 @@
 
 					  : Vec2(-1.0f);
 
-	drawPoint(dst, (int)(dstPos.x()*dst.getWidth()), (int)(dstPos.y()*dst.getHeight()), color, size);
+	drawPoint(dst, (int)(dstPos.x() * (float)dst.getWidth()), (int)(dstPos.y() * (float)dst.getHeight()), color, size);
 }
 
 static void drawTessCoordVisualization (tcu::Surface& dst, TessPrimitiveType primitiveType, const vector<Vec3>& coords)
@@ -1431,8 +1431,8 @@
 			if (curFinalLevel != prevFinalLevel)
 				continue;
 
-			const float			curFraction		= curFinalLevel - curClampedLevel;
-			const float			prevFraction	= prevFinalLevel - prevClampedLevel;
+			const float			curFraction		= (float)curFinalLevel - curClampedLevel;
+			const float			prevFraction	= (float)prevFinalLevel - prevClampedLevel;
 
 			if (curData.additionalSegmentLength < prevData.additionalSegmentLength ||
 				(curClampedLevel == prevClampedLevel && curData.additionalSegmentLength != prevData.additionalSegmentLength))
@@ -1736,12 +1736,12 @@
 		for (int i = 0; i < gridHeight; i++)
 		for (int j = 0; j < gridWidth; j++)
 		{
-			const int corners[4] =
+			const deUint16 corners[4] =
 			{
-				(i+0)*(gridWidth+1) + j+0,
-				(i+0)*(gridWidth+1) + j+1,
-				(i+1)*(gridWidth+1) + j+0,
-				(i+1)*(gridWidth+1) + j+1
+				(deUint16)((i+0)*(gridWidth+1) + j+0),
+				(deUint16)((i+0)*(gridWidth+1) + j+1),
+				(deUint16)((i+1)*(gridWidth+1) + j+0),
+				(deUint16)((i+1)*(gridWidth+1) + j+1)
 			};
 
 			const int secondTriangleVertexIndexOffset = m_caseType == CASETYPE_BASIC	? 0
@@ -1764,7 +1764,7 @@
 			//		 share a vertices, it's at the same index for everyone.
 			for (int m = 0; m < 2; m++)
 			for (int n = 0; n < 2; n++)
-				gridIndices.push_back((i+(i+m)%2)*(gridWidth+1) + j+(j+n)%2);
+				gridIndices.push_back((deUint16)((i+(i+m)%2)*(gridWidth+1) + j+(j+n)%2));
 
 			if(m_caseType == CASETYPE_PRECISE && (i+j) % 2 == 0)
 				std::reverse(gridIndices.begin() + (gridIndices.size() - 4),
@@ -6008,7 +6008,7 @@
 				tcsDeclarations += outMaybePatch + output.declare();
 
 			if (!isPerPatchIO)
-				tcsStatements += "\t\tv += float(gl_InvocationID)*" + de::floatToString(0.4f*output.numBasicSubobjectsInElementType(), 1) + ";\n";
+				tcsStatements += "\t\tv += float(gl_InvocationID)*" + de::floatToString(0.4f * (float)output.numBasicSubobjectsInElementType(), 1) + ";\n";
 
 			tcsStatements += "\n\t\t// Assign values to output " + output.name() + "\n";
 			if (isArray)
@@ -6017,7 +6017,7 @@
 				tcsStatements += output.glslTraverseBasicType(2, glslAssignBasicTypeObject);
 
 			if (!isPerPatchIO)
-				tcsStatements += "\t\tv += float(" + de::toString(int(NUM_OUTPUT_VERTICES)) + "-gl_InvocationID-1)*" + de::floatToString(0.4f*output.numBasicSubobjectsInElementType(), 1) + ";\n";
+				tcsStatements += "\t\tv += float(" + de::toString(int(NUM_OUTPUT_VERTICES)) + "-gl_InvocationID-1)*" + de::floatToString(0.4f * (float)output.numBasicSubobjectsInElementType(), 1) + ";\n";
 		}
 		tcsStatements += "\t}\n";
 
diff --git a/modules/gles31/functional/es31fTextureBorderClampTests.cpp b/modules/gles31/functional/es31fTextureBorderClampTests.cpp
index 9df2ea5..742324b 100644
--- a/modules/gles31/functional/es31fTextureBorderClampTests.cpp
+++ b/modules/gles31/functional/es31fTextureBorderClampTests.cpp
@@ -428,10 +428,10 @@
 													 tcu::floatToU8(sRGB[1]),
 													 tcu::floatToU8(sRGB[2]),
 													 tcu::floatToU8(sRGB[3]));
-		const tcu::Vec4		linearized	= tcu::sRGBToLinear(tcu::Vec4(sRGB8[0] / 255.0f,
-																	  sRGB8[1] / 255.0f,
-																	  sRGB8[2] / 255.0f,
-																	  sRGB8[3] / 255.0f));
+		const tcu::Vec4		linearized	= tcu::sRGBToLinear(tcu::Vec4((float)sRGB8[0] / 255.0f,
+																	  (float)sRGB8[1] / 255.0f,
+																	  (float)sRGB8[2] / 255.0f,
+																	  (float)sRGB8[3] / 255.0f));
 
 		return rr::GenericVec4(tcu::select(linearized, tcu::Vec4(0.0f), channelMask));
 	}
@@ -674,7 +674,7 @@
 	m_texture = genDummyTexture<glu::Texture2D>(m_context.getRenderContext(), m_context.getContextInfo(), m_texFormat, tcu::IVec2(m_texWidth, m_texHeight));
 
 	m_testCtx.getLog()	<< tcu::TestLog::Message
-						<< "Created texture with format " << ((glu::isCompressedFormat(m_texFormat)) ? (glu::getCompressedTexFormatName(m_texFormat)) : (glu::getPixelFormatName(m_texFormat)))
+						<< "Created texture with format " << glu::getTextureFormatName(m_texFormat)
 						<< ", size (" << m_texture->getRefTexture().getWidth() << ", " << m_texture->getRefTexture().getHeight() << ")\n"
 						<< "Setting sampling state using " << ((m_stateType == STATE_TEXTURE_PARAM) ? ("texture state") : ("sampler state"))
 						<< tcu::TestLog::EndMessage;
@@ -2085,7 +2085,7 @@
 
 	// texture info
 	m_testCtx.getLog()	<< tcu::TestLog::Message
-						<< "Created 3D texture with format " << ((glu::isCompressedFormat(m_texFormat)) ? (glu::getCompressedTexFormatName(m_texFormat)) : (glu::getPixelFormatName(m_texFormat)))
+						<< "Created 3D texture with format " << glu::getTextureFormatName(m_texFormat)
 						<< ", size (" << m_texture->getRefTexture().getWidth() << ", " << m_texture->getRefTexture().getHeight() << ", " << m_texture->getRefTexture().getDepth() << ")\n"
 						<< tcu::TestLog::EndMessage;
 
diff --git a/modules/gles31/functional/es31fTextureFormatTests.cpp b/modules/gles31/functional/es31fTextureFormatTests.cpp
index ad35705..a964047 100644
--- a/modules/gles31/functional/es31fTextureFormatTests.cpp
+++ b/modules/gles31/functional/es31fTextureFormatTests.cpp
@@ -240,10 +240,10 @@
 
 // TextureBufferFormatCase
 
-class TextureBufferFormatCase : public tcu::TestCase
+class TextureBufferFormatCase : public TestCase
 {
 public:
-								TextureBufferFormatCase		(tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, deUint32 internalFormat, int width);
+								TextureBufferFormatCase		(Context& ctx, glu::RenderContext& renderCtx, const char* name, const char* description, deUint32 internalFormat, int width);
 								~TextureBufferFormatCase	(void);
 
 	void						init						(void);
@@ -258,18 +258,20 @@
 
 	deUint32					m_format;
 	int							m_width;
+	int							m_maxTextureBufferSize;
 
 	glu::TextureBuffer*			m_texture;
 	TextureRenderer				m_renderer;
 };
 
-TextureBufferFormatCase::TextureBufferFormatCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, deUint32 internalFormat, int width)
-	: TestCase		(testCtx, name, description)
-	, m_renderCtx	(renderCtx)
-	, m_format		(internalFormat)
-	, m_width		(width)
-	, m_texture		(DE_NULL)
-	, m_renderer	(renderCtx, testCtx.getLog(), glu::GLSL_VERSION_310_ES, glu::PRECISION_HIGHP)
+TextureBufferFormatCase::TextureBufferFormatCase (Context& ctx, glu::RenderContext& renderCtx, const char* name, const char* description, deUint32 internalFormat, int width)
+	: TestCase					(ctx, name, description)
+	, m_renderCtx				(renderCtx)
+	, m_format					(internalFormat)
+	, m_width					(width)
+	, m_maxTextureBufferSize	(0)
+	, m_texture					(DE_NULL)
+	, m_renderer				(renderCtx, ctx.getTestContext().getLog(), glu::GLSL_VERSION_310_ES, glu::PRECISION_HIGHP)
 {
 }
 
@@ -285,18 +287,19 @@
 	tcu::TextureFormatInfo	spec	= tcu::getTextureFormatInfo(fmt);
 	tcu::Vec4				colorA	(spec.valueMin.x(), spec.valueMax.y(), spec.valueMin.z(), spec.valueMax.w());
 	tcu::Vec4				colorB	(spec.valueMax.x(), spec.valueMin.y(), spec.valueMax.z(), spec.valueMin.w());
-	std::ostringstream		fmtName;
 
-	fmtName << glu::getPixelFormatStr(m_format);
+	m_maxTextureBufferSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_BUFFER_SIZE);
+	if (m_maxTextureBufferSize <= 0)
+		TCU_THROW(NotSupportedError, "GL_MAX_TEXTURE_BUFFER_SIZE > 0 required");
 
-	log << TestLog::Message << "Buffer texture, " << fmtName.str() << ", " << m_width
+	log << TestLog::Message << "Buffer texture, " << glu::getTextureFormatStr(m_format) << ", " << m_width
 							<< ",\n  fill with " << formatGradient(&colorA, &colorB) << " gradient"
 		<< TestLog::EndMessage;
 
 	m_texture = new glu::TextureBuffer(m_renderCtx, m_format, m_width * fmt.getPixelSize());
 
 	// Fill level 0.
-	tcu::fillWithComponentGradients(m_texture->getRefTexture(), colorA, colorB);
+	tcu::fillWithComponentGradients(m_texture->getFullRefTexture(), colorA, colorB);
 }
 
 void TextureBufferFormatCase::deinit (void)
@@ -309,22 +312,23 @@
 
 TextureBufferFormatCase::IterateResult TextureBufferFormatCase::iterate (void)
 {
-	TestLog&				log					= m_testCtx.getLog();
-	const glw::Functions&	gl					= m_renderCtx.getFunctions();
-	RandomViewport			viewport			(m_renderCtx.getRenderTarget(), m_width, 1, deStringHash(getName()));
-	tcu::Surface			renderedFrame		(viewport.width, viewport.height);
-	tcu::Surface			referenceFrame		(viewport.width, viewport.height);
-	tcu::RGBA				threshold			= m_renderCtx.getRenderTarget().getPixelFormat().getColorThreshold() + tcu::RGBA(1,1,1,1);
-	vector<float>			texCoord;
-	RenderParams			renderParams		(TEXTURETYPE_BUFFER);
-	tcu::TextureFormatInfo	spec				= tcu::getTextureFormatInfo(m_texture->getRefTexture().getFormat());
+	TestLog&							log						= m_testCtx.getLog();
+	const glw::Functions&				gl						= m_renderCtx.getFunctions();
+	RandomViewport						viewport				(m_renderCtx.getRenderTarget(), m_width, 1, deStringHash(getName()));
+	tcu::Surface						renderedFrame			(viewport.width, viewport.height);
+	tcu::Surface						referenceFrame			(viewport.width, viewport.height);
+	tcu::RGBA							threshold				= m_renderCtx.getRenderTarget().getPixelFormat().getColorThreshold() + tcu::RGBA(1,1,1,1);
+	vector<float>						texCoord;
+	RenderParams						renderParams			(TEXTURETYPE_BUFFER);
+	const tcu::ConstPixelBufferAccess	effectiveRefTexture		= glu::getTextureBufferEffectiveRefTexture(*m_texture, m_maxTextureBufferSize);
+	tcu::TextureFormatInfo				spec					= tcu::getTextureFormatInfo(effectiveRefTexture.getFormat());
 
 	renderParams.flags			|= RenderParams::LOG_ALL;
-	renderParams.samplerType	= getFetchSamplerType(m_texture->getRefTexture().getFormat());
+	renderParams.samplerType	= getFetchSamplerType(effectiveRefTexture.getFormat());
 	renderParams.colorScale		= spec.lookupScale;
 	renderParams.colorBias		= spec.lookupBias;
 
-	computeQuadTexCoord1D(texCoord, 0.0f, (float)(m_texture->getRefTexture().getWidth()));
+	computeQuadTexCoord1D(texCoord, 0.0f, (float)(effectiveRefTexture.getWidth()));
 
 	gl.clearColor(0.125f, 0.25f, 0.5f, 1.0f);
 	gl.clear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
@@ -349,7 +353,7 @@
 	GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels()");
 
 	// Compute reference.
-	fetchTexture(SurfaceAccess(referenceFrame, m_renderCtx.getRenderTarget().getPixelFormat()), m_texture->getRefTexture(), &texCoord[0], spec.lookupScale, spec.lookupBias);
+	fetchTexture(SurfaceAccess(referenceFrame, m_renderCtx.getRenderTarget().getPixelFormat()), effectiveRefTexture, &texCoord[0], spec.lookupScale, spec.lookupBias);
 
 	// Compare and log.
 	bool isOk = compareImages(log, referenceFrame, renderedFrame, threshold);
@@ -414,7 +418,7 @@
 		deUint32	format		= texFormats[formatNdx].format;
 		deUint32	dataType	= texFormats[formatNdx].dataType;
 		string	nameBase		= texFormats[formatNdx].name;
-		string	descriptionBase	= string(glu::getPixelFormatName(format)) + ", " + glu::getTypeName(dataType);
+		string	descriptionBase	= string(glu::getTextureFormatName(format)) + ", " + glu::getTypeName(dataType);
 
 		unsizedGroup->addChild(new TextureCubeArrayFormatCase (m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_cube_array_pot").c_str(),		(descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), format, dataType, 64, 12));
 		unsizedGroup->addChild(new TextureCubeArrayFormatCase (m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_cube_array_npot").c_str(),	(descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), format, dataType, 64, 12));
@@ -495,7 +499,7 @@
 	{
 		deUint32	internalFormat	= sizedColorFormats[formatNdx].internalFormat;
 		string		nameBase		= sizedColorFormats[formatNdx].name;
-		string		descriptionBase	= glu::getPixelFormatName(internalFormat);
+		string		descriptionBase	= glu::getTextureFormatName(internalFormat);
 
 		sizedCubeArrayGroup->addChild(new TextureCubeArrayFormatCase (m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_pot").c_str(),		(descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), internalFormat, 64, 12));
 		sizedCubeArrayGroup->addChild(new TextureCubeArrayFormatCase (m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_npot").c_str(),	(descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), internalFormat, 64, 12));
@@ -505,7 +509,7 @@
 	{
 		deUint32	internalFormat	= sizedDepthStencilFormats[formatNdx].internalFormat;
 		string		nameBase		= sizedDepthStencilFormats[formatNdx].name;
-		string		descriptionBase	= glu::getPixelFormatName(internalFormat);
+		string		descriptionBase	= glu::getTextureFormatName(internalFormat);
 
 		sizedCubeArrayGroup->addChild(new TextureCubeArrayFormatCase (m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_pot").c_str(),		(descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), internalFormat, 64, 12));
 		sizedCubeArrayGroup->addChild(new TextureCubeArrayFormatCase (m_testCtx, m_context.getRenderContext(), m_context.getContextInfo(), (nameBase + "_npot").c_str(),	(descriptionBase + ", GL_TEXTURE_CUBE_MAP_ARRAY").c_str(), internalFormat, 64, 12));
@@ -551,10 +555,10 @@
 	{
 		deUint32	internalFormat	= bufferColorFormats[formatNdx].internalFormat;
 		string		nameBase		= bufferColorFormats[formatNdx].name;
-		string		descriptionBase	= glu::getPixelFormatName(internalFormat);
+		string		descriptionBase	= glu::getTextureFormatName(internalFormat);
 
-		sizedBufferGroup->addChild	(new TextureBufferFormatCase	(m_testCtx, m_context.getRenderContext(),	(nameBase + "_pot").c_str(),	(descriptionBase + ", GL_TEXTURE_BUFFER").c_str(),	internalFormat, 64));
-		sizedBufferGroup->addChild	(new TextureBufferFormatCase	(m_testCtx, m_context.getRenderContext(),	(nameBase + "_npot").c_str(),	(descriptionBase + ", GL_TEXTURE_BUFFER").c_str(),	internalFormat, 112));
+		sizedBufferGroup->addChild	(new TextureBufferFormatCase	(m_context, m_context.getRenderContext(),	(nameBase + "_pot").c_str(),	(descriptionBase + ", GL_TEXTURE_BUFFER").c_str(),	internalFormat, 64));
+		sizedBufferGroup->addChild	(new TextureBufferFormatCase	(m_context, m_context.getRenderContext(),	(nameBase + "_npot").c_str(),	(descriptionBase + ", GL_TEXTURE_BUFFER").c_str(),	internalFormat, 112));
 	}
 }
 
diff --git a/modules/gles31/functional/es31fTextureGatherTests.cpp b/modules/gles31/functional/es31fTextureGatherTests.cpp
index f5a5540..1eecc83 100644
--- a/modules/gles31/functional/es31fTextureGatherTests.cpp
+++ b/modules/gles31/functional/es31fTextureGatherTests.cpp
@@ -641,7 +641,7 @@
 
 	float operator() (const IVec2& pixCoord) const
 	{
-		return (float)(pixCoord.x() + 0.5f) / (float)m_renderSize.x();
+		return ((float)pixCoord.x() + 0.5f) / (float)m_renderSize.x();
 	}
 
 private:
@@ -1262,7 +1262,7 @@
 	GLU_EXPECT_NO_ERROR(gl.getError(), "Create and setup framebuffer object");
 
 	log << TestLog::Message << "Using a framebuffer object with renderbuffer with format "
-							<< glu::getPixelFormatName(glu::getInternalFormat(m_colorBufferFormat))
+							<< glu::getTextureFormatName(glu::getInternalFormat(m_colorBufferFormat))
 							<< " and size " << RENDER_SIZE << TestLog::EndMessage;
 
 	// Generate subclass-specific iterations.
diff --git a/modules/gles31/functional/es31fTextureLevelStateQueryTests.cpp b/modules/gles31/functional/es31fTextureLevelStateQueryTests.cpp
index 86c50b1..00d151b 100644
--- a/modules/gles31/functional/es31fTextureLevelStateQueryTests.cpp
+++ b/modules/gles31/functional/es31fTextureLevelStateQueryTests.cpp
@@ -164,8 +164,8 @@
 
 struct PixelFormatPrinter
 {
-	static std::string	getIntegerName	(int v)		{ return de::toString(glu::getPixelFormatStr(v));		}
-	static std::string	getFloatName	(float v)	{ return de::toString(glu::getPixelFormatStr((int)v));	}
+	static std::string	getIntegerName	(int v)		{ return de::toString(glu::getTextureFormatStr(v));		}
+	static std::string	getFloatName	(float v)	{ return de::toString(glu::getTextureFormatStr((int)v));	}
 };
 
 template <typename Printer>
@@ -225,7 +225,7 @@
 		{
 			if (ndx != 0)
 				msg << ", ";
-			msg << glu::getPixelFormatStr(refValues[ndx]);
+			msg << glu::getTextureFormatStr(refValues[ndx]);
 		}
 		msg << "}";
 		msg << tcu::TestLog::EndMessage;
@@ -244,7 +244,7 @@
 				if (state.getIntAccess() == refValues[ndx])
 					return true;
 
-			gl.getLog() << tcu::TestLog::Message << "Error: got " << state.getIntAccess() << ", (" << glu::getPixelFormatStr(state.getIntAccess()) << ")" << tcu::TestLog::EndMessage;
+			gl.getLog() << tcu::TestLog::Message << "Error: got " << state.getIntAccess() << ", (" << glu::getTextureFormatStr(state.getIntAccess()) << ")" << tcu::TestLog::EndMessage;
 			return false;
 		}
 		case DATATYPE_FLOAT:
@@ -253,7 +253,7 @@
 				if (state.getFloatAccess() == (float)refValues[ndx])
 					return true;
 
-			gl.getLog() << tcu::TestLog::Message << "Error: got " << state.getFloatAccess() << ", (" << glu::getPixelFormatStr((int)state.getFloatAccess()) << ")" << tcu::TestLog::EndMessage;
+			gl.getLog() << tcu::TestLog::Message << "Error: got " << state.getFloatAccess() << ", (" << glu::getTextureFormatStr((int)state.getFloatAccess()) << ")" << tcu::TestLog::EndMessage;
 			return false;
 		}
 		default:
@@ -623,7 +623,7 @@
 		texGen.queryTarget		= queryTarget;
 		texGen.immutable		= true;
 		texGen.sampleCount		= (isMultisampleTarget(target) ? (1) : (0));
-		texGen.description		= glu::getTextureTargetStr(target).toString() + ", internal format " + glu::getPixelFormatName(internalFormats[internalFormatNdx]);
+		texGen.description		= glu::getTextureTargetStr(target).toString() + ", internal format " + glu::getTextureFormatName(internalFormats[internalFormatNdx]);
 
 		if (target == GL_TEXTURE_BUFFER)
 		{
diff --git a/modules/gles31/functional/es31fTextureMultisampleTests.cpp b/modules/gles31/functional/es31fTextureMultisampleTests.cpp
index 7f8a786..1bdf3e4 100644
--- a/modules/gles31/functional/es31fTextureMultisampleTests.cpp
+++ b/modules/gles31/functional/es31fTextureMultisampleTests.cpp
@@ -666,12 +666,12 @@
 		for (int y = 0; y < m_gridsize; ++y)
 		for (int x = 0; x < m_gridsize; ++x)
 		{
-			gridData[(y * m_gridsize + x)*6 + 0] = tcu::Vec4(((float)(x+0) / m_gridsize) * 2.0f - 1.0f, ((float)(y+0) / m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
-			gridData[(y * m_gridsize + x)*6 + 1] = tcu::Vec4(((float)(x+0) / m_gridsize) * 2.0f - 1.0f, ((float)(y+1) / m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
-			gridData[(y * m_gridsize + x)*6 + 2] = tcu::Vec4(((float)(x+1) / m_gridsize) * 2.0f - 1.0f, ((float)(y+1) / m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
-			gridData[(y * m_gridsize + x)*6 + 3] = tcu::Vec4(((float)(x+0) / m_gridsize) * 2.0f - 1.0f, ((float)(y+0) / m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
-			gridData[(y * m_gridsize + x)*6 + 4] = tcu::Vec4(((float)(x+1) / m_gridsize) * 2.0f - 1.0f, ((float)(y+1) / m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
-			gridData[(y * m_gridsize + x)*6 + 5] = tcu::Vec4(((float)(x+1) / m_gridsize) * 2.0f - 1.0f, ((float)(y+0) / m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
+			gridData[(y * m_gridsize + x)*6 + 0] = tcu::Vec4(((float)(x+0) / (float)m_gridsize) * 2.0f - 1.0f, ((float)(y+0) / (float)m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
+			gridData[(y * m_gridsize + x)*6 + 1] = tcu::Vec4(((float)(x+0) / (float)m_gridsize) * 2.0f - 1.0f, ((float)(y+1) / (float)m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
+			gridData[(y * m_gridsize + x)*6 + 2] = tcu::Vec4(((float)(x+1) / (float)m_gridsize) * 2.0f - 1.0f, ((float)(y+1) / (float)m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
+			gridData[(y * m_gridsize + x)*6 + 3] = tcu::Vec4(((float)(x+0) / (float)m_gridsize) * 2.0f - 1.0f, ((float)(y+0) / (float)m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
+			gridData[(y * m_gridsize + x)*6 + 4] = tcu::Vec4(((float)(x+1) / (float)m_gridsize) * 2.0f - 1.0f, ((float)(y+1) / (float)m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
+			gridData[(y * m_gridsize + x)*6 + 5] = tcu::Vec4(((float)(x+1) / (float)m_gridsize) * 2.0f - 1.0f, ((float)(y+0) / (float)m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
 		}
 
 		gl.bufferData			(GL_ARRAY_BUFFER, (int)(gridData.size() * sizeof(tcu::Vec4)), gridData[0].getPtr(), GL_STATIC_DRAW);
@@ -911,7 +911,7 @@
 	for (int x = 0; x < m_gridsize; ++x)
 	{
 		if (m_flags & FLAGS_SAMPLE_COVERAGE)
-			gl.sampleCoverage((y*m_gridsize + x) / float(m_gridsize*m_gridsize), GL_FALSE);
+			gl.sampleCoverage((float)(y*m_gridsize + x) / float(m_gridsize*m_gridsize), GL_FALSE);
 
 		gl.drawArrays				(GL_TRIANGLES, (y*m_gridsize + x) * 6, 6);
 		GLU_EXPECT_NO_ERROR			(gl.getError(), "drawArrays");
@@ -1126,7 +1126,7 @@
 		if (m_numSamples > maxSamples)
 			throw tcu::NotSupportedError("Requested sample count is greater than supported");
 
-		m_testCtx.getLog() << tcu::TestLog::Message << "Max sample count for " << glu::getPixelFormatStr(internalFormat) << ": " << maxSamples << tcu::TestLog::EndMessage;
+		m_testCtx.getLog() << tcu::TestLog::Message << "Max sample count for " << glu::getTextureFormatStr(internalFormat) << ": " << maxSamples << tcu::TestLog::EndMessage;
 	}
 
 	{
@@ -1661,8 +1661,8 @@
 {
 	const bool				colorAttachmentTexture	= (m_caseType == CASE_DIFFERENT_N_SAMPLES_TEX) || (m_caseType == CASE_DIFFERENT_FIXED_TEX);
 	const bool				colorAttachmentRbo		= (m_caseType == CASE_DIFFERENT_N_SAMPLES_RBO) || (m_caseType == CASE_DIFFERENT_FIXED_RBO);
-	const glw::GLenum		fixedSampleLocations0	= (m_caseType == CASE_DIFFERENT_N_SAMPLES_RBO) ? (GL_TRUE) : (GL_FALSE);
-	const glw::GLenum		fixedSampleLocations1	= ((m_caseType == CASE_DIFFERENT_FIXED_TEX) || (m_caseType == CASE_DIFFERENT_FIXED_RBO)) ? (GL_TRUE) : (GL_FALSE);
+	const glw::GLboolean	fixedSampleLocations0	= (m_caseType == CASE_DIFFERENT_N_SAMPLES_RBO) ? (GL_TRUE) : (GL_FALSE);
+	const glw::GLboolean	fixedSampleLocations1	= ((m_caseType == CASE_DIFFERENT_FIXED_TEX) || (m_caseType == CASE_DIFFERENT_FIXED_RBO)) ? (GL_TRUE) : (GL_FALSE);
 	glu::CallLogWrapper		gl						(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
 	glw::GLuint				fboId					= 0;
 	glw::GLuint				rboId					= 0;
diff --git a/modules/gles31/functional/es31fTextureSpecificationTests.cpp b/modules/gles31/functional/es31fTextureSpecificationTests.cpp
index 302d1b4..bad7f20 100644
--- a/modules/gles31/functional/es31fTextureSpecificationTests.cpp
+++ b/modules/gles31/functional/es31fTextureSpecificationTests.cpp
@@ -326,9 +326,9 @@
 	void createTexture (void)
 	{
 		deUint32				tex			= 0;
-		tcu::TextureLevel		levelData	(m_texFormat);
 		de::Random				rnd			(deStringHash(getName()));
 		glu::TransferFormat		transferFmt	= glu::getTransferFormat(m_texFormat);
+		tcu::TextureLevel		levelData	(glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
 
 		glGenTextures(1, &tex);
 		glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, tex);
@@ -364,9 +364,9 @@
 	void createTexture (void)
 	{
 		deUint32				tex			= 0;
-		tcu::TextureLevel		levelData	(m_texFormat);
 		de::Random				rnd			(deStringHash(getName()));
 		glu::TransferFormat		transferFmt	= glu::getTransferFormat(m_texFormat);
+		tcu::TextureLevel		levelData	(glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
 
 		glGenTextures	(1, &tex);
 		glBindTexture	(GL_TEXTURE_CUBE_MAP_ARRAY, tex);
@@ -605,7 +605,7 @@
 	{
 		glu::TransferFormat	fmt			= glu::getTransferFormat(m_texFormat);
 		deUint32			tex			= 0;
-		tcu::TextureLevel	levelData	(m_texFormat);
+		tcu::TextureLevel	levelData	(glu::mapGLTransferFormat(fmt.format, fmt.dataType));
 
 		glGenTextures(1, &tex);
 		glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, tex);
@@ -651,7 +651,7 @@
 		glu::TransferFormat	fmt			= glu::getTransferFormat(m_texFormat);
 		de::Random			rnd			(deStringHash(getName()));
 		deUint32			tex			= 0;
-		tcu::TextureLevel	levelData	(m_texFormat);
+		tcu::TextureLevel	levelData	(glu::mapGLTransferFormat(fmt.format, fmt.dataType));
 
 		glGenTextures(1, &tex);
 		glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, tex);
diff --git a/modules/gles31/functional/es31fUniformLocationTests.cpp b/modules/gles31/functional/es31fUniformLocationTests.cpp
index 9d7fc8b..19cfbd7 100644
--- a/modules/gles31/functional/es31fUniformLocationTests.cpp
+++ b/modules/gles31/functional/es31fUniformLocationTests.cpp
@@ -184,7 +184,7 @@
 	else if (type >= TYPE_SAMPLER_1D_SHADOW && type <=	TYPE_SAMPLER_2D_ARRAY_SHADOW)
 		return TYPE_FLOAT;
 	else
-		DE_ASSERT(!"Unknown sampler type");
+		DE_FATAL("Unknown sampler type");
 
 	return TYPE_INVALID;
 }
@@ -204,11 +204,11 @@
 	else if (glu::isDataTypeUintOrUVec(adjustedType))
 		return float(hash%255);
 	else if (glu::isDataTypeFloatOrVec(adjustedType))
-		return (hash%255)/255.0f;
+		return float(hash%255)/255.0f;
 	else if (glu::isDataTypeBoolOrBVec(adjustedType))
 		return float(hash%2);
 	else
-		DE_ASSERT(!"Unkown primitive type");
+		DE_FATAL("Unkown primitive type");
 
 	return glu::TYPE_INVALID;
 }
@@ -482,7 +482,7 @@
 			return GL_RGBA8UI;
 
 		default:
-			DE_ASSERT(!"Unsupported (sampler) type");
+			DE_FATAL("Unsupported (sampler) type");
 			return 0;
 	}
 }
diff --git a/modules/gles31/functional/es31fVertexAttributeBindingTests.cpp b/modules/gles31/functional/es31fVertexAttributeBindingTests.cpp
index 3136137..765d553 100644
--- a/modules/gles31/functional/es31fVertexAttributeBindingTests.cpp
+++ b/modules/gles31/functional/es31fVertexAttributeBindingTests.cpp
@@ -456,12 +456,12 @@
 		const tcu::Vec4&	color = ((x + y) % 2 == 0) ? (colorA) : (colorB);
 		const tcu::Vec4		positions[6] =
 		{
-			tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
-			tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
-			tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
-			tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
-			tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
-			tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+			tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+			tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+			tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+			tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+			tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+			tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
 		};
 
 		// copy cell vertices to the buffer.
@@ -748,12 +748,12 @@
 		for (int y = 0; y < GRID_SIZE; ++y)
 		for (int x = 0; x < GRID_SIZE; ++x)
 		{
-			primitiveData[(y * GRID_SIZE + x) * 6 + 0] = tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
-			primitiveData[(y * GRID_SIZE + x) * 6 + 1] = tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
-			primitiveData[(y * GRID_SIZE + x) * 6 + 2] = tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
-			primitiveData[(y * GRID_SIZE + x) * 6 + 3] = tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
-			primitiveData[(y * GRID_SIZE + x) * 6 + 4] = tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
-			primitiveData[(y * GRID_SIZE + x) * 6 + 5] = tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+			primitiveData[(y * GRID_SIZE + x) * 6 + 0] = tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+			primitiveData[(y * GRID_SIZE + x) * 6 + 1] = tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+			primitiveData[(y * GRID_SIZE + x) * 6 + 2] = tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+			primitiveData[(y * GRID_SIZE + x) * 6 + 3] = tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+			primitiveData[(y * GRID_SIZE + x) * 6 + 4] = tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+			primitiveData[(y * GRID_SIZE + x) * 6 + 5] = tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
 		}
 	}
 
@@ -772,7 +772,7 @@
 			const tcu::Vec4& color = ((x + y) % 2 == 0) ? (green) : (yellow);
 
 			colorOffsetWritePtr[(y * GRID_SIZE + x) * 2 + 0] = color;
-			colorOffsetWritePtr[(y * GRID_SIZE + x) * 2 + 1] = tcu::Vec4(x / float(GRID_SIZE) * 2.0f - 1.0f, y / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 0.0f);
+			colorOffsetWritePtr[(y * GRID_SIZE + x) * 2 + 1] = tcu::Vec4(float(x) / float(GRID_SIZE) * 2.0f - 1.0f, float(y) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 0.0f);
 		}
 	}
 	else
@@ -1031,7 +1031,7 @@
 			const tcu::Vec4& color = ((x + y) % 2 == 0) ? (green) : (yellow);
 
 			colorOffsetData[((y * GRID_SIZE + x) * numInstanceElementsPerCell + v) * 2 + 0] = color;
-			colorOffsetData[((y * GRID_SIZE + x) * numInstanceElementsPerCell + v) * 2 + 1] = tcu::Vec4(x / float(GRID_SIZE) * 2.0f - 1.0f, y / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 0.0f);
+			colorOffsetData[((y * GRID_SIZE + x) * numInstanceElementsPerCell + v) * 2 + 1] = tcu::Vec4(float(x) / float(GRID_SIZE) * 2.0f - 1.0f, float(y) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 0.0f);
 		}
 	}
 
@@ -1246,17 +1246,17 @@
 	{
 		const tcu::Vec4& color = ((x + y) % 2 == 0) ? (green) : (yellow);
 
-		vertexData[(y * GRID_SIZE + x) * 12 +  0] = tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+		vertexData[(y * GRID_SIZE + x) * 12 +  0] = tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
 		vertexData[(y * GRID_SIZE + x) * 12 +  1] = color;
-		vertexData[(y * GRID_SIZE + x) * 12 +  2] = tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+		vertexData[(y * GRID_SIZE + x) * 12 +  2] = tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
 		vertexData[(y * GRID_SIZE + x) * 12 +  3] = color;
-		vertexData[(y * GRID_SIZE + x) * 12 +  4] = tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+		vertexData[(y * GRID_SIZE + x) * 12 +  4] = tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
 		vertexData[(y * GRID_SIZE + x) * 12 +  5] = color;
-		vertexData[(y * GRID_SIZE + x) * 12 +  6] = tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+		vertexData[(y * GRID_SIZE + x) * 12 +  6] = tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
 		vertexData[(y * GRID_SIZE + x) * 12 +  7] = color;
-		vertexData[(y * GRID_SIZE + x) * 12 +  8] = tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+		vertexData[(y * GRID_SIZE + x) * 12 +  8] = tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
 		vertexData[(y * GRID_SIZE + x) * 12 +  9] = color;
-		vertexData[(y * GRID_SIZE + x) * 12 + 10] = tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+		vertexData[(y * GRID_SIZE + x) * 12 + 10] = tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
 		vertexData[(y * GRID_SIZE + x) * 12 + 11] = color;
 	}
 
diff --git a/modules/gles31/scripts/gen-implicit-conversions.py b/modules/gles31/scripts/gen-implicit-conversions.py
index 188f3b5..c84dd84 100644
--- a/modules/gles31/scripts/gen-implicit-conversions.py
+++ b/modules/gles31/scripts/gen-implicit-conversions.py
@@ -1,3 +1,25 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import sys
 import itertools
 import operator
diff --git a/modules/gles31/scripts/gen-uniform-blocks.py b/modules/gles31/scripts/gen-uniform-blocks.py
index 1d716ab..ad44085 100644
--- a/modules/gles31/scripts/gen-uniform-blocks.py
+++ b/modules/gles31/scripts/gen-uniform-blocks.py
@@ -1,3 +1,25 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 from genutil import *
 
 allCases = []
diff --git a/modules/gles31/stress/es31sDrawTests.cpp b/modules/gles31/stress/es31sDrawTests.cpp
index 7af5c2a..0a0c427 100644
--- a/modules/gles31/stress/es31sDrawTests.cpp
+++ b/modules/gles31/stress/es31sDrawTests.cpp
@@ -197,7 +197,7 @@
 		std::vector<deUint16>	indices			(indexBufferSize);
 
 		for (int ndx = 0; ndx < (int)indices.size(); ++ndx)
-			indices[ndx] = (m_op == INVALID_INDEX) ? (overBoundDrawCount + ndx) : (ndx);
+			indices[ndx] = (deUint16)((m_op == INVALID_INDEX) ? (overBoundDrawCount + ndx) : (ndx));
 
 		gl.glGenBuffers(1, &m_indexBufferID);
 		gl.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBufferID);
diff --git a/modules/gles31/stress/es31sVertexAttributeBindingTests.cpp b/modules/gles31/stress/es31sVertexAttributeBindingTests.cpp
index 5622297..3a285a5 100644
--- a/modules/gles31/stress/es31sVertexAttributeBindingTests.cpp
+++ b/modules/gles31/stress/es31sVertexAttributeBindingTests.cpp
@@ -450,12 +450,12 @@
 		const tcu::Vec4&	color = ((x + y) % 2 == 0) ? (colorA) : (colorB);
 		const tcu::Vec4		positions[6] =
 		{
-			tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
-			tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
-			tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
-			tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
-			tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
-			tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+			tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+			tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+			tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+			tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+			tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+			tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
 		};
 
 		// copy cell vertices to the buffer.
diff --git a/modules/glshared/glsBufferTestUtil.cpp b/modules/glshared/glsBufferTestUtil.cpp
index b00ff84..34b60a6 100644
--- a/modules/glshared/glsBufferTestUtil.cpp
+++ b/modules/glshared/glsBufferTestUtil.cpp
@@ -480,10 +480,10 @@
 	for (int y = 0; y < gridSizeY; y++)
 	for (int x = 0; x < gridSizeX; x++)
 	{
-		float	sx0			= (x+0) / (float)gridSizeX;
-		float	sy0			= (y+0) / (float)gridSizeY;
-		float	sx1			= (x+1) / (float)gridSizeX;
-		float	sy1			= (y+1) / (float)gridSizeY;
+		float	sx0			= (float)(x+0) / (float)gridSizeX;
+		float	sy0			= (float)(y+0) / (float)gridSizeY;
+		float	sx1			= (float)(x+1) / (float)gridSizeX;
+		float	sy1			= (float)(y+1) / (float)gridSizeY;
 		float	fx0			= 2.0f * sx0 - 1.0f;
 		float	fy0			= 2.0f * sy0 - 1.0f;
 		float	fx1			= 2.0f * sx1 - 1.0f;
@@ -549,8 +549,8 @@
 		for (int y = 0; y < VERIFY_QUAD_SIZE; y++)
 		for (int x = 0; x < VERIFY_QUAD_SIZE; x++)
 		{
-			float		fx		= (float)(x+0.5f) / (float)VERIFY_QUAD_SIZE;
-			float		fy		= (float)(y+0.5f) / (float)VERIFY_QUAD_SIZE;
+			float		fx		= ((float)x+0.5f) / (float)VERIFY_QUAD_SIZE;
+			float		fy		= ((float)y+0.5f) / (float)VERIFY_QUAD_SIZE;
 
 			bool		tri		= fx + fy <= 1.0f;
 			float		tx		= tri ? fx : (1.0f-fx);
diff --git a/modules/glshared/glsBuiltinPrecisionTests.cpp b/modules/glshared/glsBuiltinPrecisionTests.cpp
index bc7eb5d..1a00ed3 100644
--- a/modules/glshared/glsBuiltinPrecisionTests.cpp
+++ b/modules/glshared/glsBuiltinPrecisionTests.cpp
@@ -168,7 +168,7 @@
 template <>
 const char* dataTypeNameOf<Void> (void)
 {
-	DE_ASSERT(!"Impossible");
+	DE_FATAL("Impossible");
 	return DE_NULL;
 }
 
@@ -182,7 +182,7 @@
 template <>
 VarType getVarTypeOf<Void> (Precision)
 {
-	DE_ASSERT(!"Impossible");
+	DE_FATAL("Impossible");
 	return VarType();
 }
 
@@ -340,7 +340,7 @@
 										 const float&		value,
 										 ostream&			os)
 	{
-		os << (value ? "true" : "false");
+		os << (value != 0.0f ? "true" : "false");
 	}
 
 	static void			doPrintIVal		(const FloatFormat&,
@@ -2090,7 +2090,7 @@
 			case glu::PRECISION_LOWP:
 				return ctx.format.ulp(ret, 2.0);
 			default:
-				DE_ASSERT(!"Impossible");
+				DE_FATAL("Impossible");
 		}
 		return 0;
 	}
@@ -2128,7 +2128,7 @@
 			case glu::PRECISION_LOWP:
 				return ctx.format.ulp(ret, 2.0);
 			default:
-				DE_ASSERT(!"Impossible");
+				DE_FATAL("Impossible");
 		}
 
 		return 0;
@@ -2473,8 +2473,8 @@
 // These are not defined as derived forms in the GLSL ES spec, but
 // that gives us a reasonable precision.
 DEFINE_DERIVED_FLOAT1(ASinh, asinh, x, log(x + sqrt(x * x + constant(1.0f))));
-DEFINE_DERIVED_FLOAT1(ACosh, acosh, x, log(x + sqrt((x + constant(1.0f)) *
-													(x - constant(1.0f)))));
+DEFINE_DERIVED_FLOAT1(ACosh, acosh, x, log(x + sqrt(alternatives((x + constant(1.0f)) * (x - constant(1.0f)),
+																 (x*x - constant(1.0f))))));
 DEFINE_DERIVED_FLOAT1(ATanh, atanh, x, constant(0.5f) * log((constant(1.0f) + x) /
 															(constant(1.0f) - x)));
 
@@ -4032,7 +4032,7 @@
 		const int	exp		= rnd.getInt(0, getNumBits(prec)-2);
 		const int	sign	= rnd.getBool() ? -1 : 1;
 
-		return sign * rnd.getInt(0, 1L << exp);
+		return sign * rnd.getInt(0, (deInt32)1 << exp);
 	}
 
 	void	genFixeds	(const FloatFormat&, vector<int>& dst) const
@@ -4152,26 +4152,26 @@
 	for (int sign = -1; sign <= 1; sign += 2)
 	{
 		// Smallest subnormal
-		dst.push_back(sign * minQuantum);
+		dst.push_back((float)sign * minQuantum);
 
 		// Largest subnormal
-		dst.push_back(sign * (minNormalized - minQuantum));
+		dst.push_back((float)sign * (minNormalized - minQuantum));
 
 		// Smallest normalized
-		dst.push_back(sign * minNormalized);
+		dst.push_back((float)sign * minNormalized);
 
 		// Next smallest normalized
-		dst.push_back(sign * (minNormalized + minQuantum));
+		dst.push_back((float)sign * (minNormalized + minQuantum));
 
-		dst.push_back(sign * 0.5f);
-		dst.push_back(sign * 1.0f);
-		dst.push_back(sign * 2.0f);
+		dst.push_back((float)sign * 0.5f);
+		dst.push_back((float)sign * 1.0f);
+		dst.push_back((float)sign * 2.0f);
 
 		// Largest number
-		dst.push_back(sign * (deFloatLdExp(1.0f, maxExp) +
-							  (deFloatLdExp(1.0f, maxExp) - maxQuantum)));
+		dst.push_back((float)sign * (deFloatLdExp(1.0f, maxExp) +
+									(deFloatLdExp(1.0f, maxExp) - maxQuantum)));
 
-		dst.push_back(sign * TCU_INFINITY);
+		dst.push_back((float)sign * TCU_INFINITY);
 	}
 }
 
@@ -4962,7 +4962,7 @@
 		case 1:
 			return new InOutFuncCase<Sig>(context, name, func);
 		default:
-			DE_ASSERT(!"Impossible");
+			DE_FATAL("Impossible");
 	}
 	return DE_NULL;
 }
diff --git a/modules/glshared/glsCalibration.cpp b/modules/glshared/glsCalibration.cpp
index 133a8b7..bd86e4e 100644
--- a/modules/glshared/glsCalibration.cpp
+++ b/modules/glshared/glsCalibration.cpp
@@ -105,7 +105,7 @@
 	DE_ASSERT(position <= 1.0f);
 
 	const int	maxNdx				= (int)values.size() - 1;
-	const float	floatNdx			= maxNdx * position;
+	const float	floatNdx			= (float)maxNdx * position;
 	const int	lowerNdx			= (int)deFloatFloor(floatNdx);
 	const int	higherNdx			= lowerNdx + (lowerNdx == maxNdx ? 0 : 1); // Use only last element if position is 1.0
 	const float	interpolationFactor = floatNdx - (float)lowerNdx;
diff --git a/modules/glshared/glsDrawTest.cpp b/modules/glshared/glsDrawTest.cpp
index 4a6ac52..80f0b3a 100644
--- a/modules/glshared/glsDrawTest.cpp
+++ b/modules/glshared/glsDrawTest.cpp
@@ -397,10 +397,10 @@
 		static WrappedType<Type>	create			(Type value)							{ WrappedType<Type> v; v.m_value = value; return v; }
 		inline Type					getValue		(void) const							{ return m_value; }
 
-		inline WrappedType<Type>	operator+		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create(m_value + other.getValue()); }
-		inline WrappedType<Type>	operator*		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create(m_value * other.getValue()); }
-		inline WrappedType<Type>	operator/		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create(m_value / other.getValue()); }
-		inline WrappedType<Type>	operator-		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create(m_value - other.getValue()); }
+		inline WrappedType<Type>	operator+		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create((Type)(m_value + other.getValue())); }
+		inline WrappedType<Type>	operator*		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create((Type)(m_value * other.getValue())); }
+		inline WrappedType<Type>	operator/		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create((Type)(m_value / other.getValue())); }
+		inline WrappedType<Type>	operator-		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create((Type)(m_value - other.getValue())); }
 
 		inline WrappedType<Type>&	operator+=		(const WrappedType<Type>& other)		{ m_value += other.getValue(); return *this; }
 		inline WrappedType<Type>&	operator*=		(const WrappedType<Type>& other)		{ m_value *= other.getValue(); return *this; }
@@ -689,7 +689,7 @@
 	if (max < min)
 		return min;
 
-	return GLValue::Short::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+	return GLValue::Short::create((min == max ? min : (deInt16)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
 }
 
 template<>
@@ -698,7 +698,7 @@
 	if (max < min)
 		return min;
 
-	return GLValue::Ushort::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+	return GLValue::Ushort::create((min == max ? min : (deUint16)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
 }
 
 template<>
@@ -707,7 +707,7 @@
 	if (max < min)
 		return min;
 
-	return GLValue::Byte::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+	return GLValue::Byte::create((min == max ? min : (deInt8)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
 }
 
 template<>
@@ -716,7 +716,7 @@
 	if (max < min)
 		return min;
 
-	return GLValue::Ubyte::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+	return GLValue::Ubyte::create((min == max ? min : (deUint8)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
 }
 
 template<>
@@ -1176,10 +1176,10 @@
 	if (isCoordinate)
 		switch (numComponents)
 		{
-			case 1:	coord += tcu::Vec2((float)attribValue.x(),						(float)attribValue.x());					break;
-			case 2:	coord += tcu::Vec2((float)attribValue.x(),						(float)attribValue.y());					break;
-			case 3:	coord += tcu::Vec2((float)attribValue.x() + attribValue.z(),	(float)attribValue.y());					break;
-			case 4:	coord += tcu::Vec2((float)attribValue.x() + attribValue.z(),	(float)attribValue.y() + attribValue.w());	break;
+			case 1:	coord += tcu::Vec2((float)attribValue.x(),							(float)attribValue.x());							break;
+			case 2:	coord += tcu::Vec2((float)attribValue.x(),							(float)attribValue.y());							break;
+			case 3:	coord += tcu::Vec2((float)attribValue.x() + (float)attribValue.z(),	(float)attribValue.y());							break;
+			case 4:	coord += tcu::Vec2((float)attribValue.x() + (float)attribValue.z(),	(float)attribValue.y() + (float)attribValue.w());	break;
 
 			default:
 				DE_ASSERT(false);
@@ -1193,20 +1193,20 @@
 				break;
 
 			case 2:
-				color.x() = color.x() * attribValue.x();
-				color.y() = color.y() * attribValue.y();
+				color.x() = color.x() * (float)attribValue.x();
+				color.y() = color.y() * (float)attribValue.y();
 				break;
 
 			case 3:
-				color.x() = color.x() * attribValue.x();
-				color.y() = color.y() * attribValue.y();
-				color.z() = color.z() * attribValue.z();
+				color.x() = color.x() * (float)attribValue.x();
+				color.y() = color.y() * (float)attribValue.y();
+				color.z() = color.z() * (float)attribValue.z();
 				break;
 
 			case 4:
-				color.x() = color.x() * attribValue.x() * attribValue.w();
-				color.y() = color.y() * attribValue.y() * attribValue.w();
-				color.z() = color.z() * attribValue.z() * attribValue.w();
+				color.x() = color.x() * (float)attribValue.x() * (float)attribValue.w();
+				color.y() = color.y() * (float)attribValue.y() * (float)attribValue.w();
+				color.z() = color.z() * (float)attribValue.z() * (float)attribValue.w();
 				break;
 
 			default:
@@ -1776,7 +1776,7 @@
 	if (min < 0 || (size_t)min > std::numeric_limits<T>::max() ||
 		max < 0 || (size_t)max > std::numeric_limits<T>::max() ||
 		min > max)
-		DE_ASSERT(!"Invalid range");
+		DE_FATAL("Invalid range");
 
 	for (int elementNdx = 0; elementNdx < elementCount; ++elementNdx)
 	{
@@ -2463,21 +2463,21 @@
 {
 	static const int size[] =
 	{
-		sizeof(float),		// INPUTTYPE_FLOAT = 0,
-		sizeof(deInt32),	// INPUTTYPE_FIXED,
-		sizeof(double),		// INPUTTYPE_DOUBLE
+		(int)sizeof(float),			// INPUTTYPE_FLOAT = 0,
+		(int)sizeof(deInt32),		// INPUTTYPE_FIXED,
+		(int)sizeof(double),		// INPUTTYPE_DOUBLE
 
-		sizeof(deInt8),		// INPUTTYPE_BYTE,
-		sizeof(deInt16),	// INPUTTYPE_SHORT,
+		(int)sizeof(deInt8),		// INPUTTYPE_BYTE,
+		(int)sizeof(deInt16),		// INPUTTYPE_SHORT,
 
-		sizeof(deUint8),	// INPUTTYPE_UNSIGNED_BYTE,
-		sizeof(deUint16),	// INPUTTYPE_UNSIGNED_SHORT,
+		(int)sizeof(deUint8),		// INPUTTYPE_UNSIGNED_BYTE,
+		(int)sizeof(deUint16),		// INPUTTYPE_UNSIGNED_SHORT,
 
-		sizeof(deInt32),		// INPUTTYPE_INT,
-		sizeof(deUint32),		// INPUTTYPE_UNSIGNED_INT,
-		sizeof(deFloat16),		// INPUTTYPE_HALF,
-		sizeof(deUint32) / 4,		// INPUTTYPE_UNSIGNED_INT_2_10_10_10,
-		sizeof(deUint32) / 4		// INPUTTYPE_INT_2_10_10_10,
+		(int)sizeof(deInt32),		// INPUTTYPE_INT,
+		(int)sizeof(deUint32),		// INPUTTYPE_UNSIGNED_INT,
+		(int)sizeof(deFloat16),		// INPUTTYPE_HALF,
+		(int)sizeof(deUint32) / 4,	// INPUTTYPE_UNSIGNED_INT_2_10_10_10,
+		(int)sizeof(deUint32) / 4	// INPUTTYPE_INT_2_10_10_10,
 	};
 
 	return de::getSizedArrayElement<DrawTestSpec::INPUTTYPE_LAST>(size, (int)type);
@@ -3203,7 +3203,7 @@
 	else if (contextSupports(m_renderCtx.getType(), glu::ApiType::es(3,1)) || glu::isContextTypeGLCore(m_renderCtx.getType()))
 		useVao = true;
 	else
-		DE_ASSERT(!"Unknown context type");
+		DE_FATAL("Unknown context type");
 
 	m_refBuffers	= new sglr::ReferenceContextBuffers(m_renderCtx.getRenderTarget().getPixelFormat(), 0, 0, renderTargetWidth, renderTargetHeight, renderTargetSamples);
 	m_refContext	= new sglr::ReferenceContext(limits, m_refBuffers->getColorbuffer(), m_refBuffers->getDepthbuffer(), m_refBuffers->getStencilbuffer());
@@ -3211,9 +3211,9 @@
 	m_glArrayPack	= new AttributePack(m_testCtx, m_renderCtx, *m_glesContext, tcu::UVec2(renderTargetWidth, renderTargetHeight), useVao, true);
 	m_rrArrayPack	= new AttributePack(m_testCtx, m_renderCtx, *m_refContext,  tcu::UVec2(renderTargetWidth, renderTargetHeight), useVao, false);
 
-	m_maxDiffRed	= deCeilFloatToInt32(256.0f * (6.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().redBits)));
-	m_maxDiffGreen	= deCeilFloatToInt32(256.0f * (6.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().greenBits)));
-	m_maxDiffBlue	= deCeilFloatToInt32(256.0f * (6.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().blueBits)));
+	m_maxDiffRed	= deCeilFloatToInt32(256.0f * (6.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().redBits)));
+	m_maxDiffGreen	= deCeilFloatToInt32(256.0f * (6.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().greenBits)));
+	m_maxDiffBlue	= deCeilFloatToInt32(256.0f * (6.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().blueBits)));
 }
 
 void DrawTest::deinit (void)
@@ -3849,14 +3849,14 @@
 			if (attribSpec.normalize)
 				attrMaxValue += 1.0f;
 			else
-				attrMaxValue += 1024.0;
+				attrMaxValue += 1024.0f;
 		}
 		else if (attribSpec.inputType == DrawTestSpec::INPUTTYPE_INT_2_10_10_10)
 		{
 			if (attribSpec.normalize)
 				attrMaxValue += 1.0f;
 			else
-				attrMaxValue += 512.0;
+				attrMaxValue += 512.0f;
 		}
 		else
 		{
@@ -3891,12 +3891,12 @@
 		if (attribSpec.inputType == DrawTestSpec::INPUTTYPE_UNSIGNED_INT_2_10_10_10)
 		{
 			if (!attribSpec.normalize)
-				colorScale *= 1.0 / 1024.0;
+				colorScale *= 1.0f / 1024.0f;
 		}
 		else if (attribSpec.inputType == DrawTestSpec::INPUTTYPE_INT_2_10_10_10)
 		{
 			if (!attribSpec.normalize)
-				colorScale *= 1.0 / 512.0;
+				colorScale *= 1.0f / 512.0f;
 		}
 		else
 		{
diff --git a/modules/glshared/glsFboCompletenessTests.cpp b/modules/glshared/glsFboCompletenessTests.cpp
index db75fdf..0426a83 100644
--- a/modules/glshared/glsFboCompletenessTests.cpp
+++ b/modules/glshared/glsFboCompletenessTests.cpp
@@ -34,7 +34,7 @@
 using namespace glw;
 using glu::RenderContext;
 using glu::getFramebufferStatusName;
-using glu::getPixelFormatName;
+using glu::getTextureFormatName;
 using glu::getTypeName;
 using glu::getErrorName;
 using glu::Framebuffer;
@@ -713,7 +713,7 @@
 			image = &builder.makeConfig<Texture2D>();
 			break;
 		default:
-			DE_ASSERT(!"Impossible case");
+			DE_FATAL("Impossible case");
 	}
 	image->internalFormat = format;
 	image->width = width;
@@ -762,7 +762,7 @@
 
 static string formatName (ImageFormat format)
 {
-	const string s = getPixelFormatName(format.format);
+	const string s = getTextureFormatName(format.format);
 	const string fmtStr = toLower(s.substr(3));
 
 	if (format.unsizedType != GL_NONE)
@@ -776,7 +776,7 @@
 
 static string formatDesc (ImageFormat format)
 {
-	const string fmtStr = getPixelFormatName(format.format);
+	const string fmtStr = getTextureFormatName(format.format);
 
 	if (format.unsizedType != GL_NONE)
 	{
@@ -827,7 +827,7 @@
 		case GL_TEXTURE:
 			return "tex";
 		default:
-			DE_ASSERT(!"Impossible case");
+			DE_FATAL("Impossible case");
 	}
 	return ""; // Shut up compiler
 }
diff --git a/modules/glshared/glsFboUtil.cpp b/modules/glshared/glsFboUtil.cpp
index 749d25e..0c27670 100644
--- a/modules/glshared/glsFboUtil.cpp
+++ b/modules/glshared/glsFboUtil.cpp
@@ -38,7 +38,7 @@
 using glu::TransferFormat;
 using glu::mapGLInternalFormat;
 using glu::mapGLTransferFormat;
-using glu::getPixelFormatName;
+using glu::getTextureFormatName;
 using glu::getTypeName;
 using glu::getFramebufferTargetName;
 using glu::getFramebufferAttachmentName;
@@ -81,12 +81,12 @@
 	if (format.unsizedType == GL_NONE)
 	{
 		// sized format
-		return stream << glu::getPixelFormatStr(format.format);
+		return stream << glu::getTextureFormatStr(format.format);
 	}
 	else
 	{
 		// unsized format
-		return stream << "(format = " << glu::getPixelFormatStr(format.format) << ", type = " << glu::getTypeStr(format.unsizedType) << ")";
+		return stream << "(format = " << glu::getTextureFormatStr(format.format) << ", type = " << glu::getTypeStr(format.unsizedType) << ")";
 	}
 }
 
@@ -322,7 +322,7 @@
 	if (dynamic_cast<const Texture2DArray*>(&img) != DE_NULL)
 		return GL_TEXTURE_2D_ARRAY;
 
-	DE_ASSERT(!"Impossible image type");
+	DE_FATAL("Impossible image type");
 	return GL_NONE;
 }
 
@@ -411,7 +411,7 @@
 		gl.bindTexture(glTarget(*tex), 0);
 	}
 	else
-		DE_ASSERT(!"Impossible image type");
+		DE_FATAL("Impossible image type");
 	return ret;
 }
 
@@ -422,7 +422,7 @@
 	else if (dynamic_cast<const Texture*>(&cfg) != DE_NULL)
 		gl.deleteTextures(1, &img);
 	else
-		DE_ASSERT(!"Impossible image type");
+		DE_FATAL("Impossible image type");
 }
 
 static void attachAttachment (const Attachment& att, GLenum attPoint,
@@ -441,7 +441,7 @@
 		gl.framebufferTextureLayer(lAtt->target, attPoint,
 								   lAtt->imageName, lAtt->level, lAtt->layer);
 	else
-		DE_ASSERT(!"Impossible attachment type");
+		DE_FATAL("Impossible attachment type");
 }
 
 GLenum attachmentType (const Attachment& att)
@@ -451,7 +451,7 @@
 	else if (dynamic_cast<const TextureAttachment*>(&att) != DE_NULL)
 		return GL_TEXTURE;
 
-	DE_ASSERT(!"Impossible attachment type");
+	DE_FATAL("Impossible attachment type");
 	return GL_NONE;
 }
 
@@ -463,7 +463,7 @@
 			 dynamic_cast<const TextureLayerAttachment*>(&tAtt))
 		return lAtt->layer;
 
-	DE_ASSERT(!"Impossible attachment type");
+	DE_FATAL("Impossible attachment type");
 	return 0;
 }
 
@@ -660,7 +660,7 @@
 		case GL_RENDERBUFFER:
 			return de::lookupDefault(rbos, imgName, DE_NULL);
 		default:
-			DE_ASSERT(!"Bad image type");
+			DE_FATAL("Bad image type");
 	}
 	return DE_NULL; // shut up compiler warning
 }
@@ -683,7 +683,7 @@
 static void logImage (const Image& img, TestLog& log, bool useType)
 {
 	const GLenum type = img.internalFormat.unsizedType;
-	logField(log, "Internal format",	getPixelFormatName(img.internalFormat.format));
+	logField(log, "Internal format",	getTextureFormatName(img.internalFormat.format));
 	if (useType && type != GL_NONE)
 		logField(log, "Format type",	getTypeName(type));
 	logField(log, "Width",				toString(img.width));
diff --git a/modules/glshared/glsFragOpInteractionCase.cpp b/modules/glshared/glsFragOpInteractionCase.cpp
index e97e7b1..5b68420 100644
--- a/modules/glshared/glsFragOpInteractionCase.cpp
+++ b/modules/glshared/glsFragOpInteractionCase.cpp
@@ -186,8 +186,8 @@
 	const int		maxOutOfBounds	= 0;
 	const float		minSize			= 0.5f;
 
-	const int		minW			= deCeilFloatToInt32(minSize*targetW);
-	const int		minH			= deCeilFloatToInt32(minSize*targetH);
+	const int		minW			= deCeilFloatToInt32(minSize * (float)targetW);
+	const int		minH			= deCeilFloatToInt32(minSize * (float)targetH);
 	const int		maxW			= targetW + 2*maxOutOfBounds;
 	const int		maxH			= targetH + 2*maxOutOfBounds;
 
@@ -396,7 +396,7 @@
 		const deUint64 subUnitBorderLo	= (1u << (numSubBits - 1u)) - 1u;
 		const deUint64 subUnitBorderHi	= 1u << (numSubBits - 1u);
 		const deUint64 maxFixedValue	= (1u << (numBits + numSubBits)) - 1u;
-		const deUint64 fixedValue		= deRoundFloatToInt64(v * maxFixedValue);
+		const deUint64 fixedValue		= deRoundFloatToInt64(v * (float)maxFixedValue);
 
 		const deUint64 units			= fixedValue >> numSubBits;
 		const deUint64 subUnits			= fixedValue & ((1u << numSubBits) - 1u);
diff --git a/modules/glshared/glsInteractionTestUtil.cpp b/modules/glshared/glsInteractionTestUtil.cpp
index 2c8f126..a19b019 100644
--- a/modules/glshared/glsInteractionTestUtil.cpp
+++ b/modules/glshared/glsInteractionTestUtil.cpp
@@ -154,8 +154,8 @@
 
 	if (state.scissorTestEnabled)
 	{
-		int minScissorW		= deCeilFloatToInt32(minScissorSize*targetWidth);
-		int minScissorH		= deCeilFloatToInt32(minScissorSize*targetHeight);
+		int minScissorW		= deCeilFloatToInt32(minScissorSize * (float)targetWidth);
+		int minScissorH		= deCeilFloatToInt32(minScissorSize * (float)targetHeight);
 		int maxScissorW		= targetWidth + 2*maxScissorOutOfBounds;
 		int maxScissorH		= targetHeight + 2*maxScissorOutOfBounds;
 
@@ -227,8 +227,8 @@
 	const int		maxOutOfBounds		= 0;
 	const float		minSize				= 0.5f;
 
-	int minW		= deCeilFloatToInt32(minSize*targetWidth);
-	int minH		= deCeilFloatToInt32(minSize*targetHeight);
+	int minW		= deCeilFloatToInt32(minSize * (float)targetWidth);
+	int minH		= deCeilFloatToInt32(minSize * (float)targetHeight);
 	int maxW		= targetWidth + 2*maxOutOfBounds;
 	int maxH		= targetHeight + 2*maxOutOfBounds;
 
diff --git a/modules/glshared/glsLongStressCase.cpp b/modules/glshared/glsLongStressCase.cpp
index 7f751ce..71d8fdf 100644
--- a/modules/glshared/glsLongStressCase.cpp
+++ b/modules/glshared/glsLongStressCase.cpp
@@ -385,13 +385,13 @@
 				{
 					const int vtxNdx = (int)m_posBuf.size()/2;
 
-					m_ndxBuf.push_back(vtxNdx+0);
-					m_ndxBuf.push_back(vtxNdx+1);
-					m_ndxBuf.push_back(vtxNdx+2);
+					m_ndxBuf.push_back(deUint16(vtxNdx+0));
+					m_ndxBuf.push_back(deUint16(vtxNdx+1));
+					m_ndxBuf.push_back(deUint16(vtxNdx+2));
 
-					m_ndxBuf.push_back(vtxNdx+2);
-					m_ndxBuf.push_back(vtxNdx+1);
-					m_ndxBuf.push_back(vtxNdx+3);
+					m_ndxBuf.push_back(deUint16(vtxNdx+2));
+					m_ndxBuf.push_back(deUint16(vtxNdx+1));
+					m_ndxBuf.push_back(deUint16(vtxNdx+3));
 
 					m_posBuf.push_back(ax);
 					m_posBuf.push_back(ay);
@@ -1494,7 +1494,7 @@
 				<< TestLog::Message << "Frame number: " << m_currentIteration << TestLog::EndMessage
 				<< TestLog::Message << "Time since last log entry: " << timeDiff << "s" << TestLog::EndMessage
 				<< TestLog::Message << "Frames since last log entry: " << iterDiff << TestLog::EndMessage
-				<< TestLog::Message << "Average frame time since last log entry: " << de::floatToString((float)timeDiff / iterDiff, 2) << "s" << TestLog::EndMessage
+				<< TestLog::Message << "Average frame time since last log entry: " << de::floatToString((float)timeDiff / (float)iterDiff, 2) << "s" << TestLog::EndMessage
 				<< TestLog::Message << "Approximate texture memory usage: "
 									<< de::floatToString((float)m_textures->computeApproxMemUsage() / Mi, 2) << " MiB / "
 									<< de::floatToString((float)m_maxTexMemoryUsageBytes / Mi, 2) << " MiB"
diff --git a/modules/glshared/glsMemoryStressCase.cpp b/modules/glshared/glsMemoryStressCase.cpp
index cff05bf..3195d28 100644
--- a/modules/glshared/glsMemoryStressCase.cpp
+++ b/modules/glshared/glsMemoryStressCase.cpp
@@ -920,7 +920,7 @@
 		}
 		else
 		{
-			const float change = (min - max) / ((float)(max));
+			const float change = (float)(min - max) / (float)(max);
 			if (change > threshold)
 			{
 				log << TestLog::Message << "Allocated objects max: " << max << ", min: " << min << ", difference: " << change << "% threshold: " << threshold << "%" << TestLog::EndMessage;
diff --git a/modules/glshared/glsRandomShaderCase.cpp b/modules/glshared/glsRandomShaderCase.cpp
index 5400661..9edd854 100644
--- a/modules/glshared/glsRandomShaderCase.cpp
+++ b/modules/glshared/glsRandomShaderCase.cpp
@@ -210,12 +210,12 @@
 		int	quadY	= quadNdx / (m_gridWidth);
 		int quadX	= quadNdx - quadY*m_gridWidth;
 
-		m_indices[quadNdx*6+0] = quadX + quadY*(m_gridWidth+1);
-		m_indices[quadNdx*6+1] = quadX + (quadY+1)*(m_gridWidth+1);
-		m_indices[quadNdx*6+2] = quadX + quadY*(m_gridWidth+1) + 1;
-		m_indices[quadNdx*6+3] = m_indices[quadNdx*6+2];
-		m_indices[quadNdx*6+4] = m_indices[quadNdx*6+1];
-		m_indices[quadNdx*6+5] = quadX + (quadY+1)*(m_gridWidth+1) + 1;
+		m_indices[quadNdx*6+0] = (deUint16)(quadX + quadY*(m_gridWidth+1));
+		m_indices[quadNdx*6+1] = (deUint16)(quadX + (quadY+1)*(m_gridWidth+1));
+		m_indices[quadNdx*6+2] = (deUint16)(quadX + quadY*(m_gridWidth+1) + 1);
+		m_indices[quadNdx*6+3] = (deUint16)(m_indices[quadNdx*6+2]);
+		m_indices[quadNdx*6+4] = (deUint16)(m_indices[quadNdx*6+1]);
+		m_indices[quadNdx*6+5] = (deUint16)(quadX + (quadY+1)*(m_gridWidth+1) + 1);
 	}
 
 	// Create textures.
diff --git a/modules/glshared/glsRasterizationTestUtil.cpp b/modules/glshared/glsRasterizationTestUtil.cpp
index d50a8c8..6088888 100644
--- a/modules/glshared/glsRasterizationTestUtil.cpp
+++ b/modules/glshared/glsRasterizationTestUtil.cpp
@@ -103,7 +103,7 @@
 
 bool pixelNearLineSegment (const tcu::IVec2& pixel, const tcu::Vec2& p0, const tcu::Vec2& p1)
 {
-	const tcu::Vec2 pixelCenterPosition = tcu::Vec2(pixel.x() + 0.5f, pixel.y() + 0.5f);
+	const tcu::Vec2 pixelCenterPosition = tcu::Vec2((float)pixel.x() + 0.5f, (float)pixel.y() + 0.5f);
 
 	// "Near" = Distance from the line to the pixel is less than 2 * pixel_max_radius. (pixel_max_radius = sqrt(2) / 2)
 	const float maxPixelDistance		= 1.414f;
@@ -521,15 +521,15 @@
 																				 WeightEquation		weightEquation)
 {
 	// allow interpolation weights anywhere in the central subpixels
-	const float testSquareSize = (2.0f / (1UL << subpixelBits));
+	const float testSquareSize = (2.0f / (float)(1UL << subpixelBits));
 	const float testSquarePos  = (0.5f - testSquareSize / 2);
 
 	const tcu::Vec2 corners[4] =
 	{
-		tcu::Vec2(pixel.x() + testSquarePos + 0.0f,				pixel.y() + testSquarePos + 0.0f),
-		tcu::Vec2(pixel.x() + testSquarePos + 0.0f,				pixel.y() + testSquarePos + testSquareSize),
-		tcu::Vec2(pixel.x() + testSquarePos + testSquareSize,	pixel.y() + testSquarePos + testSquareSize),
-		tcu::Vec2(pixel.x() + testSquarePos + testSquareSize,	pixel.y() + testSquarePos + 0.0f),
+		tcu::Vec2((float)pixel.x() + testSquarePos + 0.0f,				(float)pixel.y() + testSquarePos + 0.0f),
+		tcu::Vec2((float)pixel.x() + testSquarePos + 0.0f,				(float)pixel.y() + testSquarePos + testSquareSize),
+		tcu::Vec2((float)pixel.x() + testSquarePos + testSquareSize,	(float)pixel.y() + testSquarePos + testSquareSize),
+		tcu::Vec2((float)pixel.x() + testSquarePos + testSquareSize,	(float)pixel.y() + testSquarePos + 0.0f),
 	};
 
 	// calculate interpolation as a line
@@ -573,14 +573,14 @@
 	{
 		// allow anywhere in the pixel area in multisample
 		// allow only in the center subpixels (4 subpixels) in singlesample
-		const float testSquareSize = (multisample) ? (1.0f) : (2.0f / (1UL << subpixelBits));
+		const float testSquareSize = (multisample) ? (1.0f) : (2.0f / (float)(1UL << subpixelBits));
 		const float testSquarePos  = (multisample) ? (0.0f) : (0.5f - testSquareSize / 2);
 		const tcu::Vec2 corners[4] =
 		{
-			tcu::Vec2((pixel.x() + testSquarePos + 0.0f)           / viewportSize.x() * 2.0f - 1.0f, (pixel.y() + testSquarePos + 0.0f          ) / viewportSize.y() * 2.0f - 1.0f),
-			tcu::Vec2((pixel.x() + testSquarePos + 0.0f)           / viewportSize.x() * 2.0f - 1.0f, (pixel.y() + testSquarePos + testSquareSize) / viewportSize.y() * 2.0f - 1.0f),
-			tcu::Vec2((pixel.x() + testSquarePos + testSquareSize) / viewportSize.x() * 2.0f - 1.0f, (pixel.y() + testSquarePos + testSquareSize) / viewportSize.y() * 2.0f - 1.0f),
-			tcu::Vec2((pixel.x() + testSquarePos + testSquareSize) / viewportSize.x() * 2.0f - 1.0f, (pixel.y() + testSquarePos + 0.0f          ) / viewportSize.y() * 2.0f - 1.0f),
+			tcu::Vec2(((float)pixel.x() + testSquarePos + 0.0f)           / (float)viewportSize.x() * 2.0f - 1.0f, ((float)pixel.y() + testSquarePos + 0.0f          ) / (float)viewportSize.y() * 2.0f - 1.0f),
+			tcu::Vec2(((float)pixel.x() + testSquarePos + 0.0f)           / (float)viewportSize.x() * 2.0f - 1.0f, ((float)pixel.y() + testSquarePos + testSquareSize) / (float)viewportSize.y() * 2.0f - 1.0f),
+			tcu::Vec2(((float)pixel.x() + testSquarePos + testSquareSize) / (float)viewportSize.x() * 2.0f - 1.0f, ((float)pixel.y() + testSquarePos + testSquareSize) / (float)viewportSize.y() * 2.0f - 1.0f),
+			tcu::Vec2(((float)pixel.x() + testSquarePos + testSquareSize) / (float)viewportSize.x() * 2.0f - 1.0f, ((float)pixel.y() + testSquarePos + 0.0f          ) / (float)viewportSize.y() * 2.0f - 1.0f),
 		};
 		const InterpolationRange weights[4] =
 		{
@@ -622,18 +622,18 @@
 		// allow interpolation weights anywhere in the pixel
 		const tcu::Vec2 corners[4] =
 		{
-			tcu::Vec2(pixel.x() + 0.0f, pixel.y() + 0.0f),
-			tcu::Vec2(pixel.x() + 0.0f, pixel.y() + 1.0f),
-			tcu::Vec2(pixel.x() + 1.0f, pixel.y() + 1.0f),
-			tcu::Vec2(pixel.x() + 1.0f, pixel.y() + 0.0f),
+			tcu::Vec2((float)pixel.x() + 0.0f, (float)pixel.y() + 0.0f),
+			tcu::Vec2((float)pixel.x() + 0.0f, (float)pixel.y() + 1.0f),
+			tcu::Vec2((float)pixel.x() + 1.0f, (float)pixel.y() + 1.0f),
+			tcu::Vec2((float)pixel.x() + 1.0f, (float)pixel.y() + 0.0f),
 		};
 
 		const float		wa = scene.lines[lineNdx].positions[0].w();
 		const float		wb = scene.lines[lineNdx].positions[1].w();
-		const tcu::Vec2	pa = tcu::Vec2((scene.lines[lineNdx].positions[0].x() / wa + 1.0f) * 0.5f * viewportSize.x(),
-									   (scene.lines[lineNdx].positions[0].y() / wa + 1.0f) * 0.5f * viewportSize.y());
-		const tcu::Vec2	pb = tcu::Vec2((scene.lines[lineNdx].positions[1].x() / wb + 1.0f) * 0.5f * viewportSize.x(),
-									   (scene.lines[lineNdx].positions[1].y() / wb + 1.0f) * 0.5f * viewportSize.y());
+		const tcu::Vec2	pa = tcu::Vec2((scene.lines[lineNdx].positions[0].x() / wa + 1.0f) * 0.5f * (float)viewportSize.x(),
+									   (scene.lines[lineNdx].positions[0].y() / wa + 1.0f) * 0.5f * (float)viewportSize.y());
+		const tcu::Vec2	pb = tcu::Vec2((scene.lines[lineNdx].positions[1].x() / wb + 1.0f) * 0.5f * (float)viewportSize.x(),
+									   (scene.lines[lineNdx].positions[1].y() / wb + 1.0f) * 0.5f * (float)viewportSize.y());
 
 		// calculate interpolation as a line
 		const LineInterpolationRange weights[4] =
@@ -792,12 +792,12 @@
 			const tcu::Vec3		valueRangeMax	= tcu::Vec3(colorStackMax.xyz());
 
 			const tcu::IVec3	formatLimit		((1 << args.redBits) - 1, (1 << args.greenBits) - 1, (1 << args.blueBits) - 1);
-			const tcu::Vec3		colorMinF		(de::clamp(valueRangeMin.x() * formatLimit.x(), 0.0f, (float)formatLimit.x()),
-												 de::clamp(valueRangeMin.y() * formatLimit.y(), 0.0f, (float)formatLimit.y()),
-												 de::clamp(valueRangeMin.z() * formatLimit.z(), 0.0f, (float)formatLimit.z()));
-			const tcu::Vec3		colorMaxF		(de::clamp(valueRangeMax.x() * formatLimit.x(), 0.0f, (float)formatLimit.x()),
-												 de::clamp(valueRangeMax.y() * formatLimit.y(), 0.0f, (float)formatLimit.y()),
-												 de::clamp(valueRangeMax.z() * formatLimit.z(), 0.0f, (float)formatLimit.z()));
+			const tcu::Vec3		colorMinF		(de::clamp(valueRangeMin.x() * (float)formatLimit.x(), 0.0f, (float)formatLimit.x()),
+												 de::clamp(valueRangeMin.y() * (float)formatLimit.y(), 0.0f, (float)formatLimit.y()),
+												 de::clamp(valueRangeMin.z() * (float)formatLimit.z(), 0.0f, (float)formatLimit.z()));
+			const tcu::Vec3		colorMaxF		(de::clamp(valueRangeMax.x() * (float)formatLimit.x(), 0.0f, (float)formatLimit.x()),
+												 de::clamp(valueRangeMax.y() * (float)formatLimit.y(), 0.0f, (float)formatLimit.y()),
+												 de::clamp(valueRangeMax.z() * (float)formatLimit.z(), 0.0f, (float)formatLimit.z()));
 			const tcu::IVec3	colorMin		((int)deFloatFloor(colorMinF.x()),
 												 (int)deFloatFloor(colorMinF.y()),
 												 (int)deFloatFloor(colorMinF.z()));
@@ -1458,10 +1458,10 @@
 					DE_ASSERT(deInBounds32(fragPos.x(), 0, maskMap.getWidth()));
 					DE_ASSERT(deInBounds32(fragPos.y(), 0, maskMap.getHeight()));
 
-					const int			previousMask	= maskMap.getPixelInt(fragPos.x(), fragPos.y()).x();
-					const int			newMask			= (previousMask) | (1UL << bitNdx);
+					const deUint32		previousMask	= maskMap.getPixelUint(fragPos.x(), fragPos.y()).x();
+					const deUint32		newMask			= (previousMask) | ((deUint32)1u << bitNdx);
 
-					maskMap.setPixel(tcu::IVec4(newMask, 0, 0, 0), fragPos.x(), fragPos.y());
+					maskMap.setPixel(tcu::UVec4(newMask, 0, 0, 0), fragPos.x(), fragPos.y());
 				}
 			}
 		}
@@ -1562,12 +1562,12 @@
 				const tcu::Vec4					valueMin		= de::clamp(range.min.x(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[0] + de::clamp(range.min.y(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[1];
 				const tcu::Vec4					valueMax		= de::clamp(range.max.x(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[0] + de::clamp(range.max.y(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[1];
 
-				const tcu::Vec3					colorMinF		(de::clamp(valueMin.x() * formatLimit.x(), 0.0f, (float)formatLimit.x()),
-																 de::clamp(valueMin.y() * formatLimit.y(), 0.0f, (float)formatLimit.y()),
-																 de::clamp(valueMin.z() * formatLimit.z(), 0.0f, (float)formatLimit.z()));
-				const tcu::Vec3					colorMaxF		(de::clamp(valueMax.x() * formatLimit.x(), 0.0f, (float)formatLimit.x()),
-																 de::clamp(valueMax.y() * formatLimit.y(), 0.0f, (float)formatLimit.y()),
-																 de::clamp(valueMax.z() * formatLimit.z(), 0.0f, (float)formatLimit.z()));
+				const tcu::Vec3					colorMinF		(de::clamp(valueMin.x() * (float)formatLimit.x(), 0.0f, (float)formatLimit.x()),
+																 de::clamp(valueMin.y() * (float)formatLimit.y(), 0.0f, (float)formatLimit.y()),
+																 de::clamp(valueMin.z() * (float)formatLimit.z(), 0.0f, (float)formatLimit.z()));
+				const tcu::Vec3					colorMaxF		(de::clamp(valueMax.x() * (float)formatLimit.x(), 0.0f, (float)formatLimit.x()),
+																 de::clamp(valueMax.y() * (float)formatLimit.y(), 0.0f, (float)formatLimit.y()),
+																 de::clamp(valueMax.z() * (float)formatLimit.z(), 0.0f, (float)formatLimit.z()));
 				const tcu::IVec3				colorMin		((int)deFloatFloor(colorMinF.x()),
 																 (int)deFloatFloor(colorMinF.y()),
 																 (int)deFloatFloor(colorMinF.z()));
@@ -1916,18 +1916,18 @@
 					const tcu::Vec4					valueMin		= de::clamp(range.min.x(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[0] + de::clamp(range.min.y(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[1];
 					const tcu::Vec4					valueMax		= de::clamp(range.max.x(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[0] + de::clamp(range.max.y(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[1];
 
-					const tcu::Vec3					colorMinF		(de::clamp(valueMin.x() * formatLimit.x(), 0.0f, (float)formatLimit.x()),
-																	de::clamp(valueMin.y() * formatLimit.y(), 0.0f, (float)formatLimit.y()),
-																	de::clamp(valueMin.z() * formatLimit.z(), 0.0f, (float)formatLimit.z()));
-					const tcu::Vec3					colorMaxF		(de::clamp(valueMax.x() * formatLimit.x(), 0.0f, (float)formatLimit.x()),
-																	de::clamp(valueMax.y() * formatLimit.y(), 0.0f, (float)formatLimit.y()),
-																	de::clamp(valueMax.z() * formatLimit.z(), 0.0f, (float)formatLimit.z()));
+					const tcu::Vec3					colorMinF		(de::clamp(valueMin.x() * (float)formatLimit.x(), 0.0f, (float)formatLimit.x()),
+																	 de::clamp(valueMin.y() * (float)formatLimit.y(), 0.0f, (float)formatLimit.y()),
+																	 de::clamp(valueMin.z() * (float)formatLimit.z(), 0.0f, (float)formatLimit.z()));
+					const tcu::Vec3					colorMaxF		(de::clamp(valueMax.x() * (float)formatLimit.x(), 0.0f, (float)formatLimit.x()),
+																	 de::clamp(valueMax.y() * (float)formatLimit.y(), 0.0f, (float)formatLimit.y()),
+																	 de::clamp(valueMax.z() * (float)formatLimit.z(), 0.0f, (float)formatLimit.z()));
 					const tcu::IVec3				colorMin		((int)deFloatFloor(colorMinF.x()),
-																	(int)deFloatFloor(colorMinF.y()),
-																	(int)deFloatFloor(colorMinF.z()));
+																	 (int)deFloatFloor(colorMinF.y()),
+																	 (int)deFloatFloor(colorMinF.z()));
 					const tcu::IVec3				colorMax		((int)deFloatCeil (colorMaxF.x()),
-																	(int)deFloatCeil (colorMaxF.y()),
-																	(int)deFloatCeil (colorMaxF.z()));
+																	 (int)deFloatCeil (colorMaxF.y()),
+																	 (int)deFloatCeil (colorMaxF.z()));
 
 					// Verify validity
 					if (pixelNativeColor.x() < colorMin.x() ||
@@ -2086,9 +2086,9 @@
 		const I64Vec2 pixelCenterPosition = I64Vec2(pixel.x(), pixel.y()) * I64Vec2(numSubPixels, numSubPixels) + I64Vec2(numSubPixels / 2, numSubPixels / 2);
 		const I64Vec2 triangleSubPixelSpaceRound[3] =
 		{
-			I64Vec2(deRoundFloatToInt32(triangleScreenSpace[0].x()*numSubPixels), deRoundFloatToInt32(triangleScreenSpace[0].y()*numSubPixels)),
-			I64Vec2(deRoundFloatToInt32(triangleScreenSpace[1].x()*numSubPixels), deRoundFloatToInt32(triangleScreenSpace[1].y()*numSubPixels)),
-			I64Vec2(deRoundFloatToInt32(triangleScreenSpace[2].x()*numSubPixels), deRoundFloatToInt32(triangleScreenSpace[2].y()*numSubPixels)),
+			I64Vec2(deRoundFloatToInt32(triangleScreenSpace[0].x() * (float)numSubPixels), deRoundFloatToInt32(triangleScreenSpace[0].y() * (float)numSubPixels)),
+			I64Vec2(deRoundFloatToInt32(triangleScreenSpace[1].x() * (float)numSubPixels), deRoundFloatToInt32(triangleScreenSpace[1].y() * (float)numSubPixels)),
+			I64Vec2(deRoundFloatToInt32(triangleScreenSpace[2].x() * (float)numSubPixels), deRoundFloatToInt32(triangleScreenSpace[2].y() * (float)numSubPixels)),
 		};
 
 		// Check (using cross product) if pixel center is
@@ -2138,15 +2138,15 @@
 		// both rounding directions
 		const I64Vec2 triangleSubPixelSpaceFloor[3] =
 		{
-			I64Vec2(deFloorFloatToInt32(triangleScreenSpace[0].x()*numSubPixels), deFloorFloatToInt32(triangleScreenSpace[0].y()*numSubPixels)),
-			I64Vec2(deFloorFloatToInt32(triangleScreenSpace[1].x()*numSubPixels), deFloorFloatToInt32(triangleScreenSpace[1].y()*numSubPixels)),
-			I64Vec2(deFloorFloatToInt32(triangleScreenSpace[2].x()*numSubPixels), deFloorFloatToInt32(triangleScreenSpace[2].y()*numSubPixels)),
+			I64Vec2(deFloorFloatToInt32(triangleScreenSpace[0].x() * (float)numSubPixels), deFloorFloatToInt32(triangleScreenSpace[0].y() * (float)numSubPixels)),
+			I64Vec2(deFloorFloatToInt32(triangleScreenSpace[1].x() * (float)numSubPixels), deFloorFloatToInt32(triangleScreenSpace[1].y() * (float)numSubPixels)),
+			I64Vec2(deFloorFloatToInt32(triangleScreenSpace[2].x() * (float)numSubPixels), deFloorFloatToInt32(triangleScreenSpace[2].y() * (float)numSubPixels)),
 		};
 		const I64Vec2 triangleSubPixelSpaceCeil[3] =
 		{
-			I64Vec2(deCeilFloatToInt32(triangleScreenSpace[0].x()*numSubPixels), deCeilFloatToInt32(triangleScreenSpace[0].y()*numSubPixels)),
-			I64Vec2(deCeilFloatToInt32(triangleScreenSpace[1].x()*numSubPixels), deCeilFloatToInt32(triangleScreenSpace[1].y()*numSubPixels)),
-			I64Vec2(deCeilFloatToInt32(triangleScreenSpace[2].x()*numSubPixels), deCeilFloatToInt32(triangleScreenSpace[2].y()*numSubPixels)),
+			I64Vec2(deCeilFloatToInt32(triangleScreenSpace[0].x() * (float)numSubPixels), deCeilFloatToInt32(triangleScreenSpace[0].y() * (float)numSubPixels)),
+			I64Vec2(deCeilFloatToInt32(triangleScreenSpace[1].x() * (float)numSubPixels), deCeilFloatToInt32(triangleScreenSpace[1].y() * (float)numSubPixels)),
+			I64Vec2(deCeilFloatToInt32(triangleScreenSpace[2].x() * (float)numSubPixels), deCeilFloatToInt32(triangleScreenSpace[2].y() * (float)numSubPixels)),
 		};
 		const I64Vec2* const corners = (multisample) ? (pixelCorners) : (pixelCenterCorners);
 
diff --git a/modules/glshared/glsScissorTests.cpp b/modules/glshared/glsScissorTests.cpp
index 6462182..96cbeea 100644
--- a/modules/glshared/glsScissorTests.cpp
+++ b/modules/glshared/glsScissorTests.cpp
@@ -159,7 +159,7 @@
 			break;
 
 		default:
-			DE_ASSERT(!"Unsupported version");
+			DE_FATAL("Unsupported version");
 	}
 
 	return glu::makeVtxFragSources(tcu::StringTemplate(vtxSource).specialize(params), tcu::StringTemplate(frgSource).specialize(params));
@@ -202,10 +202,10 @@
 	const glu::ShaderProgram	shader			(m_renderCtx, genShaders(glu::getContextTypeGLSLVersion(m_renderCtx.getType())));
 
 	const RandomViewport		viewport		(m_renderCtx.getRenderTarget(), 256, 256, deStringHash(getName()));
-	const IVec4					relScissorArea	(int(m_scissorArea.x()*viewport.width),
-												 int(m_scissorArea.y()*viewport.height),
-												 int(m_scissorArea.z()*viewport.width),
-												 int(m_scissorArea.w()*viewport.height));
+	const IVec4					relScissorArea	(int(m_scissorArea.x() * (float)viewport.width),
+												 int(m_scissorArea.y() * (float)viewport.height),
+												 int(m_scissorArea.z() * (float)viewport.width),
+												 int(m_scissorArea.w() * (float)viewport.height));
 	const IVec4					absScissorArea	(relScissorArea.x() + viewport.x,
 												 relScissorArea.y() + viewport.y,
 												 relScissorArea.z(),
@@ -380,7 +380,7 @@
 		}
 
 		for (int ndx = 0; ndx < indexCount; ndx++)
-			indices[primNdx*indexCount + ndx] = baseIndices[ndx] + primNdx*vertexCount;
+			indices[primNdx*indexCount + ndx] = (deUint16)(baseIndices[ndx] + primNdx*vertexCount);
 	}
 
 	gl.uniform4fv(gl.getUniformLocation(program, "u_color"), 1, white.m_data);
@@ -767,7 +767,7 @@
 		case CLEAR_COLOR_FLOAT:
 			retval.colorFmt	= GL_RGBA16F;
 			retval.texFmt	= tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::HALF_FLOAT);
-			DE_ASSERT(!"Floating point clear not implemented");// \todo [2014-1-23 otto] pixel read format & type, nothing guaranteed, need extension...
+			DE_FATAL("Floating point clear not implemented");// \todo [2014-1-23 otto] pixel read format & type, nothing guaranteed, need extension...
 			break;
 
 		case CLEAR_COLOR_INT:
diff --git a/modules/glshared/glsShaderExecUtil.cpp b/modules/glshared/glsShaderExecUtil.cpp
index fad4d71..019c526 100644
--- a/modules/glshared/glsShaderExecUtil.cpp
+++ b/modules/glshared/glsShaderExecUtil.cpp
@@ -486,7 +486,7 @@
 	vector<glu::VertexArrayBinding>			vertexArrays;
 	de::UniquePtr<glu::TransformFeedback>	transformFeedback	(useTFObject ? new glu::TransformFeedback(m_renderCtx) : DE_NULL);
 	glu::Buffer								outputBuffer		(m_renderCtx);
-	const int								outputBufferStride	= computeTotalScalarSize(m_outputs.begin(), m_outputs.end())*sizeof(deUint32);
+	const int								outputBufferStride	= computeTotalScalarSize(m_outputs.begin(), m_outputs.end())*(int)sizeof(deUint32);
 
 	// Setup inputs.
 	for (int inputNdx = 0; inputNdx < (int)m_inputs.size(); inputNdx++)
@@ -506,7 +506,7 @@
 		{
 			int		numRows	= glu::getDataTypeMatrixNumRows(basicType);
 			int		numCols	= glu::getDataTypeMatrixNumColumns(basicType);
-			int		stride	= numRows * numCols * sizeof(float);
+			int		stride	= numRows * numCols * (int)sizeof(float);
 
 			for (int colNdx = 0; colNdx < numCols; ++colNdx)
 				vertexArrays.push_back(glu::va::Float(symbol.name, colNdx, numRows, numValues, stride, ((const float*)ptr) + colNdx * numRows));
@@ -547,9 +547,9 @@
 			const int			scalarSize	= symbol.varType.getScalarSize();
 
 			for (int ndx = 0; ndx < numValues; ndx++)
-				deMemcpy((deUint32*)dstPtr + scalarSize*ndx, (const deUint8*)srcPtr + curOffset + ndx*outputBufferStride, scalarSize*sizeof(deUint32));
+				deMemcpy((deUint32*)dstPtr + scalarSize*ndx, (const deUint8*)srcPtr + curOffset + ndx*outputBufferStride, scalarSize*(int)sizeof(deUint32));
 
-			curOffset += scalarSize*sizeof(deUint32);
+			curOffset += scalarSize*(int)sizeof(deUint32);
 		}
 
 		gl.unmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);
@@ -751,7 +751,7 @@
 		{
 			int		numRows	= glu::getDataTypeMatrixNumRows(basicType);
 			int		numCols	= glu::getDataTypeMatrixNumColumns(basicType);
-			int		stride	= numRows * numCols * sizeof(float);
+			int		stride	= numRows * numCols * (int)sizeof(float);
 
 			for (int colNdx = 0; colNdx < numCols; ++colNdx)
 				vertexArrays.push_back(glu::va::Float(attribName, colNdx, numRows, numValues, stride, ((const float*)ptr) + colNdx * numRows));
@@ -966,7 +966,7 @@
 		if (glu::isDataTypeScalarOrVector(basicType))
 		{
 			const deUint32	alignment	= getVecStd430ByteAlignment(basicType);
-			const deUint32	size		= (deUint32)glu::getDataTypeScalarSize(basicType)*sizeof(deUint32);
+			const deUint32	size		= (deUint32)glu::getDataTypeScalarSize(basicType)*(int)sizeof(deUint32);
 
 			curOffset		= (deUint32)deAlign32((int)curOffset, (int)alignment);
 			maxAlignment	= de::max(maxAlignment, alignment);
@@ -1021,7 +1021,7 @@
 		{
 			for (int vecNdx = 0; vecNdx < numVecs; vecNdx++)
 			{
-				const int		srcOffset		= sizeof(deUint32)*(elemNdx*scalarSize + vecNdx*numComps);
+				const int		srcOffset		= (int)sizeof(deUint32)*(elemNdx*scalarSize + vecNdx*numComps);
 				const int		dstOffset		= layout.offset + layout.stride*elemNdx + (isMatrix ? layout.matrixStride*vecNdx : 0);
 				const deUint8*	srcPtr			= (const deUint8*)srcBasePtr + srcOffset;
 				deUint8*		dstPtr			= (deUint8*)dstBasePtr + dstOffset;
@@ -1049,7 +1049,7 @@
 			for (int vecNdx = 0; vecNdx < numVecs; vecNdx++)
 			{
 				const int		srcOffset		= layout.offset + layout.stride*elemNdx + (isMatrix ? layout.matrixStride*vecNdx : 0);
-				const int		dstOffset		= sizeof(deUint32)*(elemNdx*scalarSize + vecNdx*numComps);
+				const int		dstOffset		= (int)sizeof(deUint32)*(elemNdx*scalarSize + vecNdx*numComps);
 				const deUint8*	srcPtr			= (const deUint8*)srcBasePtr + srcOffset;
 				deUint8*		dstPtr			= (deUint8*)dstBasePtr + dstOffset;
 
diff --git a/modules/glshared/glsShaderLibraryCase.cpp b/modules/glshared/glsShaderLibraryCase.cpp
index 089d7a6..a37bb47 100644
--- a/modules/glshared/glsShaderLibraryCase.cpp
+++ b/modules/glshared/glsShaderLibraryCase.cpp
@@ -85,6 +85,17 @@
 	return version != glu::GLSL_VERSION_100_ES;
 }
 
+static int queryGLInt (const glu::RenderContext& renderCtx, deUint32 pname)
+{
+	const glw::Functions&	gl		= renderCtx.getFunctions();
+	glw::GLint				value	= 0;
+
+	gl.getIntegerv(pname, &value);
+	GLU_EXPECT_NO_ERROR(gl.getError(), ("query " + de::toString(glu::getGettableStateStr(pname))).c_str());
+
+	return value;
+}
+
 ShaderCase::ValueBlock::ValueBlock (void)
 	: arrayLength(0)
 {
@@ -575,7 +586,7 @@
 
 			case TYPE_SAMPLER_2D:
 			case TYPE_SAMPLER_CUBE:
-				DE_ASSERT(!"implement!");
+				DE_FATAL("implement!");
 				break;
 
 			default:
@@ -947,7 +958,7 @@
 						DE_ASSERT(scalarSize == numCols*numRows);
 
 						for (int i = 0; i < numCols; i++)
-							vertexArrays.push_back(va::Float(attribLoc + i, numRows, numVerticesPerDraw, scalarSize*sizeof(float), &scalars[i * numRows]));
+							vertexArrays.push_back(va::Float(attribLoc + i, numRows, numVerticesPerDraw, scalarSize*(int)sizeof(float), &scalars[i * numRows]));
 					}
 					else
 					{
@@ -1017,10 +1028,10 @@
 				// Read back results.
 				Surface			surface			(width, height);
 				const float		w				= s_positions[3];
-				const int		minY			= deCeilFloatToInt32 (((-quadSize / w) * 0.5f + 0.5f) * height + 1.0f);
-				const int		maxY			= deFloorFloatToInt32(((+quadSize / w) * 0.5f + 0.5f) * height - 0.5f);
-				const int		minX			= deCeilFloatToInt32 (((-quadSize / w) * 0.5f + 0.5f) * width + 1.0f);
-				const int		maxX			= deFloorFloatToInt32(((+quadSize / w) * 0.5f + 0.5f) * width - 0.5f);
+				const int		minY			= deCeilFloatToInt32 (((-quadSize / w) * 0.5f + 0.5f) * (float)height + 1.0f);
+				const int		maxY			= deFloorFloatToInt32(((+quadSize / w) * 0.5f + 0.5f) * (float)height - 0.5f);
+				const int		minX			= deCeilFloatToInt32 (((-quadSize / w) * 0.5f + 0.5f) * (float)width + 1.0f);
+				const int		maxX			= deFloorFloatToInt32(((+quadSize / w) * 0.5f + 0.5f) * (float)width - 0.5f);
 
 				GLU_EXPECT_NO_ERROR(postDrawError, "draw");
 
@@ -1493,7 +1504,7 @@
 	return withExt;
 }
 
-static map<string, string> generateVertexSpecialization (glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
+static map<string, string> generateVertexSpecialization (const glu::RenderContext& renderCtx, glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
 {
 	const bool				usesInout	= usesShaderInoutQualifiers(targetVersion);
 	const char*				vtxIn		= usesInout ? "in" : "attribute";
@@ -1501,6 +1512,8 @@
 	ostringstream			setup;
 	map<string, string>		params;
 
+	DE_UNREF(renderCtx);
+
 	decl << vtxIn << " highp vec4 dEQP_Position;\n";
 
 	for (int ndx = 0; ndx < (int)valueBlock.values.size(); ndx++)
@@ -1534,7 +1547,7 @@
 	return params;
 }
 
-static map<string, string> generateFragmentSpecialization (glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
+static map<string, string> generateFragmentSpecialization (const glu::RenderContext& renderCtx, glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
 {
 	const bool			usesInout		= usesShaderInoutQualifiers(targetVersion);
 	const bool			customColorOut	= usesInout;
@@ -1543,6 +1556,8 @@
 	ostringstream		output;
 	map<string, string>	params;
 
+	DE_UNREF(renderCtx);
+
 	genCompareFunctions(decl, valueBlock, false);
 	genCompareOp(output, fragColor, valueBlock, "", DE_NULL);
 
@@ -1573,11 +1588,12 @@
 	return params;
 }
 
-static map<string, string> generateGeometrySpecialization (glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
+static map<string, string> generateGeometrySpecialization (const glu::RenderContext& renderCtx, glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
 {
 	ostringstream		decl;
 	map<string, string>	params;
 
+	DE_UNREF(renderCtx);
 	DE_UNREF(targetVersion);
 
 	decl << "layout (triangles) in;\n";
@@ -1601,7 +1617,7 @@
 	return params;
 }
 
-static map<string, string> generateTessControlSpecialization (glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
+static map<string, string> generateTessControlSpecialization (const glu::RenderContext& renderCtx, glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
 {
 	ostringstream		decl;
 	ostringstream		output;
@@ -1635,10 +1651,11 @@
 
 	params.insert(pair<string, string>("TESSELLATION_CONTROL_DECLARATIONS",	decl.str()));
 	params.insert(pair<string, string>("TESSELLATION_CONTROL_OUTPUT",		output.str()));
+	params.insert(pair<string, string>("GL_MAX_PATCH_VERTICES",				de::toString(queryGLInt(renderCtx, GL_MAX_PATCH_VERTICES))));
 	return params;
 }
 
-static map<string, string> generateTessEvalSpecialization (glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
+static map<string, string> generateTessEvalSpecialization (const glu::RenderContext& renderCtx, glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
 {
 	ostringstream		decl;
 	ostringstream		output;
@@ -1666,14 +1683,22 @@
 
 	params.insert(pair<string, string>("TESSELLATION_EVALUATION_DECLARATIONS",	decl.str()));
 	params.insert(pair<string, string>("TESSELLATION_EVALUATION_OUTPUT",		output.str()));
+	params.insert(pair<string, string>("GL_MAX_PATCH_VERTICES",					de::toString(queryGLInt(renderCtx, GL_MAX_PATCH_VERTICES))));
 	return params;
 }
 
-static void specializeShaders (glu::ProgramSources& dst, glu::ShaderType shaderType, const std::vector<std::string>& sources, const ShaderCase::ValueBlock& valueBlock, glu::GLSLVersion targetVersion, const std::vector<ShaderCase::CaseRequirement>& requirements, std::map<std::string, std::string> (*specializationGenerator)(glu::GLSLVersion, const ShaderCase::ValueBlock&))
+static void specializeShaders (const glu::RenderContext&						renderCtx,
+							   glu::ProgramSources&								dst,
+							   glu::ShaderType									shaderType,
+							   const std::vector<std::string>&					sources,
+							   const ShaderCase::ValueBlock&					valueBlock,
+							   glu::GLSLVersion									targetVersion,
+							   const std::vector<ShaderCase::CaseRequirement>&	requirements,
+							   std::map<std::string, std::string>				(*specializationGenerator)(const glu::RenderContext&, glu::GLSLVersion, const ShaderCase::ValueBlock&))
 {
 	if (!sources.empty())
 	{
-		const std::map<std::string, std::string> specializationParams = specializationGenerator(targetVersion, valueBlock);
+		const std::map<std::string, std::string> specializationParams = specializationGenerator(renderCtx, targetVersion, valueBlock);
 
 		for (int ndx = 0; ndx < (int)sources.size(); ++ndx)
 		{
@@ -1688,27 +1713,27 @@
 
 void ShaderCase::specializeVertexShaders (glu::ProgramSources& dst, const std::vector<std::string>& sources, const ValueBlock& valueBlock, const std::vector<ShaderCase::CaseRequirement>& requirements) const
 {
-	specializeShaders(dst, glu::SHADERTYPE_VERTEX, sources, valueBlock, m_targetVersion, requirements, generateVertexSpecialization);
+	specializeShaders(m_renderCtx, dst, glu::SHADERTYPE_VERTEX, sources, valueBlock, m_targetVersion, requirements, generateVertexSpecialization);
 }
 
 void ShaderCase::specializeFragmentShaders (glu::ProgramSources& dst, const std::vector<std::string>& sources, const ValueBlock& valueBlock, const std::vector<ShaderCase::CaseRequirement>& requirements) const
 {
-	specializeShaders(dst, glu::SHADERTYPE_FRAGMENT, sources, valueBlock, m_targetVersion, requirements, generateFragmentSpecialization);
+	specializeShaders(m_renderCtx, dst, glu::SHADERTYPE_FRAGMENT, sources, valueBlock, m_targetVersion, requirements, generateFragmentSpecialization);
 }
 
 void ShaderCase::specializeGeometryShaders (glu::ProgramSources& dst, const std::vector<std::string>& sources, const ValueBlock& valueBlock, const std::vector<ShaderCase::CaseRequirement>& requirements) const
 {
-	specializeShaders(dst, glu::SHADERTYPE_GEOMETRY, sources, valueBlock, m_targetVersion, requirements, generateGeometrySpecialization);
+	specializeShaders(m_renderCtx, dst, glu::SHADERTYPE_GEOMETRY, sources, valueBlock, m_targetVersion, requirements, generateGeometrySpecialization);
 }
 
 void ShaderCase::specializeTessControlShaders (glu::ProgramSources& dst, const std::vector<std::string>& sources, const ValueBlock& valueBlock, const std::vector<ShaderCase::CaseRequirement>& requirements) const
 {
-	specializeShaders(dst, glu::SHADERTYPE_TESSELLATION_CONTROL, sources, valueBlock, m_targetVersion, requirements, generateTessControlSpecialization);
+	specializeShaders(m_renderCtx, dst, glu::SHADERTYPE_TESSELLATION_CONTROL, sources, valueBlock, m_targetVersion, requirements, generateTessControlSpecialization);
 }
 
 void ShaderCase::specializeTessEvalShaders (glu::ProgramSources& dst, const std::vector<std::string>& sources, const ValueBlock& valueBlock, const std::vector<ShaderCase::CaseRequirement>& requirements) const
 {
-	specializeShaders(dst, glu::SHADERTYPE_TESSELLATION_EVALUATION, sources, valueBlock, m_targetVersion, requirements, generateTessEvalSpecialization);
+	specializeShaders(m_renderCtx, dst, glu::SHADERTYPE_TESSELLATION_EVALUATION, sources, valueBlock, m_targetVersion, requirements, generateTessEvalSpecialization);
 }
 
 void ShaderCase::dumpValues (const ValueBlock& valueBlock, int arrayNdx)
diff --git a/modules/glshared/glsShaderRenderCase.cpp b/modules/glshared/glsShaderRenderCase.cpp
index e7dddf9..2bdb94b 100644
--- a/modules/glshared/glsShaderRenderCase.cpp
+++ b/modules/glshared/glsShaderRenderCase.cpp
@@ -64,22 +64,6 @@
 static const int			MAX_RENDER_HEIGHT		= 112;
 static const tcu::Vec4		DEFAULT_CLEAR_COLOR		= tcu::Vec4(0.125f, 0.25f, 0.5f, 1.0f);
 
-inline RGBA toRGBA (const Vec4& a)
-{
-	return RGBA(deClamp32(deRoundFloatToInt32(a.x() * 255.0f), 0, 255),
-				deClamp32(deRoundFloatToInt32(a.y() * 255.0f), 0, 255),
-				deClamp32(deRoundFloatToInt32(a.z() * 255.0f), 0, 255),
-				deClamp32(deRoundFloatToInt32(a.w() * 255.0f), 0, 255));
-}
-
-inline tcu::Vec4 toVec (const RGBA& c)
-{
-	return tcu::Vec4(c.getRed()		/ 255.0f,
-					 c.getGreen()	/ 255.0f,
-					 c.getBlue()	/ 255.0f,
-					 c.getAlpha()	/ 255.0f);
-}
-
 // TextureBinding
 
 TextureBinding::TextureBinding (const glu::Texture2D* tex2D, const tcu::Sampler& sampler)
@@ -214,8 +198,8 @@
 	for (int y = 0; y < gridSize+1; y++)
 	for (int x = 0; x < gridSize+1; x++)
 	{
-		float				sx			= x / (float)gridSize;
-		float				sy			= y / (float)gridSize;
+		float				sx			= (float)x / (float)gridSize;
+		float				sy			= (float)y / (float)gridSize;
 		float				fx			= 2.0f * sx - 1.0f;
 		float				fy			= 2.0f * sy - 1.0f;
 		int					vtxNdx		= ((y * (gridSize+1)) + x);
@@ -242,13 +226,13 @@
 		int v11 = ((y+1) * stride) + x + 1;
 
 		int baseNdx = ((y * gridSize) + x) * 6;
-		m_indices[baseNdx + 0] = v10;
-		m_indices[baseNdx + 1] = v00;
-		m_indices[baseNdx + 2] = v01;
+		m_indices[baseNdx + 0] = (deUint16)v10;
+		m_indices[baseNdx + 1] = (deUint16)v00;
+		m_indices[baseNdx + 2] = (deUint16)v01;
 
-		m_indices[baseNdx + 3] = v10;
-		m_indices[baseNdx + 4] = v01;
-		m_indices[baseNdx + 5] = v11;
+		m_indices[baseNdx + 3] = (deUint16)v10;
+		m_indices[baseNdx + 4] = (deUint16)v01;
+		m_indices[baseNdx + 5] = (deUint16)v11;
 	}
 }
 
@@ -663,8 +647,8 @@
 	for (int y = 0; y < gridSize+1; y++)
 	for (int x = 0; x < gridSize+1; x++)
 	{
-		float				sx			= x / (float)gridSize;
-		float				sy			= y / (float)gridSize;
+		float				sx			= (float)x / (float)gridSize;
+		float				sy			= (float)y / (float)gridSize;
 		int					vtxNdx		= ((y * (gridSize+1)) + x);
 
 		evalCtx.reset(sx, sy);
@@ -682,10 +666,10 @@
 	for (int y = 0; y < gridSize; y++)
 	for (int x = 0; x < gridSize; x++)
 	{
-		float x0 = x / (float)gridSize;
-		float x1 = (x + 1) / (float)gridSize;
-		float y0 = y / (float)gridSize;
-		float y1 = (y + 1) / (float)gridSize;
+		float x0 = (float)x       / (float)gridSize;
+		float x1 = (float)(x + 1) / (float)gridSize;
+		float y0 = (float)y       / (float)gridSize;
+		float y1 = (float)(y + 1) / (float)gridSize;
 
 		float sx0 = x0 * (float)width;
 		float sx1 = x1 * (float)width;
@@ -730,7 +714,7 @@
 			const Vec4&	t2		= tri ? c10 : c01;
 			Vec4		color	= t0 + (t1-t0)*tx + (t2-t0)*ty;
 
-			result.setPixel(ix, iy, toRGBA(color));
+			result.setPixel(ix, iy, tcu::RGBA(color));
 		}
 	}
 }
@@ -758,7 +742,7 @@
 		if (!hasAlpha)
 			color.w() = 1.0f;
 
-		result.setPixel(x, y, toRGBA(color));
+		result.setPixel(x, y, tcu::RGBA(color));
 	}
 }
 
diff --git a/modules/glshared/glsStateChangePerfTestCases.cpp b/modules/glshared/glsStateChangePerfTestCases.cpp
index aacb05e..51ab6aa 100644
--- a/modules/glshared/glsStateChangePerfTestCases.cpp
+++ b/modules/glshared/glsStateChangePerfTestCases.cpp
@@ -71,7 +71,7 @@
 	for (int i = 0; i < (int)values.size(); i++)
 		sum += values[i];
 
-	result.mean = ((double)sum) / values.size();
+	result.mean = ((double)sum) / (double)values.size();
 
 	for (int i = 0; i < (int)values.size(); i++)
 	{
@@ -79,7 +79,7 @@
 		result.variance += (val - result.mean) * (val - result.mean);
 	}
 
-	result.variance /= values.size();
+	result.variance /= (double)values.size();
 
 	{
 		const int n = (int)(values.size()/2);
@@ -107,9 +107,9 @@
 
 	for (int triangleNdx = 0; triangleNdx < triangleCount; triangleNdx++)
 	{
-		indices.push_back((GLushort)triangleNdx*3);
-		indices.push_back((GLushort)triangleNdx*3+1);
-		indices.push_back((GLushort)triangleNdx*3+2);
+		indices.push_back((GLushort)(triangleNdx*3));
+		indices.push_back((GLushort)(triangleNdx*3+1));
+		indices.push_back((GLushort)(triangleNdx*3+2));
 	}
 }
 
@@ -173,7 +173,7 @@
 		sum += (value - avg) * (value - avg);
 	}
 
-	return sum / values.size();
+	return sum / (double)values.size();
 }
 
 deUint64 findMin (const vector<deUint64>& values)
@@ -681,7 +681,7 @@
 	for (int valueNdx = 0; valueNdx < (int)values.size(); valueNdx++)
 		sum += values[valueNdx];
 
-	return ((double)sum) / values.size();
+	return ((double)sum) / (double)values.size();
 }
 
 void StateChangeCallPerformanceCase::logAndSetTestResult (void)
diff --git a/modules/glshared/glsStateQueryUtil.cpp b/modules/glshared/glsStateQueryUtil.cpp
index 1242c8d..5edbc1a 100644
--- a/modules/glshared/glsStateQueryUtil.cpp
+++ b/modules/glshared/glsStateQueryUtil.cpp
@@ -1736,7 +1736,7 @@
 
 static float normalizeI32Float (deInt32 c)
 {
-	return de::max(c / float((1ul << 31) - 1u), -1.0f);
+	return de::max((float)c / float((1ul << 31) - 1u), -1.0f);
 }
 
 void verifyNormalizedI32Vec4 (tcu::ResultCollector& result, QueriedState& state, const tcu::IVec4& expected)
diff --git a/modules/glshared/glsTextureBufferCase.cpp b/modules/glshared/glsTextureBufferCase.cpp
index 21787a2..8954cf4 100644
--- a/modules/glshared/glsTextureBufferCase.cpp
+++ b/modules/glshared/glsTextureBufferCase.cpp
@@ -41,6 +41,7 @@
 #include "gluShaderUtil.hpp"
 #include "gluStrUtil.hpp"
 #include "gluTexture.hpp"
+#include "gluTextureUtil.hpp"
 
 #include "glwEnums.hpp"
 #include "glwFunctions.hpp"
@@ -82,16 +83,9 @@
 
 deUint8 extend2BitsToByte (deUint8 bits)
 {
-	deUint8 x = 0;
-
 	DE_ASSERT((bits & (~0x03u)) == 0);
 
-	x |= bits << 6;
-	x |= bits << 4;
-	x |= bits << 2;
-	x |= bits;
-
-	return x;
+	return (deUint8)(bits | (bits << 2) | (bits << 4) | (bits << 6));
 }
 
 void genRandomCoords (de::Random rng, vector<deUint8>& coords, size_t offset, size_t size)
@@ -211,7 +205,7 @@
 	}
 
 private:
-	const tcu::ConstPixelBufferAccess& m_texture;
+	const tcu::ConstPixelBufferAccess m_texture;
 };
 
 class CoordFragmentShader : public rr::FragmentShader
@@ -294,7 +288,7 @@
 	}
 
 private:
-	const tcu::ConstPixelBufferAccess& m_texture;
+	const tcu::ConstPixelBufferAccess m_texture;
 };
 
 string generateVertexShaderTemplate (RenderBits renderBits)
@@ -435,7 +429,12 @@
 
 	log << TestLog::Message << "BufferData, Size: " << data.size() << TestLog::EndMessage;
 
-	texture.bufferData(&(data[0]), data.size());
+	{
+		// replace getRefBuffer with a new buffer
+		de::ArrayBuffer<deUint8> buffer(&(data[0]), data.size());
+		texture.getRefBuffer().swap(buffer);
+	}
+
 	texture.upload();
 }
 
@@ -445,7 +444,7 @@
 						  glu::TextureBuffer&	texture)
 {
 	const size_t				minSize		= 4*16;
-	const size_t				size		= de::max<size_t>(minSize, size_t((texture.getSize() != 0 ? texture.getSize() : texture.getBufferSize()) * (0.7 + 0.3 * rng.getFloat())));
+	const size_t				size		= de::max<size_t>(minSize, size_t((float)(texture.getSize() != 0 ? texture.getSize() : texture.getBufferSize()) * (0.7f + 0.3f * rng.getFloat())));
 	const size_t				minOffset	= texture.getOffset();
 	const size_t				offset		= minOffset + (rng.getUint32() % (texture.getBufferSize() - (size + minOffset)));
 	vector<deUint8>				data;
@@ -459,7 +458,7 @@
 	gl.bindBuffer(GL_TEXTURE_BUFFER, 0);
 	GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to update data with glBufferSubData()");
 
-	deMemcpy(texture.getRefBuffer() + offset, &(data[0]), int(data.size()));
+	deMemcpy((deUint8*)texture.getRefBuffer().getPtr() + offset, &(data[0]), int(data.size()));
 }
 
 void modifyMapWrite (TestLog&				log,
@@ -468,7 +467,7 @@
 					 glu::TextureBuffer&	texture)
 {
 	const size_t				minSize		= 4*16;
-	const size_t				size		= de::max<size_t>(minSize, size_t((texture.getSize() != 0 ? texture.getSize() : texture.getBufferSize()) * (0.7 + 0.3 * rng.getFloat())));
+	const size_t				size		= de::max<size_t>(minSize, size_t((float)(texture.getSize() != 0 ? texture.getSize() : texture.getBufferSize()) * (0.7f + 0.3f * rng.getFloat())));
 	const size_t				minOffset	= texture.getOffset();
 	const size_t				offset		= minOffset + (rng.getUint32() % (texture.getBufferSize() - (size + minOffset)));
 	vector<deUint8>				data;
@@ -492,7 +491,7 @@
 	gl.bindBuffer(GL_TEXTURE_BUFFER, 0);
 	GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to update data with glMapBufferRange()");
 
-	deMemcpy(texture.getRefBuffer()+offset, &(data[0]), int(data.size()));
+	deMemcpy((deUint8*)texture.getRefBuffer().getPtr()+offset, &(data[0]), int(data.size()));
 }
 
 void modifyMapReadWrite (TestLog&				log,
@@ -502,9 +501,10 @@
 						 glu::TextureBuffer&	texture)
 {
 	const size_t				minSize		= 4*16;
-	const size_t				size		= de::max<size_t>(minSize, size_t((texture.getSize() != 0 ? texture.getSize() : texture.getBufferSize()) * (0.7 + 0.3 * rng.getFloat())));
+	const size_t				size		= de::max<size_t>(minSize, size_t((float)(texture.getSize() != 0 ? texture.getSize() : texture.getBufferSize()) * (0.7f + 0.3f * rng.getFloat())));
 	const size_t				minOffset	= texture.getOffset();
 	const size_t				offset		= minOffset + (rng.getUint32() % (texture.getBufferSize() - (size + minOffset)));
+	deUint8* const				refPtr		= (deUint8*)texture.getRefBuffer().getPtr() + offset;
 	vector<deUint8>				data;
 
 	genRandomCoords(rng, data, offset, size);
@@ -521,10 +521,10 @@
 
 		for (int i = 0; i < (int)data.size(); i++)
 		{
-			if (ptr[i] != texture.getRefBuffer()[offset+i])
+			if (ptr[i] != refPtr[i])
 			{
 				if (invalidBytes < 24)
-					log << TestLog::Message << "Invalid byte in mapped buffer. " << tcu::Format::Hex<2>(data[i]).toString() << " at " << i << ", expected " << tcu::Format::Hex<2>(texture.getRefBuffer()[i]).toString() << TestLog::EndMessage;
+					log << TestLog::Message << "Invalid byte in mapped buffer. " << tcu::Format::Hex<2>(data[i]).toString() << " at " << i << ", expected " << tcu::Format::Hex<2>(refPtr[i]).toString() << TestLog::EndMessage;
 
 				invalidBytes++;
 			}
@@ -545,7 +545,7 @@
 	GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to update data with glMapBufferRange()");
 
 	for (int i = 0; i < (int)data.size(); i++)
-		texture.getRefBuffer()[offset+i] = data[i];
+		refPtr[i] = data[i];
 }
 
 void modify (TestLog&						log,
@@ -656,31 +656,34 @@
 void renderReference (RenderBits					renderBits,
 					  deUint32						coordSeed,
 					  int							triangleCount,
-					  glu::TextureBuffer&			texture,
+					  const glu::TextureBuffer&		texture,
+					  int							maxTextureBufferSize,
 					  const tcu::PixelBufferAccess&	target)
 {
-	const CoordVertexShader			coordVertexShader;
-	const TextureVertexShader		textureVertexShader		(texture.getRefTexture());
-	const rr::VertexShader* const	vertexShader			= (renderBits & RENDERBITS_AS_VERTEX_TEXTURE ? static_cast<const rr::VertexShader*>(&textureVertexShader) : &coordVertexShader);
+	const tcu::ConstPixelBufferAccess	effectiveAccess			= glu::getTextureBufferEffectiveRefTexture(texture, maxTextureBufferSize);
 
-	const CoordFragmentShader		coordFragmmentShader;
-	const TextureFragmentShader		textureFragmentShader	(texture.getRefTexture());
-	const rr::FragmentShader* const	fragmentShader			= (renderBits & RENDERBITS_AS_FRAGMENT_TEXTURE ? static_cast<const rr::FragmentShader*>(&textureFragmentShader) : &coordFragmmentShader);
+	const CoordVertexShader				coordVertexShader;
+	const TextureVertexShader			textureVertexShader		(effectiveAccess);
+	const rr::VertexShader* const		vertexShader			= (renderBits & RENDERBITS_AS_VERTEX_TEXTURE ? static_cast<const rr::VertexShader*>(&textureVertexShader) : &coordVertexShader);
 
-	const rr::Renderer				renderer;
-	const rr::RenderState			renderState(rr::ViewportState(rr::WindowRectangle(0, 0, target.getWidth(), target.getHeight())));
-	const rr::RenderTarget			renderTarget(rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(target));
+	const CoordFragmentShader			coordFragmmentShader;
+	const TextureFragmentShader			textureFragmentShader	(effectiveAccess);
+	const rr::FragmentShader* const		fragmentShader			= (renderBits & RENDERBITS_AS_FRAGMENT_TEXTURE ? static_cast<const rr::FragmentShader*>(&textureFragmentShader) : &coordFragmmentShader);
 
-	const rr::Program				program(vertexShader, fragmentShader);
+	const rr::Renderer					renderer;
+	const rr::RenderState				renderState(rr::ViewportState(rr::WindowRectangle(0, 0, target.getWidth(), target.getHeight())));
+	const rr::RenderTarget				renderTarget(rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(target));
 
-	rr::VertexAttrib				vertexAttribs[1];
-	vector<deUint8>					coords;
+	const rr::Program					program(vertexShader, fragmentShader);
+
+	rr::VertexAttrib					vertexAttribs[1];
+	vector<deUint8>						coords;
 
 	if (renderBits & RENDERBITS_AS_VERTEX_ARRAY)
 	{
 		vertexAttribs[0].type			= rr::VERTEXATTRIBTYPE_NONPURE_UNORM8;
 		vertexAttribs[0].size			= 2;
-		vertexAttribs[0].pointer		= texture.getRefBuffer();
+		vertexAttribs[0].pointer		= texture.getRefBuffer().getPtr();
 	}
 	else
 	{
@@ -695,7 +698,7 @@
 
 	if (renderBits & RENDERBITS_AS_INDEX_ARRAY)
 	{
-		const rr::PrimitiveList	primitives(rr::PRIMITIVETYPE_TRIANGLES, triangleCount * 3, rr::DrawIndices((const void*)texture.getRefBuffer(), rr::INDEXTYPE_UINT8));
+		const rr::PrimitiveList	primitives(rr::PRIMITIVETYPE_TRIANGLES, triangleCount * 3, rr::DrawIndices(texture.getRefBuffer().getPtr(), rr::INDEXTYPE_UINT8));
 		const rr::DrawCommand	cmd(renderState, renderTarget, program, 1, vertexAttribs, primitives);
 
 		renderer.draw(cmd);
@@ -759,14 +762,19 @@
 			 glu::TextureBuffer&			texture,
 			 const tcu::PixelBufferAccess&	target)
 {
-	const tcu::ScopedLogSection	renderSection	(log, "Render Texture buffer", "Render Texture Buffer");
-	const int					triangleCount	= 8;
-	const deUint32				coordSeed		= rng.getUint32();
+	const tcu::ScopedLogSection	renderSection			(log, "Render Texture buffer", "Render Texture Buffer");
+	const int					triangleCount			= 8;
+	const deUint32				coordSeed				= rng.getUint32();
+	int							maxTextureBufferSize	= 0;
+
+	renderContext.getFunctions().getIntegerv(GL_MAX_TEXTURE_BUFFER_SIZE, &maxTextureBufferSize);
+	GLU_EXPECT_NO_ERROR(renderContext.getFunctions().getError(), "query GL_MAX_TEXTURE_BUFFER_SIZE");
+	DE_ASSERT(maxTextureBufferSize > 0); // checked in init()
 
 	logRendering(log, renderBits);
 
 	renderGL(renderContext, renderBits, coordSeed, triangleCount, program, texture);
-	renderReference(renderBits, coordSeed, triangleCount, texture, target);
+	renderReference(renderBits, coordSeed, triangleCount, texture, maxTextureBufferSize, target);
 }
 
 void verifyScreen (TestLog&								log,
@@ -830,7 +838,7 @@
 {
 	const tcu::ScopedLogSection	section(log, "Texture Info", "Texture Info");
 
-	log << TestLog::Message << "Texture format : " << glu::getPixelFormatStr(format) << TestLog::EndMessage;
+	log << TestLog::Message << "Texture format : " << glu::getTextureFormatStr(format) << TestLog::EndMessage;
 	log << TestLog::Message << "Buffer size : " << bufferSize << TestLog::EndMessage;
 
 	if (offset != 0 || size != 0)
@@ -958,6 +966,12 @@
 		&& !(glu::contextSupports(m_renderCtx.getType(), glu::ApiType(3, 1, glu::PROFILE_ES)) && info->isExtensionSupported("GL_EXT_texture_buffer")))
 		throw tcu::NotSupportedError("Texture buffers not supported", "", __FILE__, __LINE__);
 
+	{
+		const int maxTextureBufferSize = info->getInt(GL_MAX_TEXTURE_BUFFER_SIZE);
+		if (maxTextureBufferSize <= 0)
+			TCU_THROW(NotSupportedError, "GL_MAX_TEXTURE_BUFFER_SIZE > 0 required");
+	}
+
 	if (m_preRender != 0)
 	{
 		TestLog&					log			= m_testCtx.getLog();
diff --git a/modules/glshared/glsTextureStateQueryTests.cpp b/modules/glshared/glsTextureStateQueryTests.cpp
index a35de5f..945c238 100644
--- a/modules/glshared/glsTextureStateQueryTests.cpp
+++ b/modules/glshared/glsTextureStateQueryTests.cpp
@@ -2356,17 +2356,17 @@
 {
 	if (isMultisampleTarget(target) && isSamplerStateTester(tester))
 	{
-		DE_ASSERT(!"Multisample textures have no sampler state");
+		DE_FATAL("Multisample textures have no sampler state");
 		return DE_NULL;
 	}
 	if (target == GL_TEXTURE_BUFFER)
 	{
-		DE_ASSERT(!"Buffer textures have no texture state");
+		DE_FATAL("Buffer textures have no texture state");
 		return DE_NULL;
 	}
 	if (target != GL_TEXTURE_3D && mapTesterToPname(tester) == GL_TEXTURE_WRAP_R)
 	{
-		DE_ASSERT(!"Only 3D textures have wrap r filter");
+		DE_FATAL("Only 3D textures have wrap r filter");
 		return DE_NULL;
 	}
 
diff --git a/modules/glshared/glsTextureTestUtil.cpp b/modules/glshared/glsTextureTestUtil.cpp
index 5966e22..452f3c9 100644
--- a/modules/glshared/glsTextureTestUtil.cpp
+++ b/modules/glshared/glsTextureTestUtil.cpp
@@ -213,7 +213,7 @@
 
 // 1D lookup LOD computation.
 
-inline float computeLodFromDerivates (LodMode mode, float dudx, float dudy)
+float computeLodFromDerivates (LodMode mode, float dudx, float dudy)
 {
 	float p = 0.0f;
 	switch (mode)
@@ -244,7 +244,7 @@
 
 // 2D lookup LOD computation.
 
-inline float computeLodFromDerivates (LodMode mode, float dudx, float dvdx, float dudy, float dvdy)
+float computeLodFromDerivates (LodMode mode, float dudx, float dvdx, float dudy, float dvdy)
 {
 	float p = 0.0f;
 	switch (mode)
@@ -284,7 +284,7 @@
 
 // 3D lookup LOD computation.
 
-inline float computeLodFromDerivates (LodMode mode, float dudx, float dvdx, float dwdx, float dudy, float dvdy, float dwdy)
+float computeLodFromDerivates (LodMode mode, float dudx, float dvdx, float dwdx, float dudy, float dvdy, float dwdy)
 {
 	float p = 0.0f;
 	switch (mode)
@@ -982,13 +982,6 @@
 	}
 }
 
-void clear (const SurfaceAccess& dst, const tcu::Vec4& color)
-{
-	for (int y = 0; y < dst.getHeight(); y++)
-		for (int x = 0; x < dst.getWidth(); x++)
-			dst.setPixel(color, x, y);
-}
-
 bool compareImages (TestLog& log, const tcu::Surface& reference, const tcu::Surface& rendered, tcu::RGBA threshold)
 {
 	return tcu::pixelThresholdCompare(log, "Result", "Image comparison result", reference, rendered, threshold, tcu::COMPARE_LOG_RESULT);
@@ -1148,7 +1141,7 @@
 		params["FRAG_COLOR"]	= "dEQP_FragColor";
 	}
 	else
-		DE_ASSERT(!"Unsupported version");
+		DE_FATAL("Unsupported version");
 
 	params["PRECISION"]		= glu::getPrecisionName(m_texCoordPrecision);
 
@@ -1234,7 +1227,7 @@
 		}
 	}
 	else
-		DE_ASSERT(!"Unsupported version");
+		DE_FATAL("Unsupported version");
 
 	params["SAMPLER_TYPE"]	= sampler;
 	params["LOOKUP"]		= lookup;
@@ -3247,10 +3240,10 @@
 	for (int x = 0; x < dst.getWidth(); x++)
 	{
 		const tcu::Vec4	result	= dst.getPixel(x, y);
-		const int		minX		= deFloorFloatToInt32(float(x-0.5f) / dstW * srcW);
-		const int		minY		= deFloorFloatToInt32(float(y-0.5f) / dstH * srcH);
-		const int		maxX		= deCeilFloatToInt32(float(x+1.5f) / dstW * srcW);
-		const int		maxY		= deCeilFloatToInt32(float(y+1.5f) / dstH * srcH);
+		const int		minX		= deFloorFloatToInt32(((float)x-0.5f) / dstW * srcW);
+		const int		minY		= deFloorFloatToInt32(((float)y-0.5f) / dstH * srcH);
+		const int		maxX		= deCeilFloatToInt32(((float)x+1.5f) / dstW * srcW);
+		const int		maxY		= deCeilFloatToInt32(((float)y+1.5f) / dstH * srcH);
 		tcu::Vec4		minVal, maxVal;
 		bool			isOk;
 
diff --git a/modules/glshared/glsTextureTestUtil.hpp b/modules/glshared/glsTextureTestUtil.hpp
index 6225efb..c7a8af1 100644
--- a/modules/glshared/glsTextureTestUtil.hpp
+++ b/modules/glshared/glsTextureTestUtil.hpp
@@ -240,14 +240,6 @@
 	RandomViewport (const tcu::RenderTarget& renderTarget, int preferredWidth, int preferredHeight, deUint32 seed);
 };
 
-inline tcu::RGBA toRGBA (const tcu::Vec4& v)
-{
-	return tcu::RGBA(tcu::floatToU8(v.x()),
-					 tcu::floatToU8(v.y()),
-					 tcu::floatToU8(v.z()),
-					 tcu::floatToU8(v.w()));
-}
-
 inline tcu::RGBA toRGBAMasked (const tcu::Vec4& v, deUint8 mask)
 {
 	return tcu::RGBA((mask&tcu::RGBA::RED_MASK)		? tcu::floatToU8(v.x()) : 0,
@@ -256,20 +248,18 @@
 					 (mask&tcu::RGBA::ALPHA_MASK)	? tcu::floatToU8(v.w()) : 0xFF); //!< \note Alpha defaults to full saturation when reading masked format
 }
 
+// \todo[jarkko 2015-05-19] remove this
 inline tcu::Vec4 toVec4 (const tcu::RGBA& c)
 {
-	return tcu::Vec4(c.getRed()		/ 255.0f,
-					 c.getGreen()	/ 255.0f,
-					 c.getBlue()	/ 255.0f,
-					 c.getAlpha()	/ 255.0f);
+	return c.toVec();
 }
 
 inline deUint8 getColorMask (const tcu::PixelFormat& format)
 {
-	return (format.redBits		? tcu::RGBA::RED_MASK	: 0) |
-		   (format.greenBits	? tcu::RGBA::GREEN_MASK	: 0) |
-		   (format.blueBits		? tcu::RGBA::BLUE_MASK	: 0) |
-		   (format.alphaBits	? tcu::RGBA::ALPHA_MASK	: 0);
+	return (deUint8)((format.redBits	? tcu::RGBA::RED_MASK	: 0) |
+					 (format.greenBits	? tcu::RGBA::GREEN_MASK	: 0) |
+					 (format.blueBits	? tcu::RGBA::BLUE_MASK	: 0) |
+					 (format.alphaBits	? tcu::RGBA::ALPHA_MASK	: 0));
 }
 
 inline tcu::IVec4 getBitsVec (const tcu::PixelFormat& format)
@@ -354,8 +344,6 @@
 	int					maxLevel;
 };
 
-void			clear						(const SurfaceAccess& dst, const tcu::Vec4& color);
-
 // Similar to sampleTexture() except uses texelFetch.
 void			fetchTexture				(const SurfaceAccess& dst, const tcu::ConstPixelBufferAccess& src, const float* texCoord, const tcu::Vec4& colorScale, const tcu::Vec4& colorBias);
 
@@ -367,6 +355,10 @@
 void			sampleTexture				(const SurfaceAccess& dst, const tcu::Texture1DView&		src, const float* texCoord, const ReferenceParams& params);
 void			sampleTexture				(const SurfaceAccess& dst, const tcu::Texture1DArrayView&	src, const float* texCoord, const ReferenceParams& params);
 
+float			computeLodFromDerivates		(LodMode mode, float dudx, float dudy);
+float			computeLodFromDerivates		(LodMode mode, float dudx, float dvdx, float dudy, float dvdy);
+float			computeLodFromDerivates		(LodMode mode, float dudx, float dvdx, float dwdx, float dudy, float dvdy, float dwdy);
+
 void			computeQuadTexCoord1D			(std::vector<float>& dst, float left, float right);
 void			computeQuadTexCoord1DArray		(std::vector<float>& dst, int layerNdx, float left, float right);
 void			computeQuadTexCoord2D			(std::vector<float>& dst, const tcu::Vec2& bottomLeft, const tcu::Vec2& topRight);
diff --git a/modules/glshared/glsUniformBlockCase.cpp b/modules/glshared/glsUniformBlockCase.cpp
index d2d4760..fd272bf 100644
--- a/modules/glshared/glsUniformBlockCase.cpp
+++ b/modules/glshared/glsUniformBlockCase.cpp
@@ -361,7 +361,7 @@
 
 int getDataTypeByteSize (glu::DataType type)
 {
-	return glu::getDataTypeScalarSize(type)*sizeof(deUint32);
+	return glu::getDataTypeScalarSize(type)*(int)sizeof(deUint32);
 }
 
 int getDataTypeByteAlignment (glu::DataType type)
@@ -371,12 +371,12 @@
 		case glu::TYPE_FLOAT:
 		case glu::TYPE_INT:
 		case glu::TYPE_UINT:
-		case glu::TYPE_BOOL:		return 1*sizeof(deUint32);
+		case glu::TYPE_BOOL:		return 1*(int)sizeof(deUint32);
 
 		case glu::TYPE_FLOAT_VEC2:
 		case glu::TYPE_INT_VEC2:
 		case glu::TYPE_UINT_VEC2:
-		case glu::TYPE_BOOL_VEC2:	return 2*sizeof(deUint32);
+		case glu::TYPE_BOOL_VEC2:	return 2*(int)sizeof(deUint32);
 
 		case glu::TYPE_FLOAT_VEC3:
 		case glu::TYPE_INT_VEC3:
@@ -386,7 +386,7 @@
 		case glu::TYPE_FLOAT_VEC4:
 		case glu::TYPE_INT_VEC4:
 		case glu::TYPE_UINT_VEC4:
-		case glu::TYPE_BOOL_VEC4:	return 4*sizeof(deUint32);
+		case glu::TYPE_BOOL_VEC4:	return 4*(int)sizeof(deUint32);
 
 		default:
 			DE_ASSERT(false);
@@ -398,8 +398,8 @@
 {
 	DE_ASSERT(!glu::isDataTypeMatrix(type));
 
-	int baseStride		= getDataTypeByteSize(type);
-	int vec4Alignment	= sizeof(deUint32)*4;
+	const int baseStride	= getDataTypeByteSize(type);
+	const int vec4Alignment	= (int)sizeof(deUint32)*4;
 
 	DE_ASSERT(baseStride <= vec4Alignment);
 	return de::max(baseStride, vec4Alignment); // Really? See rule 4.
@@ -413,7 +413,7 @@
 
 int computeStd140BaseAlignment (const VarType& type)
 {
-	const int vec4Alignment = sizeof(deUint32)*4;
+	const int vec4Alignment = (int)sizeof(deUint32)*4;
 
 	if (type.isBasicType())
 	{
diff --git a/modules/glshared/glsVertexArrayTests.cpp b/modules/glshared/glsVertexArrayTests.cpp
index e5ec808..54cb855 100644
--- a/modules/glshared/glsVertexArrayTests.cpp
+++ b/modules/glshared/glsVertexArrayTests.cpp
@@ -172,21 +172,21 @@
 {
 	static const int size[] =
 	{
-		sizeof(float),		// INPUTTYPE_FLOAT = 0,
-		sizeof(deInt32),	// INPUTTYPE_FIXED,
-		sizeof(double),		// INPUTTYPE_DOUBLE
+		(int)sizeof(float),			// INPUTTYPE_FLOAT = 0,
+		(int)sizeof(deInt32),		// INPUTTYPE_FIXED,
+		(int)sizeof(double),		// INPUTTYPE_DOUBLE
 
-		sizeof(deInt8),		// INPUTTYPE_BYTE,
-		sizeof(deInt16),	// INPUTTYPE_SHORT,
+		(int)sizeof(deInt8),		// INPUTTYPE_BYTE,
+		(int)sizeof(deInt16),		// INPUTTYPE_SHORT,
 
-		sizeof(deUint8),	// INPUTTYPE_UNSIGNED_BYTE,
-		sizeof(deUint16),	// INPUTTYPE_UNSIGNED_SHORT,
+		(int)sizeof(deUint8),		// INPUTTYPE_UNSIGNED_BYTE,
+		(int)sizeof(deUint16),		// INPUTTYPE_UNSIGNED_SHORT,
 
-		sizeof(deInt32),		// INPUTTYPE_INT,
-		sizeof(deUint32),		// INPUTTYPE_UNSIGNED_INT,
-		sizeof(deFloat16),		// INPUTTYPE_HALF,
-		sizeof(deUint32) / 4,		// INPUTTYPE_UNSIGNED_INT_2_10_10_10,
-		sizeof(deUint32) / 4		// INPUTTYPE_INT_2_10_10_10,
+		(int)sizeof(deInt32),		// INPUTTYPE_INT,
+		(int)sizeof(deUint32),		// INPUTTYPE_UNSIGNED_INT,
+		(int)sizeof(deFloat16),		// INPUTTYPE_HALF,
+		(int)sizeof(deUint32) / 4,	// INPUTTYPE_UNSIGNED_INT_2_10_10_10,
+		(int)sizeof(deUint32) / 4	// INPUTTYPE_INT_2_10_10_10,
 	};
 
 	return de::getSizedArrayElement<Array::INPUTTYPE_LAST>(size, (int)type);
@@ -234,7 +234,7 @@
 	if (max < min)
 		return min;
 
-	return GLValue::Short::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+	return GLValue::Short::create((min == max ? min : (deInt16)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
 }
 
 template<>
@@ -243,7 +243,7 @@
 	if (max < min)
 		return min;
 
-	return GLValue::Ushort::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+	return GLValue::Ushort::create((min == max ? min : (deUint16)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
 }
 
 template<>
@@ -252,7 +252,7 @@
 	if (max < min)
 		return min;
 
-	return GLValue::Byte::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+	return GLValue::Byte::create((min == max ? min : (deInt8)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
 }
 
 template<>
@@ -261,7 +261,7 @@
 	if (max < min)
 		return min;
 
-	return GLValue::Ubyte::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+	return GLValue::Ubyte::create((min == max ? min : (deUint8)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
 }
 
 template<>
@@ -781,10 +781,10 @@
 	if (isCoordinate)
 		switch (numComponents)
 		{
-			case 1:	coord = tcu::Vec2((float)attribValue.x(),					(float)attribValue.x());					break;
-			case 2:	coord = tcu::Vec2((float)attribValue.x(),					(float)attribValue.y());					break;
-			case 3:	coord = tcu::Vec2((float)attribValue.x() + attribValue.z(),	(float)attribValue.y());					break;
-			case 4:	coord = tcu::Vec2((float)attribValue.x() + attribValue.z(),	(float)attribValue.y() + attribValue.w());	break;
+			case 1:	coord = tcu::Vec2((float)attribValue.x(),							(float)attribValue.x());							break;
+			case 2:	coord = tcu::Vec2((float)attribValue.x(),							(float)attribValue.y());							break;
+			case 3:	coord = tcu::Vec2((float)attribValue.x() + (float)attribValue.z(),	(float)attribValue.y());							break;
+			case 4:	coord = tcu::Vec2((float)attribValue.x() + (float)attribValue.z(),	(float)attribValue.y() + (float)attribValue.w());	break;
 
 			default:
 				DE_ASSERT(false);
@@ -798,20 +798,20 @@
 				break;
 
 			case 2:
-				color.x() = color.x() * attribValue.x();
-				color.y() = color.y() * attribValue.y();
+				color.x() = color.x() * (float)attribValue.x();
+				color.y() = color.y() * (float)attribValue.y();
 				break;
 
 			case 3:
-				color.x() = color.x() * attribValue.x();
-				color.y() = color.y() * attribValue.y();
-				color.z() = color.z() * attribValue.z();
+				color.x() = color.x() * (float)attribValue.x();
+				color.y() = color.y() * (float)attribValue.y();
+				color.z() = color.z() * (float)attribValue.z();
 				break;
 
 			case 4:
-				color.x() = color.x() * attribValue.x() * attribValue.w();
-				color.y() = color.y() * attribValue.y() * attribValue.w();
-				color.z() = color.z() * attribValue.z() * attribValue.w();
+				color.x() = color.x() * (float)attribValue.x() * (float)attribValue.w();
+				color.y() = color.y() * (float)attribValue.y() * (float)attribValue.w();
+				color.z() = color.z() * (float)attribValue.z() * (float)attribValue.w();
 				break;
 
 			default:
@@ -1758,9 +1758,9 @@
 	, m_glArrayPack		(DE_NULL)
 	, m_rrArrayPack		(DE_NULL)
 	, m_isOk			(false)
-	, m_maxDiffRed		(deCeilFloatToInt32(256.0f * (2.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().redBits))))
-	, m_maxDiffGreen	(deCeilFloatToInt32(256.0f * (2.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().greenBits))))
-	, m_maxDiffBlue		(deCeilFloatToInt32(256.0f * (2.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().blueBits))))
+	, m_maxDiffRed		(deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().redBits))))
+	, m_maxDiffGreen	(deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().greenBits))))
+	, m_maxDiffBlue		(deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().blueBits))))
 {
 }
 
@@ -1817,14 +1817,21 @@
 
 		m_isOk = true;
 
-		for (int y = 1; y < ref.getHeight()-1; y++)
+		for (int y = 0; y < ref.getHeight(); y++)
 		{
-			for (int x = 1; x < ref.getWidth()-1; x++)
+			for (int x = 0; x < ref.getWidth(); x++)
 			{
 				tcu::RGBA	refPixel		= ref.getPixel(x, y);
 				tcu::RGBA	screenPixel		= screen.getPixel(x, y);
 				bool		isOkPixel		= false;
 
+				if (y == 0 || y + 1 == ref.getHeight() || x == 0 || x + 1 == ref.getWidth())
+				{
+					// Don't check borders since the pixel neighborhood is undefined
+					error.setPixel(x, y, tcu::RGBA(screenPixel.getRed(), (screenPixel.getGreen() + 255) / 2, screenPixel.getBlue(), 255));
+					continue;
+				}
+
 				// Don't do comparisons for this pixel if it belongs to a one-pixel-thin part (i.e. it doesn't have similar-color neighbors in both x and y directions) in both result and reference.
 				// This fixes some false negatives.
 				bool		refThin			= (!tcu::compareThreshold(refPixel, ref.getPixel(x-1, y  ), threshold) && !tcu::compareThreshold(refPixel, ref.getPixel(x+1, y  ), threshold)) ||
@@ -1843,9 +1850,9 @@
 							// Check reference pixel against screen pixel
 							{
 								tcu::RGBA	screenCmpPixel	= screen.getPixel(x+dx, y+dy);
-								deUint8		r				= deAbs32(refPixel.getRed()		- screenCmpPixel.getRed());
-								deUint8		g				= deAbs32(refPixel.getGreen()	- screenCmpPixel.getGreen());
-								deUint8		b				= deAbs32(refPixel.getBlue()	- screenCmpPixel.getBlue());
+								deUint8		r				= (deUint8)deAbs32(refPixel.getRed()	- screenCmpPixel.getRed());
+								deUint8		g				= (deUint8)deAbs32(refPixel.getGreen()	- screenCmpPixel.getGreen());
+								deUint8		b				= (deUint8)deAbs32(refPixel.getBlue()	- screenCmpPixel.getBlue());
 
 								if (r <= m_maxDiffRed && g <= m_maxDiffGreen && b <= m_maxDiffBlue)
 									isOkPixel = true;
@@ -1854,9 +1861,9 @@
 							// Check screen pixels against reference pixel
 							{
 								tcu::RGBA	refCmpPixel		= ref.getPixel(x+dx, y+dy);
-								deUint8		r				= deAbs32(refCmpPixel.getRed()		- screenPixel.getRed());
-								deUint8		g				= deAbs32(refCmpPixel.getGreen()	- screenPixel.getGreen());
-								deUint8		b				= deAbs32(refCmpPixel.getBlue()		- screenPixel.getBlue());
+								deUint8		r				= (deUint8)deAbs32(refCmpPixel.getRed()		- screenPixel.getRed());
+								deUint8		g				= (deUint8)deAbs32(refCmpPixel.getGreen()	- screenPixel.getGreen());
+								deUint8		b				= (deUint8)deAbs32(refCmpPixel.getBlue()	- screenPixel.getBlue());
 
 								if (r <= m_maxDiffRed && g <= m_maxDiffGreen && b <= m_maxDiffBlue)
 									isOkPixel = true;
diff --git a/modules/glshared/glsVertexArrayTests.hpp b/modules/glshared/glsVertexArrayTests.hpp
index 155bb6d..25a04a3 100644
--- a/modules/glshared/glsVertexArrayTests.hpp
+++ b/modules/glshared/glsVertexArrayTests.hpp
@@ -244,10 +244,10 @@
 		static WrappedType<Type>	create			(Type value)							{ WrappedType<Type> v; v.m_value = value; return v; }
 		inline Type					getValue		(void) const							{ return m_value; }
 
-		inline WrappedType<Type>	operator+		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create(m_value + other.getValue()); }
-		inline WrappedType<Type>	operator*		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create(m_value * other.getValue()); }
-		inline WrappedType<Type>	operator/		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create(m_value / other.getValue()); }
-		inline WrappedType<Type>	operator-		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create(m_value - other.getValue()); }
+		inline WrappedType<Type>	operator+		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create((Type)(m_value + other.getValue())); }
+		inline WrappedType<Type>	operator*		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create((Type)(m_value * other.getValue())); }
+		inline WrappedType<Type>	operator/		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create((Type)(m_value / other.getValue())); }
+		inline WrappedType<Type>	operator-		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create((Type)(m_value - other.getValue())); }
 
 		inline WrappedType<Type>&	operator+=		(const WrappedType<Type>& other)		{ m_value += other.getValue(); return *this; }
 		inline WrappedType<Type>&	operator*=		(const WrappedType<Type>& other)		{ m_value *= other.getValue(); return *this; }
diff --git a/modules/internal/ditFrameworkTests.cpp b/modules/internal/ditFrameworkTests.cpp
index fdf23dc..2b55b15 100644
--- a/modules/internal/ditFrameworkTests.cpp
+++ b/modules/internal/ditFrameworkTests.cpp
@@ -791,8 +791,8 @@
 																	  (subCase.vtx[1].z() == subCase.vtx[2].z());
 			const float						refDepth				= subCase.vtx[0].z()*(zf - zn)/2.0f + (zn + zf)/2.0f;
 
-			rr::resolveMultisampleColorBuffer(resolvedColor.getAccess(), rr::MultisampleConstPixelBufferAccess::fromMultisampleAccess(interpolated.getAccess()));
-			rr::resolveMultisampleColorBuffer(resolvedDepthStencil.getAccess(), rr::MultisampleConstPixelBufferAccess::fromMultisampleAccess(depthStencil.getAccess()));
+			rr::resolveMultisampleBuffer(resolvedColor.getAccess(), rr::MultisampleConstPixelBufferAccess::fromMultisampleAccess(interpolated.getAccess()));
+			rr::resolveMultisampleBuffer(resolvedDepthStencil.getAccess(), rr::MultisampleConstPixelBufferAccess::fromMultisampleAccess(depthStencil.getAccess()));
 			clear(errorAccess, Vec4(0.0f, 1.0f, 0.0f, 1.0f));
 
 			for (int y = 0; y < height; y++)
diff --git a/modules/internal/ditImageCompareTests.cpp b/modules/internal/ditImageCompareTests.cpp
index 899b488..28c480c 100644
--- a/modules/internal/ditImageCompareTests.cpp
+++ b/modules/internal/ditImageCompareTests.cpp
@@ -83,6 +83,10 @@
 			compareTime = deGetMicroseconds()-startTime;
 		}
 
+		m_testCtx.getLog() << TestLog::Image("RefImage",	"Reference Image",	refImg)
+						   << TestLog::Image("CmpImage",	"Compare Image",	cmpImg)
+						   << TestLog::Image("ErrorMask",	"Error Mask",		errorMask);
+
 		m_testCtx.getLog() << TestLog::Float("Result", "Result metric", "", QP_KEY_TAG_NONE, result)
 						   << TestLog::Float("MinBound", "Minimum bound", "", QP_KEY_TAG_NONE, m_minBound)
 						   << TestLog::Float("MaxBound", "Maximum bound", "", QP_KEY_TAG_NONE, m_maxBound)
@@ -164,7 +168,7 @@
 		addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube",			"cube_ref.png",				"cube_cmp.png",				0.0029f,		0.0031f));
 		addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_2",			"cube_2_ref.png",			"cube_2_cmp.png",			0.0134f,		0.0140f));
 		addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_sphere",	"cube_sphere_ref.png",		"cube_sphere_cmp.png",		0.0730f,		0.0801f));
-		addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_nmap",		"cube_nmap_ref.png",		"cube_nmap_cmp.png",		0.0024f,		0.0025f));
+		addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_nmap",		"cube_nmap_ref.png",		"cube_nmap_cmp.png",		0.0022f,		0.0025f));
 		addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_nmap_2",	"cube_nmap_2_ref.png",		"cube_nmap_2_cmp.png",		0.0172f,		0.0189f));
 		addChild(new FuzzyComparisonMetricCase(m_testCtx, "earth_diffuse",	"earth_diffuse_ref.png",	"earth_diffuse_cmp.png",	0.0f,			0.00002f));
 		addChild(new FuzzyComparisonMetricCase(m_testCtx, "eath_texture",	"earth_texture_ref.png",	"earth_texture_cmp.png",	0.0002f,		0.0003f));
@@ -172,7 +176,7 @@
 		addChild(new FuzzyComparisonMetricCase(m_testCtx, "earth_light",	"earth_light_ref.png",		"earth_light_cmp.png",		1.7050f,		1.7070f));
 		addChild(new FuzzyComparisonMetricCase(m_testCtx, "lessThan0",		"lessThan0-reference.png",	"lessThan0-result.png",		0.0003f,		0.0004f));
 		addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_sphere_2",	"cube_sphere_2_ref.png",	"cube_sphere_2_cmp.png",	0.0207f,		0.0230f));
-		addChild(new FuzzyComparisonMetricCase(m_testCtx, "earth_to_empty",	"earth_spot_ref.png",		"empty_256x256.png",		77074.0f,		77076.0f));
+		addChild(new FuzzyComparisonMetricCase(m_testCtx, "earth_to_empty",	"earth_spot_ref.png",		"empty_256x256.png",		54951.0f,		54955.0f));
 	}
 };
 
diff --git a/scripts/build/build.py b/scripts/build/build.py
index 7732e12..1f030fa 100644
--- a/scripts/build/build.py
+++ b/scripts/build/build.py
@@ -22,6 +22,7 @@
 
 import os
 import sys
+import shutil
 
 from common import *
 from config import *
@@ -39,12 +40,23 @@
 		os.makedirs(config.buildDir)
 
 	pushWorkingDir(config.getBuildDir())
-	execute(["cmake", config.getSrcPath()] + cfgArgs)
-	popWorkingDir()
+
+	try:
+		execute(["cmake", config.getSrcPath()] + cfgArgs)
+	finally:
+		popWorkingDir()
 
 def build (config, generator, targets = None):
-	# Initialize or update build dir.
-	initBuildDir(config, generator)
+	if os.path.exists(config.buildDir):
+		try:
+			initBuildDir(config, generator)
+		except Exception as e:
+			print e
+			print "WARNING: Using existing build directory failed; re-creating build directory"
+			shutil.rmtree(config.buildDir)
+			initBuildDir(config, generator)
+	else:
+		initBuildDir(config, generator)
 
 	baseCmd		= ['cmake', '--build', '.']
 	buildArgs	= generator.getBuildArgs(config.getBuildType())
diff --git a/scripts/build_android_mustpass.py b/scripts/build_android_mustpass.py
index 020f1be..34cea0f 100644
--- a/scripts/build_android_mustpass.py
+++ b/scripts/build_android_mustpass.py
@@ -119,13 +119,9 @@
 				cases.append(line[6:].strip())
 	return cases
 
-def getCaseList (mustpass, module):
-	generator	= ANY_GENERATOR
-	buildCfg	= getBuildConfig(DEFAULT_BUILD_DIR, DEFAULT_TARGET, "Debug")
-
+def getCaseList (buildCfg, generator, module):
 	build(buildCfg, generator, [module.binName])
 	genCaseList(buildCfg, generator, module, "txt")
-
 	return readCaseList(getCaseListPath(buildCfg, module, "txt"))
 
 def readPatternList (filename):
@@ -137,7 +133,7 @@
 				ptrns.append(line)
 	return ptrns
 
-def applyPatterns (caseList, patterns, op):
+def applyPatterns (caseList, patterns, filename, op):
 	matched			= set()
 	errors			= []
 	curList			= copy(caseList)
@@ -173,15 +169,15 @@
 		print "ERROR: %s: %s" % (reason, pattern)
 
 	if len(errors) > 0:
-		die("Found %s invalid patterns" % len(errors))
+		die("Found %s invalid patterns while processing file %s" % (len(errors), filename))
 
 	return [c for c in caseList if op(c in matched)]
 
-def applyInclude (caseList, patterns):
-	return applyPatterns(caseList, patterns, lambda b: b)
+def applyInclude (caseList, patterns, filename):
+	return applyPatterns(caseList, patterns, filename, lambda b: b)
 
-def applyExclude (caseList, patterns):
-	return applyPatterns(caseList, patterns, lambda b: not b)
+def applyExclude (caseList, patterns, filename):
+	return applyPatterns(caseList, patterns, filename, lambda b: not b)
 
 def readPatternLists (mustpass):
 	lists = {}
@@ -197,10 +193,10 @@
 	for filter in filters:
 		ptrnList = patternLists[filter.filename]
 		if filter.type == Filter.TYPE_INCLUDE:
-			res = applyInclude(res, ptrnList)
+			res = applyInclude(res, ptrnList, filter.filename)
 		else:
 			assert filter.type == Filter.TYPE_EXCLUDE
-			res = applyExclude(res, ptrnList)
+			res = applyExclude(res, ptrnList, filter.filename)
 	return res
 
 def appendToHierarchy (root, casePath):
@@ -361,14 +357,14 @@
 
 	print "Done!"
 
-def genMustpassLists (mustpassLists):
+def genMustpassLists (mustpassLists, generator, buildCfg):
 	moduleCaseLists = {}
 
 	# Getting case lists involves invoking build, so we want to cache the results
 	for mustpass in mustpassLists:
 		for package in mustpass.packages:
 			if not package.module in moduleCaseLists:
-				moduleCaseLists[package.module] = getCaseList(mustpass, package.module)
+				moduleCaseLists[package.module] = getCaseList(buildCfg, generator, package.module)
 
 	for mustpass in mustpassLists:
 		genMustpass(mustpass, moduleCaseLists)
@@ -408,7 +404,7 @@
 					  filters		= [include("es31-lmp-mr1.txt")]),
 	])
 
-MASTER_EGL_COMMON_FILTERS		= [include("egl-master.txt"), exclude("egl-failures.txt")]
+MASTER_EGL_COMMON_FILTERS		= [include("egl-master.txt"), exclude("egl-failures.txt"), exclude("egl-new-tests.txt")]
 MASTER_EGL_PKG					= Package(module = EGL_MODULE, configurations = [
 		# Master
 		Configuration(name			= "master",
@@ -489,6 +485,7 @@
 		exclude("gles31-driver-issues.txt"),
 		exclude("gles31-test-issues.txt"),
 		exclude("gles31-spec-issues.txt"),
+		exclude("gles31-new-tests.txt"),
 	]
 MASTER_GLES31_PKG				= Package(module = GLES31_MODULE, configurations = [
 		# Master
@@ -542,4 +539,4 @@
 	]
 
 if __name__ == "__main__":
-	genMustpassLists(MUSTPASS_LISTS)
+	genMustpassLists(MUSTPASS_LISTS, ANY_GENERATOR, getBuildConfig(DEFAULT_BUILD_DIR, DEFAULT_TARGET, "Debug"))
diff --git a/scripts/egl/__init__.py b/scripts/egl/__init__.py
index f170c8b..10c69ef 100644
--- a/scripts/egl/__init__.py
+++ b/scripts/egl/__init__.py
@@ -32,10 +32,9 @@
 def gen ():
 	registry	= getEGLRegistry()
 	iface		= getDefaultInterface()
-	noExtIface	= getInterface(registry, 'egl', VERSION)
 
 	str_util.gen(iface)
-	call_log_wrapper.gen(noExtIface)
+	call_log_wrapper.gen(iface)
 	proc_address_tests.gen()
 	enums.gen(iface)
 	func_ptrs.gen(iface)
diff --git a/scripts/egl/call_log_wrapper.py b/scripts/egl/call_log_wrapper.py
index 7841e46..2710341 100644
--- a/scripts/egl/call_log_wrapper.py
+++ b/scripts/egl/call_log_wrapper.py
@@ -1,5 +1,25 @@
 # -*- coding: utf-8 -*-
 
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import os
 import string
 
diff --git a/scripts/egl/common.py b/scripts/egl/common.py
index 1105c4f..64690dd 100644
--- a/scripts/egl/common.py
+++ b/scripts/egl/common.py
@@ -60,7 +60,10 @@
 	"EGL_EXT_platform_base",
 	"EGL_EXT_platform_x11",
 	"EGL_ANDROID_image_native_buffer",
-	"EGL_EXT_yuv_surface"
+	"EGL_EXT_yuv_surface",
+	"EGL_EXT_buffer_age",
+	"EGL_KHR_partial_update",
+	"EGL_KHR_swap_buffers_with_damage"
 ]
 PROTECTS			= [
 	"KHRONOS_SUPPORT_INT64"
diff --git a/scripts/egl/enums.py b/scripts/egl/enums.py
index c78e0a7..353062e 100644
--- a/scripts/egl/enums.py
+++ b/scripts/egl/enums.py
@@ -1,5 +1,25 @@
 # -*- coding: utf-8 -*-
 
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import os
 import string
 
diff --git a/scripts/egl/func_ptrs.py b/scripts/egl/func_ptrs.py
index 024e9b1..a170e9f 100644
--- a/scripts/egl/func_ptrs.py
+++ b/scripts/egl/func_ptrs.py
@@ -1,5 +1,25 @@
 # -*- coding: utf-8 -*-
 
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 from common import *
 from khr_util.format import commandParams
 
diff --git a/scripts/egl/library.py b/scripts/egl/library.py
index f0e675b..e2641a4 100644
--- a/scripts/egl/library.py
+++ b/scripts/egl/library.py
@@ -1,5 +1,25 @@
 # -*- coding: utf-8 -*-
 
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 from common import *
 from khr_util.format import indentLines, commandParams, commandArgs
 import khr_util.registry
diff --git a/scripts/launchcontrol_build.py b/scripts/launchcontrol_build.py
index 06a2d4f..676487a 100644
--- a/scripts/launchcontrol_build.py
+++ b/scripts/launchcontrol_build.py
@@ -25,14 +25,27 @@
 from build.build import *
 from argparse import ArgumentParser
 import multiprocessing
+from build_android_mustpass import *
+
+class LaunchControlConfig:
+	def __init__ (self, buildArgs, checkMustpassLists):
+		self.buildArgs 			= buildArgs
+		self.checkMustpassLists = checkMustpassLists
+
+	def getBuildArgs (self):
+		return self.buildArgs
+
+	def getCheckMustpassLists (self):
+		return self.checkMustpassLists
 
 # This is a bit silly, but CMake needs to know the word width prior to
 # parsing the project files, hence cannot use our own defines.
 X86_64_ARGS = ["-DDE_CPU=DE_CPU_X86_64", "-DCMAKE_C_FLAGS=-m64", "-DCMAKE_CXX_FLAGS=-m64"]
 
 BUILD_CONFIGS = {
-	"gcc-x86_64-x11_glx":   X86_64_ARGS + ["-DDEQP_TARGET=x11_glx"],
-	"clang-x86_64-x11_glx": X86_64_ARGS + ["-DDEQP_TARGET=x11_glx", "-DCMAKE_C_COMPILER=clang", "-DCMAKE_CXX_COMPILER=clang++"]
+	"gcc-x86_64-x11_glx":   LaunchControlConfig(X86_64_ARGS + ["-DDEQP_TARGET=x11_glx"], False),
+	"clang-x86_64-x11_glx": LaunchControlConfig(X86_64_ARGS + ["-DDEQP_TARGET=x11_glx", "-DCMAKE_C_COMPILER=clang", "-DCMAKE_CXX_COMPILER=clang++"], False),
+	"gcc-x86_64-null":		LaunchControlConfig(X86_64_ARGS + ["-DDEQP_TARGET=null"], True)
 }
 
 def buildWithMake (workingDir):
@@ -43,6 +56,12 @@
 	execute(["make", "-j%d" % threadCount])
 	popWorkingDir()
 
+def checkForChanges ():
+	pushWorkingDir(DEQP_DIR)
+	# If there are changed files, exit code will be non-zero and the script terminates immediately.
+	execute(["git", "diff", "--exit-code"])
+	popWorkingDir()
+
 def parseOptions ():
 	parser = ArgumentParser()
 
@@ -72,9 +91,14 @@
 	print "# %s %s BUILD" % (options.config.upper(), options.buildType.upper())
 	print "############################################################\n"
 
+	launchControlConfig = BUILD_CONFIGS[options.config]
 	buildDir = os.path.realpath(os.path.normpath(options.buildDir))
-	config = BuildConfig(buildDir, options.buildType, BUILD_CONFIGS[options.config])
+	config = BuildConfig(buildDir, options.buildType, launchControlConfig.getBuildArgs())
 	initBuildDir(config, MAKEFILE_GENERATOR)
 	buildWithMake(buildDir)
 
+	if launchControlConfig.getCheckMustpassLists():
+		genMustpassLists(MUSTPASS_LISTS, MAKEFILE_GENERATOR, config)
+		checkForChanges()
+
 	print "\n--- BUILD SCRIPT COMPLETE"
diff --git a/scripts/opengl/gen_call_log_wrapper.py b/scripts/opengl/gen_call_log_wrapper.py
index c5f15e2..9d9dbc5 100644
--- a/scripts/opengl/gen_call_log_wrapper.py
+++ b/scripts/opengl/gen_call_log_wrapper.py
@@ -79,10 +79,12 @@
 	"glClearBufferfi":						LogSpec({0: enum("Buffer")}),
 	"glClearBufferiv":						LogSpec({0: enum("Buffer")}),
 	"glClearBufferuiv":						LogSpec({0: enum("Buffer")}),
-	"glCompressedTexImage2D":				LogSpec({0: enum("TextureTarget"), 2: enum("CompressedTexFormat")}),
-	"glCompressedTexSubImage2D":			LogSpec({0: enum("TextureTarget"), 6: enum("CompressedTexFormat")}),
-	"glCopyTexImage1D":						LogSpec({0: enum("TextureTarget"), 2: enum("PixelFormat")}),
-	"glCopyTexImage2D":						LogSpec({0: enum("TextureTarget"), 2: enum("PixelFormat")}),
+	"glCompressedTexImage2D":				LogSpec({0: enum("TextureTarget"), 2: enum("CompressedTextureFormat")}),
+	"glCompressedTexSubImage2D":			LogSpec({0: enum("TextureTarget"), 6: enum("CompressedTextureFormat")}),
+	"glCompressedTexImage3D":				LogSpec({0: enum("TextureTarget"), 2: enum("CompressedTextureFormat")}),
+	"glCompressedTexSubImage3D":			LogSpec({0: enum("TextureTarget"), 8: enum("CompressedTextureFormat")}),
+	"glCopyTexImage1D":						LogSpec({0: enum("TextureTarget"), 2: enum("UncompressedTextureFormat")}),
+	"glCopyTexImage2D":						LogSpec({0: enum("TextureTarget"), 2: enum("UncompressedTextureFormat")}),
 	"glCreateShader":						LogSpec({0: enum("ShaderType")}),
 	"glCullFace":							LogSpec({0: enum("Face")}),
 	"glDeleteBuffers":						LogSpec({1: pointer(size = "n")}),
@@ -165,7 +167,7 @@
 												# wrapper from attempting to print the argument as a C string.
 			},
 			argOutPrints = {2: booleanPointer(size = "getIndexedQueryNumArgsOut(target)")}),
-	"glGetInternalformativ":				LogSpec({0: enum("InternalFormatTarget"), 1: enum("PixelFormat"), 2: enum("InternalFormatParameter")}, argOutPrints = {4: pointer(size = "bufSize")}),
+	"glGetInternalformativ":				LogSpec({0: enum("InternalFormatTarget"), 1: enum("UncompressedTextureFormat"), 2: enum("InternalFormatParameter")}, argOutPrints = {4: pointer(size = "bufSize")}),
 	"glGetMultisamplefv":					LogSpec({0: enum("MultisampleParameter")}, argOutPrints = {2: pointer(size = "2")}),
 	"glGetPointerv":						LogSpec({0: enum("PointerState")}, argOutPrints = {1: pointer(size = "1")}),
 	"glGetProgramiv":						LogSpec({1: enum("ProgramParam")}, argOutPrints = {2: pointer(size = "getProgramQueryNumArgsOut(pname)")}),
@@ -207,22 +209,22 @@
 	"glIsEnabledi":							LogSpec({0: enum("IndexedEnableCap")}),
 	"glPixelStorei":						LogSpec({0: enum("PixelStoreParameter")}),
 	"glReadBuffer":							LogSpec({0: enum("DrawReadBuffer")}),
-	"glReadPixels":							LogSpec({4: enum("PixelFormat"), 5: enum("Type")}),
-	"glRenderbufferStorage":				LogSpec({0: enum("FramebufferTarget"), 1: enum("PixelFormat")}),
-	"glRenderbufferStorageMultisample":		LogSpec({0: enum("FramebufferTarget"), 2: enum("PixelFormat")}),
+	"glReadPixels":							LogSpec({4: enum("UncompressedTextureFormat"), 5: enum("Type")}),
+	"glRenderbufferStorage":				LogSpec({0: enum("FramebufferTarget"), 1: enum("UncompressedTextureFormat")}),
+	"glRenderbufferStorageMultisample":		LogSpec({0: enum("FramebufferTarget"), 2: enum("UncompressedTextureFormat")}),
 	"glStencilFunc":						LogSpec({0: enum("CompareFunc")}),
 	"glStencilFuncSeparate":				LogSpec({0: enum("Face"), 1: enum("CompareFunc")}),
 	"glStencilMaskSeparate":				LogSpec({0: enum("Face")}),
 	"glStencilOp":							LogSpec({0: enum("StencilOp"), 1: enum("StencilOp"), 2: enum("StencilOp")}),
 	"glStencilOpSeparate":					LogSpec({0: enum("Face"), 1: enum("StencilOp"), 2: enum("StencilOp"), 3: enum("StencilOp")}),
-	"glTexImage1D":							LogSpec({0: enum("TextureTarget"), 2: enum("PixelFormat"), 5: enum("PixelFormat"), 6: enum("Type")}),
-	"glTexImage2D":							LogSpec({0: enum("TextureTarget"), 2: enum("PixelFormat"), 6: enum("PixelFormat"), 7: enum("Type")}),
-	"glTexImage2DMultisample":				LogSpec({0: enum("TextureTarget"), 2: enum("PixelFormat"), 5: enum("Boolean")}),
-	"glTexImage3D":							LogSpec({0: enum("TextureTarget"), 2: enum("PixelFormat"), 7: enum("PixelFormat"), 8: enum("Type")}),
-	"glTexStorage2D":						LogSpec({0: enum("TextureTarget"), 2: enum("PixelFormat")}),
-	"glTexStorage3D":						LogSpec({0: enum("TextureTarget"), 2: enum("PixelFormat")}),
-	"glTexStorage2DMultisample":			LogSpec({0: enum("TextureTarget"), 2: enum("PixelFormat"), 5: enum("Boolean")}),
-	"glTexStorage3DMultisample":			LogSpec({0: enum("TextureTarget"), 2: enum("PixelFormat"), 6: enum("Boolean")}),
+	"glTexImage1D":							LogSpec({0: enum("TextureTarget"), 2: enum("UncompressedTextureFormat"), 5: enum("UncompressedTextureFormat"), 6: enum("Type")}),
+	"glTexImage2D":							LogSpec({0: enum("TextureTarget"), 2: enum("UncompressedTextureFormat"), 6: enum("UncompressedTextureFormat"), 7: enum("Type")}),
+	"glTexImage2DMultisample":				LogSpec({0: enum("TextureTarget"), 2: enum("UncompressedTextureFormat"), 5: enum("Boolean")}),
+	"glTexImage3D":							LogSpec({0: enum("TextureTarget"), 2: enum("UncompressedTextureFormat"), 7: enum("UncompressedTextureFormat"), 8: enum("Type")}),
+	"glTexStorage2D":						LogSpec({0: enum("TextureTarget"), 2: enum("TextureFormat")}),
+	"glTexStorage3D":						LogSpec({0: enum("TextureTarget"), 2: enum("TextureFormat")}),
+	"glTexStorage2DMultisample":			LogSpec({0: enum("TextureTarget"), 2: enum("UncompressedTextureFormat"), 5: enum("Boolean")}),
+	"glTexStorage3DMultisample":			LogSpec({0: enum("TextureTarget"), 2: enum("UncompressedTextureFormat"), 6: enum("Boolean")}),
 	# \todo [2012-03-08 pyry] Pointer values..
 	"glTexParameterf":						LogSpec({0: enum("TextureTarget"), 1: enum("TextureParameter")}),
 	"glTexParameteri":						LogSpec({0: enum("TextureTarget"), 1: enum("TextureParameter"), 2: lambda name: "getTextureParameterValueStr(pname, %s)" % name}),
@@ -236,9 +238,9 @@
 	"glSamplerParameteriv":					LogSpec({1: enum("TextureParameter"), 2: pointer(size = "getTextureParamNumArgs(pname)")}),
 	"glSamplerParameterIiv":				LogSpec({1: enum("TextureParameter"), 2: pointer(size = "getTextureParamNumArgs(pname)")}),
 	"glSamplerParameterIuiv":				LogSpec({1: enum("TextureParameter"), 2: pointer(size = "getTextureParamNumArgs(pname)")}),
-	"glTexSubImage1D":						LogSpec({0: enum("TextureTarget"), 4: enum("PixelFormat"), 5: enum("Type")}),
-	"glTexSubImage2D":						LogSpec({0: enum("TextureTarget"), 6: enum("PixelFormat"), 7: enum("Type")}),
-	"glTexSubImage3D":						LogSpec({0: enum("TextureTarget"), 8: enum("PixelFormat"), 9: enum("Type")}),
+	"glTexSubImage1D":						LogSpec({0: enum("TextureTarget"), 4: enum("UncompressedTextureFormat"), 5: enum("Type")}),
+	"glTexSubImage2D":						LogSpec({0: enum("TextureTarget"), 6: enum("UncompressedTextureFormat"), 7: enum("Type")}),
+	"glTexSubImage3D":						LogSpec({0: enum("TextureTarget"), 8: enum("UncompressedTextureFormat"), 9: enum("Type")}),
 	"glUniform1fv":							LogSpec({2: pointer(size = "(count * 1)")}),
 	"glUniform1iv":							LogSpec({2: pointer(size = "(count * 1)")}),
 	"glUniform1uiv":						LogSpec({2: pointer(size = "(count * 1)")}),
@@ -330,7 +332,7 @@
 	"glUnmapBuffer":						LogSpec({0: enum("BufferTarget")}),
 	"glFlushMappedBufferRange":				LogSpec({0: enum("BufferTarget")}),
 	"glMemoryBarrier":						LogSpec({0: enum("MemoryBarrierFlags")}),
-	"glBindImageTexture":					LogSpec({5: enum("ImageAccess"), 6: enum("PixelFormat")}),
+	"glBindImageTexture":					LogSpec({5: enum("ImageAccess"), 6: enum("UncompressedTextureFormat")}),
 	"glGetProgramResourceIndex":			LogSpec({1: enum("ProgramInterface")}),
 	"glGetProgramResourceiv":
 		LogSpec(
@@ -347,8 +349,8 @@
 	"glDebugMessageControl":				LogSpec({0: enum("DebugMessageSource"), 1: enum("DebugMessageType"), 2: enum("DebugMessageSeverity"), 4: pointer(size = "(count)")}),
 	"glDebugMessageCallback":				LogSpec({0: fnPointer, 1: voidPointer}),
 	"glPushDebugGroup":						LogSpec({0: enum("DebugMessageSource")}),
-	"glTexBuffer":							LogSpec({0: enum("BufferTarget"), 1: enum("PixelFormat")}),
-	"glTexBufferRange":						LogSpec({0: enum("BufferTarget"), 1: enum("PixelFormat")}),
+	"glTexBuffer":							LogSpec({0: enum("BufferTarget"), 1: enum("UncompressedTextureFormat")}),
+	"glTexBufferRange":						LogSpec({0: enum("BufferTarget"), 1: enum("UncompressedTextureFormat")}),
 }
 
 def glwPrefix (string):
diff --git a/scripts/opengl/gen_null_render_context.py b/scripts/opengl/gen_null_render_context.py
index 36a2d5e..3693433 100644
--- a/scripts/opengl/gen_null_render_context.py
+++ b/scripts/opengl/gen_null_render_context.py
@@ -43,11 +43,13 @@
 	"glGenSamplers",
 	"glGenTransformFeedbacks",
 	"glGenProgramPipelines",
+	"glGetInternalformativ",
 	"glMapBufferRange",
 	"glCheckFramebufferStatus",
 	"glReadPixels",
 	"glBindBuffer",
-	"glDeleteBuffers"
+	"glDeleteBuffers",
+	"glGetAttribLocation",
 ])
 
 NULL_PLATFORM_DIR = os.path.normpath(os.path.join(SCRIPTS_DIR, "..", "..", "framework", "platform", "null"))
diff --git a/scripts/opengl/gen_str_util.py b/scripts/opengl/gen_str_util.py
index 72553b2..ac1dd15 100644
--- a/scripts/opengl/gen_str_util.py
+++ b/scripts/opengl/gen_str_util.py
@@ -460,7 +460,7 @@
 		"PACK_ROW_LENGTH",
 		"PACK_SKIP_ROWS",
 		"PACK_SKIP_PIXELS"]),
-	("PixelFormat", [
+	("UncompressedTextureFormat", [
 		# GLES2 unsized formats
 		"LUMINANCE",
 		"LUMINANCE_ALPHA",
@@ -563,7 +563,7 @@
 		"BGRA",
 		]),
 
-	("CompressedTexFormat", [
+	("CompressedTextureFormat", [
 		# ETC2/EAC formats
 		"COMPRESSED_R11_EAC",
 		"COMPRESSED_SIGNED_R11_EAC",
@@ -934,10 +934,21 @@
 	("PatchParam", [
 		"PATCH_VERTICES",
 	]),
+
+	("TextureFormat", [
+		# generated: UncompressedTextureFormat + CompressedTextureFormat
+	]),
 ]
 
+def getEnumGroupByName (name):
+	# \note: will raise an (index out of bounds) error if no such group
+	return [x for x in ENUM_GROUPS if x[0]==name][0][1]
+
 # EnableCap EnumGroups are also GettableState EnumGroups
-[x for x in ENUM_GROUPS if x[0]=="GettableState"][0][1].extend([x for x in ENUM_GROUPS if x[0]=="EnableCap"][0][1])
+getEnumGroupByName("GettableState").extend(getEnumGroupByName("EnableCap"))
+
+# TextureFormat = UncompressedTextureFormat + CompressedTextureFormat
+getEnumGroupByName("TextureFormat").extend(getEnumGroupByName("UncompressedTextureFormat") + getEnumGroupByName("CompressedTextureFormat"))
 
 def genStrUtil (iface):
 	enumGroups		= addValuePrefix(ENUM_GROUPS, "GL_")
diff --git a/scripts/src_util/pre_commit.py b/scripts/src_util/pre_commit.py
index 2f8df3f..5249ff2 100755
--- a/scripts/src_util/pre_commit.py
+++ b/scripts/src_util/pre_commit.py
@@ -1,4 +1,25 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
 
 # Check that the input file has no external include guards.
 # Returns with 0 exit code on success, 1 otherwise.
diff --git a/scripts/update-copyright-year.py b/scripts/update-copyright-year.py
index 28b4cd9..8b72f41 100644
--- a/scripts/update-copyright-year.py
+++ b/scripts/update-copyright-year.py
@@ -1,5 +1,25 @@
 # -*- coding: utf-8 -*-
 
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 import os
 import re
 import sys
diff --git a/targets/android/install.sh b/targets/android/install.sh
index 1ac9130..450ad0c 100755
--- a/targets/android/install.sh
+++ b/targets/android/install.sh
@@ -1,5 +1,25 @@
 #!/bin/sh
 
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# 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.
+#
+#-------------------------------------------------------------------------
+
 echo "Removing old dEQP Ondevice Package..."
 adb $* uninstall com.drawelements.deqp
 
diff --git a/targets/null/null.cmake b/targets/null/null.cmake
index d86ef46..d12f177 100644
--- a/targets/null/null.cmake
+++ b/targets/null/null.cmake
@@ -12,4 +12,6 @@
 	null/tcuNullPlatform.hpp
 	null/tcuNullRenderContext.cpp
 	null/tcuNullRenderContext.hpp
+	null/tcuNullContextFactory.cpp
+	null/tcuNullContextFactory.hpp
 	)