[Mesa-dev] [PATCH] fbo-depth-array:Check completness with a color texture
Ilia Mirkin
imirkin at alum.mit.edu
Wed Oct 8 05:58:50 PDT 2014
On Wed, Oct 8, 2014 at 8:33 AM, Vincent Lejeune <vljn at ovi.com> wrote:
> ---
> tests/all.py | 2 +-
> tests/fbo/fbo-depth-array.c | 36 ++++++++++++++++++++++++++++++------
> 2 files changed, 31 insertions(+), 7 deletions(-)
>
> diff --git a/tests/all.py b/tests/all.py
> index 586cead..9aa600f 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -2831,7 +2831,7 @@ add_shader_test_dir(ext_texture_array,
> add_msaa_visual_plain_tests(ext_texture_array, 'copyteximage 1D_ARRAY')
> add_msaa_visual_plain_tests(ext_texture_array, 'copyteximage 2D_ARRAY')
> add_plain_test(ext_texture_array, 'fbo-array')
> -for test in ('depth-clear', 'depth-layered-clear', 'depth-draw', 'fs-writes-depth',
> +for test in ('depth-clear', 'depth-layered-clear', 'depth-stencil-color-clear', 'depth-draw', 'fs-writes-depth',
depth-stencil-color-layered-clear, right? Or fix the string in the test...
> 'stencil-clear', 'stencil-layered-clear', 'stencil-draw', 'fs-writes-stencil'):
> add_concurrent_test(ext_texture_array, 'fbo-depth-array ' + test)
> add_plain_test(ext_texture_array, 'array-texture')
> diff --git a/tests/fbo/fbo-depth-array.c b/tests/fbo/fbo-depth-array.c
> index 84370e4..dde807d 100644
> --- a/tests/fbo/fbo-depth-array.c
> +++ b/tests/fbo/fbo-depth-array.c
> @@ -46,6 +46,7 @@
> enum {
> CLEAR,
> LAYERED_CLEAR,
> + LAYERED_DEPTH_STENCIL_COLOR_CLEAR,
> DRAW,
> FS_WRITES_VALUE,
> };
> @@ -135,11 +136,13 @@ static GLuint program_stencil_output;
> static GLuint program_texdepth;
> static GLuint program_texstencil;
>
> +static GLuint color_texture;
> +
>
> static float
> get_depth_value(unsigned layer)
> {
> - if (test == LAYERED_CLEAR)
> + if (test == LAYERED_CLEAR || LAYERED_DEPTH_STENCIL_COLOR_CLEAR)
> return 0.4; /* constant */
> else
> return (double)(layer+1) / (layers+1);
> @@ -181,6 +184,10 @@ parse_args(int argc, char **argv)
> test = LAYERED_CLEAR;
> puts("Testing layered glClear");
> }
> + else if (!strcmp(argv[i], "depth-stencil-color-layered-clear")) {
> + test = LAYERED_DEPTH_STENCIL_COLOR_CLEAR;
> + puts("Testing depth stencil color layered glClear");
> + }
> else if (!strcmp(argv[i], "depth-draw")) {
> test = DRAW;
> puts("Testing drawing");
> @@ -224,6 +231,14 @@ create_array_fbo(void)
> int layer;
>
> glGenTextures(1, &tex);
> + glGenTextures(1, &color_texture);
> +
> + glBindTexture(GL_TEXTURE_2D_ARRAY, color_texture);
> + glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA,
> + width, height, layers, 0,
> + GL_RGBA, GL_UNSIGNED_INT, NULL);
> + assert(glGetError() == 0);
> +
> glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
> assert(glGetError() == 0);
>
> @@ -241,11 +256,19 @@ create_array_fbo(void)
>
> /* draw something into each layer of the array texture */
> for (layer = 0; layer < layers; layer++) {
> - if (test == LAYERED_CLEAR) {
> - glFramebufferTexture(GL_FRAMEBUFFER,
> - test_stencil ? GL_STENCIL_ATTACHMENT :
> - GL_DEPTH_ATTACHMENT,
> - tex, 0);
> + if (test == LAYERED_CLEAR || test == LAYERED_DEPTH_STENCIL_COLOR_CLEAR) {
> + if (test == LAYERED_DEPTH_STENCIL_COLOR_CLEAR) {
> + glFramebufferTexture(GL_FRAMEBUFFER,
> + GL_COLOR_ATTACHMENT0_EXT,
> + color_texture, 0);
> + glFramebufferTexture(GL_FRAMEBUFFER,
> + GL_DEPTH_STENCIL_ATTACHMENT,
> + tex, 0);
> + } else
> + glFramebufferTexture(GL_FRAMEBUFFER,
> + test_stencil ? GL_STENCIL_ATTACHMENT :
> + GL_DEPTH_ATTACHMENT,
> + tex, 0);
>
> status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
> if (status != GL_FRAMEBUFFER_COMPLETE) {
> @@ -433,6 +456,7 @@ test_once(void)
> }
>
> glDeleteTextures(1, &tex);
> + glDeleteTextures(1, &color_texture);
> assert(glGetError() == 0);
> return pass;
> }
> --
> 1.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list