This adds the testing of EXT_texture_sRGB_decode with ASTC compressed textures.
Cc: Nanley Chery <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> --- tests/all.py | 2 +- .../khr_compressed_astc-miptree.c | 26 +++++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tests/all.py b/tests/all.py index 6db24ad..e2998d0 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4355,7 +4355,7 @@ with profile.group_manager( g(['khr_compressed_astc-basic_gl'], 'basic-gl') g(['khr_compressed_astc-basic_gles2'], 'basic-gles') - for subtest in ('hdr', 'ldr', 'srgb', "srgb-fp"): + for subtest in ('hdr', 'ldr', 'srgb', "srgb-fp", "srgb-sd"): g(['khr_compressed_astc-miptree_gl', '-subtest', subtest], 'miptree-gl {}'.format(subtest)) g(['khr_compressed_astc-miptree_gles2', '-subtest', subtest], diff --git a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c index 61edc5f..da43cb8 100644 --- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c +++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c @@ -60,6 +60,7 @@ enum test_type TEST_TYPE_LDR, TEST_TYPE_SRGB, TEST_TYPE_SRGB_FP, + TEST_TYPE_SRGB_SD, }; enum piglit_result @@ -69,6 +70,7 @@ static enum test_type ldr_test = TEST_TYPE_LDR; static enum test_type hdr_test = TEST_TYPE_HDR; static enum test_type srgb_test = TEST_TYPE_SRGB; static enum test_type srgb_fp_test = TEST_TYPE_SRGB_FP; +static enum test_type srgb_skip_test = TEST_TYPE_SRGB_SD; static const struct piglit_subtest subtests[] = { { "LDR Profile", @@ -94,6 +96,12 @@ static const struct piglit_subtest subtests[] = { test_miptrees, &srgb_fp_test, }, + { + "sRGB skip decode", + "srgb-sd", + test_miptrees, + &srgb_skip_test, + }, {NULL}, }; @@ -159,7 +167,7 @@ load_texture(const char *dir1, const char *dir2, } /** Compares the compressed texture against the decompressed texture */ -bool draw_compare_levels(bool check_error, +bool draw_compare_levels(bool check_error, bool srgb_skip_decode, GLint level_pixel_size_loc, GLint pixel_offset_loc, GLuint compressed_tex, GLuint decompressed_tex) { @@ -179,12 +187,20 @@ bool draw_compare_levels(bool check_error, /* Draw miplevel of compressed texture. */ glBindTexture(GL_TEXTURE_2D, compressed_tex); + if (srgb_skip_decode) + glTexParameteri(GL_TEXTURE_2D, + GL_TEXTURE_SRGB_DECODE_EXT, + GL_SKIP_DECODE_EXT); glUniform2f(pixel_offset_loc, x, y); glDrawArrays(GL_TRIANGLE_FAN, 0, NUM_VERTICES); /* Draw miplevel of decompressed texture. */ if (!check_error) { glBindTexture(GL_TEXTURE_2D, decompressed_tex); + if (srgb_skip_decode) + glTexParameteri(GL_TEXTURE_2D, + GL_TEXTURE_SRGB_DECODE_EXT, + GL_SKIP_DECODE_EXT); glUniform2f(pixel_offset_loc, LEVEL0_WIDTH + x, y); glDrawArrays(GL_TRIANGLE_FAN, 0, NUM_VERTICES); } @@ -224,9 +240,10 @@ test_miptrees(void* input_type) { const enum test_type subtest = *(enum test_type*) input_type; const bool is_srgb_test = subtest == TEST_TYPE_SRGB; + const bool is_srgb_skip_decode_test = subtest == TEST_TYPE_SRGB_SD; const bool is_hdr_test = subtest == TEST_TYPE_HDR; - static const char * tests[4] = {"hdr", "ldrl", "ldrs", "ldrs"}; + static const char * tests[5] = {"hdr", "ldrl", "ldrs", "ldrs", "ldrs"}; static const char * block_dim_str[14] = { "4x4", "5x4", @@ -248,6 +265,9 @@ test_miptrees(void* input_type) GLint level_pixel_size_loc = glGetUniformLocation(prog, "level_pixel_size"); + if (is_srgb_skip_decode_test) + piglit_require_extension("GL_EXT_texture_sRGB_decode"); + /* Check for error color if an LDR-only sys reading an HDR * texture. No need to draw a reference mipmap in this case. */ @@ -283,7 +303,7 @@ test_miptrees(void* input_type) /* Draw and compare each level of the two textures */ glClear(GL_COLOR_BUFFER_BIT); - if (!draw_compare_levels(check_error, + if (!draw_compare_levels(check_error, is_srgb_skip_decode_test, level_pixel_size_loc, pixel_offset_loc, tex_compressed, -- 2.5.5 _______________________________________________ Piglit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/piglit
