mesa: add bounds checking for uniform array access
authorFrank Henigman <fjhenigman@google.com>
Fri, 14 Dec 2012 20:52:17 +0000 (15:52 -0500)
committerAndreas Boll <andreas.boll.dev@gmail.com>
Wed, 13 Feb 2013 17:46:38 +0000 (18:46 +0100)
commit3bdb75893491acaca571de6c8caf241dc47b9953
treef090d6e3301644a9d2f22decb340ce1ce12f0268
parentdcb6a7ccbb63aaeec719b873a809c61a8bf45297
mesa: add bounds checking for uniform array access

No piglit regressions and now passes glsl-uniform-out-of-bounds-2.

validate_uniform_parameters now checks that the array index is
valid.  This means if an index is out of bounds, glGetUniform* now
fails with GL_INVALID_OPERATION, as it should.
_mesa_uniform and _mesa_uniform_matrix also call
validate_uniform_parameters so the bounds checks there became
redundant and were removed.

The test in glGetUniformLocation is modified to check array bounds
so it now returns GL_INVALID_INDEX (-1) if you ask for the location
of a non-existent array element, as it should.

Signed-off-by: Frank Henigman <fjhenigman@google.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
(cherry picked from commit 46e3aeb07702f57d389fbfcade9d4ef66218dc53)
src/mesa/main/uniform_query.cpp