Merge "Update egl/common.py"
diff --git a/Android.mk b/Android.mk
index 9c27830..3a6e7a0 100644
--- a/Android.mk
+++ b/Android.mk
@@ -76,6 +76,7 @@
 	framework/delibs/debase/deInt32.c \
 	framework/delibs/debase/deInt32Test.c \
 	framework/delibs/debase/deMath.c \
+	framework/delibs/debase/deMathTest.c \
 	framework/delibs/debase/deMemory.c \
 	framework/delibs/debase/deRandom.c \
 	framework/delibs/debase/deString.c \
diff --git a/android/cts/master/com.drawelements.deqp.gles3.xml b/android/cts/master/com.drawelements.deqp.gles3.xml
index e0ecc54..fc5f67b 100644
--- a/android/cts/master/com.drawelements.deqp.gles3.xml
+++ b/android/cts/master/com.drawelements.deqp.gles3.xml
@@ -3181,12 +3181,6 @@
 						<Test name="line_1_fragment">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
 						</Test>
-						<Test name="line_2_vertex">
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-						</Test>
-						<Test name="line_2_fragment">
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-						</Test>
 						<Test name="file_vertex">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
 						</Test>
@@ -3773,18 +3767,6 @@
 						<Test name="pragma_macro_exp_fragment">
 							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
 						</Test>
-						<Test name="invalid_pragma_invalid_debug_vertex">
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-						</Test>
-						<Test name="invalid_pragma_invalid_debug_fragment">
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-						</Test>
-						<Test name="invalid_pragma_invalid_token_vertex">
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-						</Test>
-						<Test name="invalid_pragma_invalid_token_fragment">
-							<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-						</Test>
 					</TestCase>
 					<TestCase name="extensions">
 						<Test name="basic_vertex">
@@ -141145,9 +141127,6 @@
 				<Test name="flush">
 					<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
 				</Test>
-				<Test name="flush_wait">
-					<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-				</Test>
 				<Test name="finish">
 					<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 676ac21..c380d4a 100644
--- a/android/cts/master/com.drawelements.deqp.gles31.xml
+++ b/android/cts/master/com.drawelements.deqp.gles31.xml
@@ -10192,98 +10192,6 @@
 						</TestCase>
 					</TestSuite>
 					<TestSuite name="interpolate_at_centroid">
-						<TestCase name="consistency">
-							<Test name="default_framebuffer">
-								<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="singlesample_texture">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_texture_1">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_texture_2">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_texture_4">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_texture_8">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_texture_16">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="singlesample_rbo">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_rbo_1">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_rbo_2">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_rbo_4">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_rbo_8">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_rbo_16">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-						</TestCase>
-						<TestCase name="array_element">
-							<Test name="default_framebuffer">
-								<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="singlesample_texture">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_texture_1">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_texture_2">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_texture_4">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_texture_8">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_texture_16">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="singlesample_rbo">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_rbo_1">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_rbo_2">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_rbo_4">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_rbo_8">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-							<Test name="multisample_rbo_16">
-								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
-							</Test>
-						</TestCase>
 						<TestCase name="negative">
 							<Test name="vec4_identity_swizzle">
 								<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
@@ -103996,6 +103904,11 @@
 					</TestCase>
 				</TestSuite>
 			</TestSuite>
+			<TestCase name="default_vertex_array_object">
+				<Test name="vertex_attrib_divisor">
+					<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+				</Test>
+			</TestCase>
 		</TestSuite>
 	</TestSuite>
 </TestPackage>
diff --git a/android/cts/master/gles3-master.txt b/android/cts/master/gles3-master.txt
index dfce400..d9bb904 100644
--- a/android/cts/master/gles3-master.txt
+++ b/android/cts/master/gles3-master.txt
@@ -951,8 +951,6 @@
 dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.gl_es_2_fragment
 dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.line_1_vertex
 dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.line_1_fragment
-dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.line_2_vertex
-dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.line_2_fragment
 dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.file_vertex
 dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.file_fragment
 dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.if_gl_es_vertex
@@ -1143,10 +1141,6 @@
 dEQP-GLES3.functional.shaders.preprocessor.pragmas.pragma_fragment
 dEQP-GLES3.functional.shaders.preprocessor.pragmas.pragma_macro_exp_vertex
 dEQP-GLES3.functional.shaders.preprocessor.pragmas.pragma_macro_exp_fragment
-dEQP-GLES3.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_debug_vertex
-dEQP-GLES3.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_debug_fragment
-dEQP-GLES3.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_token_vertex
-dEQP-GLES3.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_token_fragment
 dEQP-GLES3.functional.shaders.preprocessor.extensions.basic_vertex
 dEQP-GLES3.functional.shaders.preprocessor.extensions.basic_fragment
 dEQP-GLES3.functional.shaders.preprocessor.extensions.macro_exp_vertex
@@ -41831,7 +41825,6 @@
 dEQP-GLES3.functional.draw.random.210
 dEQP-GLES3.functional.flush_finish.wait
 dEQP-GLES3.functional.flush_finish.flush
-dEQP-GLES3.functional.flush_finish.flush_wait
 dEQP-GLES3.functional.flush_finish.finish
 dEQP-GLES3.functional.flush_finish.finish_wait
 dEQP-GLES3.functional.default_vertex_attrib.float.vertex_attrib_1f
diff --git a/android/cts/master/gles31-master.txt b/android/cts/master/gles31-master.txt
index 805672d..1a053b5 100644
--- a/android/cts/master/gles31-master.txt
+++ b/android/cts/master/gles31-master.txt
@@ -3142,32 +3142,6 @@
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.negative.interpolate_local
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.negative.interpolate_global
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.negative.interpolate_constant
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.default_framebuffer
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.singlesample_texture
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.multisample_texture_1
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.multisample_texture_2
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.multisample_texture_4
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.multisample_texture_8
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.multisample_texture_16
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.singlesample_rbo
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.multisample_rbo_1
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.multisample_rbo_2
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.multisample_rbo_4
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.multisample_rbo_8
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.multisample_rbo_16
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.default_framebuffer
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.singlesample_texture
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.multisample_texture_1
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.multisample_texture_2
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.multisample_texture_4
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.multisample_texture_8
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.multisample_texture_16
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.singlesample_rbo
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.multisample_rbo_1
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.multisample_rbo_2
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.multisample_rbo_4
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.multisample_rbo_8
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.multisample_rbo_16
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.negative.vec4_identity_swizzle
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.negative.vec4_crop_swizzle
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.negative.vec4_mixed_swizzle
@@ -32150,3 +32124,4 @@
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.17
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.18
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.19
+dEQP-GLES31.functional.default_vertex_array_object.vertex_attrib_divisor
diff --git a/android/cts/master/gles31-multisample.txt b/android/cts/master/gles31-multisample.txt
index 943a0b9..4a97ff2 100644
--- a/android/cts/master/gles31-multisample.txt
+++ b/android/cts/master/gles31-multisample.txt
@@ -24,8 +24,6 @@
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.dynamic_sample_number.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.centroid_qualified.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.default_framebuffer
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.default_framebuffer
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.no_qualifiers.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.centroid_qualifier.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.sample_qualifier.default_framebuffer
diff --git a/android/cts/master/gles31-rotate-landscape.txt b/android/cts/master/gles31-rotate-landscape.txt
index 4c0b027..cb4528d 100644
--- a/android/cts/master/gles31-rotate-landscape.txt
+++ b/android/cts/master/gles31-rotate-landscape.txt
@@ -24,8 +24,6 @@
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.dynamic_sample_number.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.centroid_qualified.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.default_framebuffer
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.default_framebuffer
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.no_qualifiers.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.centroid_qualifier.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.sample_qualifier.default_framebuffer
diff --git a/android/cts/master/gles31-rotate-portrait.txt b/android/cts/master/gles31-rotate-portrait.txt
index 4c0b027..cb4528d 100644
--- a/android/cts/master/gles31-rotate-portrait.txt
+++ b/android/cts/master/gles31-rotate-portrait.txt
@@ -24,8 +24,6 @@
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.dynamic_sample_number.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.centroid_qualified.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.default_framebuffer
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.default_framebuffer
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.no_qualifiers.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.centroid_qualifier.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.sample_qualifier.default_framebuffer
diff --git a/android/cts/master/gles31-rotate-reverse-landscape.txt b/android/cts/master/gles31-rotate-reverse-landscape.txt
index 4c0b027..cb4528d 100644
--- a/android/cts/master/gles31-rotate-reverse-landscape.txt
+++ b/android/cts/master/gles31-rotate-reverse-landscape.txt
@@ -24,8 +24,6 @@
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.dynamic_sample_number.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.centroid_qualified.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.default_framebuffer
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.default_framebuffer
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.no_qualifiers.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.centroid_qualifier.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.sample_qualifier.default_framebuffer
diff --git a/android/cts/master/gles31-rotate-reverse-portrait.txt b/android/cts/master/gles31-rotate-reverse-portrait.txt
index 4c0b027..cb4528d 100644
--- a/android/cts/master/gles31-rotate-reverse-portrait.txt
+++ b/android/cts/master/gles31-rotate-reverse-portrait.txt
@@ -24,8 +24,6 @@
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.dynamic_sample_number.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.centroid_qualified.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.default_framebuffer
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.default_framebuffer
-dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.no_qualifiers.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.centroid_qualifier.default_framebuffer
 dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.sample_qualifier.default_framebuffer
diff --git a/android/cts/master/src/gles2-failures.txt b/android/cts/master/src/gles2-failures.txt
index 74c0b72..0236295 100644
--- a/android/cts/master/src/gles2-failures.txt
+++ b/android/cts/master/src/gles2-failures.txt
@@ -1941,10 +1941,10 @@
 dEQP-GLES2.functional.shaders.preprocessor.operator_precedence.mul_vs_plus_vertex
 dEQP-GLES2.functional.shaders.preprocessor.operator_precedence.xor_vs_bitwise_and_fragment
 dEQP-GLES2.functional.shaders.preprocessor.operator_precedence.xor_vs_bitwise_and_vertex
-dEQP-GLES2.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_debug_fragment
-dEQP-GLES2.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_debug_vertex
-dEQP-GLES2.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_token_fragment
-dEQP-GLES2.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_token_vertex
+dEQP-GLES2.functional.shaders.preprocessor.pragmas.pragma_unrecognized_debug_fragment
+dEQP-GLES2.functional.shaders.preprocessor.pragmas.pragma_unrecognized_debug_vertex
+dEQP-GLES2.functional.shaders.preprocessor.pragmas.pragma_unrecognized_token_fragment
+dEQP-GLES2.functional.shaders.preprocessor.pragmas.pragma_unrecognized_token_vertex
 dEQP-GLES2.functional.shaders.preprocessor.pragmas.pragma_fragment
 dEQP-GLES2.functional.shaders.preprocessor.pragmas.pragma_vertex
 dEQP-GLES2.functional.shaders.preprocessor.predefined_macros.line_2_fragment
@@ -2585,9 +2585,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
new file mode 100644
index 0000000..eb826ed
--- /dev/null
+++ b/android/cts/master/src/gles2-test-issues.txt
@@ -0,0 +1,3 @@
+# Bug 21526557
+dEQP-GLES2.functional.texture.size.cube.256x256_rgba4444
+dEQP-GLES2.functional.texture.size.cube.512x512_rgba4444
diff --git a/android/cts/master/src/gles3-driver-issues.txt b/android/cts/master/src/gles3-driver-issues.txt
index 7038ff9..888d94c 100644
--- a/android/cts/master/src/gles3-driver-issues.txt
+++ b/android/cts/master/src/gles3-driver-issues.txt
@@ -1,2 +1,6 @@
 # Bug 21495208
 dEQP-GLES3.functional.attribute_location.bind_aliasing.*
+
+# Bug 21737600
+dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.line_2_vertex
+dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.line_2_fragment
diff --git a/android/cts/master/src/gles3-spec-issues.txt b/android/cts/master/src/gles3-spec-issues.txt
index c972291..d28c58b 100644
--- a/android/cts/master/src/gles3-spec-issues.txt
+++ b/android/cts/master/src/gles3-spec-issues.txt
@@ -509,3 +509,6 @@
 
 # Khronos bugs 11207, 12408, internal bug 20699693
 dEQP-GLES3.functional.shaders.arrays.invalid.empty_declaration_without_var_name_*
+
+# Khronos bug 13916, internal bug 20558284
+dEQP-GLES3.functional.flush_finish.flush_wait
diff --git a/android/cts/master/src/gles3-test-issues.txt b/android/cts/master/src/gles3-test-issues.txt
index 220d3d4..c03cf6e 100644
--- a/android/cts/master/src/gles3-test-issues.txt
+++ b/android/cts/master/src/gles3-test-issues.txt
@@ -64,3 +64,7 @@
 
 # Bug 21620051
 dEQP-GLES3.functional.shaders.texture_functions.texture.sampler2darrayshadow_vertex
+
+# Bug 21725534
+dEQP-GLES3.functional.shaders.preprocessor.pragmas.pragma_unrecognized_debug_*
+dEQP-GLES3.functional.shaders.preprocessor.pragmas.pragma_unrecognized_token_*
diff --git a/android/cts/master/src/gles31-spec-issues.txt b/android/cts/master/src/gles31-spec-issues.txt
index f68ae46..26a63ea 100644
--- a/android/cts/master/src/gles31-spec-issues.txt
+++ b/android/cts/master/src/gles31-spec-issues.txt
@@ -1,5 +1,2 @@
-# Bug 13564
-dEQP-GLES31.functional.default_vertex_array_object.vertex_attrib_divisor
-
 # Khronos bugs 11207, 12408, internal bug 20699693
 dEQP-GLES31.functional.shaders.arrays_of_arrays.invalid.empty_declaration_without_var_name_*
diff --git a/android/cts/master/src/gles31-test-issues.txt b/android/cts/master/src/gles31-test-issues.txt
index 920c9a5..587f6fd 100644
--- a/android/cts/master/src/gles31-test-issues.txt
+++ b/android/cts/master/src/gles31-test-issues.txt
@@ -23,3 +23,7 @@
 dEQP-GLES31.functional.copy_image.non_compressed.viewclass_16_bits.*_rg8_snorm.*
 dEQP-GLES31.functional.copy_image.non_compressed.viewclass_8_bits.r8_snorm_*
 dEQP-GLES31.functional.copy_image.non_compressed.viewclass_8_bits.*_r8_snorm.*
+
+# Bug 20453509
+dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.consistency.*
+dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.array_element.*
diff --git a/data/gles2/shaders/preprocessor.test b/data/gles2/shaders/preprocessor.test
index 6aeb5e1..d2dc32b 100644
--- a/data/gles2/shaders/preprocessor.test
+++ b/data/gles2/shaders/preprocessor.test
@@ -2719,11 +2719,13 @@
 		""
 	end
 
-	case invalid_pragma_invalid_debug
-		expect compile_fail
+	case pragma_unrecognized_debug
+		expect build_successful
 		both ""
 			#pragma debug(1.23)
 
+			// unrecognized preprocessor token
+
 			precision mediump float;
 			void main()
 			{
@@ -2732,11 +2734,13 @@
 		""
 	end
 
-	case invalid_pragma_invalid_token
-		expect compile_fail
+	case pragma_unrecognized_token
+		expect build_successful
 		both ""
 			#pragma ¤¤½
 
+			// trailing bytes form a valid but unrecognized preprocessor token
+
 			precision mediump float;
 			void main()
 			{
diff --git a/data/gles3/shaders/preprocessor.test b/data/gles3/shaders/preprocessor.test
index ed5e1f9..12e0d8c 100644
--- a/data/gles3/shaders/preprocessor.test
+++ b/data/gles3/shaders/preprocessor.test
@@ -3287,13 +3287,15 @@
 		""
 	end
 
-	case invalid_pragma_invalid_debug
+	case pragma_unrecognized_debug
 		version 300 es
-		expect compile_fail
+		expect build_successful
 		both ""
 			#version 300 es
 			#pragma debug(1.23)
 
+			// unrecognized preprocessor token
+
 			precision mediump float;
 			${DECLARATIONS}
 			void main()
@@ -3303,13 +3305,15 @@
 		""
 	end
 
-	case invalid_pragma_invalid_token
+	case pragma_unrecognized_token
 		version 300 es
-		expect compile_fail
+		expect build_successful
 		both ""
 			#version 300 es
 			#pragma ¤¤½
 
+			// trailing bytes form a valid but unrecognized preprocessor token
+
 			precision mediump float;
 			${DECLARATIONS}
 			void main()
diff --git a/data/gles31/shaders/linkage_geometry_uniform_types.test b/data/gles31/shaders/linkage_geometry_uniform_types.test
index d13a822..460cf83 100644
--- a/data/gles31/shaders/linkage_geometry_uniform_types.test
+++ b/data/gles31/shaders/linkage_geometry_uniform_types.test
@@ -33,7 +33,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mediump float geo_var;
 			void main()
@@ -77,7 +77,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in vec2 geo_var;
 			void main()
@@ -121,7 +121,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in vec3 geo_var;
 			void main()
@@ -165,7 +165,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in vec4 geo_var;
 			void main()
@@ -209,7 +209,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat2 geo_var;
 			void main()
@@ -253,7 +253,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat2x3 geo_var;
 			void main()
@@ -297,7 +297,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat2x4 geo_var;
 			void main()
@@ -341,7 +341,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat3x2 geo_var;
 			void main()
@@ -385,7 +385,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat3 geo_var;
 			void main()
@@ -429,7 +429,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat3x4 geo_var;
 			void main()
@@ -473,7 +473,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat4x2 geo_var;
 			void main()
@@ -517,7 +517,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat4x3 geo_var;
 			void main()
@@ -561,7 +561,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat4 geo_var;
 			void main()
@@ -606,6 +606,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in int geo_var;
 			void main()
@@ -650,6 +651,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in ivec2 geo_var;
 			void main()
@@ -694,6 +696,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in ivec3 geo_var;
 			void main()
@@ -738,6 +741,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in ivec4 geo_var;
 			void main()
@@ -782,6 +786,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in uint geo_var;
 			void main()
@@ -826,6 +831,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in uvec2 geo_var;
 			void main()
@@ -870,6 +876,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in uvec3 geo_var;
 			void main()
@@ -914,6 +921,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in uvec4 geo_var;
 			void main()
diff --git a/data/gles31/shaders/linkage_tessellation_uniform_types.test b/data/gles31/shaders/linkage_tessellation_uniform_types.test
index 616c971..5850049 100644
--- a/data/gles31/shaders/linkage_tessellation_uniform_types.test
+++ b/data/gles31/shaders/linkage_tessellation_uniform_types.test
@@ -41,7 +41,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mediump float te_out;
 			void main()
@@ -93,7 +93,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in vec2 te_out;
 			void main()
@@ -145,7 +145,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in vec3 te_out;
 			void main()
@@ -197,7 +197,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in vec4 te_out;
 			void main()
@@ -249,7 +249,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat2 te_out;
 			void main()
@@ -301,7 +301,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat2x3 te_out;
 			void main()
@@ -353,7 +353,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat2x4 te_out;
 			void main()
@@ -405,7 +405,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat3x2 te_out;
 			void main()
@@ -457,7 +457,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat3 te_out;
 			void main()
@@ -509,7 +509,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat3x4 te_out;
 			void main()
@@ -561,7 +561,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat4x2 te_out;
 			void main()
@@ -613,7 +613,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat4x3 te_out;
 			void main()
@@ -665,7 +665,7 @@
 		""
 		fragment ""
 			#version 310 es
-			precision mediump float;
+			precision highp float;
 			${FRAGMENT_DECLARATIONS}
 			in mat4 te_out;
 			void main()
@@ -718,6 +718,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in int te_out;
 			void main()
@@ -770,6 +771,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in ivec2 te_out;
 			void main()
@@ -822,6 +824,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in ivec3 te_out;
 			void main()
@@ -874,6 +877,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in ivec4 te_out;
 			void main()
@@ -926,6 +930,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in uint te_out;
 			void main()
@@ -978,6 +983,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in uvec2 te_out;
 			void main()
@@ -1030,6 +1036,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in uvec3 te_out;
 			void main()
@@ -1082,6 +1089,7 @@
 		""
 		fragment ""
 			#version 310 es
+			precision highp int;
 			${FRAGMENT_DECLARATIONS}
 			flat in uvec4 te_out;
 			void main()
diff --git a/framework/common/tcuImageCompare.cpp b/framework/common/tcuImageCompare.cpp
index ced0145..0811c92 100644
--- a/framework/common/tcuImageCompare.cpp
+++ b/framework/common/tcuImageCompare.cpp
@@ -31,6 +31,7 @@
 #include "tcuRGBA.hpp"
 #include "tcuTexture.hpp"
 #include "tcuTextureUtil.hpp"
+#include "tcuFloat.hpp"
 
 #include <string.h>
 
@@ -392,6 +393,74 @@
 }
 
 /*--------------------------------------------------------------------*//*!
+ * Returns the index of float in a float space without denormals
+ * so that:
+ * 1) f(0.0) = 0
+ * 2) f(-0.0) = 0
+ * 3) f(b) = f(a) + 1  <==>  b = nextAfter(a)
+ *
+ * See computeFloatFlushRelaxedULPDiff for details
+ *//*--------------------------------------------------------------------*/
+static deInt32 getPositionOfIEEEFloatWithoutDenormals (float x)
+{
+	DE_ASSERT(!deIsNaN(x)); // not sane
+
+	if (x == 0.0f)
+		return 0;
+	else if (x < 0.0f)
+		return -getPositionOfIEEEFloatWithoutDenormals(-x);
+	else
+	{
+		DE_ASSERT(x > 0.0f);
+
+		const tcu::Float32 f(x);
+
+		if (f.isDenorm())
+		{
+			// Denorms are flushed to zero
+			return 0;
+		}
+		else
+		{
+			// sign is 0, and it's a normal number. Natural position is its bit
+			// pattern but since we've collapsed the denorms, we must remove
+			// 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));
+		}
+	}
+}
+
+static deUint32 computeFloatFlushRelaxedULPDiff (float a, float b)
+{
+	if (deIsNaN(a) && deIsNaN(b))
+		return 0;
+	else if (deIsNaN(a) || deIsNaN(b))
+	{
+		return 0xFFFFFFFFu;
+	}
+	else
+	{
+		// Using the "definition 5" in Muller, Jean-Michel. "On the definition of ulp (x)" (2005)
+		// assuming a floating point space is IEEE single precision floating point space without
+		// denormals (and signed zeros).
+		const deInt32 aIndex = getPositionOfIEEEFloatWithoutDenormals(a);
+		const deInt32 bIndex = getPositionOfIEEEFloatWithoutDenormals(b);
+		return (deUint32)de::abs(aIndex - bIndex);
+	}
+}
+
+static tcu::UVec4 computeFlushRelaxedULPDiff (const tcu::Vec4& a, const tcu::Vec4& b)
+{
+	return tcu::UVec4(computeFloatFlushRelaxedULPDiff(a.x(), b.x()),
+					  computeFloatFlushRelaxedULPDiff(a.y(), b.y()),
+					  computeFloatFlushRelaxedULPDiff(a.z(), b.z()),
+					  computeFloatFlushRelaxedULPDiff(a.w(), b.w()));
+}
+
+/*--------------------------------------------------------------------*//*!
  * \brief Per-pixel threshold-based comparison
  *
  * This compare computes per-pixel differences between result and reference
@@ -399,7 +468,8 @@
  *
  * This comparison uses ULP (units in last place) metric for computing the
  * difference between floating-point values and thus this function can
- * be used only for comparing floating-point texture data.
+ * be used only for comparing floating-point texture data. In ULP calculation
+ * the denormal numbers are allowed to be flushed to zero.
  *
  * On failure error image is generated that shows where the failing pixels
  * are.
@@ -432,17 +502,10 @@
 		{
 			for (int x = 0; x < width; x++)
 			{
-				Vec4	refPix		= reference.getPixel(x, y, z);
-				Vec4	cmpPix		= result.getPixel(x, y, z);
-				UVec4	refBits;
-				UVec4	cmpBits;
-
-				// memcpy() is the way to do float->uint32 reinterpretation.
-				memcpy(refBits.getPtr(), refPix.getPtr(), 4*sizeof(deUint32));
-				memcpy(cmpBits.getPtr(), cmpPix.getPtr(), 4*sizeof(deUint32));
-
-				UVec4	diff		= abs(refBits.cast<int>() - cmpBits.cast<int>()).cast<deUint32>();
-				bool	isOk		= boolAll(lessThanEqual(diff, threshold));
+				const Vec4	refPix	= reference.getPixel(x, y, z);
+				const Vec4	cmpPix	= result.getPixel(x, y, z);
+				const UVec4	diff	= computeFlushRelaxedULPDiff(refPix, cmpPix);
+				const bool	isOk	= boolAll(lessThanEqual(diff, threshold));
 
 				maxDiff = max(maxDiff, diff);
 
diff --git a/framework/common/tcuInterval.hpp b/framework/common/tcuInterval.hpp
index 0a2f65f..0c29d57 100644
--- a/framework/common/tcuInterval.hpp
+++ b/framework/common/tcuInterval.hpp
@@ -118,7 +118,7 @@
 
 	bool		intersects		(const Interval& other) const
 	{
-		return ((other.hi() >= lo() && other.lo() >= hi()) ||
+		return ((other.hi() >= lo() && other.lo() <= hi()) ||
 				(other.hasNaN() && hasNaN()));
 	}
 
diff --git a/framework/common/tcuTexture.cpp b/framework/common/tcuTexture.cpp
index d7e82c1..43c7616 100644
--- a/framework/common/tcuTexture.cpp
+++ b/framework/common/tcuTexture.cpp
@@ -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)
@@ -788,9 +832,6 @@
 
 	const deUint8* const pixelPtr = (const deUint8*)getPixelPtr(x, y, z);
 
-#define UB32(OFFS, COUNT) ((*((const deUint32*)pixelPtr) >> (OFFS)) & ((1<<(COUNT))-1))
-#define NB32(OFFS, COUNT) channelToNormFloat(UB32(OFFS, COUNT), (COUNT))
-
 	DE_ASSERT(m_format.order == TextureFormat::DS || m_format.order == TextureFormat::D);
 
 	switch (m_format.type)
@@ -800,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;
@@ -814,9 +856,6 @@
 			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
@@ -832,8 +871,9 @@
 		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);
@@ -842,7 +882,7 @@
 
 		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:
 		{
@@ -988,15 +1028,16 @@
 
 	deUint8* const pixelPtr = (deUint8*)getPixelPtr(x, y, z);
 
-#define PN(VAL, OFFS, BITS) (normFloatToChannel((VAL), (BITS)) << (OFFS))
-
 	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);
 			}
@@ -1012,8 +1053,6 @@
 			floatToChannel(pixelPtr, depth, m_format.type);
 			break;
 	}
-
-#undef PN
 }
 
 void PixelBufferAccess::setPixStencil (int stencil, int x, int y, int z) const
@@ -1024,15 +1063,16 @@
 
 	deUint8* const pixelPtr = (deUint8*)getPixelPtr(x, y, z);
 
-#define PU(VAL, OFFS, BITS) (uintToChannel((deUint32)(VAL), (BITS)) << (OFFS))
-
 	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);
 			}
@@ -1040,7 +1080,7 @@
 
 		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:
@@ -1048,8 +1088,6 @@
 			intToChannel(pixelPtr, stencil, m_format.type);
 			break;
 	}
-
-#undef PU
 }
 
 static inline int imod (int a, int b)
diff --git a/framework/common/tcuTextureUtil.cpp b/framework/common/tcuTextureUtil.cpp
index d8018af..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
 	{
diff --git a/framework/delibs/debase/CMakeLists.txt b/framework/delibs/debase/CMakeLists.txt
index 6f18c88..b960bbc 100644
--- a/framework/delibs/debase/CMakeLists.txt
+++ b/framework/delibs/debase/CMakeLists.txt
@@ -14,6 +14,7 @@
 	deInt32Test.c
 	deMath.c
 	deMath.h
+	deMathTest.c
 	deMemory.c
 	deMemory.h
 	deRandom.c
diff --git a/framework/delibs/debase/deMath.c b/framework/delibs/debase/deMath.c
index 259286c..26e2aef 100644
--- a/framework/delibs/debase/deMath.c
+++ b/framework/delibs/debase/deMath.c
@@ -22,6 +22,7 @@
  *//*--------------------------------------------------------------------*/
 
 #include "deMath.h"
+#include "deInt32.h"
 
 #if (DE_COMPILER == DE_COMPILER_MSC)
 #	include <float.h>
@@ -133,3 +134,56 @@
 		return 2.0 * deRound(a / 2.0);
 	return deRound(a);
 }
+
+float deInt32ToFloatRoundToNegInf (deInt32 x)
+{
+	/* \note Sign bit is separate so the range is symmetric */
+	if (x >= -0xFFFFFF && x <= 0xFFFFFF)
+	{
+		/* 24 bits are representable (23 mantissa + 1 implicit). */
+		return (float)x;
+	}
+	else if (x != -0x7FFFFFFF - 1)
+	{
+		/* we are losing bits */
+		const int		exponent	= 31 - deClz32((deUint32)deAbs32(x));
+		const int		numLostBits	= exponent - 23;
+		const deUint32	lostMask	= deBitMask32(0, numLostBits);
+
+		DE_ASSERT(numLostBits > 0);
+
+		if (x > 0)
+		{
+			/* Mask out lost bits to floor to a representable value */
+			return (float)(deInt32)(~lostMask & (deUint32)x);
+		}
+		else if ((lostMask & (deUint32)-x) == 0u)
+		{
+			/* this was a representable value */
+			DE_ASSERT( (deInt32)(float)x == x );
+			return (float)x;
+		}
+		else
+		{
+			/* not representable, choose the next lower */
+			const float nearestHigher	= (float)-(deInt32)(~lostMask & (deUint32)-x);
+			const float oneUlp			= (float)(1u << (deUint32)numLostBits);
+			const float nearestLower	= nearestHigher - oneUlp;
+
+			/* check sanity */
+			DE_ASSERT((deInt32)(float)nearestHigher > (deInt32)(float)nearestLower);
+
+			return nearestLower;
+		}
+	}
+	else
+		return -(float)0x80000000u;
+}
+
+float deInt32ToFloatRoundToPosInf (deInt32 x)
+{
+	if (x == -0x7FFFFFFF - 1)
+		return -(float)0x80000000u;
+	else
+		return -deInt32ToFloatRoundToNegInf(-x);
+}
diff --git a/framework/delibs/debase/deMath.h b/framework/delibs/debase/deMath.h
index b6f5487..12b25a5 100644
--- a/framework/delibs/debase/deMath.h
+++ b/framework/delibs/debase/deMath.h
@@ -56,6 +56,8 @@
 deRoundingMode		deGetRoundingMode	(void);
 deBool				deSetRoundingMode	(deRoundingMode mode);
 
+void				deMath_selfTest		(void);
+
 /* Float properties */
 
 /* \note The NaN test probably won't work with -ffast-math */
@@ -186,11 +188,27 @@
 DE_INLINE deBool	deFloatCmpGT		(float a, float b)			{ return (a > b);  }
 DE_INLINE deBool	deFloatCmpGE		(float a, float b)			{ return (a >= b); }
 
+/* Convert int to float. If the value cannot be represented exactly in native single precision format, return
+ * either the nearest lower or the nearest higher representable value, chosen in an implementation-defined manner.
+ *
+ * \note Choosing either nearest lower or nearest higher means that implementation could for example consistently
+ *       choose the lower value, i.e. this function does not round towards nearest.
+ * \note Value returned is in native single precision format. For example with x86 extended precision, the value
+ *       returned might not be representable in IEEE single precision float.
+ */
+DE_INLINE float		deInt32ToFloat				(deInt32 x)					{ return (float)x; }
+
+/* Convert to float. If the value cannot be represented exactly in IEEE single precision floating point format,
+ * return the nearest lower (round towards negative inf). */
+float				deInt32ToFloatRoundToNegInf	(deInt32 x);
+
+/* Convert to float. If the value cannot be represented exactly IEEE single precision floating point format,
+ * return the nearest higher (round towards positive inf). */
+float				deInt32ToFloatRoundToPosInf	(deInt32 x);
+
 /* Conversion to integer. */
 
-DE_INLINE float		deInt32ToFloat		(deInt32 x)					{ return (float)x; }
 DE_INLINE deInt32	deChopFloatToInt32	(float x)					{ return (deInt32)x; }
-
 DE_INLINE deInt32	deFloorFloatToInt32	(float x)					{ return (deInt32)(deFloatFloor(x)); }
 DE_INLINE deInt32	deCeilFloatToInt32	(float x)					{ return (deInt32)(deFloatCeil(x)); }
 
diff --git a/framework/delibs/debase/deMathTest.c b/framework/delibs/debase/deMathTest.c
new file mode 100644
index 0000000..d8e73a7
--- /dev/null
+++ b/framework/delibs/debase/deMathTest.c
@@ -0,0 +1,107 @@
+/*-------------------------------------------------------------------------
+ * drawElements Base Portability Library
+ * -------------------------------------
+ *
+ * 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 Testing of deMath functions.
+ *//*--------------------------------------------------------------------*/
+
+#include "deMath.h"
+#include "deRandom.h"
+
+DE_BEGIN_EXTERN_C
+
+static deBool conversionToFloatLosesPrecision (deInt32 x)
+{
+	if (x == -0x7FFFFFFF - 1)
+		return DE_FALSE;
+	else if (x < 0)
+		return conversionToFloatLosesPrecision(-x);
+	else if (x == 0)
+		return DE_FALSE;
+	else if (((deUint32)x & 0x1) == 0)
+		return conversionToFloatLosesPrecision(x >> 1); /* remove trailing zeros */
+	else
+		return x > ((1 << 24) - 1); /* remaining part does not fit in the mantissa? */
+}
+
+static void testSingleInt32ToFloat (deInt32 x)
+{
+	/* roundTowardsToNegInf(x) <= round(x) <= roundTowardsPosInf(x). */
+	/* \note: Need to use inequalities since round(x) returns arbitrary precision floats. */
+	DE_TEST_ASSERT(deInt32ToFloatRoundToNegInf(x) <= deInt32ToFloat(x));
+	DE_TEST_ASSERT(deInt32ToFloat(x) <= deInt32ToFloatRoundToPosInf(x));
+
+	/* if precision is lost, floor(x) < ceil(x). Else floor(x) == ceil(x) */
+	if (conversionToFloatLosesPrecision(x))
+		DE_TEST_ASSERT(deInt32ToFloatRoundToNegInf(x) < deInt32ToFloatRoundToPosInf(x));
+	else
+		DE_TEST_ASSERT(deInt32ToFloatRoundToNegInf(x) == deInt32ToFloatRoundToPosInf(x));
+
+	/* max one ulp from each other */
+	if (deInt32ToFloatRoundToNegInf(x) < deInt32ToFloatRoundToPosInf(x))
+	{
+		union
+		{
+			float f;
+			deInt32 u;
+		} v0, v1;
+
+		v0.f = deInt32ToFloatRoundToNegInf(x);
+		v1.f = deInt32ToFloatRoundToPosInf(x);
+
+		DE_TEST_ASSERT(v0.u + 1 == v1.u || v0.u == v1.u + 1);
+	}
+}
+
+static void testInt32ToFloat (void)
+{
+	const int	numIterations = 2500000;
+
+	int			sign;
+	int			numBits;
+	int			delta;
+	int			ndx;
+	deRandom	rnd;
+
+	deRandom_init(&rnd, 0xdeadbeefu-1);
+
+	for (sign = -1; sign < 1; ++sign)
+	for (numBits = 0; numBits < 32; ++numBits)
+	for (delta = -2; delta < 3; ++delta)
+	{
+		const deInt64 x = (deInt64)(sign == -1 ? (-1) : (+1)) * (1LL << (deInt64)numBits) + (deInt64)delta;
+
+		/* would overflow */
+		if (x > 0x7FFFFFFF || x < -0x7FFFFFFF - 1)
+			continue;
+
+		testSingleInt32ToFloat((deInt32)x);
+	}
+
+	for (ndx = 0; ndx < numIterations; ++ndx)
+		testSingleInt32ToFloat((deInt32)deRandom_getUint32(&rnd));
+}
+
+void deMath_selfTest (void)
+{
+	/* Test Int32ToFloat*(). */
+	testInt32ToFloat();
+}
+
+DE_END_EXTERN_C
diff --git a/modules/gles2/performance/es2pShaderCompilationCases.cpp b/modules/gles2/performance/es2pShaderCompilationCases.cpp
index 21ec8ef..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);
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/es3fShaderBuiltinVarTests.cpp b/modules/gles3/functional/es3fShaderBuiltinVarTests.cpp
index 7874059..7cb6f4f 100644
--- a/modules/gles3/functional/es3fShaderBuiltinVarTests.cpp
+++ b/modules/gles3/functional/es3fShaderBuiltinVarTests.cpp
@@ -73,7 +73,7 @@
 	int value = -1;
 	gl.getIntegerv(pname, &value);
 	GLU_EXPECT_NO_ERROR(gl.getError(), ("glGetIntegerv(" + glu::getGettableStateStr((int)pname).toString() + ")").c_str());
-	TCU_CHECK_MSG(value%4 == 0, ("Expected " + glu::getGettableStateStr((int)pname).toString() + " to be divisible by 4").c_str());
+	// Accept truncated division. According to the spec, the number of vectors is number of components divided by four, plain and simple.
 	return value/4;
 }
 
diff --git a/modules/gles3/functional/es3fShaderDerivateTests.cpp b/modules/gles3/functional/es3fShaderDerivateTests.cpp
index 508cfc8..ed49d28 100644
--- a/modules/gles3/functional/es3fShaderDerivateTests.cpp
+++ b/modules/gles3/functional/es3fShaderDerivateTests.cpp
@@ -267,7 +267,7 @@
 	return getSingleULPForExponent(exp, numMantissaBits);
 }
 
-static float convertFloorFlushToZero (float value, int minExponent, int numAccurateBits)
+static float convertFloatFlushToZeroRtn (float value, int minExponent, int numAccurateBits)
 {
 	if (value == 0.0f)
 	{
@@ -308,9 +308,9 @@
 	}
 }
 
-static float convertCeilFlushToZero (float value, int minExponent, int numAccurateBits)
+static float convertFloatFlushToZeroRtp (float value, int minExponent, int numAccurateBits)
 {
-	return -convertFloorFlushToZero(-value, minExponent, numAccurateBits);
+	return -convertFloatFlushToZeroRtn(-value, minExponent, numAccurateBits);
 }
 
 static float addErrorUlp (float value, float numUlps, int numMantissaBits)
@@ -489,11 +489,11 @@
 		// check components separately
 		for (int c = 0; c < numComponents; ++c)
 		{
-			// interpolation value range
-			const tcu::Interval	forwardComponent		(convertFloorFlushToZero(functionValueForward[c], minExponent, numVaryingSampleBits),
-														 convertCeilFlushToZero(functionValueForward[c], minExponent, numVaryingSampleBits));
-			const tcu::Interval	backwardComponent		(convertFloorFlushToZero(functionValueBackward[c], minExponent, numVaryingSampleBits),
-														 convertCeilFlushToZero(functionValueBackward[c], minExponent, numVaryingSampleBits));
+			// Simulate interpolation. Add allowed interpolation error and round to target precision. Allow one half ULP (i.e. correct rounding)
+			const tcu::Interval	forwardComponent		(convertFloatFlushToZeroRtn(addErrorUlp((float)functionValueForward[c],  -0.5f, numVaryingSampleBits), minExponent, numBits),
+														 convertFloatFlushToZeroRtp(addErrorUlp((float)functionValueForward[c],  +0.5f, numVaryingSampleBits), minExponent, numBits));
+			const tcu::Interval	backwardComponent		(convertFloatFlushToZeroRtn(addErrorUlp((float)functionValueBackward[c], -0.5f, numVaryingSampleBits), minExponent, numBits),
+														 convertFloatFlushToZeroRtp(addErrorUlp((float)functionValueBackward[c], +0.5f, numVaryingSampleBits), minExponent, numBits));
 			const int			maxValueExp				= de::max(de::max(tcu::Float32(forwardComponent.lo()).exponent(),   tcu::Float32(forwardComponent.hi()).exponent()),
 																  de::max(tcu::Float32(backwardComponent.lo()).exponent(),  tcu::Float32(backwardComponent.hi()).exponent()));
 
@@ -508,12 +508,12 @@
 			const int			numeratorLoBits			= de::max(0, numBits - numeratorLoBitsLost);
 			const int			numeratorHiBits			= de::max(0, numBits - numeratorHiBitsLost);
 
-			const tcu::Interval	numeratorRange			(convertFloorFlushToZero((float)numerator.lo(), minExponent, numeratorLoBits),
-														 convertCeilFlushToZero((float)numerator.hi(), minExponent, numeratorHiBits));
+			const tcu::Interval	numeratorRange			(convertFloatFlushToZeroRtn((float)numerator.lo(), minExponent, numeratorLoBits),
+														 convertFloatFlushToZeroRtp((float)numerator.hi(), minExponent, numeratorHiBits));
 
 			const tcu::Interval	divisionRange			= numeratorRange / 3.0f; // legal sample area is anywhere within this and neighboring pixels (i.e. size = 3)
-			const tcu::Interval	divisionResultRange		(convertFloorFlushToZero(addErrorUlp((float)divisionRange.lo(), -divisionErrorUlps, numBits), minExponent, numBits),
-														 convertCeilFlushToZero(addErrorUlp((float)divisionRange.hi(), +divisionErrorUlps, numBits), minExponent, numBits));
+			const tcu::Interval	divisionResultRange		(convertFloatFlushToZeroRtn(addErrorUlp((float)divisionRange.lo(), -divisionErrorUlps, numBits), minExponent, numBits),
+														 convertFloatFlushToZeroRtp(addErrorUlp((float)divisionRange.hi(), +divisionErrorUlps, numBits), minExponent, numBits));
 			const tcu::Interval	finalResultRange		(divisionResultRange.lo() - surfaceThreshold[c], divisionResultRange.hi() + surfaceThreshold[c]);
 
 			if (resultDerivative[c] >= finalResultRange.lo() && resultDerivative[c] <= finalResultRange.hi())
diff --git a/modules/gles3/functional/es3fShaderOperatorTests.cpp b/modules/gles3/functional/es3fShaderOperatorTests.cpp
index f74dc7a..4ead3ea 100644
--- a/modules/gles3/functional/es3fShaderOperatorTests.cpp
+++ b/modules/gles3/functional/es3fShaderOperatorTests.cpp
@@ -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/es3fShaderPrecisionTests.cpp b/modules/gles3/functional/es3fShaderPrecisionTests.cpp
index a030b32..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		= maskBits < 32 ? refBits >> maskBits : 0u;
-		const deUint64	accurateResBits		= maskBits < 32 ? resBits >> maskBits : 0u;
+		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)
diff --git a/modules/gles3/performance/es3pShaderCompilationCases.cpp b/modules/gles3/performance/es3pShaderCompilationCases.cpp
index c3ad27d..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);
diff --git a/modules/gles31/functional/es31fCopyImageTests.cpp b/modules/gles31/functional/es31fCopyImageTests.cpp
index 98c10af..53f7416 100644
--- a/modules/gles31/functional/es31fCopyImageTests.cpp
+++ b/modules/gles31/functional/es31fCopyImageTests.cpp
@@ -902,6 +902,12 @@
 		tcu::Surface			renderedFrame	(viewport.width, viewport.height);
 		tcu::Surface			referenceFrame	(viewport.width, viewport.height);
 
+		renderParams.baseLevel	= level;
+		renderParams.maxLevel	= level;
+
+		gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, level);
+		gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level);
+
 		computeQuadTexCoord2D(texCoord, tcu::Vec2(0.0f, 0.0f), tcu::Vec2(1.0f, 1.0f));
 
 		// Setup base viewport.
@@ -922,6 +928,9 @@
 			log << TestLog::Message << "Image comparison of level " << level << " passed." << TestLog::EndMessage;
 	}
 
+	gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+	gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1000);
+
 	gl.bindTexture(GL_TEXTURE_2D, 0);
 	GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to unbind texture.");
 }
@@ -1043,6 +1052,12 @@
 	{
 		const IVec3 levelSize = getLevelSize(info.getTarget(), info.getSize(), level);
 
+		renderParams.baseLevel	= level;
+		renderParams.maxLevel	= level;
+
+		gl.texParameteri(GL_TEXTURE_3D, GL_TEXTURE_BASE_LEVEL, level);
+		gl.texParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAX_LEVEL, level);
+
 		for (int slice = 0; slice < levelSize.z(); slice++)
 		{
 			const RandomViewport	viewport		(renderContext.getRenderTarget(), levelSize.x(), levelSize.y(), rng.getUint32());
@@ -1072,6 +1087,9 @@
 		}
 	}
 
+	gl.texParameteri(GL_TEXTURE_3D, GL_TEXTURE_BASE_LEVEL, 0);
+	gl.texParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAX_LEVEL, 1000);
+
 	gl.bindTexture(GL_TEXTURE_3D, 0);
 	GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to unbind texture.");
 }
@@ -1147,6 +1165,12 @@
 		if (levelSize.x() < 4 && levelSize.y() < 4)
 			continue;
 
+		renderParams.baseLevel	= level;
+		renderParams.maxLevel	= level;
+
+		gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BASE_LEVEL, level);
+		gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, level);
+
 		for (int face = 0; face < 6; face++)
 		{
 			const RandomViewport	viewport		(renderContext.getRenderTarget(), levelSize.x(), levelSize.y(), rng.getUint32());
@@ -1176,6 +1200,9 @@
 		}
 	}
 
+	gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BASE_LEVEL, 0);
+	gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, 1000);
+
 	gl.bindTexture(GL_TEXTURE_CUBE_MAP, 0);
 	GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to unbind texture.");
 }
@@ -1307,6 +1334,12 @@
 	{
 		const IVec3 levelSize = getLevelSize(info.getTarget(), info.getSize(), level);
 
+		renderParams.baseLevel	= level;
+		renderParams.maxLevel	= level;
+
+		gl.texParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BASE_LEVEL, level);
+		gl.texParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, level);
+
 		for (int layer = 0; layer < levelSize.z(); layer++)
 		{
 			const RandomViewport	viewport		(renderContext.getRenderTarget(), levelSize.x(), levelSize.y(), rng.getUint32());
@@ -1335,6 +1368,9 @@
 		}
 	}
 
+	gl.texParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BASE_LEVEL, 0);
+	gl.texParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, 1000);
+
 	gl.bindTexture(GL_TEXTURE_2D_ARRAY, 0);
 	GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to unbind texture.");
 }
diff --git a/modules/gles31/functional/es31fDebugTests.cpp b/modules/gles31/functional/es31fDebugTests.cpp
index 2c7370b..e8acd2c 100644
--- a/modules/gles31/functional/es31fDebugTests.cpp
+++ b/modules/gles31/functional/es31fDebugTests.cpp
@@ -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)
 	{
@@ -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");
diff --git a/modules/gles31/functional/es31fGeometryShaderTests.cpp b/modules/gles31/functional/es31fGeometryShaderTests.cpp
index ae92528..2f4e60c 100644
--- a/modules/gles31/functional/es31fGeometryShaderTests.cpp
+++ b/modules/gles31/functional/es31fGeometryShaderTests.cpp
@@ -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)
diff --git a/modules/gles31/functional/es31fIntegerStateQueryTests.cpp b/modules/gles31/functional/es31fIntegerStateQueryTests.cpp
index 24a5f25..775b7d1 100644
--- a/modules/gles31/functional/es31fIntegerStateQueryTests.cpp
+++ b/modules/gles31/functional/es31fIntegerStateQueryTests.cpp
@@ -369,14 +369,19 @@
 	gl.enableLogging(true);
 
 	{
-		const tcu::ScopedLogSection	section(m_testCtx.getLog(), "Minimum", "Minimum is " + de::toString(m_minValue));
+		const tcu::ScopedLogSection	section(m_testCtx.getLog(), "Minimum", "Specified minimum is " + de::toString(m_minValue));
 
 		verifyStateIntegerMin(result, gl, m_target, m_minValue, m_verifierType);
 	}
 	{
-		const tcu::ScopedLogSection	section(m_testCtx.getLog(), "Ties", "Tied to " + de::toString(glu::getGettableStateStr(m_tiedTo)));
+		const tcu::ScopedLogSection				section		(m_testCtx.getLog(), "Ties", "The limit is tied to the value of " + de::toString(glu::getGettableStateStr(m_tiedTo)));
+		StateQueryMemoryWriteGuard<glw::GLint>	tiedToValue;
 
-		verifyStateIntegerEqualToOther(result, gl, m_target, m_tiedTo, m_verifierType);
+		gl.glGetIntegerv(m_tiedTo, &tiedToValue);
+		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glGetIntegerv");
+
+		if (tiedToValue.verifyValidity(result))
+			verifyStateIntegerMin(result, gl, m_target, tiedToValue, m_verifierType);
 	}
 
 	result.setTestContextResult(m_testCtx);
diff --git a/modules/gles31/functional/es31fProgramInterfaceQueryTestCase.cpp b/modules/gles31/functional/es31fProgramInterfaceQueryTestCase.cpp
index 778ef6f..3f061ac 100644
--- a/modules/gles31/functional/es31fProgramInterfaceQueryTestCase.cpp
+++ b/modules/gles31/functional/es31fProgramInterfaceQueryTestCase.cpp
@@ -2631,6 +2631,7 @@
 				{ GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS,				usage.numSamplers										},
 				{ GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS,			usage.numAtomicCounterBuffers							},
 				{ GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS,					usage.numAtomicCounters									},
+				{ GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS,					usage.numImages											},
 				{ GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS,			usage.numShaderStorageBlocks							},
 			};
 
@@ -2660,6 +2661,7 @@
 				{ GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS,			usage.numSamplers										},
 				{ GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS,		usage.numAtomicCounterBuffers							},
 				{ GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS,				usage.numAtomicCounters									},
+				{ GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS,				usage.numImages											},
 				{ GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS,			usage.numShaderStorageBlocks							},
 			};
 
diff --git a/modules/gles31/functional/es31fTessellationTests.cpp b/modules/gles31/functional/es31fTessellationTests.cpp
index c9c5dbf..73e2cf3 100644
--- a/modules/gles31/functional/es31fTessellationTests.cpp
+++ b/modules/gles31/functional/es31fTessellationTests.cpp
@@ -5998,10 +5998,12 @@
 			DE_ASSERT(numElements != -2);
 
 			if (isArray)
+			{
+				// \note: TCS output arrays are always implicitly-sized
 				tcsDeclarations += outMaybePatch + output.declareArray(m_ioType == IO_TYPE_PER_PATCH_ARRAY			? de::toString(int(NUM_PER_PATCH_ARRAY_ELEMS))
 																	   : m_ioType == IO_TYPE_PER_PATCH_BLOCK_ARRAY	? de::toString(int(NUM_PER_PATCH_BLOCKS))
-																	   : isExplicitVertexArraySize					? de::toString(int(NUM_OUTPUT_VERTICES))
 																	   : "");
+			}
 			else
 				tcsDeclarations += outMaybePatch + output.declare();
 
diff --git a/modules/glshared/glsShaderExecUtil.cpp b/modules/glshared/glsShaderExecUtil.cpp
index 6891eec..019c526 100644
--- a/modules/glshared/glsShaderExecUtil.cpp
+++ b/modules/glshared/glsShaderExecUtil.cpp
@@ -29,6 +29,7 @@
 #include "gluTextureUtil.hpp"
 #include "gluProgramInterfaceQuery.hpp"
 #include "gluPixelTransfer.hpp"
+#include "gluStrUtil.hpp"
 #include "tcuTestLog.hpp"
 #include "glwFunctions.hpp"
 #include "glwEnums.hpp"
@@ -73,6 +74,21 @@
 		throw tcu::NotSupportedError(extension + " is not supported");
 }
 
+static void checkLimit (const glu::RenderContext& renderCtx, deUint32 pname, int required)
+{
+	const glw::Functions&	gl					= renderCtx.getFunctions();
+	int						implementationLimit	= -1;
+	deUint32				error;
+
+	gl.getIntegerv(pname, &implementationLimit);
+	error = gl.getError();
+
+	if (error != GL_NO_ERROR)
+		throw tcu::TestError("Failed to query " + de::toString(glu::getGettableStateStr(pname)) + " - got " + de::toString(glu::getErrorStr(error)));
+	if (implementationLimit < required)
+		throw tcu::NotSupportedError("Test requires " + de::toString(glu::getGettableStateStr(pname)) + " >= " + de::toString(required) + ", got " + de::toString(implementationLimit));
+}
+
 // Shader utilities
 
 static std::string generateVertexShader (const ShaderSpec& shaderSpec)
@@ -1282,10 +1298,25 @@
 class CheckTessSupport
 {
 public:
-	inline CheckTessSupport (const glu::RenderContext& renderCtx)
+	enum Stage
 	{
+		STAGE_CONTROL = 0,
+		STAGE_EVAL,
+	};
+
+	inline CheckTessSupport (const glu::RenderContext& renderCtx, Stage stage)
+	{
+		const int numBlockRequired = 2; // highest binding is always 1 (output) i.e. count == 2
+
 		if (renderCtx.getType().getAPI().getProfile() == glu::PROFILE_ES)
 			checkExtension(renderCtx, "GL_EXT_tessellation_shader");
+
+		if (stage == STAGE_CONTROL)
+			checkLimit(renderCtx, GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS, numBlockRequired);
+		else if (stage == STAGE_EVAL)
+			checkLimit(renderCtx, GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS, numBlockRequired);
+		else
+			DE_ASSERT(false);
 	}
 };
 
@@ -1356,7 +1387,7 @@
 }
 
 TessControlExecutor::TessControlExecutor (const glu::RenderContext& renderCtx, const ShaderSpec& shaderSpec)
-	: CheckTessSupport	(renderCtx)
+	: CheckTessSupport	(renderCtx, STAGE_CONTROL)
 	, BufferIoExecutor	(renderCtx, shaderSpec, glu::ProgramSources()
 							<< glu::VertexSource(generateVertexShaderForTess(shaderSpec.version))
 							<< glu::TessellationControlSource(generateTessControlShader(shaderSpec))
@@ -1459,7 +1490,7 @@
 }
 
 TessEvaluationExecutor::TessEvaluationExecutor (const glu::RenderContext& renderCtx, const ShaderSpec& shaderSpec)
-	: CheckTessSupport	(renderCtx)
+	: CheckTessSupport	(renderCtx, STAGE_EVAL)
 	, BufferIoExecutor	(renderCtx, shaderSpec, glu::ProgramSources()
 							<< glu::VertexSource(generateVertexShaderForTess(shaderSpec.version))
 							<< glu::TessellationControlSource(generatePassthroughTessControlShader(shaderSpec.version))
diff --git a/modules/glshared/glsStateQueryUtil.cpp b/modules/glshared/glsStateQueryUtil.cpp
index ef3000f..5edbc1a 100644
--- a/modules/glshared/glsStateQueryUtil.cpp
+++ b/modules/glshared/glsStateQueryUtil.cpp
@@ -1079,11 +1079,20 @@
 
 		case DATATYPE_FLOAT:
 		{
-			const glw::GLfloat reference = (glw::GLfloat)expected;
-			if (state.getFloatAccess() != reference)
+			const glw::GLfloat refValueMin = deInt32ToFloatRoundToNegInf(expected);
+			const glw::GLfloat refValueMax = deInt32ToFloatRoundToPosInf(expected);
+
+			if (state.getFloatAccess() < refValueMin ||
+				state.getFloatAccess() > refValueMax ||
+				deIsNaN(state.getFloatAccess()))
 			{
 				std::ostringstream buf;
-				buf << "Expected " << reference << ", got " << state.getFloatAccess();
+
+				if (refValueMin == refValueMax)
+					buf << "Expected " << refValueMin << ", got " << state.getFloatAccess();
+				else
+					buf << "Expected in range [" << refValueMin << ", " << refValueMax << "], got " << state.getFloatAccess();
+
 				result.fail(buf.str());
 			}
 			break;
@@ -1147,7 +1156,7 @@
 
 		case DATATYPE_FLOAT:
 		{
-			if (state.getFloatAccess() < minValue)
+			if (state.getFloatAccess() < deInt32ToFloatRoundToNegInf(minValue) || deIsNaN(state.getFloatAccess()))
 			{
 				std::ostringstream buf;
 				buf << "Expected greater or equal to " << minValue << ", got " << state.getFloatAccess();
@@ -1201,7 +1210,7 @@
 
 		case DATATYPE_FLOAT:
 		{
-			if (state.getFloatAccess() > maxValue)
+			if (state.getFloatAccess() > deInt32ToFloatRoundToPosInf(maxValue) || deIsNaN(state.getFloatAccess()))
 			{
 				std::ostringstream buf;
 				buf << "Expected less or equal to " << maxValue << ", got " << state.getFloatAccess();
@@ -1336,7 +1345,7 @@
 
 		case DATATYPE_FLOAT:
 		{
-			if (state.getFloatAccess() < minValue)
+			if (state.getFloatAccess() < minValue || deIsNaN(state.getFloatAccess()))
 			{
 				std::ostringstream buf;
 				buf << "Expected greater or equal to " << minValue << ", got " << state.getFloatAccess();
@@ -1390,7 +1399,7 @@
 
 		case DATATYPE_FLOAT:
 		{
-			if (state.getFloatAccess() > maxValue)
+			if (state.getFloatAccess() > maxValue || deIsNaN(state.getFloatAccess()))
 			{
 				std::ostringstream buf;
 				buf << "Expected less or equal to " << maxValue << ", got " << state.getFloatAccess();
@@ -1614,7 +1623,6 @@
 	}
 }
 
-
 void verifyFloatVec4 (tcu::ResultCollector& result, QueriedState& state, const tcu::Vec4& expected)
 {
 	switch (state.getType())
diff --git a/modules/glshared/glsVertexArrayTests.cpp b/modules/glshared/glsVertexArrayTests.cpp
index 71bba45..54cb855 100644
--- a/modules/glshared/glsVertexArrayTests.cpp
+++ b/modules/glshared/glsVertexArrayTests.cpp
@@ -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)) ||
diff --git a/modules/internal/ditDelibsTests.cpp b/modules/internal/ditDelibsTests.cpp
index f2bc06c..5f58c00 100644
--- a/modules/internal/ditDelibsTests.cpp
+++ b/modules/internal/ditDelibsTests.cpp
@@ -43,6 +43,7 @@
 
 // debase
 #include "deInt32.h"
+#include "deMath.h"
 
 // decpp
 #include "deBlockBuffer.hpp"
@@ -156,6 +157,7 @@
 	void init (void)
 	{
 		addChild(new SelfCheckCase(m_testCtx, "int32",	"deInt32_selfTest()",	deInt32_selfTest));
+		addChild(new SelfCheckCase(m_testCtx, "math",	"deMath_selfTest()",	deMath_selfTest));
 	}
 };
 
diff --git a/scripts/build_android_mustpass.py b/scripts/build_android_mustpass.py
index 3fd8ff7..8f987f7 100644
--- a/scripts/build_android_mustpass.py
+++ b/scripts/build_android_mustpass.py
@@ -137,7 +137,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 +173,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 +197,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):
@@ -418,7 +418,11 @@
 					  filters		= MASTER_EGL_COMMON_FILTERS),
 	])
 
-MASTER_GLES2_COMMON_FILTERS		= [include("gles2-master.txt"), exclude("gles2-failures.txt")]
+MASTER_GLES2_COMMON_FILTERS		= [
+		include("gles2-master.txt"),
+		exclude("gles2-test-issues.txt"),
+		exclude("gles2-failures.txt")
+	]
 MASTER_GLES2_PKG				= Package(module = GLES2_MODULE, configurations = [
 		# Master
 		Configuration(name			= "master",