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 Sample shading tests 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es31fSampleShadingTests.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es31fMultisampleShaderRenderCase.hpp" 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRenderTarget.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuSurface.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsStateQueryUtil.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluCallLogWrapper.hpp" 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluContextInfo.hpp" 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluShaderProgram.hpp" 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp" 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluPixelTransfer.hpp" 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp" 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp" 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deStringUtil.hpp" 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deRandom.hpp" 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <map> 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles31 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass SampleShadingStateCase : public TestCase 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry enum VerifierType 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_IS_ENABLED = 0, 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_GET_BOOLEAN, 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_GET_INTEGER, 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_GET_FLOAT, 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_GET_INTEGER64, 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_LAST 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry SampleShadingStateCase (Context& ctx, const char* name, const char* desc, VerifierType); 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void); 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool verify (bool v); 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const VerifierType m_verifier; 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 743c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySampleShadingStateCase::SampleShadingStateCase (Context& ctx, const char* name, const char* desc, VerifierType type) 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCase (ctx, name, desc) 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_verifier (type) 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(m_verifier < TYPE_LAST); 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid SampleShadingStateCase::init (void) 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!m_context.getContextInfo().isExtensionSupported("GL_OES_sample_shading")) 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError("Test requires GL_OES_sample_shading extension"); 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 873c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySampleShadingStateCase::IterateResult SampleShadingStateCase::iterate (void) 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool allOk = true; 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.enableLogging(true); 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // initial 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Verifying initial value" << tcu::TestLog::EndMessage; 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(false); 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // true and false too 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Verifying random values" << tcu::TestLog::EndMessage; 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glEnable(GL_SAMPLE_SHADING); 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(true); 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glDisable(GL_SAMPLE_SHADING); 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(false); 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!allOk && m_testCtx.getTestResult() == QP_TEST_RESULT_PASS) 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got unexpected value"); 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool SampleShadingStateCase::verify (bool v) 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.enableLogging(true); 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (m_verifier) 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case TYPE_IS_ENABLED: 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::GLboolean retVal = gl.glIsEnabled(GL_SAMPLE_SHADING); 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((v && retVal==GL_TRUE) || (!v && retVal==GL_FALSE)) 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return true; 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "// ERROR: Expected " << ((v) ? ("GL_TRUE") : ("GL_FALSE")) << ", got " << ((retVal == GL_TRUE) ? ("GL_TRUE") : (retVal == GL_FALSE) ? ("GL_FALSE") : ("not-a-boolean")) << tcu::TestLog::EndMessage; 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case TYPE_GET_BOOLEAN: 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::StateQueryUtil::StateQueryMemoryWriteGuard<glw::GLboolean> state; 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetBooleanv(GL_SAMPLE_SHADING, &state); 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!state.verifyValidity(m_testCtx)) 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((v && state==GL_TRUE) || (!v && state==GL_FALSE)) 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return true; 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "// ERROR: Expected " << ((v) ? ("GL_TRUE") : ("GL_FALSE")) << ", got " << ((state == GL_TRUE) ? ("GL_TRUE") : (state == GL_FALSE) ? ("GL_FALSE") : ("not-a-boolean")) << tcu::TestLog::EndMessage; 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case TYPE_GET_INTEGER: 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::StateQueryUtil::StateQueryMemoryWriteGuard<glw::GLint> state; 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetIntegerv(GL_SAMPLE_SHADING, &state); 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!state.verifyValidity(m_testCtx)) 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((v && state==1) || (!v && state==0)) 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return true; 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "// ERROR: Expected " << ((v) ? ("1") : ("0")) << ", got " << state << tcu::TestLog::EndMessage; 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case TYPE_GET_FLOAT: 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::StateQueryUtil::StateQueryMemoryWriteGuard<glw::GLfloat> state; 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetFloatv(GL_SAMPLE_SHADING, &state); 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!state.verifyValidity(m_testCtx)) 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((v && state==1.0f) || (!v && state==0.0f)) 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return true; 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "// ERROR: Expected " << ((v) ? ("1.0") : ("0.0")) << ", got " << state << tcu::TestLog::EndMessage; 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case TYPE_GET_INTEGER64: 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::StateQueryUtil::StateQueryMemoryWriteGuard<glw::GLint64> state; 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetInteger64v(GL_SAMPLE_SHADING, &state); 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!state.verifyValidity(m_testCtx)) 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((v && state==1) || (!v && state==0)) 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return true; 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "// ERROR: Expected " << ((v) ? ("1") : ("0")) << ", got " << state << tcu::TestLog::EndMessage; 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry default: 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(false); 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass MinSampleShadingValueCase : public TestCase 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry enum VerifierType 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_GET_BOOLEAN = 0, 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_GET_INTEGER, 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_GET_FLOAT, 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_GET_INTEGER64, 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_LAST 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MinSampleShadingValueCase (Context& ctx, const char* name, const char* desc, VerifierType); 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void); 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool verify (float v); 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const VerifierType m_verifier; 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2273c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMinSampleShadingValueCase::MinSampleShadingValueCase (Context& ctx, const char* name, const char* desc, VerifierType type) 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCase (ctx, name, desc) 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_verifier (type) 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(m_verifier < TYPE_LAST); 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MinSampleShadingValueCase::init (void) 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!m_context.getContextInfo().isExtensionSupported("GL_OES_sample_shading")) 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError("Test requires GL_OES_sample_shading extension"); 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2403c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMinSampleShadingValueCase::IterateResult MinSampleShadingValueCase::iterate (void) 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool allOk = true; 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.enableLogging(true); 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // initial 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Verifying initial value" << tcu::TestLog::EndMessage; 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(0.0); 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // special values 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Verifying special values" << tcu::TestLog::EndMessage; 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glMinSampleShading(0.0f); 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(0.0); 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glMinSampleShading(1.0f); 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(1.0); 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glMinSampleShading(0.5f); 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(0.5); 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // random values 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int numRandomTests = 10; 2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry de::Random rnd (0xde123); 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Verifying random values" << tcu::TestLog::EndMessage; 2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int randNdx = 0; randNdx < numRandomTests; ++randNdx) 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float value = rnd.getFloat(); 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glMinSampleShading(value); 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(value); 2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!allOk && m_testCtx.getTestResult() == QP_TEST_RESULT_PASS) 2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got unexpected value"); 2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool MinSampleShadingValueCase::verify (float v) 2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.enableLogging(true); 2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (m_verifier) 2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case TYPE_GET_BOOLEAN: 2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::StateQueryUtil::StateQueryMemoryWriteGuard<glw::GLboolean> state; 3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetBooleanv(GL_MIN_SAMPLE_SHADING_VALUE, &state); 3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!state.verifyValidity(m_testCtx)) 3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((v!=0.0f && state==GL_TRUE) || (v==0.0f && state==GL_FALSE)) 3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return true; 3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "// ERROR: Expected " << ((v!=0.0f) ? ("GL_TRUE") : ("GL_FALSE")) << ", got " << ((state == GL_TRUE) ? ("GL_TRUE") : (state == GL_FALSE) ? ("GL_FALSE") : ("not-a-boolean")) << tcu::TestLog::EndMessage; 3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case TYPE_GET_INTEGER: 3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::StateQueryUtil::StateQueryMemoryWriteGuard<glw::GLint> state; 3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetIntegerv(GL_MIN_SAMPLE_SHADING_VALUE, &state); 3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!state.verifyValidity(m_testCtx)) 3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((v>=0.5f && state==1) || (v<=0.5f && state==0)) 3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return true; 3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "// ERROR: Expected " << ((v==0.5) ? ("0 or 1") : (v<0.5) ? ("0") : ("1")) << ", got " << state << tcu::TestLog::EndMessage; 3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case TYPE_GET_FLOAT: 3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::StateQueryUtil::StateQueryMemoryWriteGuard<glw::GLfloat> state; 3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetFloatv(GL_MIN_SAMPLE_SHADING_VALUE, &state); 3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!state.verifyValidity(m_testCtx)) 3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (v == state) 3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return true; 3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "// ERROR: Expected " << v << ", got " << state << tcu::TestLog::EndMessage; 3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case TYPE_GET_INTEGER64: 3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::StateQueryUtil::StateQueryMemoryWriteGuard<glw::GLint64> state; 3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetInteger64v(GL_MIN_SAMPLE_SHADING_VALUE, &state); 3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!state.verifyValidity(m_testCtx)) 3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((v>=0.5f && state==1) || (v<=0.5f && state==0)) 3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return true; 3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "// ERROR: Expected " << ((v==0.5) ? ("0 or 1") : (v<0.5) ? ("0") : ("1")) << ", got " << state << tcu::TestLog::EndMessage; 3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry default: 3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(false); 3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass MinSampleShadingValueClampingCase : public TestCase 3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MinSampleShadingValueClampingCase (Context& ctx, const char* name, const char* desc); 3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void); 3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool verify (float v); 3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3773c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMinSampleShadingValueClampingCase::MinSampleShadingValueClampingCase (Context& ctx, const char* name, const char* desc) 3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCase(ctx, name, desc) 3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MinSampleShadingValueClampingCase::init (void) 3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!m_context.getContextInfo().isExtensionSupported("GL_OES_sample_shading")) 3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError("Test requires GL_OES_sample_shading extension"); 3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3883c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMinSampleShadingValueClampingCase::IterateResult MinSampleShadingValueClampingCase::iterate (void) 3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool allOk = true; 3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.enableLogging(true); 3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // special values 3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Verifying clamped values. Value is clamped when specified." << tcu::TestLog::EndMessage; 3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glMinSampleShading(-0.5f); 4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(0.0); 4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glMinSampleShading(-1.0f); 4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(0.0); 4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glMinSampleShading(-1.5f); 4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(0.0); 4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glMinSampleShading(1.5f); 4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(1.0); 4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glMinSampleShading(2.0f); 4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(1.0); 4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glMinSampleShading(2.5f); 4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry allOk &= verify(1.0); 4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!allOk && m_testCtx.getTestResult() == QP_TEST_RESULT_PASS) 4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got unexpected value"); 4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool MinSampleShadingValueClampingCase::verify (float v) 4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::StateQueryUtil::StateQueryMemoryWriteGuard<glw::GLfloat> state; 4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.enableLogging(true); 4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetFloatv(GL_MIN_SAMPLE_SHADING_VALUE, &state); 4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!state.verifyValidity(m_testCtx)) 4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (v == state) 4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return true; 4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "// ERROR: Expected " << v << ", got " << state << tcu::TestLog::EndMessage; 4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass SampleShadingRenderingCase : public MultisampleShaderRenderUtil::MultisampleRenderCase 4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry enum TestType 4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TEST_DISCARD = 0, 4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TEST_COLOR, 4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TEST_LAST 4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry SampleShadingRenderingCase (Context& ctx, const char* name, const char* desc, RenderTarget target, int numSamples, TestType type); 4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~SampleShadingRenderingCase (void); 4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void); 4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void setShadingValue (int sampleCount); 4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void preDraw (void); 4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void postDraw (void); 4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::string getIterationDescription (int iteration) const; 4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool verifyImage (const tcu::Surface& resultImage); 4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::string genFragmentSource (int numSamples) const; 4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry enum 4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry RENDER_SIZE = 128 4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const TestType m_type; 4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4773c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySampleShadingRenderingCase::SampleShadingRenderingCase (Context& ctx, const char* name, const char* desc, RenderTarget target, int numSamples, TestType type) 4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : MultisampleShaderRenderUtil::MultisampleRenderCase (ctx, name, desc, numSamples, target, RENDER_SIZE) 4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_type (type) 4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(type < TEST_LAST); 4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4843c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySampleShadingRenderingCase::~SampleShadingRenderingCase (void) 4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deinit(); 4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid SampleShadingRenderingCase::init (void) 4903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // requirements 4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!m_context.getContextInfo().isExtensionSupported("GL_OES_sample_shading")) 4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError("Test requires GL_OES_sample_shading extension"); 4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_renderTarget == TARGET_DEFAULT && m_context.getRenderTarget().getNumSamples() <= 1) 4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError("Multisampled default framebuffer required"); 4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // test purpose and expectations 4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() 5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::Message 5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "Verifying that a varying is given at least N different values for different samples within a single pixel.\n" 5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << " Render high-frequency function, map result to black/white. Modify N with glMinSampleShading().\n" 5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << " => Resulting image should contain N+1 shades of gray.\n" 5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::EndMessage; 5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // setup resources 5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MultisampleShaderRenderUtil::MultisampleRenderCase::init(); 5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // set iterations 5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_numIterations = m_numTargetSamples + 1; 5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid SampleShadingRenderingCase::setShadingValue (int sampleCount) 5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::Functions& gl = m_context.getRenderContext().getFunctions(); 5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (sampleCount == 0) 5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.disable(GL_SAMPLE_SHADING); 5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.minSampleShading(1.0f); 5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLU_EXPECT_NO_ERROR(gl.getError(), "set ratio"); 5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Minimum number of samples is max(ceil(<mss> * <samples>),1). Decrease mss with epsilon to prevent 5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // ceiling to a too large sample count. 5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float epsilon = 0.25f / (float)m_numTargetSamples; 5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float ratio = (sampleCount / (float)m_numTargetSamples) - epsilon; 5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.enable(GL_SAMPLE_SHADING); 5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.minSampleShading(ratio); 5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLU_EXPECT_NO_ERROR(gl.getError(), "set ratio"); 5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() 5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::Message 5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "Setting MIN_SAMPLE_SHADING_VALUE = " << ratio << "\n" 5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "Requested sample count: shadingValue * numSamples = " << ratio << " * " << m_numTargetSamples << " = " << (ratio * m_numTargetSamples) << "\n" 5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "Minimum sample count: ceil(shadingValue * numSamples) = ceil(" << (ratio * m_numTargetSamples) << ") = " << sampleCount 5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::EndMessage; 5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // can't fail with reasonable values of numSamples 5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(deFloatCeil(ratio * m_numTargetSamples) == float(sampleCount)); 5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid SampleShadingRenderingCase::preDraw (void) 5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry setShadingValue(m_iteration); 5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid SampleShadingRenderingCase::postDraw (void) 5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::Functions& gl = m_context.getRenderContext().getFunctions(); 5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.disable(GL_SAMPLE_SHADING); 5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.minSampleShading(1.0f); 5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystd::string SampleShadingRenderingCase::getIterationDescription (int iteration) const 5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (iteration == 0) 5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return "Disabled SAMPLE_SHADING"; 5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 5663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return "Samples per pixel: " + de::toString(iteration); 5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool SampleShadingRenderingCase::verifyImage (const tcu::Surface& resultImage) 5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int numShadesRequired = (m_iteration == 0) ? (2) : (m_iteration + 1); 5723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int rareThreshold = 100; 5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int rareCount = 0; 5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::map<deUint32, int> shadeFrequency; 5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // we should now have n+1 different shades of white, n = num samples 5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() 5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::Image("ResultImage", "Result Image", resultImage.getAccess()) 5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::Message 5813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "Verifying image has (at least) " << numShadesRequired << " different shades.\n" 5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "Excluding pixels with no full coverage (pixels on the shared edge of the triangle pair)." 5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::EndMessage; 5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int y = 0; y < RENDER_SIZE; ++y) 5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int x = 0; x < RENDER_SIZE; ++x) 5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::RGBA color = resultImage.getPixel(x, y); 5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const deUint32 packed = ((deUint32)color.getRed()) + ((deUint32)color.getGreen() << 8) + ((deUint32)color.getGreen() << 16); 5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // on the triangle edge, skip 5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (x == y) 5933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (shadeFrequency.find(packed) == shadeFrequency.end()) 5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry shadeFrequency[packed] = 1; 5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry shadeFrequency[packed] = shadeFrequency[packed] + 1; 5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (std::map<deUint32, int>::const_iterator it = shadeFrequency.begin(); it != shadeFrequency.end(); ++it) 6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (it->second < rareThreshold) 6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry rareCount++; 6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() 6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::Message 6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "Found " << (int)shadeFrequency.size() << " different shades.\n" 6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "\tRare (less than " << rareThreshold << " pixels): " << rareCount << "\n" 6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "\tCommon: " << (int)shadeFrequency.size() - rareCount << "\n" 6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::EndMessage; 6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((int)shadeFrequency.size() < numShadesRequired) 6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Image verification failed." << tcu::TestLog::EndMessage; 6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return false; 6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return true; 6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystd::string SampleShadingRenderingCase::genFragmentSource (int numSamples) const 6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_UNREF(numSamples); 6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::ostringstream buf; 6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry buf << "#version 310 es\n" 6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "in highp vec4 v_position;\n" 6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "layout(location = 0) out mediump vec4 fragColor;\n" 6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "void main (void)\n" 6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "{\n" 6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry " highp float field = dot(v_position.xy, v_position.xy) + dot(21.0 * v_position.xx, sin(3.1 * v_position.xy));\n" 6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry " fragColor = vec4(1.0, 1.0, 1.0, 1.0);\n" 6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "\n" 6343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry " if (fract(field) > 0.5)\n"; 6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_type == TEST_DISCARD) 6373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry buf << " discard;\n"; 6383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else if (m_type == TEST_COLOR) 6393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry buf << " fragColor = vec4(0.0, 0.0, 0.0, 1.0);\n"; 6403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 6413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(false); 6423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry buf << "}"; 6443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return buf.str(); 6463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous 6493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6503c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySampleShadingTests::SampleShadingTests (Context& context) 6513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "sample_shading", "Test sample shading") 6523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6553c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySampleShadingTests::~SampleShadingTests (void) 6563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6593c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid SampleShadingTests::init (void) 6603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* const stateQueryGroup = new tcu::TestCaseGroup(m_testCtx, "state_query", "State query tests."); 6623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* const minSamplesGroup = new tcu::TestCaseGroup(m_testCtx, "min_sample_shading", "Min sample shading tests."); 6633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(stateQueryGroup); 6653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(minSamplesGroup); 6663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // .state query 6683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry stateQueryGroup->addChild(new SampleShadingStateCase (m_context, "sample_shading_is_enabled", "test SAMPLE_SHADING", SampleShadingStateCase::TYPE_IS_ENABLED)); 6703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry stateQueryGroup->addChild(new SampleShadingStateCase (m_context, "sample_shading_get_boolean", "test SAMPLE_SHADING", SampleShadingStateCase::TYPE_GET_BOOLEAN)); 6713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry stateQueryGroup->addChild(new SampleShadingStateCase (m_context, "sample_shading_get_integer", "test SAMPLE_SHADING", SampleShadingStateCase::TYPE_GET_INTEGER)); 6723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry stateQueryGroup->addChild(new SampleShadingStateCase (m_context, "sample_shading_get_float", "test SAMPLE_SHADING", SampleShadingStateCase::TYPE_GET_FLOAT)); 6733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry stateQueryGroup->addChild(new SampleShadingStateCase (m_context, "sample_shading_get_integer64", "test SAMPLE_SHADING", SampleShadingStateCase::TYPE_GET_INTEGER64)); 6743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry stateQueryGroup->addChild(new MinSampleShadingValueCase (m_context, "min_sample_shading_value_get_boolean", "test MIN_SAMPLE_SHADING_VALUE", MinSampleShadingValueCase::TYPE_GET_BOOLEAN)); 6753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry stateQueryGroup->addChild(new MinSampleShadingValueCase (m_context, "min_sample_shading_value_get_integer", "test MIN_SAMPLE_SHADING_VALUE", MinSampleShadingValueCase::TYPE_GET_INTEGER)); 6763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry stateQueryGroup->addChild(new MinSampleShadingValueCase (m_context, "min_sample_shading_value_get_float", "test MIN_SAMPLE_SHADING_VALUE", MinSampleShadingValueCase::TYPE_GET_FLOAT)); 6773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry stateQueryGroup->addChild(new MinSampleShadingValueCase (m_context, "min_sample_shading_value_get_integer64", "test MIN_SAMPLE_SHADING_VALUE", MinSampleShadingValueCase::TYPE_GET_INTEGER64)); 6783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry stateQueryGroup->addChild(new MinSampleShadingValueClampingCase (m_context, "min_sample_shading_value_clamping", "test MIN_SAMPLE_SHADING_VALUE clamping")); 6793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // .min_sample_count 6823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static const struct Target 6843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry SampleShadingRenderingCase::RenderTarget target; 6863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int numSamples; 6873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const char* name; 6883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } targets[] = 6893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { SampleShadingRenderingCase::TARGET_DEFAULT, 0, "default_framebuffer" }, 6913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { SampleShadingRenderingCase::TARGET_TEXTURE, 2, "multisample_texture_samples_2" }, 6923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { SampleShadingRenderingCase::TARGET_TEXTURE, 4, "multisample_texture_samples_4" }, 6933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { SampleShadingRenderingCase::TARGET_TEXTURE, 8, "multisample_texture_samples_8" }, 6943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { SampleShadingRenderingCase::TARGET_TEXTURE, 16, "multisample_texture_samples_16" }, 6953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { SampleShadingRenderingCase::TARGET_RENDERBUFFER, 2, "multisample_renderbuffer_samples_2" }, 6963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { SampleShadingRenderingCase::TARGET_RENDERBUFFER, 4, "multisample_renderbuffer_samples_4" }, 6973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { SampleShadingRenderingCase::TARGET_RENDERBUFFER, 8, "multisample_renderbuffer_samples_8" }, 6983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { SampleShadingRenderingCase::TARGET_RENDERBUFFER, 16, "multisample_renderbuffer_samples_16" }, 6993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 7003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(targets); ++ndx) 7023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry minSamplesGroup->addChild(new SampleShadingRenderingCase(m_context, (std::string(targets[ndx].name) + "_color").c_str(), "Test multiple samples per pixel with color", targets[ndx].target, targets[ndx].numSamples, SampleShadingRenderingCase::TEST_COLOR)); 7043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry minSamplesGroup->addChild(new SampleShadingRenderingCase(m_context, (std::string(targets[ndx].name) + "_discard").c_str(), "Test multiple samples per pixel with", targets[ndx].target, targets[ndx].numSamples, SampleShadingRenderingCase::TEST_DISCARD)); 7053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 7083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional 7103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles31 7113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 712