Reset texture data to 0 after each 16 iterations to avoid overflow
The default precision of int in the fragment shader is mediump. The fs_out_color
in GeometryShaderMaxCombinedTextureUnitsTest::m_fragment_shader_code_body will
overflow when the number of texture unit become large, since each texture data
is equal to index of the texture units.
So reset texture data to 0 after each 16 iterations to avoid the overflow.
Component: OpenGL
Affected tests: KHR-GLES31.core.geometry_shader.limits.max_combined_texture_units
VK-GL-CTS issue: 2622
Change-Id: Icc9f2ed77a5a1cf6f315605f5f1045a60a56396c
(cherry picked from commit ccb924af7b96ee3771ce25f6d31a0b243bbddee1)
diff --git a/external/openglcts/modules/glesext/geometry_shader/esextcGeometryShaderLimits.cpp b/external/openglcts/modules/glesext/geometry_shader/esextcGeometryShaderLimits.cpp
index 5d7bd2c..8485605 100644
--- a/external/openglcts/modules/glesext/geometry_shader/esextcGeometryShaderLimits.cpp
+++ b/external/openglcts/modules/glesext/geometry_shader/esextcGeometryShaderLimits.cpp
@@ -3180,8 +3180,8 @@
/* Prepare texture storage and fill data */
for (int i = 0; i < m_n_texture_units; ++i)
{
- /* unique intensity equal to index of the texture */
- m_textures[i].data = i;
+ /* Reset texture data to 0 after each 16 iterations */
+ m_textures[i].data = i % 16;
/* Generate and bind texture */
gl.genTextures(1, &m_textures[i].texture_id);