Check GL_NV_framebuffer_multisample support in negative api tests.
authorMika Isojärvi <misojarvi@google.com>
Mon, 23 Feb 2015 19:36:50 +0000 (11:36 -0800)
committerMika Isojärvi <misojarvi@google.com>
Mon, 23 Feb 2015 19:36:50 +0000 (11:36 -0800)
Check if GL_NV_framebuffer_multisample is supported before assuming, that blit
operations with sample count bigger than 0 fail.

Bug: 19462860
Change-Id: Ice201a3674767a502856500092e11166f6483375

modules/gles3/functional/es3fNegativeBufferApiTests.cpp
modules/gles31/functional/es31fNegativeBufferApiTests.cpp

index 7fdad38..bb5fd44 100644 (file)
@@ -1195,26 +1195,29 @@ void NegativeBufferApiTests::init (void)
 
                        expectError                                             (GL_NO_ERROR);
 
-                       m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the value of GL_SAMPLE_BUFFERS for the draw buffer is greater than zero.");
-                       glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32);
-                       glFramebufferRenderbuffer               (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
-                       glBlitFramebuffer                               (0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
-                       expectError                                             (GL_INVALID_OPERATION);
-                       m_log << TestLog::EndSection;
-
-                       m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the formats of draw and read buffers are not identical.");
-                       glRenderbufferStorage                   (GL_RENDERBUFFER, GL_RGBA4, 32, 32);
-                       glFramebufferRenderbuffer               (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
-                       glBlitFramebuffer                               (0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
-                       expectError                                             (GL_INVALID_OPERATION);
-                       m_log << TestLog::EndSection;
-
-                       m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the source and destination rectangles are not defined with the same (X0, Y0) and (X1, Y1) bounds.");
-                       glRenderbufferStorage                   (GL_RENDERBUFFER, GL_RGBA8, 32, 32);
-                       glFramebufferRenderbuffer               (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
-                       glBlitFramebuffer                               (0, 0, 16, 16, 2, 2, 18, 18, GL_COLOR_BUFFER_BIT, GL_NEAREST);
-                       expectError                                             (GL_INVALID_OPERATION);
-                       m_log << TestLog::EndSection;
+                       if (!m_context.getContextInfo().isExtensionSupported("GL_NV_framebuffer_multisample"))
+                       {
+                               m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the value of GL_SAMPLE_BUFFERS for the draw buffer is greater than zero.");
+                               glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32);
+                               glFramebufferRenderbuffer               (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
+                               glBlitFramebuffer                               (0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+                               expectError                                             (GL_INVALID_OPERATION);
+                               m_log << TestLog::EndSection;
+
+                               m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the formats of draw and read buffers are not identical.");
+                               glRenderbufferStorage                   (GL_RENDERBUFFER, GL_RGBA4, 32, 32);
+                               glFramebufferRenderbuffer               (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
+                               glBlitFramebuffer                               (0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+                               expectError                                             (GL_INVALID_OPERATION);
+                               m_log << TestLog::EndSection;
+
+                               m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the source and destination rectangles are not defined with the same (X0, Y0) and (X1, Y1) bounds.");
+                               glRenderbufferStorage                   (GL_RENDERBUFFER, GL_RGBA8, 32, 32);
+                               glFramebufferRenderbuffer               (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
+                               glBlitFramebuffer                               (0, 0, 16, 16, 2, 2, 18, 18, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+                               expectError                                             (GL_INVALID_OPERATION);
+                               m_log << TestLog::EndSection;
+                       }
 
                        glBindFramebuffer               (GL_FRAMEBUFFER, 0);
                        glDeleteRenderbuffers   (2, rbo);
index 9f63623..56b698e 100644 (file)
@@ -1222,26 +1222,29 @@ void blit_framebuffer_multisample (NegativeTestContext& ctx)
 
        ctx.expectError                                         (GL_NO_ERROR);
 
-       ctx.beginSection("GL_INVALID_OPERATION is generated if the value of GL_SAMPLE_BUFFERS for the draw buffer is greater than zero.");
-       ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32);
-       ctx.glFramebufferRenderbuffer           (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
-       ctx.glBlitFramebuffer                           (0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
-       ctx.expectError                                         (GL_INVALID_OPERATION);
-       ctx.endSection();
-
-       ctx.beginSection("GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the formats of draw and read buffers are not identical.");
-       ctx.glRenderbufferStorage                       (GL_RENDERBUFFER, GL_RGBA4, 32, 32);
-       ctx.glFramebufferRenderbuffer           (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
-       ctx.glBlitFramebuffer                           (0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
-       ctx.expectError                                         (GL_INVALID_OPERATION);
-       ctx.endSection();
-
-       ctx.beginSection("GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the source and destination rectangles are not defined with the same (X0, Y0) and (X1, Y1) bounds.");
-       ctx.glRenderbufferStorage                       (GL_RENDERBUFFER, GL_RGBA8, 32, 32);
-       ctx.glFramebufferRenderbuffer           (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
-       ctx.glBlitFramebuffer                           (0, 0, 16, 16, 2, 2, 18, 18, GL_COLOR_BUFFER_BIT, GL_NEAREST);
-       ctx.expectError                                         (GL_INVALID_OPERATION);
-       ctx.endSection();
+       if (!ctx.getContextInfo().isExtensionSupported("GL_NV_framebuffer_multisample"))
+       {
+               ctx.beginSection("GL_INVALID_OPERATION is generated if the value of GL_SAMPLE_BUFFERS for the draw buffer is greater than zero.");
+               ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32);
+               ctx.glFramebufferRenderbuffer           (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
+               ctx.glBlitFramebuffer                           (0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+               ctx.expectError                                         (GL_INVALID_OPERATION);
+               ctx.endSection();
+
+               ctx.beginSection("GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the formats of draw and read buffers are not identical.");
+               ctx.glRenderbufferStorage                       (GL_RENDERBUFFER, GL_RGBA4, 32, 32);
+               ctx.glFramebufferRenderbuffer           (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
+               ctx.glBlitFramebuffer                           (0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+               ctx.expectError                                         (GL_INVALID_OPERATION);
+               ctx.endSection();
+
+               ctx.beginSection("GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the source and destination rectangles are not defined with the same (X0, Y0) and (X1, Y1) bounds.");
+               ctx.glRenderbufferStorage                       (GL_RENDERBUFFER, GL_RGBA8, 32, 32);
+               ctx.glFramebufferRenderbuffer           (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
+               ctx.glBlitFramebuffer                           (0, 0, 16, 16, 2, 2, 18, 18, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+               ctx.expectError                                         (GL_INVALID_OPERATION);
+               ctx.endSection();
+       }
 
        ctx.glBindFramebuffer                           (GL_FRAMEBUFFER, 0);
        ctx.glDeleteRenderbuffers                       (2, rbo);