diff options
author | Topi Pohjolainen <topi.pohjolainen@intel.com> | 2016-10-08 17:54:22 +0300 |
---|---|---|
committer | Topi Pohjolainen <topi.pohjolainen@intel.com> | 2016-10-09 11:00:53 +0300 |
commit | 3804c1c96634929cbbe1cdef85c26ea0cc32eb9a (patch) | |
tree | 43df0ff26128062da248cded1238f46e219071dd | |
parent | 467ddb1e196dc2f56291da64a89f180acf640f69 (diff) |
intel_lossless_65x65: Use glCopyImageSubDatalossless_65x65
Original deqp case uses glCopyImageSubData(). This seems to make
a difference and the error can be reproduced for simpler textures.
Fails on SKL using the default color. Also fails if one uses
0xCC000113:
./bin/fcc-intel-lossless-65x65 CC000113 -auto -fbo
But works, for example, with 0xCC000213
./bin/fcc-intel-lossless-65x65 0xCC000213 -auto -fbo
Using INTEL_DEBUG_DUMP_MIPTREE=1 one can examine the contents of
the color and auxiliary buffers. On success case (here using value
of 0xCC000213) hardware writes the color for the corner position
directly out without compression (hexdump -C 0002-*raw.bin):
00008000 13 02 00 cc 00 00 00 00 00 00 00 00 00 00 00 00
Dumping auxiliary tells that compression wasn't applied:
00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
In the failing case:
00008000 06 00 00 00 70 80 cc 13 00 00 00 00 00 00 00 00
00000040 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00
As there is no documenation available for the contents of the
color buffer in case of lossless compression (and just some odd
fragments for the auxiliary), there is no telling if the data is
written out correctly or the sampling engine just failing or...
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
-rw-r--r-- | tests/fast_color_clear/intel_lossless_65x65.c | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/tests/fast_color_clear/intel_lossless_65x65.c b/tests/fast_color_clear/intel_lossless_65x65.c index ab9521259..8c064b3ed 100644 --- a/tests/fast_color_clear/intel_lossless_65x65.c +++ b/tests/fast_color_clear/intel_lossless_65x65.c @@ -50,18 +50,6 @@ static const char vs_source[] = " gl_Position = gl_Vertex;\n" "}\n"; -static const char *fs_paint_color_source = - "#version 130\n" - "uniform uint red;\n" - "out uvec4 color_out;\n" - "void main()\n" - "{\n" - " if (gl_FragCoord.xy == vec2(64.5, 64.5))\n" - " color_out.x = red;\n" - " else\n" - " color_out.x = uint(0xFF00FF00);\n" - "}\n"; - static const char *fs_sample_corner_source = "#version 130\n" "uniform usampler2D sampler;\n" @@ -75,11 +63,26 @@ static const char *fs_sample_corner_source = " gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n" "}\n"; -static GLuint paint_color_prog; static GLuint sample_corner_prog; -static GLuint dst_tex, dst_fb; +static GLuint src_tex, dst_tex, dst_fb; static unsigned red = 0x130000cc; +static unsigned * +get_pixels(unsigned w, unsigned h) +{ + unsigned *pixels = malloc(w * h * sizeof(unsigned)); + + for (unsigned i = 0; i < h; ++i) { + for (unsigned j = 0; j < w; ++j) { + pixels[i * w + j] = 0xFF00FF00; + } + } + + pixels[h * w - 1] = red; + + return pixels; +} + static GLuint create_tex(unsigned w, unsigned h, GLenum format, GLenum internal_format, GLenum data_type, unsigned *pixels) @@ -131,11 +134,14 @@ piglit_init(int argc, char **argv) printf("Using: 0x%x\n", red); + unsigned *pixels = get_pixels(TEX_WIDTH, TEX_HEIGHT); + src_tex = create_tex(TEX_WIDTH, TEX_HEIGHT, GL_RED_INTEGER, + GL_R32UI, GL_UNSIGNED_INT, pixels); + free(pixels); + dst_tex = create_tex(TEX_WIDTH, TEX_HEIGHT, GL_RED_INTEGER, GL_R32UI, GL_UNSIGNED_INT, NULL); - paint_color_prog = piglit_build_simple_program( - vs_source, fs_paint_color_source); sample_corner_prog = piglit_build_simple_program( vs_source, fs_sample_corner_source); @@ -148,12 +154,10 @@ piglit_display(void) bool pass = true; const float green[] = { 0.0, 1.0, 0.0, 1.0 }; - /* Paint the texture with the problematic color. */ - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dst_fb); - glUseProgram(paint_color_prog); - glViewport(0, 0, TEX_WIDTH, TEX_HEIGHT); - glUniform1ui(glGetUniformLocation(paint_color_prog, "red"), red); - piglit_draw_rect(-1, -1, 2, 2); + glCopyImageSubData(src_tex, GL_TEXTURE_2D, 0, 0, 0, 0, + dst_tex, GL_TEXTURE_2D, 0, 0, 0, 0, + TEX_WIDTH, TEX_HEIGHT, 1); + pass &= piglit_check_gl_error(GL_NO_ERROR); /* Paint the framebuffer with the color sampled from the problematic * corner position. |