Merge vk-gl-cts/opengl-cts-4.6.1 into vk-gl-cts/opengl-cts-4.6.2

Change-Id: I0c3adedad43fdc5e21c36e42eff9339421f5aac7
diff --git a/external/openglcts/modules/gl/gl4cBufferStorageTests.cpp b/external/openglcts/modules/gl/gl4cBufferStorageTests.cpp
index b5101f4..9f6beab 100644
--- a/external/openglcts/modules/gl/gl4cBufferStorageTests.cpp
+++ b/external/openglcts/modules/gl/gl4cBufferStorageTests.cpp
@@ -3338,8 +3338,8 @@
 	 *   * geometry shader should:
 	 *     - define single uniform buffer array "rectangles" with unspecified size;
 	 *     Rectangles should have two vec2 fields: position and size;
-	 *     - define single atomic_uint "atom_color";
-	 *     - increment "atom_color" once per execution;
+	 *     - define a separate atomic_uint "atom_color" per input point;
+	 *     - increment "atom_color" once per input point;
 	 *     - output a quad that is placed at rectangles[vs_gs_index].position and
 	 *     has size equal rectangles[vs_gs_index].size;
 	 *     - define output float varying "gs_fs_color" equal to "atom_color" / 255;
@@ -3359,14 +3359,20 @@
 		"    Rectangle rectangle[2];\n"
 		"} rectangles;\n"
 		"\n"
-		"layout (binding = 0) uniform atomic_uint atom_color;\n"
+		"layout (binding = 0) uniform atomic_uint atom_color[2];\n"
+		"layout (binding = 0) uniform atomic_uint invocation_hit_count[2];\n"
 		"\n"
 		"in  uint  vs_gs_index[];\n"
 		"out float gs_fs_color;\n"
 		"\n"
 		"void main()\n"
 		"{\n"
-		"    const uint  atom_color_value = atomicCounterIncrement(atom_color);\n"
+		"    if (atomicCounterIncrement(invocation_hit_count[gl_PrimitiveIDIn]) == 0)\n"
+		"    {\n"
+		"        atomicCounterIncrement(atom_color[gl_PrimitiveIDIn]);\n"
+		"    }\n"
+		"    memoryBarrierAtomicCounter();\n"
+        "    const uint atom_color_value = atomicCounter(atom_color[gl_PrimitiveIDIn]);"
 		"    //const uint  atom_color_value = vs_gs_index[0];\n"
 		"    const float color            = float(atom_color_value) / 255.0;\n"
 		"    //const float color            = rectangles.rectangle[1].size.x;\n"
@@ -3414,10 +3420,10 @@
 										 "\n";
 
 	static const GLuint atom_binding		 = 0;
-	static const size_t atom_data_size		 = 1 * sizeof(GLuint);
-	static const GLuint expected_atom_first  = 3;
-	static const GLuint expected_atom_second = 7;
-	static const GLuint expected_pixel		 = 0xff000003;
+	static const size_t atom_data_size		 = 4 * sizeof(GLuint);
+	static const GLuint expected_atom_first  = 2;
+	static const GLuint expected_atom_second = 6;
+	static const GLuint expected_pixel		 = 0xff000004;
 	static const GLuint height				 = 16;
 	static const GLuint n_rectangles		 = 2;
 	static const GLuint pixel_size			 = 4 * sizeof(GLubyte);
@@ -3434,15 +3440,12 @@
 	bool test_result = true;
 
 	/* Prepare data */
-	GLuint  atom_first_data[1];
-	GLuint  atom_second_data[1];
+	GLuint  atom_first_data[4] = {1, 1, 0, 0};
+	GLuint  atom_second_data[4] = {5, 5, 0, 0};
 	GLubyte rectangles_first_data[rectangles_data_size];
 	GLubyte rectangles_second_data[rectangles_data_size];
 	GLubyte texture_data[texture_data_size];
 
-	atom_first_data[0]  = 1;
-	atom_second_data[0] = 5;
-
 	{
 		GLfloat* ptr = (GLfloat*)rectangles_first_data;
 
@@ -3526,8 +3529,8 @@
 	 * - execute DrawArrays for two vertices;
 	 * - execute MemoryBarrier for ALL_BARRIER_BITS and Finish;
 	 * - inspect contents of:
-	 *   * texture - to verify that pixel at 8,8 is filled with RGBA8(3,0,0,0),
-	 *   * "atom_color" - to verify that it is equal to 3;
+	 *   * texture - to verify that pixel at 8,8 is filled with RGBA8(4,0,0,0),
+	 *   * "atom_color" - to verify that it is equal to 2;
 	 * - modify "rectangles" buffer via mapped memory with the following two sets
 	 *   * position [-1.0,-1.0], size [0.5,0.5],
 	 *   * position [0.5,0.5], size [0.5,0.5];
@@ -3536,8 +3539,8 @@
 	 * - execute DrawArrays for two vertices;
 	 * - execute MemoryBarrier for ALL_BARRIER_BITS and Finish;
 	 * - inspect contents of:
-	 *   * texture - to verify that pixel at 8,8 is filled with RGBA8(3,0,0,0),
-	 *   * "atom_color" - to verify that it is equal to 7;
+	 *   * texture - to verify that pixel at 8,8 is filled with RGBA8(4,0,0,0),
+	 *   * "atom_color" - to verify that it is equal to 6;
 	 *
 	 *  Additionally: change MemoryBarrier to FlushMapped*BufferRange if context supports OpenGL 4.5 Core Profile.
 	 */
diff --git a/external/openglcts/modules/gl/gl4cGPUShaderFP64Tests.cpp b/external/openglcts/modules/gl/gl4cGPUShaderFP64Tests.cpp
index 1b49064..879efc0 100644
--- a/external/openglcts/modules/gl/gl4cGPUShaderFP64Tests.cpp
+++ b/external/openglcts/modules/gl/gl4cGPUShaderFP64Tests.cpp
@@ -15290,10 +15290,12 @@
 
 			// if coresponding components of arguments are equal and if component of first argument
 			// and component of result are equal then expected result must be corrected
-			edge_case_present = (m_epsilon > de::abs(argument_1_component - argument_2_component)) &&
-								(m_epsilon > de::abs(argument_1_component - actual_result_component));
+                        bool possible_edge_case = m_epsilon > de::abs((argument_1_component / argument_2_component) -
+                                                                      round(argument_1_component / argument_2_component));
+                        edge_case_present = possible_edge_case &&
+                                            (m_epsilon > de::abs(argument_2_component - actual_result_component));
 			recheck |= edge_case_present;
-			corrected_expected_result[component] = edge_case_present ? argument_1_component : expected_result_component;
+                        corrected_expected_result[component] = edge_case_present ? argument_2_component : expected_result_component;
 		}
 
 		// recheck test result with corrected expected result