<div class="gmail_quote">On 13 July 2012 17:14, Jordan Justen <span dir="ltr"><<a href="mailto:jljusten@gmail.com" target="_blank">jljusten@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
1-3: Reviewed-by: Jordan Justen <<a href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>><br>
<br>
One question is below...<br>
<div><div class="h5"><br>
On Thu, Jul 12, 2012 at 5:53 PM, Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>> wrote:<br>
> This test reproduces a problem in Mesa's i965 driver as of 7/12/12<br>
> (commit 1a06e84): when no color buffer is present, but a multisampled<br>
> depth or stencil buffer is present, Mesa fails to set up the rendering<br>
> pipeline for multisampling.<br>
><br>
> The test includes variants for testing both the stencil buffer and the<br>
> depth buffer. The depth buffer test may be run in a "computed" mode,<br>
> in which case the depth values are output by the fragment shader (this<br>
> is an important corner case for i965).<br>
><br>
> Verified on nVidia's proprietary binary driver for Linux.<br>
> ---<br>
> tests/all.tests | 9 +<br>
> .../ext_framebuffer_multisample/CMakeLists.gl.txt | 1 +<br>
> .../spec/ext_framebuffer_multisample/no-color.cpp | 232 ++++++++++++++++++++<br>
> 3 files changed, 242 insertions(+), 0 deletions(-)<br>
> create mode 100644 tests/spec/ext_framebuffer_multisample/no-color.cpp<br>
><br>
> diff --git a/tests/all.tests b/tests/all.tests<br>
> index b0c9355..46f6a9b 100644<br>
> --- a/tests/all.tests<br>
> +++ b/tests/all.tests<br>
> @@ -1473,6 +1473,15 @@ for num_samples in MSAA_SAMPLE_COUNTS:<br>
> ext_framebuffer_multisample[test_name] = PlainExecTest(<br>
> executable)<br>
><br>
> +for num_samples in MSAA_SAMPLE_COUNTS:<br>
> + for test_type in ('depth', 'depth-computed', 'stencil'):<br>
> + for buffer_config in ('combined', 'separate', 'single'):<br>
> + test_name = ' '.join(['no-color', str(num_samples),<br>
> + test_type, buffer_config])<br>
> + executable = 'ext_framebuffer_multisample-{0} -auto'.format(<br>
> + test_name)<br>
> + ext_framebuffer_multisample[test_name] = PlainExecTest(executable)<br>
<br>
</div></div>At first I tried to run:<br>
./piglit-run.py -t ext_framebuffer_multisample-no-color<br>
<br>
But, "ext_framebuffer_multisample-" is not part of the name. Should it be?<br></blockquote><div><br></div><div>The test name in all.tests is "EXT_framebuffer_multisample/no-color". So you should be able to run it with:</div>
<div><br></div><div>./piglit-run.py -t EXT_framebuffer_multisample/no-color</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
-Jordan<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> +<br>
> ext_framebuffer_object = Group()<br>
> spec['EXT_framebuffer_object'] = ext_framebuffer_object<br>
> add_fbo_stencil_tests(ext_framebuffer_object, 'GL_STENCIL_INDEX1')<br>
> diff --git a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
> index b2b7b51..027e4c5 100644<br>
> --- a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
> +++ b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
> @@ -28,6 +28,7 @@ piglit_add_executable (ext_framebuffer_multisample-negative-copyteximage negativ<br>
> piglit_add_executable (ext_framebuffer_multisample-negative-max-samples negative-max-samples.c)<br>
> piglit_add_executable (ext_framebuffer_multisample-negative-mismatched-samples negative-mismatched-samples.c)<br>
> piglit_add_executable (ext_framebuffer_multisample-negative-readpixels negative-readpixels.c)<br>
> +piglit_add_executable (ext_framebuffer_multisample-no-color no-color.cpp common.cpp)<br>
> piglit_add_executable (ext_framebuffer_multisample-point-smooth common.cpp point-smooth.cpp)<br>
> piglit_add_executable (ext_framebuffer_multisample-polygon-smooth common.cpp polygon-smooth.cpp)<br>
> piglit_add_executable (ext_framebuffer_multisample-polygon-stipple common.cpp polygon-stipple.cpp)<br>
> diff --git a/tests/spec/ext_framebuffer_multisample/no-color.cpp b/tests/spec/ext_framebuffer_multisample/no-color.cpp<br>
> new file mode 100644<br>
> index 0000000..b7ded7c<br>
> --- /dev/null<br>
> +++ b/tests/spec/ext_framebuffer_multisample/no-color.cpp<br>
> @@ -0,0 +1,232 @@<br>
> +/*<br>
> + * Copyright © 2012 Intel Corporation<br>
> + *<br>
> + * Permission is hereby granted, free of charge, to any person obtaining a<br>
> + * copy of this software and associated documentation files (the "Software"),<br>
> + * to deal in the Software without restriction, including without limitation<br>
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
> + * and/or sell copies of the Software, and to permit persons to whom the<br>
> + * Software is furnished to do so, subject to the following conditions:<br>
> + *<br>
> + * The above copyright notice and this permission notice (including the next<br>
> + * paragraph) shall be included in all copies or substantial portions of the<br>
> + * Software.<br>
> + *<br>
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
> + * IN THE SOFTWARE.<br>
> + */<br>
> +<br>
> +/**<br>
> + * \file no-color.cpp<br>
> + *<br>
> + * This test verifies proper operation of multisampled FBOs that lack<br>
> + * a color buffer. It operates by performing identical draw<br>
> + * operations in an FBO that lacks a color buffer and an FBO that has<br>
> + * a color buffer, and verifying that the resulting output is the<br>
> + * same.<br>
> + *<br>
> + * The test can run in any of the following modes:<br>
> + *<br>
> + * - depth: test depth buffer behaviour, using a fragment shader that<br>
> + * does not compute depth.<br>
> + *<br>
> + * - depth-computed: test depth buffer behaviour, using a fragment<br>
> + * shader that *does* compute depth.<br>
> + *<br>
> + * - stencil: test stencil buffer beahviour.<br>
> + *<br>
> + * It can also be configured to use either a combined depth/stencil<br>
> + * buffer, separate depth/stencil buffers, or just a single<br>
> + * depth/stencil buffer depending on the type of test.<br>
> + *<br>
> + * The test operates by performing the following steps:<br>
> + *<br>
> + * 1. Draw a test pattern to a multisampled FBO that lacks a color<br>
> + * buffer (let's call this the "test FBO").<br>
> + *<br>
> + * 2. Blit the test pattern to a multisampled FBO that has a full<br>
> + * complement of color, depth, and stencil buffers (let's call this<br>
> + * the "manifest FBO").<br>
> + *<br>
> + * 3. Do a "manifest" operation to cause colors to be drawn that are<br>
> + * dependent upon the contents of the depth or stencil buffer.<br>
> + *<br>
> + * 4. Blit the color buffer from the manifest FBO to the screen. This<br>
> + * is the test image, and is shown in the left half of the piglit<br>
> + * window.<br>
> + *<br>
> + * 5. Draw the test pattern again, but this time draw it directly to<br>
> + * the manifest FBO.<br>
> + *<br>
> + * 6. Do a "manifest" operation again.<br>
> + *<br>
> + * 7. Blit the color buffer to the screen. This is the reference<br>
> + * image, and is shown in the right half of the piglit window.<br>
> + *<br>
> + * 8. Compare the test and reference images to make sure they match.<br>
> + */<br>
> +<br>
> +#include "common.h"<br>
> +<br>
> +PIGLIT_GL_TEST_MAIN(<br>
> + 512 /* window_width */,<br>
> + 256 /* window_height */,<br>
> + GLUT_DOUBLE | GLUT_RGBA | GLUT_ALPHA)<br>
> +<br>
> +namespace {<br>
> +<br>
> +const int pattern_width = 256, pattern_height = 256;<br>
> +<br>
> +GLenum buffer_to_test;<br>
> +Fbo test_fbo;<br>
> +Fbo manifest_fbo;<br>
> +ManifestProgram *manifest_program;<br>
> +TestPattern *test_pattern;<br>
> +<br>
> +void<br>
> +print_usage_and_exit(char *prog_name)<br>
> +{<br>
> + printf("Usage: %s <num_samples> <test_type> <buffer_config?\n"<br>
> + " where <test_type> is one of:\n"<br>
> + " depth: test fixed pipeline depth\n"<br>
> + " depth-computed: test depth value computed by a shader\n"<br>
> + " stencil: test stencil\n"<br>
> + " and <buffer_config> is one of:\n"<br>
> + " combined: use a single combined depth/stencil buffer\n"<br>
> + " separate: use separate depth and stencil buffers\n"<br>
> + " single: use just a single buffer (depth or stencil)\n",<br>
> + prog_name);<br>
> + piglit_report_result(PIGLIT_FAIL);<br>
> +}<br>
> +<br>
> +extern "C" void<br>
> +piglit_init(int argc, char **argv)<br>
> +{<br>
> + if (argc != 4)<br>
> + print_usage_and_exit(argv[0]);<br>
> +<br>
> + /* 1st arg: num_samples */<br>
> + char *endptr = NULL;<br>
> + int num_samples = strtol(argv[1], &endptr, 0);<br>
> + if (endptr != argv[1] + strlen(argv[1]))<br>
> + print_usage_and_exit(argv[0]);<br>
> +<br>
> + /* 2nd arg: test_type */<br>
> + if (strcmp(argv[2], "depth") == 0) {<br>
> + buffer_to_test = GL_DEPTH_BUFFER_BIT;<br>
> + manifest_program = new ManifestDepth;<br>
> + test_pattern = new DepthSunburst(false /* compute_depth */);<br>
> + } else if (strcmp(argv[2], "depth-computed") == 0) {<br>
> + buffer_to_test = GL_DEPTH_BUFFER_BIT;<br>
> + manifest_program = new ManifestDepth;<br>
> + test_pattern = new DepthSunburst(true /* compute_depth */);<br>
> + } else if (strcmp(argv[2], "stencil") == 0) {<br>
> + buffer_to_test = GL_STENCIL_BUFFER_BIT;<br>
> + manifest_program = new ManifestStencil;<br>
> + test_pattern = new StencilSunburst;<br>
> + } else {<br>
> + print_usage_and_exit(argv[0]);<br>
> + }<br>
> +<br>
> + /* 3rd arg: buffer_config */<br>
> + FboConfig test_fbo_config(num_samples, pattern_width, pattern_height);<br>
> + test_fbo_config.color_internalformat = GL_NONE;<br>
> + if (strcmp(argv[3], "combined") == 0) {<br>
> + test_fbo_config.combine_depth_stencil = true;<br>
> + } else if (strcmp(argv[3], "separate") == 0) {<br>
> + test_fbo_config.combine_depth_stencil = false;<br>
> + } else if (strcmp(argv[3], "single") == 0) {<br>
> + test_fbo_config.combine_depth_stencil = false;<br>
> + if (buffer_to_test == GL_DEPTH_BUFFER_BIT)<br>
> + test_fbo_config.stencil_internalformat = GL_NONE;<br>
> + else<br>
> + test_fbo_config.depth_internalformat = GL_NONE;<br>
> + } else {<br>
> + print_usage_and_exit(argv[0]);<br>
> + }<br>
> +<br>
> + piglit_require_gl_version(30);<br>
> + piglit_require_GLSL_version(130);<br>
> +<br>
> + /* Skip the test if num_samples > GL_MAX_SAMPLES */<br>
> + GLint max_samples;<br>
> + glGetIntegerv(GL_MAX_SAMPLES, &max_samples);<br>
> + if (num_samples > max_samples)<br>
> + piglit_report_result(PIGLIT_SKIP);<br>
> +<br>
> + test_fbo.setup(test_fbo_config);<br>
> + manifest_fbo.setup(FboConfig(num_samples, pattern_width,<br>
> + pattern_height));<br>
> + manifest_program->compile();<br>
> + test_pattern->compile();<br>
> +<br>
> + if (!piglit_check_gl_error(GL_NO_ERROR))<br>
> + piglit_report_result(PIGLIT_FAIL);<br>
> +}<br>
> +<br>
> +extern "C" enum piglit_result<br>
> +piglit_display()<br>
> +{<br>
> + bool pass = true;<br>
> +<br>
> + /* Draw the test pattern into test_fbo. */<br>
> + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, test_fbo.handle);<br>
> + test_fbo.set_viewport();<br>
> + test_pattern->draw(TestPattern::no_projection);<br>
> +<br>
> + /* Blit the test pattern to manifest_fbo. */<br>
> + glBindFramebuffer(GL_READ_FRAMEBUFFER, test_fbo.handle);<br>
> + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, manifest_fbo.handle);<br>
> + glBlitFramebuffer(0, 0, pattern_width, pattern_height,<br>
> + 0, 0, pattern_width, pattern_height,<br>
> + buffer_to_test, GL_NEAREST);<br>
> +<br>
> + /* Manifest the pattern so that it is reflected in color<br>
> + * values in manifest_fbo.<br>
> + */<br>
> + manifest_program->run();<br>
> +<br>
> + /* Blit the color buffer from manifest_fbo to the screen.<br>
> + * This is the test image.<br>
> + */<br>
> + glBindFramebuffer(GL_READ_FRAMEBUFFER, manifest_fbo.handle);<br>
> + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);<br>
> + glBlitFramebuffer(0, 0, pattern_width, pattern_height,<br>
> + 0, 0, pattern_width, pattern_height,<br>
> + GL_COLOR_BUFFER_BIT, GL_NEAREST);<br>
> +<br>
> + /* Draw the test pattern into manifest_fbo. */<br>
> + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, manifest_fbo.handle);<br>
> + manifest_fbo.set_viewport();<br>
> + test_pattern->draw(TestPattern::no_projection);<br>
> +<br>
> + /* Manifest the pattern so that it is reflected in color<br>
> + * values in manifest_fbo.<br>
> + */<br>
> + manifest_program->run();<br>
> +<br>
> + /* Blit the color buffer from manifest_fbo to the screen.<br>
> + * This is the reference image.<br>
> + */<br>
> + glBindFramebuffer(GL_READ_FRAMEBUFFER, manifest_fbo.handle);<br>
> + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);<br>
> + glBlitFramebuffer(0, 0, pattern_width, pattern_height,<br>
> + pattern_width, 0, 2*pattern_width, pattern_height,<br>
> + GL_COLOR_BUFFER_BIT, GL_NEAREST);<br>
> +<br>
> + /* Compare the test and reference images */<br>
> + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);<br>
> + pass = piglit_probe_rect_halves_equal_rgba(0, 0, 2*pattern_width,<br>
> + pattern_height) && pass;<br>
> +<br>
> + piglit_present_results();<br>
> +<br>
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
> +}<br>
> +<br>
> +} /* Anonymous namespace */<br>
> --<br>
> 1.7.7.6<br>
><br>
</div></div></blockquote></div><br>