diff options
author | Francisco Jerez <currojerez@riseup.net> | 2016-09-17 00:39:41 -0700 |
---|---|---|
committer | Francisco Jerez <currojerez@riseup.net> | 2016-11-07 14:07:05 -0800 |
commit | d14a35799484c95749e3a0d3e35aca25f3a6b091 (patch) | |
tree | 29a762bf97a550d57148067b0accdb8f2f09f5c5 /tests/shaders | |
parent | 2d509dabded087d6f23f9daf8a302a0e68d2dad3 (diff) |
shader_runner: Add texture storage command.
"texture storage <texture index> <texture target> <format> (<levels>
<dimension>...)" calls the corresponding glTexStorageND command on a
newly allocated texture object, where N is determined based on the
number of dimensions passed as argument.
Diffstat (limited to 'tests/shaders')
-rw-r--r-- | tests/shaders/shader_runner.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index 5ec77755a..9385a01bf 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -3430,6 +3430,41 @@ piglit_display(void) w, h, l, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); set_texture_binding(tex, texobj, w, h, l); + } else if (parse_str(line, "texture storage ", &rest)) { + GLenum target, format; + GLuint tex_obj; + int d = h = w = 1; + + REQUIRE(parse_int(rest, &tex, &rest) && + parse_tex_target(rest, &target, &rest) && + parse_enum_gl(rest, &format, &rest) && + parse_str(rest, "(", &rest) && + parse_int(rest, &l, &rest) && + parse_int(rest, &w, &rest), + "Texture storage command not understood " + "at: %s\n", rest); + + glActiveTexture(GL_TEXTURE0 + tex); + glGenTextures(1, &tex_obj); + glBindTexture(target, tex_obj); + + if (!parse_int(rest, &h, &rest)) + glTexStorage1D(target, l, format, w); + else if (!parse_int(rest, &d, &rest)) + glTexStorage2D(target, l, format, w, h); + else + glTexStorage3D(target, l, format, w, h, d); + + if (!piglit_check_gl_error(GL_NO_ERROR)) { + fprintf(stderr, "glTexStorage error\n"); + piglit_report_result(PIGLIT_FAIL); + } + + if (target == GL_TEXTURE_1D_ARRAY) + set_texture_binding(tex, tex_obj, w, 1, h); + else + set_texture_binding(tex, tex_obj, w, h, d); + } else if (sscanf(line, "texture rgbw 2DArray %d ( %d , %d , %d )", &tex, &w, &h, &l) == 4) { |