Because the state test bypasses the framework and intentionally binds an invalid image unit in order to test the error path it makes sense for it to calculate the invalid image unit index directly instead of asking the framework -- Otherwise it would get the maximum number of image units usable through the framework which after the following commit will be different from the actual number of image units supported by the GL implementation. --- tests/spec/arb_shader_image_load_store/state.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/tests/spec/arb_shader_image_load_store/state.c b/tests/spec/arb_shader_image_load_store/state.c index 08fd2c6..305246e 100644 --- a/tests/spec/arb_shader_image_load_store/state.c +++ b/tests/spec/arb_shader_image_load_store/state.c @@ -156,6 +156,18 @@ static const struct image_unit_action actions[] = { }; /** + * Get the maximum number of image units supported by the + * implementation. + */ +static unsigned +first_invalid_image_unit(void) +{ + int n; + glGetIntegerv(GL_MAX_IMAGE_UNITS, &n); + return n; +} + +/** * Get the last action that modified the state of image unit \a idx. */ static struct image_unit_action @@ -198,7 +210,7 @@ exec_action(const struct image_unit_action a) a.access, a.format); } else if (a.action == BIND_IDX) { - const unsigned idx = MIN2(a.idx, max_image_units()); + const unsigned idx = MIN2(a.idx, first_invalid_image_unit()); glBindImageTexture(idx, get_texture(a.obj), a.level, a.layered, a.layer, @@ -395,11 +407,11 @@ run_test_uniform(void) * GL_INVALID_VALUE is generated if the value specified is * greater than or equal to the value of GL_MAX_IMAGE_UNITS. */ - glUniform1i(loc, max_image_units()); + glUniform1i(loc, first_invalid_image_unit()); ret &= piglit_check_gl_error(GL_INVALID_VALUE); v[0] = 3; - v[1] = max_image_units() + 1; + v[1] = first_invalid_image_unit() + 1; glUniform1iv(loc, 2, v); ret &= piglit_check_gl_error(GL_INVALID_VALUE); -- 2.7.0 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit