Mesa (7.9): mesa: Fix glGet of ES2's GL_MAX_*_VECTORS properties.

Ian Romanick idr at kemper.freedesktop.org
Wed Dec 15 23:15:09 UTC 2010


Module: Mesa
Branch: 7.9
Commit: c055239bae567efd669f2f99c1514ee0191cb9db
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c055239bae567efd669f2f99c1514ee0191cb9db

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Dec 15 14:32:42 2010 -0800

mesa: Fix glGet of ES2's GL_MAX_*_VECTORS properties.

Previously, the get table listed all three as having custom locations,
yet find_custom_value did not have cases to handle them.

MAX_VARYING_VECTORS does not need a custom location since MaxVaryings is
already stored as float[4] (or vec4).  MaxUniformComponents is stored as
the number of floats, however, so a custom implementation that divides
by 4 is necessary.

Fixes bugs.freedesktop.org #31495.
(cherry picked from commit 1197393faa285bee0d99409a1c82f575dbcbc708)

Conflicts:

	src/mesa/main/get.c

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/main/get.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 28e25c8..29c1c57 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -685,12 +685,9 @@ static const struct value_desc values[] = {
 #if FEATURE_ES2
    /* Enums unique to OpenGL ES 2.0 */
    { 0, 0, TYPE_API_MASK, API_OPENGLES2_BIT, NO_EXTRA },
-   { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT,
-     offsetof(GLcontext, Const.FragmentProgram.MaxUniformComponents), NO_EXTRA },
-   { GL_MAX_VARYING_VECTORS, LOC_CUSTOM, TYPE_INT,
-     offsetof(GLcontext, Const.MaxVarying), NO_EXTRA },
-   { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT,
-     offsetof(GLcontext, Const.VertexProgram.MaxUniformComponents), NO_EXTRA },
+   { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA },
+   { GL_MAX_VARYING_VECTORS, CONTEXT_INT(Const.MaxVarying), NO_EXTRA },
+   { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA },
    { GL_SHADER_COMPILER, CONST(1), NO_EXTRA },
    /* OES_get_program_binary */
    { GL_NUM_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA },
@@ -1640,6 +1637,14 @@ find_custom_value(GLcontext *ctx, const struct value_desc *d, union value *v)
    case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
       v->value_int = ctx->Array.ArrayObj->PointSize.BufferObj->Name;
       break;
+
+   case GL_MAX_VERTEX_UNIFORM_VECTORS:
+      v->value_int = ctx->Const.VertexProgram.MaxUniformComponents / 4;
+      break;
+
+   case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
+      v->value_int = ctx->Const.FragmentProgram.MaxUniformComponents / 4;
+      break;
    }   
 }
 




More information about the mesa-commit mailing list