On 6 June 2012 19:30, Paul Berry <span dir="ltr">&lt;<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote"><div class="im">On 6 June 2012 17:52, Anuj Phogat <span dir="ltr">&lt;<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>On Tue, Jun 5, 2012 at 5:03 PM, Paul Berry &lt;<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>&gt; wrote:<br>
&gt; This test builds on the existing FBO and MSAA testing infrastructure<br>
&gt; to verify proper functioning of MSAA for various formats.<br>
&gt;<br>
&gt; All core formats which are framebufferbuffer complete are tested.  All<br>
&gt; formats which are not framebuffer complete are skipped.<br>
&gt;<br>
&gt; Tests for non-core and depth/stencil formats will be added in later<br>
&gt; patches.<br>
&gt;<br>
&gt; Verified using the proprietary nVidia driver for Linux--all formats<br>
&gt; pass except the LUMINANCE_ALPHA formats, which fail due to a driver<br>
&gt; bug (when rendering to these formats, the nVidia driver maps the red<br>
&gt; channel to both luminance and alpha, instead of mapping red to<br>
&gt; luminance and alpha to alpha).<br>
<br>
</div>Paul, On AMD&#39;s catalyst driver test fails for formats other than<br>
LUMINANCE_ALPHA.<br>
Here is the test out put: <a href="http://pastebin.com/YxJGBKGh" target="_blank">http://pastebin.com/YxJGBKGh</a><br>
<br>
Most of these failures are due to mismatch in luminance and intensity<br>
values. I&#39;m not sure what&#39;s the cause.<br></blockquote><div><br></div></div><div>Will you have your Catalyst system at work tomorrow?  I&#39;d like to investigate.</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<br>
Just loosen up the tolerance to fix failures in GL_RGBA2 and GL_RGBA4.<br></blockquote><div><br></div></div><div>That&#39;s especially surprising, since the test already attempts to set the correct tolerance based on the bit depth reported by GL_FRAMEBUFFER_ATTACHMENT_{RED|GREEN|BLUE|ALPHA}_SIZE.  Let&#39;s have a look at this tomorrow too.</div>
<div><div class="h5">
<div> </div></div></div></div></blockquote><div><br>Just to keep the list updated, Anuj and I investigated this morning, and both of these issues appear to be bugs in the Catalyst driver.  For luminance, luminance/alpha and intensity formats, the driver is producing images that are far brighter than it should.  For the RGBA2 and RGBA4 formats, the driver is reporting 0 bits of alpha when in fact there are probably 4, causing the piglit test to set an incorrect tolerance.<br>
 </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div><br>
&gt; ---<br>
&gt;  tests/all.tests                                    |    6 +<br>
&gt;  .../ext_framebuffer_multisample/CMakeLists.gl.txt  |    1 +<br>
&gt;  tests/spec/ext_framebuffer_multisample/formats.cpp |  441 ++++++++++++++++++++<br>
&gt;  3 files changed, 448 insertions(+), 0 deletions(-)<br>
&gt;<br>
&gt; diff --git a/tests/all.tests b/tests/all.tests<br>
&gt; index 93716a8..129a923 100644<br>
&gt; --- a/tests/all.tests<br>
&gt; +++ b/tests/all.tests<br>
&gt; @@ -1373,6 +1373,12 @@ for num_samples in (2, 4, 8, 16, 32):<br>
&gt;                test_name)<br>
&gt;        ext_framebuffer_multisample[test_name] = PlainExecTest(executable)<br>
&gt;<br>
&gt; +for num_samples in (2, 4, 8, 16, 32):<br>
&gt; +        test_name = &#39; &#39;.join([&#39;formats&#39;, str(num_samples)])<br>
&gt; +        executable = &#39;ext_framebuffer_multisample-{0} -auto&#39;.format(<br>
&gt; +                test_name)<br>
&gt; +        ext_framebuffer_multisample[test_name] = PlainExecTest(executable)<br>
&gt; +<br>
&gt;  ext_framebuffer_object = Group()<br>
&gt;  spec[&#39;EXT_framebuffer_object&#39;] = ext_framebuffer_object<br>
&gt;  add_fbo_stencil_tests(ext_framebuffer_object, &#39;GL_STENCIL_INDEX1&#39;)<br>
&gt; diff --git a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
&gt; index 155190f..1660067 100644<br>
&gt; --- a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
&gt; +++ b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
&gt; @@ -11,6 +11,7 @@ link_libraries (<br>
&gt;<br>
&gt;  piglit_add_executable (ext_framebuffer_multisample-accuracy common.cpp accuracy.cpp)<br>
&gt;  piglit_add_executable (ext_framebuffer_multisample-dlist dlist.c)<br>
&gt; +piglit_add_executable (ext_framebuffer_multisample-formats common.cpp formats.cpp)<br>
&gt;  piglit_add_executable (ext_framebuffer_multisample-line-smooth common.cpp line-smooth.cpp)<br>
&gt;  piglit_add_executable (ext_framebuffer_multisample-minmax minmax.c)<br>
&gt;  piglit_add_executable (ext_framebuffer_multisample-multisample-blit common.cpp multisample-blit.cpp)<br>
&gt; diff --git a/tests/spec/ext_framebuffer_multisample/formats.cpp b/tests/spec/ext_framebuffer_multisample/formats.cpp<br>
&gt; new file mode 100644<br>
&gt; index 0000000..18f1e21<br>
&gt; --- /dev/null<br>
&gt; +++ b/tests/spec/ext_framebuffer_multisample/formats.cpp<br>
&gt; @@ -0,0 +1,441 @@<br>
&gt; +/*<br>
&gt; + * Copyright © 2012 Intel Corporation<br>
&gt; + *<br>
&gt; + * Permission is hereby granted, free of charge, to any person obtaining a<br>
&gt; + * copy of this software and associated documentation files (the &quot;Software&quot;),<br>
&gt; + * to deal in the Software without restriction, including without limitation<br>
&gt; + * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
&gt; + * and/or sell copies of the Software, and to permit persons to whom the<br>
&gt; + * Software is furnished to do so, subject to the following conditions:<br>
&gt; + *<br>
&gt; + * The above copyright notice and this permission notice (including the next<br>
&gt; + * paragraph) shall be included in all copies or substantial portions of the<br>
&gt; + * Software.<br>
&gt; + *<br>
&gt; + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
&gt; + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
&gt; + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
&gt; + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
&gt; + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
&gt; + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
&gt; + * IN THE SOFTWARE.<br>
&gt; + */<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * \file formats.cpp<br>
&gt; + *<br>
&gt; + * Verify the proper functioning of multisample antialiasing for all<br>
&gt; + * possible buffer formats.<br>
&gt; + *<br>
&gt; + * This test operates by rendering an MSAA image twice: once in a<br>
&gt; + * standard RGBA buffer (the behaviour of which is well tested by the<br>
&gt; + * other MSAA tests), and once in a buffer with some other format.<br>
&gt; + * Then it blits both images to corresponding single-sample buffers<br>
&gt; + * and uses glReadPixels to make sure the same image was drawn in both<br>
&gt; + * cases (to within the expected tolerance considering the bit depth<br>
&gt; + * of the two images).<br>
&gt; + *<br>
&gt; + * Finally, the images that were compared are drawn on screen to make<br>
&gt; + * it easier to diagnose failures.<br>
&gt; + */<br>
&gt; +<br>
&gt; +#include &quot;common.h&quot;<br>
&gt; +#include &quot;../../fbo/fbo-formats.h&quot;<br>
&gt; +<br>
&gt; +int piglit_width = 512, piglit_height = 256;<br>
&gt; +int piglit_window_mode = GLUT_DOUBLE | GLUT_RGBA | GLUT_ALPHA;<br>
&gt; +<br>
&gt; +namespace {<br>
&gt; +<br>
&gt; +const int pattern_width = 256; const int pattern_height = 256;<br>
&gt; +<br>
&gt; +int num_samples;<br>
&gt; +<br>
&gt; +TestPattern *test_pattern;<br>
&gt; +<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * This class encapsulates the code necessary to draw the test pattern<br>
&gt; + * in either the reference GL_RGBA format or the format under test,<br>
&gt; + * downsample it, read the rendered pixels into memory, and draw a<br>
&gt; + * visualization of the result.<br>
&gt; + */<br>
&gt; +class PatternRenderer<br>
&gt; +{<br>
&gt; +public:<br>
&gt; +       bool try_setup(GLenum internalformat);<br>
&gt; +       void set_piglit_tolerance();<br>
&gt; +       void draw();<br>
&gt; +       float *read_image(GLenum base_format);<br>
&gt; +<br>
&gt; +       /**<br>
&gt; +        * Number of bits in each color channel.  E.g. color_bits[2]<br>
&gt; +        * == number of bits in blue color channel.<br>
&gt; +        */<br>
&gt; +       GLint color_bits[4];<br>
&gt; +<br>
&gt; +       Fbo fbo_msaa;<br>
&gt; +       Fbo fbo_downsampled;<br>
&gt; +};<br>
&gt; +<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * Try to set up the necessary framebuffers to render to the given<br>
&gt; + * MSAA format.  Return false if one or more of the framebuffers is<br>
&gt; + * incomplete.<br>
&gt; + */<br>
&gt; +bool<br>
&gt; +PatternRenderer::try_setup(GLenum internalformat)<br>
&gt; +{<br>
&gt; +       FboConfig config_downsampled(0, pattern_width, pattern_height);<br>
&gt; +       config_downsampled.color_internalformat = internalformat;<br>
&gt; +<br>
&gt; +       FboConfig config_msaa = config_downsampled;<br>
&gt; +       config_msaa.num_samples = num_samples;<br>
&gt; +<br>
&gt; +       if (!(fbo_downsampled.try_setup(config_downsampled) &amp;&amp;<br>
&gt; +             fbo_msaa.try_setup(config_msaa)))<br>
&gt; +               return false;<br>
&gt; +<br>
&gt; +       glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo_downsampled.handle);<br>
&gt; +       glGetFramebufferAttachmentParameteriv(<br>
&gt; +               GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,<br>
&gt; +               GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, &amp;color_bits[0]);<br>
&gt; +       glGetFramebufferAttachmentParameteriv(<br>
&gt; +               GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,<br>
&gt; +               GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, &amp;color_bits[1]);<br>
&gt; +       glGetFramebufferAttachmentParameteriv(<br>
&gt; +               GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,<br>
&gt; +               GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, &amp;color_bits[2]);<br>
&gt; +       glGetFramebufferAttachmentParameteriv(<br>
&gt; +               GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,<br>
&gt; +               GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &amp;color_bits[3]);<br>
&gt; +<br>
&gt; +       return true;<br>
&gt; +}<br>
&gt; +<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * Set the piglit tolerance appropriately based on the number of bits<br>
&gt; + * in each channel.<br>
&gt; + */<br>
&gt; +void PatternRenderer::set_piglit_tolerance()<br>
&gt; +{<br>
&gt; +       int tolerance_bits[4];<br>
&gt; +<br>
&gt; +       for (int i = 0; i &lt; 4; ++i) {<br>
&gt; +               if (color_bits[i] == 0) {<br>
&gt; +                       /* For channels that have 0 bits, test to 8<br>
&gt; +                        * bits precision so we can verify that the<br>
&gt; +                        * blit puts in the appropriate value.<br>
&gt; +                        */<br>
&gt; +                       tolerance_bits[i] = 8;<br>
&gt; +               } else if (color_bits[i] &gt; 8) {<br>
&gt; +                       /* For channels that have &gt;8 bits, test to 8<br>
&gt; +                        * bits precision because we only use an 8-bit<br>
&gt; +                        * reference image.<br>
&gt; +                        */<br>
&gt; +                       tolerance_bits[i] = 8;<br>
&gt; +               } else {<br>
&gt; +                       tolerance_bits[i] = color_bits[i];<br>
&gt; +               }<br>
&gt; +       }<br>
&gt; +<br>
&gt; +       piglit_set_tolerance_for_bits(tolerance_bits[0], tolerance_bits[1],<br>
&gt; +                                     tolerance_bits[2], tolerance_bits[3]);<br>
&gt; +}<br>
&gt; +<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * Draw the test pattern into the MSAA framebuffer, and then blit it<br>
&gt; + * to the downsampled FBO to force an MSAA resolve.<br>
&gt; + */<br>
&gt; +void<br>
&gt; +PatternRenderer::draw()<br>
&gt; +{<br>
&gt; +       /* Draw into the MSAA fbo */<br>
&gt; +       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo_msaa.handle);<br>
&gt; +       fbo_msaa.set_viewport();<br>
&gt; +       test_pattern-&gt;draw(TestPattern::no_projection);<br>
&gt; +<br>
&gt; +       /* Blit to the downsampled fbo, forcing the image to be downsampled */<br>
&gt; +       glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo_msaa.handle);<br>
&gt; +       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo_downsampled.handle);<br>
&gt; +       glBlitFramebuffer(0, 0, pattern_width, pattern_height,<br>
&gt; +                         0, 0, pattern_width, pattern_height,<br>
&gt; +                         GL_COLOR_BUFFER_BIT, GL_NEAREST);<br>
&gt; +}<br>
&gt; +<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * Read the image from the downsampled FBO into a newly allocated<br>
&gt; + * array of floats and return it.<br>
&gt; + */<br>
&gt; +float *<br>
&gt; +PatternRenderer::read_image(GLenum base_format)<br>
&gt; +{<br>
&gt; +       unsigned components = piglit_num_components(base_format);<br>
&gt; +       unsigned size = sizeof(float)*components*pattern_width*pattern_height;<br>
&gt; +       float *image = (float *) malloc(size);<br>
&gt; +       glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo_downsampled.handle);<br>
&gt; +       if (base_format == GL_INTENSITY) {<br>
&gt; +               /* GL_INTENSITY is not allowed for ReadPixels so<br>
&gt; +                * substitute GL_LUMINANCE.<br>
&gt; +                */<br>
&gt; +               base_format = GL_LUMINANCE;<br>
&gt; +       }<br>
&gt; +       glReadPixels(0, 0, pattern_width, pattern_height, base_format, GL_FLOAT,<br>
&gt; +                    image);<br>
&gt; +       return image;<br>
&gt; +}<br>
&gt; +<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * PatternRenderer used to render the image under test.<br>
&gt; + */<br>
&gt; +PatternRenderer test_renderer;<br>
&gt; +<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * PatternRenderer used to render the reference image (in GL_RGBA<br>
&gt; + * format).<br>
&gt; + */<br>
&gt; +PatternRenderer ref_renderer;<br>
&gt; +<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * Convert the image into a format that can be easily understood by<br>
&gt; + * visual inspection, and display it on the screen.<br>
&gt; + *<br>
&gt; + * Luminance and intensity values are converted to a grayscale value.<br>
&gt; + * Alpha values are visualized by blending the image with a grayscale<br>
&gt; + * checkerboard.<br>
&gt; + */<br>
&gt; +void<br>
&gt; +visualize_image(float *img, GLenum base_internal_format, bool rhs)<br>
&gt; +{<br>
&gt; +       unsigned components = piglit_num_components(base_internal_format);<br>
&gt; +       float *visualization =<br>
&gt; +               (float *) malloc(sizeof(float)*3*pattern_width*pattern_height);<br>
&gt; +       for (int y = 0; y &lt; pattern_height; ++y) {<br>
&gt; +               for (int x = 0; x &lt; pattern_width; ++x) {<br>
&gt; +                       float r = 0, g = 0, b = 0, a = 1;<br>
&gt; +                       float *pixel =<br>
&gt; +                               &amp;img[(y * pattern_width + x) * components];<br>
&gt; +                       switch (base_internal_format) {<br>
&gt; +                       case GL_ALPHA:<br>
&gt; +                               a = pixel[0];<br>
&gt; +                               break;<br>
&gt; +                       case GL_RGBA:<br>
&gt; +                               a = pixel[3];<br>
&gt; +                               /* Fall through */<br>
&gt; +                       case GL_RGB:<br>
&gt; +                               r = pixel[0];<br>
&gt; +                               g = pixel[1];<br>
&gt; +                               b = pixel[2];<br>
&gt; +                               break;<br>
&gt; +                       case GL_LUMINANCE_ALPHA:<br>
&gt; +                               a = pixel[1];<br>
&gt; +                               /* Fall through */<br>
&gt; +                       case GL_INTENSITY:<br>
&gt; +                       case GL_LUMINANCE:<br>
&gt; +                               r = pixel[0];<br>
&gt; +                               g = pixel[0];<br>
&gt; +                               b = pixel[0];<br>
&gt; +                               break;<br>
&gt; +                       }<br>
&gt; +                       float checker = ((x ^ y) &amp; 0x10) ? 0.75 : 0.25;<br>
&gt; +                       r = r * a + checker * (1 - a);<br>
&gt; +                       g = g * a + checker * (1 - a);<br>
&gt; +                       b = b * a + checker * (1 - a);<br>
&gt; +                       visualization[(y * pattern_width + x) * 3] = r;<br>
&gt; +                       visualization[(y * pattern_width + x) * 3 + 1] = g;<br>
&gt; +                       visualization[(y * pattern_width + x) * 3 + 2] = b;<br>
&gt; +               }<br>
&gt; +       }<br>
&gt; +       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);<br>
&gt; +       glViewport(0, 0, piglit_width, piglit_height);<br>
&gt; +       glUseProgram(0);<br>
&gt; +       glRasterPos2f(rhs ? 0 : -1, -1);<br>
&gt; +       glDrawPixels(pattern_width, pattern_height, GL_RGB, GL_FLOAT,<br>
&gt; +                    visualization);<br>
&gt; +       free(visualization);<br>
&gt; +}<br>
&gt; +<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * Transform the reference image (which is in GL_RGBA format) to an<br>
&gt; + * expected image for a given base internal format, using the the<br>
&gt; + * transformation described in the GL 3.0 spec, table 3.15 (Conversion<br>
&gt; + * from RGBA, depth, and stencil pixel components to internal texture,<br>
&gt; + * table, or filter components).  In short, the mapping is as follows:<br>
&gt; + *<br>
&gt; + * base_internal_format  mapping<br>
&gt; + * GL_ALPHA              A -&gt; A<br>
&gt; + * GL_LUMINANCE          R -&gt; L<br>
&gt; + * GL_LUMINANCE_ALPHA    R,A -&gt; L,A<br>
&gt; + * GL_INTENSITY          R -&gt; I<br>
&gt; + * GL_RED                R -&gt; R<br>
&gt; + * GL_RG                 R,G -&gt; R,G<br>
&gt; + * GL_RGB                R,G,B -&gt; R,G,B<br>
&gt; + * GL_RGBA               R,G,B,A -&gt; R,G,B,A<br>
&gt; + */<br>
&gt; +float *<br>
&gt; +compute_expected_image(const float *ref_image, GLenum base_internal_format)<br>
&gt; +{<br>
&gt; +       unsigned components = piglit_num_components(base_internal_format);<br>
&gt; +       unsigned num_pixels = pattern_width*pattern_height;<br>
&gt; +       unsigned size = sizeof(float)*components*num_pixels;<br>
&gt; +       float *expected_image = (float *) malloc(size);<br>
&gt; +       for (unsigned i = 0; i &lt; num_pixels; ++i) {<br>
&gt; +               float *expected = &amp;expected_image[components*i];<br>
&gt; +               const float *ref = &amp;ref_image[4*i];<br>
&gt; +               for (unsigned j = 0; j &lt; components; ++j) {<br>
&gt; +                       switch (base_internal_format) {<br>
&gt; +                       case GL_ALPHA:<br>
&gt; +                               expected[j] = ref[3];<br>
&gt; +                               break;<br>
&gt; +                       case GL_LUMINANCE_ALPHA:<br>
&gt; +                               expected[j] = ref[j ? 3 : 0];<br>
&gt; +                               break;<br>
&gt; +                       default:<br>
&gt; +                               expected[j] = ref[j];<br>
&gt; +                               break;<br>
&gt; +                       }<br>
&gt; +               }<br>
&gt; +       }<br>
&gt; +       return expected_image;<br>
&gt; +}<br>
&gt; +<br>
&gt; +<br>
&gt; +/**<br>
&gt; + * Test a given internal format.<br>
&gt; + */<br>
&gt; +enum piglit_result<br>
&gt; +test_format(const struct format_desc *format)<br>
&gt; +{<br>
&gt; +       bool pass = true;<br>
&gt; +<br>
&gt; +       /* Caller messes with the clear color.  Reset it to the<br>
&gt; +        * default.<br>
&gt; +        */<br>
&gt; +       glClearColor(0, 0, 0, 0);<br>
&gt; +<br>
&gt; +       printf(&quot;Testing %s\n&quot;, format-&gt;name);<br>
&gt; +<br>
&gt; +       /* Set up the framebuffers for rendering the reference image.<br>
&gt; +        * This shouldn&#39;t fail.<br>
&gt; +        */<br>
&gt; +       bool setup_success = ref_renderer.try_setup(GL_RGBA);<br>
&gt; +       if (!piglit_check_gl_error(GL_NO_ERROR)) {<br>
&gt; +               printf(&quot;Error setting up reference renderbuffers\n&quot;);<br>
&gt; +               return PIGLIT_FAIL;<br>
&gt; +       }<br>
&gt; +       if (!setup_success) {<br>
&gt; +               printf(&quot;Reference framebuffer combination is unsupported\n&quot;);<br>
&gt; +               return PIGLIT_FAIL;<br>
&gt; +       }<br>
&gt; +<br>
&gt; +       /* Set up the framebuffers for rendering the test image.  This<br>
&gt; +        * might fail if the format we&#39;re testing isn&#39;t supported as a<br>
&gt; +        * render target, and that&#39;s ok.<br>
&gt; +        *<br>
&gt; +        * Note: in order to be sure we test all formats which the<br>
&gt; +        * implementations supports as render targets, we try all of<br>
&gt; +        * them, even formats that the spec doesn&#39;t define as<br>
&gt; +        * color-renderable (e.g. GL_LUMINANCE8, which is supported as<br>
&gt; +        * a render target format by some drivers even though it&#39;s not<br>
&gt; +        * officially color-renderable).  If we tried to request a<br>
&gt; +        * color-renderable format and it wasn&#39;t supported, we would<br>
&gt; +        * expect the framebuffer to be incomplete.  If we tried to<br>
&gt; +        * request a non-color-renderable format and it wasn&#39;t<br>
&gt; +        * supported, we might have received a GL error.  In either<br>
&gt; +        * case just skip to the next format.<br>
&gt; +        */<br>
&gt; +       setup_success = test_renderer.try_setup(format-&gt;internalformat);<br>
&gt; +       if (glGetError() != GL_NO_ERROR) {<br>
&gt; +               printf(&quot;Error setting up test renderbuffers\n&quot;);<br>
&gt; +               return PIGLIT_SKIP;<br>
&gt; +       }<br>
&gt; +       if (!setup_success) {<br>
&gt; +               printf(&quot;Unsupported framebuffer combination\n&quot;);<br>
&gt; +               return PIGLIT_SKIP;<br>
&gt; +       }<br>
&gt; +<br>
&gt; +       /* Draw test and reference images, and read them into memory */<br>
&gt; +       test_renderer.set_piglit_tolerance();<br>
&gt; +       test_renderer.draw();<br>
&gt; +       float *test_image =<br>
&gt; +               test_renderer.read_image(format-&gt;base_internal_format);<br>
&gt; +       ref_renderer.draw();<br>
&gt; +       float *ref_image = ref_renderer.read_image(GL_RGBA);<br>
&gt; +<br>
&gt; +       /* Compute the expected image from the reference image */<br>
&gt; +       float *expected_image =<br>
&gt; +               compute_expected_image(ref_image,<br>
&gt; +                                      format-&gt;base_internal_format);<br>
&gt; +<br>
&gt; +       /* Check that the test image was correct */<br>
&gt; +       glBindFramebuffer(GL_READ_FRAMEBUFFER,<br>
&gt; +                         test_renderer.fbo_downsampled.handle);<br>
&gt; +       pass = piglit_probe_image_color(0, 0, pattern_width, pattern_height,<br>
&gt; +                                       format-&gt;base_internal_format,<br>
&gt; +                                       expected_image) &amp;&amp; pass;<br>
&gt; +<br>
&gt; +       /* Show both the test and expected images on screen so that<br>
&gt; +        * the user can diagnose problems.<br>
&gt; +        */<br>
&gt; +       visualize_image(test_image, format-&gt;base_internal_format, false);<br>
&gt; +       visualize_image(expected_image, format-&gt;base_internal_format, true);<br>
&gt; +<br>
&gt; +       /* Finally, if any error occurred, count that as a failure. */<br>
&gt; +       pass = piglit_check_gl_error(GL_NO_ERROR) &amp;&amp; pass;<br>
&gt; +<br>
&gt; +       free(test_image);<br>
&gt; +       free(ref_image);<br>
&gt; +       free(expected_image);<br>
&gt; +<br>
&gt; +       return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
&gt; +}<br>
&gt; +<br>
&gt; +<br>
&gt; +void<br>
&gt; +print_usage_and_exit(char *prog_name)<br>
&gt; +{<br>
&gt; +       printf(&quot;Usage: %s &lt;num_samples&gt;\n&quot;, prog_name);<br>
&gt; +       piglit_report_result(PIGLIT_FAIL);<br>
&gt; +}<br>
&gt; +<br>
&gt; +<br>
&gt; +extern &quot;C&quot; void<br>
&gt; +piglit_init(int argc, char **argv)<br>
&gt; +{<br>
&gt; +       if (argc &lt; 2)<br>
&gt; +               print_usage_and_exit(argv[0]);<br>
&gt; +       char *endptr = NULL;<br>
&gt; +       num_samples = strtol(argv[1], &amp;endptr, 0);<br>
&gt; +       if (endptr != argv[1] + strlen(argv[1]))<br>
&gt; +               print_usage_and_exit(argv[0]);<br>
&gt; +<br>
&gt; +       piglit_require_gl_version(30);<br>
&gt; +       piglit_require_GLSL_version(130);<br>
</div></div>I think this check is redundant. GLSL version is implied by OpenGL 3.0<br></blockquote><div><br></div></div></div><div>You&#39;re right.  I&#39;ll remove the redundant check.</div><div class="im"><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div><br>
&gt; +<br>
&gt; +       /* Skip the test if num_samples &gt; GL_MAX_SAMPLES */<br>
&gt; +       GLint max_samples;<br>
&gt; +       glGetIntegerv(GL_MAX_SAMPLES, &amp;max_samples);<br>
&gt; +       if (num_samples &gt; max_samples)<br>
&gt; +               piglit_report_result(PIGLIT_SKIP);<br>
&gt; +<br>
&gt; +       fbo_formats_init_test_set(0 /* core formats */,<br>
&gt; +                                 GL_TRUE /* print_options */);<br>
&gt; +       test_pattern = new ColorGradientSunburst();<br>
&gt; +       test_pattern-&gt;compile();<br>
&gt; +}<br>
&gt; +<br>
&gt; +extern &quot;C&quot; enum piglit_result<br>
&gt; +piglit_display()<br>
&gt; +{<br>
&gt; +       return fbo_formats_display(test_format);<br>
&gt; +}<br>
&gt; +<br>
&gt; +};<br>
&gt; --<br>
&gt; 1.7.7.6<br>
&gt;<br>
</div></div></blockquote></div></div><br>
</blockquote></div><br>