Merge vk-gl-cts/vulkan-cts-1.0.2 into vk-gl-cts/master
[platform/upstream/VK-GL-CTS.git] / modules / gles3 / functional / es3fIntegerStateQueryTests.cpp
index be9d4a0..16c11b4 100644 (file)
@@ -1148,7 +1148,15 @@ public:
                de::Random rnd(0xabcdef);
 
                GLint maxViewportDimensions[2] = {0};
+               GLfloat viewportBoundsRange[2] = {0.0f};
+               GLboolean hasViewportArray = false;
                glGetIntegerv(GL_MAX_VIEWPORT_DIMS, maxViewportDimensions);
+               hasViewportArray = m_context.getContextInfo().isExtensionSupported("GL_OES_viewport_array") ||
+                                                  m_context.getContextInfo().isExtensionSupported("GL_NV_viewport_array");
+               if (hasViewportArray)
+               {
+                       glGetFloatv(GL_VIEWPORT_BOUNDS_RANGE, viewportBoundsRange);
+               }
 
                // verify initial value of first two values
                m_verifier->verifyInteger4(m_testCtx, GL_VIEWPORT, 0, 0, m_context.getRenderTarget().getWidth(), m_context.getRenderTarget().getHeight());
@@ -1163,7 +1171,19 @@ public:
                        GLsizei height  = rnd.getInt(0, maxViewportDimensions[1]);
 
                        glViewport(x, y, width, height);
-                       m_verifier->verifyInteger4(m_testCtx, GL_VIEWPORT, x, y, width, height);
+
+                       if (hasViewportArray)
+                       {
+                               m_verifier->verifyInteger4(m_testCtx, GL_VIEWPORT,
+                                                                                  de::clamp(x, deFloorFloatToInt32(viewportBoundsRange[0]), deFloorFloatToInt32(viewportBoundsRange[1])),
+                                                                                  de::clamp(y, deFloorFloatToInt32(viewportBoundsRange[0]), deFloorFloatToInt32(viewportBoundsRange[1])),
+                                                                                  width, height);
+                       }
+                       else
+                       {
+                               m_verifier->verifyInteger4(m_testCtx, GL_VIEWPORT, x, y, width, height);
+                       }
+
                        expectError(GL_NO_ERROR);
                }
        }