[Piglit] [PATCH piglit 4/6] bptc: Add tests using fbo-generatemipmap-formats

Neil Roberts neil at linux.intel.com
Tue Jul 29 08:27:38 PDT 2014


The unsigned half float format needs special handling because the
texture that the test uploads tries to use negative values.
---
 tests/all.py                           | 2 ++
 tests/fbo/fbo-generatemipmap-formats.c | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/tests/all.py b/tests/all.py
index ed2d95e..053b0dd 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2288,6 +2288,8 @@ arb_texture_compression_bptc = {}
 spec['ARB_texture_compression_bptc'] = arb_texture_compression_bptc
 arb_texture_compression_bptc['invalid formats'] = concurrent_test('arb_texture_compression-invalid-formats bptc')
 add_concurrent_test(arb_texture_compression_bptc, 'bptc-modes')
+add_fbo_generatemipmap_extension(arb_texture_compression_bptc, 'GL_ARB_texture_compression_bptc-unorm', 'fbo-generatemipmap-formats')
+add_fbo_generatemipmap_extension(arb_texture_compression_bptc, 'GL_ARB_texture_compression_bptc-float', 'fbo-generatemipmap-formats')
 
 ext_vertex_array_bgra = {}
 spec['EXT_vertex_array_bgra'] = ext_vertex_array_bgra
diff --git a/tests/fbo/fbo-generatemipmap-formats.c b/tests/fbo/fbo-generatemipmap-formats.c
index c7b01fb..9cb7d4e 100644
--- a/tests/fbo/fbo-generatemipmap-formats.c
+++ b/tests/fbo/fbo-generatemipmap-formats.c
@@ -393,6 +393,13 @@ test_mipmap_drawing(int x, int y, int level, GLuint internalformat)
 		g[0] = g[1] = g[2] = g[3] = 0;
 		/* If alpha in DXT1 is >= 0.5, it should be white. */
 		b[3] = 1;
+	} else if (internalformat == GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT) {
+		/* The texture is uploaded with values in the range
+		 * -5->+5 and these get mapped to 0,1 when drawing.
+		 * However when compressing to the unsigned float
+		 * compressed format the -5 values will get clamped to
+		 * 0 which comes out as 0.5 */
+		r[1] = r[2] = g[0] = g[2] = b[0] = b[1] = 0.5f;
 	}
 
 	if (tex_width == 256) {
-- 
1.9.3



More information about the Piglit mailing list