Signed-off-by: Topi Pohjolainen <[email protected]>
---
 tests/spec/ext_framebuffer_multisample/clear.cpp | 31 ++++++++++++++++++------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/clear.cpp 
b/tests/spec/ext_framebuffer_multisample/clear.cpp
index cb6c2e1a6..cb3231928 100644
--- a/tests/spec/ext_framebuffer_multisample/clear.cpp
+++ b/tests/spec/ext_framebuffer_multisample/clear.cpp
@@ -77,9 +77,9 @@ namespace {
 
 const int pattern_width = 256; const int pattern_height = 256;
 
-Fbo multisampled_fbo;
 ManifestProgram *manifest_program = NULL;
 GLbitfield buffer_to_test;
+int num_samples;
 
 
 void
@@ -103,7 +103,7 @@ piglit_init(int argc, char **argv)
 
        /* 1st arg: num_samples */
        char *endptr = NULL;
-       int num_samples = strtol(argv[1], &endptr, 0);
+       num_samples = strtol(argv[1], &endptr, 0);
        if (endptr != argv[1] + strlen(argv[1]))
                print_usage_and_exit(argv[0]);
 
@@ -130,8 +130,6 @@ piglit_init(int argc, char **argv)
        if (num_samples > max_samples)
                piglit_report_result(PIGLIT_SKIP);
 
-       multisampled_fbo.setup(FboConfig(GL_RGBA, num_samples, pattern_width,
-                                        pattern_height));
        if (manifest_program)
                manifest_program->compile();
 
@@ -142,10 +140,15 @@ piglit_init(int argc, char **argv)
 
 bool
 test_clear(const float r, const float g, const float b,
-          const float a, const bool fast_clear_compatible)
+          const float a, const bool fast_clear_compatible,
+          GLenum color_internal_format)
 {
        bool pass = true;
 
+       Fbo multisampled_fbo;
+       multisampled_fbo.setup(FboConfig(color_internal_format, num_samples,
+                                        pattern_width, pattern_height));
+
        /* Clear all buffers of the multisampled fbo to default values
         * (color={0,0,0,0}, depth=1, stencil=0), with no special
         * coverage settings set.
@@ -257,16 +260,28 @@ test_clear(const float r, const float g, const float b,
 extern "C" enum piglit_result
 piglit_display()
 {
-       bool pass =true;
+       bool pass;
 
        /* Non 'fast clear' path. */
-       pass = test_clear(1.0, 1.0, 1.0, 0.5, false) && pass;
+       if (buffer_to_test == GL_COLOR_BUFFER_BIT) {
+               pass = test_clear(1.0, 1.0, 1.0, 0.5, false, GL_RGBA);
+               pass &= test_clear(1.0, 1.0, 1.0, 0.5, false, GL_RGBA16F);
+               pass &= test_clear(1.0, 1.0, 1.0, 0.5, false, GL_RGBA32F);
+       } else {
+               pass = test_clear(1.0, 1.0, 1.0, 0.5, false, GL_RGBA);
+       }
 
        /* Test with color values compatible with Intel's i965 driver's
         * 'fast clear' constraints. It varifies the 'fast clear' path
         * if supported by the implementation.
         */
-       pass = test_clear(1.0, 1.0, 1.0, 0.0, true) && pass;
+       if (buffer_to_test == GL_COLOR_BUFFER_BIT) {
+               pass &= test_clear(1.0, 1.0, 1.0, 0.0, true, GL_RGBA);
+               pass &= test_clear(1.0, 1.0, 1.0, 0.0, true, GL_RGBA16F);
+               pass &= test_clear(1.0, 1.0, 1.0, 0.0, true, GL_RGBA32F);
+       } else {
+               pass &= test_clear(1.0, 1.0, 1.0, 0.0, true, GL_RGBA);
+       }
 
        return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
-- 
2.11.0

_______________________________________________
Piglit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to