Fix out-of-bounds buffer access in tese ShaderExecutor
Tessellation evaluation shader executor was accessing input and output
buffers one element out of bounds at the end. In addition elements
1..N-1 were evaluated twice unnecessarily.
Bug: 23684915
Change-Id: I1c187b506d36befe05b21222a7006e84b812ceca
diff --git a/modules/glshared/glsShaderExecUtil.cpp b/modules/glshared/glsShaderExecUtil.cpp
index fad4d71..9e324fd 100644
--- a/modules/glshared/glsShaderExecUtil.cpp
+++ b/modules/glshared/glsShaderExecUtil.cpp
@@ -1480,7 +1480,7 @@
src << "void main (void)\n{\n"
<< "\tgl_Position = vec4(gl_TessCoord.x, 0.0, 0.0, 1.0);\n"
- << "\thighp uint invocationId = uint(gl_PrimitiveID) + (gl_TessCoord.x > 0.5 ? 1u : 0u);\n";
+ << "\thighp uint invocationId = uint(gl_PrimitiveID)*2u + (gl_TessCoord.x > 0.5 ? 1u : 0u);\n";
generateExecBufferIo(src, shaderSpec, "invocationId");
@@ -1523,7 +1523,7 @@
// Render patches
gl.patchParameteri(GL_PATCH_VERTICES, 2);
- gl.drawArrays(GL_PATCHES, 0, 2*alignedValues);
+ gl.drawArrays(GL_PATCHES, 0, alignedValues);
// Read back data
readOutputBuffer(outputs, numValues);