Modify compute shader grid setup.
authorAnders Frostad Pedersen <anders.pedersen@arm.com>
Wed, 17 Jan 2018 11:05:45 +0000 (12:05 +0100)
committerSam Lin <samlin@google.com>
Wed, 17 Jan 2018 19:46:20 +0000 (19:46 +0000)
Modify how the grid is set up for compute shader draw indirect test,
in order to avoid verfication failures due to difference in
floating-point computations on the CPU vs the GPU.

The existing code assumes infinite FP precision.

This change will guarantee the next value of pos(X) to be equal to
the first value of pos(X+1), avoiding gaps/discontinuities.

Affects:
dEQP-GLES31.functional.draw_indirect.compute_interop.large.drawarrays_combined_grid_1000x1000_drawcount_1
dEQP-GLES31.functional.draw_indirect.compute_interop.large.drawarrays_combined_grid_1000x1000_drawcount_5000
dEQP-GLES31.functional.draw_indirect.compute_interop.large.drawarrays_combined_grid_1000x1000_drawcount_8
dEQP-GLES31.functional.draw_indirect.compute_interop.large.drawarrays_separate_grid_1000x1000_drawcount_1
dEQP-GLES31.functional.draw_indirect.compute_interop.large.drawarrays_separate_grid_1000x1000_drawcount_5000
dEQP-GLES31.functional.draw_indirect.compute_interop.large.drawarrays_separate_grid_1000x1000_drawcount_8

Bug: 71515808
Change-Id: I21fe8ec9ea48b15f6171265df802bc47be775f56

modules/gles31/functional/es31fDrawTests.cpp

index 2b8b11c..daa5307 100644 (file)
@@ -1276,17 +1276,18 @@ std::string ComputeShaderGeneratedCase::genComputeSource (bool computeCmd, bool
                        buf     << "    if (gl_GlobalInvocationID.x < gridSize && gl_GlobalInvocationID.y < gridSize && gl_GlobalInvocationID.z == 0u) {\n"
                                << "        uint        y           = gl_GlobalInvocationID.x;\n"
                                << "        uint        x           = gl_GlobalInvocationID.y;\n"
-                               << "        float       posX        = (float(x) / float(gridSize)) * 2.0 - 1.0;\n"
-                               << "        float       posY        = (float(y) / float(gridSize)) * 2.0 - 1.0;\n"
-                               << "        const float cellSize    = 2.0 / float(gridSize);\n"
+                               << "        float       posX        = (float(x)    / float(gridSize)) * 2.0 - 1.0;\n"
+                               << "        float       posXp1      = (float(x+1u) / float(gridSize)) * 2.0 - 1.0;\n"
+                               << "        float       posY        = (float(y)    / float(gridSize)) * 2.0 - 1.0;\n"
+                               << "        float       posYp1      = (float(y+1u) / float(gridSize)) * 2.0 - 1.0;\n"
                                << "        vec4        color       = ((x + y)%2u != 0u) ? (yellow) : (green);\n"
                                << "\n"
-                               << "        attribs[((y * gridSize + x) * 6u + 0u) * 2u + 0u] = vec4(posX,            posY,            0.0, 1.0);\n"
-                               << "        attribs[((y * gridSize + x) * 6u + 1u) * 2u + 0u] = vec4(posX + cellSize, posY,            0.0, 1.0);\n"
-                               << "        attribs[((y * gridSize + x) * 6u + 2u) * 2u + 0u] = vec4(posX + cellSize, posY + cellSize, 0.0, 1.0);\n"
-                               << "        attribs[((y * gridSize + x) * 6u + 3u) * 2u + 0u] = vec4(posX,            posY,            0.0, 1.0);\n"
-                               << "        attribs[((y * gridSize + x) * 6u + 4u) * 2u + 0u] = vec4(posX + cellSize, posY + cellSize, 0.0, 1.0);\n"
-                               << "        attribs[((y * gridSize + x) * 6u + 5u) * 2u + 0u] = vec4(posX,            posY + cellSize, 0.0, 1.0);\n"
+                               << "        attribs[((y * gridSize + x) * 6u + 0u) * 2u + 0u] = vec4(posX,   posY,   0.0, 1.0);\n"
+                               << "        attribs[((y * gridSize + x) * 6u + 1u) * 2u + 0u] = vec4(posXp1, posY,   0.0, 1.0);\n"
+                               << "        attribs[((y * gridSize + x) * 6u + 2u) * 2u + 0u] = vec4(posXp1, posYp1, 0.0, 1.0);\n"
+                               << "        attribs[((y * gridSize + x) * 6u + 3u) * 2u + 0u] = vec4(posX,   posY,   0.0, 1.0);\n"
+                               << "        attribs[((y * gridSize + x) * 6u + 4u) * 2u + 0u] = vec4(posXp1, posYp1, 0.0, 1.0);\n"
+                               << "        attribs[((y * gridSize + x) * 6u + 5u) * 2u + 0u] = vec4(posX,   posYp1, 0.0, 1.0);\n"
                                << "\n"
                                << "        attribs[((y * gridSize + x) * 6u + 0u) * 2u + 1u] = color;\n"
                                << "        attribs[((y * gridSize + x) * 6u + 1u) * 2u + 1u] = color;\n"