13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 3.1 Module 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ------------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Multisample interpolation state query tests 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es31fShaderMultisampleInterpolationStateQueryTests.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp" 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluCallLogWrapper.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluContextInfo.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsStateQueryUtil.hpp" 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp" 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp" 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles31 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 43cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyryusing namespace gls::StateQueryUtil; 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass InterpolationOffsetCase : public TestCase 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry enum TestType 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TEST_MIN_OFFSET = 0, 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TEST_MAX_OFFSET, 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TEST_LAST 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 56cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry InterpolationOffsetCase (Context& context, const char* name, const char* desc, QueryType verifier, TestType testType); 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~InterpolationOffsetCase (void); 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void); 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 63cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry const QueryType m_verifier; 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const TestType m_testType; 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 67cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko PöyryInterpolationOffsetCase::InterpolationOffsetCase (Context& context, const char* name, const char* desc, QueryType verifier, TestType testType) 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCase (context, name, desc) 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_verifier (verifier) 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_testType (testType) 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(m_testType < TEST_LAST); 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 753c827367444ee418f129b2c238299f49d3264554Jarkko PoyryInterpolationOffsetCase::~InterpolationOffsetCase (void) 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid InterpolationOffsetCase::init (void) 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 81fb059fdb43c8b6073ada028a68124263c59a000aPyry Haulos const bool isES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)); 82fb059fdb43c8b6073ada028a68124263c59a000aPyry Haulos 83fb059fdb43c8b6073ada028a68124263c59a000aPyry Haulos if (!isES32 && !m_context.getContextInfo().isExtensionSupported("GL_OES_shader_multisample_interpolation")) 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError("Test requires GL_OES_shader_multisample_interpolation extension"); 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 873c827367444ee418f129b2c238299f49d3264554Jarkko PoyryInterpolationOffsetCase::IterateResult InterpolationOffsetCase::iterate (void) 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 89653ad0e8a4209754304cbd5b5ceb4fdc7b29c01aPyry Haulos glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 90cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 91cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry gl.enableLogging(true); 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_testType == TEST_MAX_OFFSET) 94cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry verifyStateFloatMin(result, gl, GL_MAX_FRAGMENT_INTERPOLATION_OFFSET, 0.5, m_verifier); 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else if (m_testType == TEST_MIN_OFFSET) 96cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry verifyStateFloatMax(result, gl, GL_MIN_FRAGMENT_INTERPOLATION_OFFSET, -0.5, m_verifier); 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(false); 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 100cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry result.setTestContextResult(m_testCtx); 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FragmentInterpolationOffsetBitsCase : public TestCase 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 107cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry FragmentInterpolationOffsetBitsCase (Context& context, const char* name, const char* desc, QueryType verifier); 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~FragmentInterpolationOffsetBitsCase (void); 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void); 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 114cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry const QueryType m_verifier; 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 117cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko PöyryFragmentInterpolationOffsetBitsCase::FragmentInterpolationOffsetBitsCase (Context& context, const char* name, const char* desc, QueryType verifier) 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCase (context, name, desc) 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_verifier (verifier) 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1233c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFragmentInterpolationOffsetBitsCase::~FragmentInterpolationOffsetBitsCase (void) 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FragmentInterpolationOffsetBitsCase::init (void) 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 129fb059fdb43c8b6073ada028a68124263c59a000aPyry Haulos const bool isES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)); 130fb059fdb43c8b6073ada028a68124263c59a000aPyry Haulos 131fb059fdb43c8b6073ada028a68124263c59a000aPyry Haulos if (!isES32 && !m_context.getContextInfo().isExtensionSupported("GL_OES_shader_multisample_interpolation")) 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError("Test requires GL_OES_shader_multisample_interpolation extension"); 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1353c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFragmentInterpolationOffsetBitsCase::IterateResult FragmentInterpolationOffsetBitsCase::iterate (void) 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 137653ad0e8a4209754304cbd5b5ceb4fdc7b29c01aPyry Haulos glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 138cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 139cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry gl.enableLogging(true); 140cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry 141cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry verifyStateIntegerMin(result, gl, GL_FRAGMENT_INTERPOLATION_OFFSET_BITS, 4, m_verifier); 142cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry 143cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry result.setTestContextResult(m_testCtx); 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1493c827367444ee418f129b2c238299f49d3264554Jarkko PoyryShaderMultisampleInterpolationStateQueryTests::ShaderMultisampleInterpolationStateQueryTests (Context& context) 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "multisample_interpolation", "Test multisample interpolation states") 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1543c827367444ee418f129b2c238299f49d3264554Jarkko PoyryShaderMultisampleInterpolationStateQueryTests::~ShaderMultisampleInterpolationStateQueryTests (void) 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid ShaderMultisampleInterpolationStateQueryTests::init (void) 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static const struct Verifier 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 162cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry QueryType verifier; 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const char* name; 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const char* desc; 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } verifiers[] = 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 167cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry { QUERY_BOOLEAN, "get_boolean", "Test using getBoolean" }, 168cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry { QUERY_INTEGER, "get_integer", "Test using getInteger" }, 169cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry { QUERY_FLOAT, "get_float", "Test using getFloat" }, 170cb82ed72dcbbfd8a6d07736c3259605227bc984fJarkko Pöyry { QUERY_INTEGER64, "get_integer64", "Test using getInteger64" }, 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // .min_fragment_interpolation_offset 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* const group = new tcu::TestCaseGroup(m_testCtx, "min_fragment_interpolation_offset", "Test MIN_FRAGMENT_INTERPOLATION_OFFSET"); 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(group); 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int verifierNdx = 0; verifierNdx < DE_LENGTH_OF_ARRAY(verifiers); ++verifierNdx) 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry group->addChild(new InterpolationOffsetCase(m_context, verifiers[verifierNdx].name, verifiers[verifierNdx].desc, verifiers[verifierNdx].verifier, InterpolationOffsetCase::TEST_MIN_OFFSET)); 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // .max_fragment_interpolation_offset 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* const group = new tcu::TestCaseGroup(m_testCtx, "max_fragment_interpolation_offset", "Test MAX_FRAGMENT_INTERPOLATION_OFFSET"); 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(group); 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int verifierNdx = 0; verifierNdx < DE_LENGTH_OF_ARRAY(verifiers); ++verifierNdx) 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry group->addChild(new InterpolationOffsetCase(m_context, verifiers[verifierNdx].name, verifiers[verifierNdx].desc, verifiers[verifierNdx].verifier, InterpolationOffsetCase::TEST_MAX_OFFSET)); 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // .fragment_interpolation_offset_bits 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* const group = new tcu::TestCaseGroup(m_testCtx, "fragment_interpolation_offset_bits", "Test FRAGMENT_INTERPOLATION_OFFSET_BITS"); 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(group); 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int verifierNdx = 0; verifierNdx < DE_LENGTH_OF_ARRAY(verifiers); ++verifierNdx) 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry group->addChild(new FragmentInterpolationOffsetBitsCase(m_context, verifiers[verifierNdx].name, verifiers[verifierNdx].desc, verifiers[verifierNdx].verifier)); 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles31 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 204