diff options
author | Francisco Jerez <currojerez@riseup.net> | 2016-02-13 19:20:27 -0800 |
---|---|---|
committer | Francisco Jerez <currojerez@riseup.net> | 2016-04-16 15:16:51 -0700 |
commit | abd8390a4f95e7a510d76a56e9446fbc19b59d8d (patch) | |
tree | aff9d3a6335ad2712bddec94bf63dfa4aef552ad | |
parent | 858f7cfb517ec347bcf11676dbf30a7718caa1e3 (diff) |
arb_shader_image_load_store/state: Don't use max_image_units() to get the first invalid unit.
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.
-rw-r--r-- | tests/spec/arb_shader_image_load_store/state.c | 18 |
1 files 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 08fd2c69d..305246e60 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); |