es2fRasterizationTests.cpp revision 2306a3bf8214ab2c51d8023ca1ccd979fb8d31bb
13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 2.0 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 Functional rasterization tests. 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es2fRasterizationTests.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsRasterizationTestUtil.hpp" 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuSurface.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRenderTarget.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuVectorUtil.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuStringTemplate.hpp" 302306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry#include "tcuResultCollector.hpp" 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluShaderProgram.hpp" 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp" 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluPixelTransfer.hpp" 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluStrUtil.hpp" 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deStringUtil.hpp" 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deRandom.hpp" 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp" 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp" 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <vector> 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles2 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace gls::RasterizationTestUtil; 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const char* const s_shaderVertexTemplate = "attribute highp vec4 a_position;\n" 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "attribute highp vec4 a_color;\n" 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "varying highp vec4 v_color;\n" 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "uniform highp float u_pointSize;\n" 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "void main ()\n" 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "{\n" 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry " gl_Position = a_position;\n" 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry " gl_PointSize = u_pointSize;\n" 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry " v_color = a_color;\n" 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "}\n"; 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const char* const s_shaderFragmentTemplate = "varying mediump vec4 v_color;\n" 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "void main ()\n" 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "{\n" 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry " gl_FragColor = v_color;\n" 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "}\n"; 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyryenum InterpolationCaseFlags 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry INTERPOLATIONFLAGS_NONE = 0, 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry INTERPOLATIONFLAGS_PROJECTED = (1 << 1), 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyryenum PrimitiveWideness 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry PRIMITIVEWIDENESS_NARROW = 0, 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry PRIMITIVEWIDENESS_WIDE, 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry PRIMITIVEWIDENESS_LAST 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BaseRenderingCase : public TestCase 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry BaseRenderingCase (Context& context, const char* name, const char* desc, int renderSize = 256); 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~BaseRenderingCase (void); 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void init (void); 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void deinit (void); 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected: 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void drawPrimitives (tcu::Surface& result, const std::vector<tcu::Vec4>& vertexData, glw::GLenum primitiveType); 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void drawPrimitives (tcu::Surface& result, const std::vector<tcu::Vec4>& vertexData, const std::vector<tcu::Vec4>& coloDrata, glw::GLenum primitiveType); 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int m_renderSize; 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int m_numSamples; 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int m_subpixelBits; 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float m_pointSize; 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float m_lineWidth; 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ShaderProgram* m_shader; 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1043c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBaseRenderingCase::BaseRenderingCase (Context& context, const char* name, const char* desc, int renderSize) 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCase (context, name, desc) 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_renderSize (renderSize) 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_numSamples (-1) 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_subpixelBits (-1) 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_pointSize (1.0f) 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_lineWidth (1.0f) 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_shader (DE_NULL) 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1153c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBaseRenderingCase::~BaseRenderingCase (void) 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deinit(); 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid BaseRenderingCase::init (void) 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int width = m_context.getRenderTarget().getWidth(); 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int height = m_context.getRenderTarget().getHeight(); 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Requirements 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (width < m_renderSize || height < m_renderSize) 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError(std::string("Render target size must be at least ") + de::toString(m_renderSize) + "x" + de::toString(m_renderSize)); 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_lineWidth != 1.0f) 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float range[2] = { 0.0f, 0.0f }; 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderContext().getFunctions().getFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range); 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_lineWidth < range[0] || m_lineWidth > range[1]) 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError(std::string("Support for line width ") + de::toString(m_lineWidth) + " is required."); 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "ALIASED_LINE_WIDTH_RANGE = [" << range[0] << ", " << range[1] << "]" << tcu::TestLog::EndMessage; 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_pointSize != 1.0f) 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float range[2] = { 0.0f, 0.0f }; 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderContext().getFunctions().getFloatv(GL_ALIASED_POINT_SIZE_RANGE, range); 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_pointSize < range[0] || m_pointSize > range[1]) 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError(std::string("Support for point size ") + de::toString(m_pointSize) + " is required."); 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "ALIASED_POINT_SIZE_RANGE = [" << range[0] << ", " << range[1] << "]" << tcu::TestLog::EndMessage; 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Query info 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_numSamples = m_context.getRenderTarget().getNumSamples(); 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderContext().getFunctions().getIntegerv(GL_SUBPIXEL_BITS, &m_subpixelBits); 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Sample count = " << m_numSamples << tcu::TestLog::EndMessage; 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "SUBPIXEL_BITS = " << m_subpixelBits << tcu::TestLog::EndMessage; 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Gen shader 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::StringTemplate vertexSource (s_shaderVertexTemplate); 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::StringTemplate fragmentSource (s_shaderFragmentTemplate); 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::map<std::string, std::string> params; 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_shader = new glu::ShaderProgram(m_context.getRenderContext(), glu::ProgramSources() << glu::VertexSource(vertexSource.specialize(params)) << glu::FragmentSource(fragmentSource.specialize(params))); 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!m_shader->isOk()) 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::TestError("could not create shader"); 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid BaseRenderingCase::deinit (void) 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_shader) 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete m_shader; 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_shader = DE_NULL; 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid BaseRenderingCase::drawPrimitives (tcu::Surface& result, const std::vector<tcu::Vec4>& vertexData, glw::GLenum primitiveType) 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // default to color white 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const std::vector<tcu::Vec4> colorData(vertexData.size(), tcu::Vec4(1.0f, 1.0f, 1.0f, 1.0f)); 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry drawPrimitives(result, vertexData, colorData, primitiveType); 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid BaseRenderingCase::drawPrimitives (tcu::Surface& result, const std::vector<tcu::Vec4>& vertexData, const std::vector<tcu::Vec4>& colorData, glw::GLenum primitiveType) 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::Functions& gl = m_context.getRenderContext().getFunctions(); 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::GLint positionLoc = gl.getAttribLocation(m_shader->getProgram(), "a_position"); 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::GLint colorLoc = gl.getAttribLocation(m_shader->getProgram(), "a_color"); 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::GLint pointSizeLoc = gl.getUniformLocation(m_shader->getProgram(), "u_pointSize"); 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.clearColor (0, 0, 0, 1); 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.clear (GL_COLOR_BUFFER_BIT); 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.viewport (0, 0, m_renderSize, m_renderSize); 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.useProgram (m_shader->getProgram()); 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.enableVertexAttribArray (positionLoc); 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.vertexAttribPointer (positionLoc, 4, GL_FLOAT, GL_FALSE, 0, &vertexData[0]); 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.enableVertexAttribArray (colorLoc); 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.vertexAttribPointer (colorLoc, 4, GL_FLOAT, GL_FALSE, 0, &colorData[0]); 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.uniform1f (pointSizeLoc, m_pointSize); 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.lineWidth (m_lineWidth); 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.drawArrays (primitiveType, 0, (glw::GLsizei)vertexData.size()); 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.disableVertexAttribArray (colorLoc); 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.disableVertexAttribArray (positionLoc); 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.useProgram (0); 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.finish (); 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLU_EXPECT_NO_ERROR (gl.getError(), "draw primitives"); 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::readPixels(m_context.getRenderContext(), 0, 0, result.getAccess()); 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BaseTriangleCase : public BaseRenderingCase 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry BaseTriangleCase (Context& context, const char* name, const char* desc, glw::GLenum primitiveDrawType); 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~BaseTriangleCase (void); 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void generateTriangles (int iteration, std::vector<tcu::Vec4>& outData, std::vector<TriangleSceneSpec::SceneTriangle>& outTriangles) = DE_NULL; 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int m_iteration; 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int m_iterationCount; 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::GLenum m_primitiveDrawType; 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool m_allIterationsPassed; 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2333c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBaseTriangleCase::BaseTriangleCase (Context& context, const char* name, const char* desc, glw::GLenum primitiveDrawType) 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BaseRenderingCase (context, name, desc) 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_iteration (0) 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_iterationCount (3) 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_primitiveDrawType (primitiveDrawType) 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_allIterationsPassed (true) 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2423c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBaseTriangleCase::~BaseTriangleCase (void) 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2463c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBaseTriangleCase::IterateResult BaseTriangleCase::iterate (void) 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const std::string iterationDescription = "Test iteration " + de::toString(m_iteration+1) + " / " + de::toString(m_iterationCount); 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::ScopedLogSection section (m_testCtx.getLog(), iterationDescription, iterationDescription); 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Surface resultImage (m_renderSize, m_renderSize); 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<tcu::Vec4> drawBuffer; 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<TriangleSceneSpec::SceneTriangle> triangles; 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry generateTriangles(m_iteration, drawBuffer, triangles); 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // draw image 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry drawPrimitives(resultImage, drawBuffer, m_primitiveDrawType); 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // compare 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool compareOk; 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry RasterizationArguments args; 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TriangleSceneSpec scene; 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.numSamples = m_numSamples; 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.subpixelBits = m_subpixelBits; 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.redBits = m_context.getRenderTarget().getPixelFormat().redBits; 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.greenBits = m_context.getRenderTarget().getPixelFormat().greenBits; 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.blueBits = m_context.getRenderTarget().getPixelFormat().blueBits; 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry scene.triangles.swap(triangles); 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry compareOk = verifyTriangleGroupRasterization(resultImage, scene, args, m_testCtx.getLog()); 2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!compareOk) 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_allIterationsPassed = false; 2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // result 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (++m_iteration == m_iterationCount) 2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_allIterationsPassed) 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Incorrect rasterization"); 2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return CONTINUE; 2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BaseLineCase : public BaseRenderingCase 2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry BaseLineCase (Context& context, const char* name, const char* desc, glw::GLenum primitiveDrawType, PrimitiveWideness wideness); 2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~BaseLineCase (void); 2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void generateLines (int iteration, std::vector<tcu::Vec4>& outData, std::vector<LineSceneSpec::SceneLine>& outLines) = DE_NULL; 3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int m_iteration; 3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int m_iterationCount; 3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::GLenum m_primitiveDrawType; 3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const PrimitiveWideness m_primitiveWideness; 3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool m_allIterationsPassed; 3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static const float s_wideSize; 3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst float BaseLineCase::s_wideSize = 5.0f; 3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3143c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBaseLineCase::BaseLineCase (Context& context, const char* name, const char* desc, glw::GLenum primitiveDrawType, PrimitiveWideness wideness) 3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BaseRenderingCase (context, name, desc) 3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_iteration (0) 3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_iterationCount (3) 3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_primitiveDrawType (primitiveDrawType) 3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_primitiveWideness (wideness) 3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_allIterationsPassed (true) 3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(m_primitiveWideness < PRIMITIVEWIDENESS_LAST); 3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_lineWidth = (m_primitiveWideness == PRIMITIVEWIDENESS_WIDE) ? (s_wideSize) : (1.0f); 3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3263c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBaseLineCase::~BaseLineCase (void) 3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3303c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBaseLineCase::IterateResult BaseLineCase::iterate (void) 3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const std::string iterationDescription = "Test iteration " + de::toString(m_iteration+1) + " / " + de::toString(m_iterationCount); 3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::ScopedLogSection section (m_testCtx.getLog(), iterationDescription, iterationDescription); 3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Surface resultImage (m_renderSize, m_renderSize); 3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<tcu::Vec4> drawBuffer; 3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<LineSceneSpec::SceneLine> lines; 3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // last iteration, max out size 3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_primitiveWideness == PRIMITIVEWIDENESS_WIDE && 3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_iteration+1 == m_iterationCount) 3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float range[2] = { 0.0f, 0.0f }; 3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderContext().getFunctions().getFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range); 3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_lineWidth = range[1]; 3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // gen data 3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry generateLines(m_iteration, drawBuffer, lines); 3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // draw image 3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry drawPrimitives(resultImage, drawBuffer, m_primitiveDrawType); 3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // compare 3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool compareOk; 3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry RasterizationArguments args; 3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry LineSceneSpec scene; 3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.numSamples = m_numSamples; 3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.subpixelBits = m_subpixelBits; 3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.redBits = m_context.getRenderTarget().getPixelFormat().redBits; 3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.greenBits = m_context.getRenderTarget().getPixelFormat().greenBits; 3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.blueBits = m_context.getRenderTarget().getPixelFormat().blueBits; 3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry scene.lines.swap(lines); 3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry scene.lineWidth = m_lineWidth; 3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry compareOk = verifyLineGroupRasterization(resultImage, scene, args, m_testCtx.getLog()); 3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!compareOk) 3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_allIterationsPassed = false; 3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // result 3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (++m_iteration == m_iterationCount) 3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_allIterationsPassed) 3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Incorrect rasterization"); 3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return CONTINUE; 3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass PointCase : public BaseRenderingCase 3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry PointCase (Context& context, const char* name, const char* desc, PrimitiveWideness wideness); 3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~PointCase (void); 3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void generatePoints (int iteration, std::vector<tcu::Vec4>& outData, std::vector<PointSceneSpec::ScenePoint>& outPoints); 3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int m_iteration; 4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int m_iterationCount; 4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const PrimitiveWideness m_primitiveWideness; 4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool m_allIterationsPassed; 4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static const float s_wideSize; 4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst float PointCase::s_wideSize = 10.0f; 4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4093c827367444ee418f129b2c238299f49d3264554Jarkko PoyryPointCase::PointCase (Context& context, const char* name, const char* desc, PrimitiveWideness wideness) 4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BaseRenderingCase (context, name, desc) 4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_iteration (0) 4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_iterationCount (3) 4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_primitiveWideness (wideness) 4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_allIterationsPassed (true) 4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_pointSize = (m_primitiveWideness == PRIMITIVEWIDENESS_WIDE) ? (s_wideSize) : (1.0f); 4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4193c827367444ee418f129b2c238299f49d3264554Jarkko PoyryPointCase::~PointCase (void) 4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4233c827367444ee418f129b2c238299f49d3264554Jarkko PoyryPointCase::IterateResult PointCase::iterate (void) 4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const std::string iterationDescription = "Test iteration " + de::toString(m_iteration+1) + " / " + de::toString(m_iterationCount); 4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::ScopedLogSection section (m_testCtx.getLog(), iterationDescription, iterationDescription); 4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Surface resultImage (m_renderSize, m_renderSize); 4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<tcu::Vec4> drawBuffer; 4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<PointSceneSpec::ScenePoint> points; 4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // last iteration, max out size 4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_primitiveWideness == PRIMITIVEWIDENESS_WIDE && 4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_iteration+1 == m_iterationCount) 4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float range[2] = { 0.0f, 0.0f }; 4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderContext().getFunctions().getFloatv(GL_ALIASED_POINT_SIZE_RANGE, range); 4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_pointSize = range[1]; 4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // gen data 4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry generatePoints(m_iteration, drawBuffer, points); 4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // draw image 4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry drawPrimitives(resultImage, drawBuffer, GL_POINTS); 4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // compare 4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool compareOk; 4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry RasterizationArguments args; 4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry PointSceneSpec scene; 4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.numSamples = m_numSamples; 4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.subpixelBits = m_subpixelBits; 4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.redBits = m_context.getRenderTarget().getPixelFormat().redBits; 4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.greenBits = m_context.getRenderTarget().getPixelFormat().greenBits; 4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.blueBits = m_context.getRenderTarget().getPixelFormat().blueBits; 4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry scene.points.swap(points); 4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry compareOk = verifyPointGroupRasterization(resultImage, scene, args, m_testCtx.getLog()); 4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!compareOk) 4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_allIterationsPassed = false; 4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // result 4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (++m_iteration == m_iterationCount) 4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_allIterationsPassed) 4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Incorrect rasterization"); 4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return CONTINUE; 4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid PointCase::generatePoints (int iteration, std::vector<tcu::Vec4>& outData, std::vector<PointSceneSpec::ScenePoint>& outPoints) 4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData.resize(6); 4843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (iteration) 4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 0: 4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \note: these values are chosen arbitrarily 4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4( 0.2f, 0.8f, 0.0f, 1.0f); 4903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4( 0.5f, 0.2f, 0.0f, 1.0f); 4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.5f, 0.3f, 0.0f, 1.0f); 4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4(-0.5f, 0.2f, 0.0f, 1.0f); 4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4(-0.2f, -0.4f, 0.0f, 1.0f); 4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[5] = tcu::Vec4(-0.4f, 0.2f, 0.0f, 1.0f); 4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 1: 4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4(-0.499f, 0.128f, 0.0f, 1.0f); 4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4(-0.501f, -0.3f, 0.0f, 1.0f); 5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.11f, -0.2f, 0.0f, 1.0f); 5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4( 0.11f, 0.2f, 0.0f, 1.0f); 5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4( 0.88f, 0.9f, 0.0f, 1.0f); 5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[5] = tcu::Vec4( 0.4f, 1.2f, 0.0f, 1.0f); 5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 2: 5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4( -0.9f, -0.3f, 0.0f, 1.0f); 5083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4( 0.3f, -0.9f, 0.0f, 1.0f); 5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( -0.4f, -0.1f, 0.0f, 1.0f); 5103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4(-0.11f, 0.2f, 0.0f, 1.0f); 5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4( 0.88f, 0.7f, 0.0f, 1.0f); 5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[5] = tcu::Vec4( -0.4f, 0.4f, 0.0f, 1.0f); 5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outPoints.resize(outData.size()); 5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int pointNdx = 0; pointNdx < (int)outPoints.size(); ++pointNdx) 5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outPoints[pointNdx].position = outData[pointNdx]; 5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outPoints[pointNdx].pointSize = m_pointSize; 5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // log 5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Rendering " << outPoints.size() << " point(s): (point size = " << m_pointSize << ")" << tcu::TestLog::EndMessage; 5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int pointNdx = 0; pointNdx < (int)outPoints.size(); ++pointNdx) 5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Point " << (pointNdx+1) << ":\t" << outPoints[pointNdx].position << tcu::TestLog::EndMessage; 5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TrianglesCase : public BaseTriangleCase 5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TrianglesCase (Context& context, const char* name, const char* desc); 5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~TrianglesCase (void); 5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void generateTriangles (int iteration, std::vector<tcu::Vec4>& outData, std::vector<TriangleSceneSpec::SceneTriangle>& outTriangles); 5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5383c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTrianglesCase::TrianglesCase (Context& context, const char* name, const char* desc) 5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BaseTriangleCase(context, name, desc, GL_TRIANGLES) 5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5433c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTrianglesCase::~TrianglesCase (void) 5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid TrianglesCase::generateTriangles (int iteration, std::vector<tcu::Vec4>& outData, std::vector<TriangleSceneSpec::SceneTriangle>& outTriangles) 5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData.resize(6); 5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (iteration) 5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 0: 5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \note: these values are chosen arbitrarily 5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4( 0.2f, 0.8f, 0.0f, 1.0f); 5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4( 0.5f, 0.2f, 0.0f, 1.0f); 5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.5f, 0.3f, 0.0f, 1.0f); 5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4(-0.5f, 0.2f, 0.0f, 1.0f); 5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4(-1.5f, -0.4f, 0.0f, 1.0f); 5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[5] = tcu::Vec4(-0.4f, 0.2f, 0.0f, 1.0f); 5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 1: 5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4(-0.499f, 0.128f, 0.0f, 1.0f); 5663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4(-0.501f, -0.3f, 0.0f, 1.0f); 5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.11f, -0.2f, 0.0f, 1.0f); 5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4( 0.11f, 0.2f, 0.0f, 1.0f); 5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4( 0.88f, 0.9f, 0.0f, 1.0f); 5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[5] = tcu::Vec4( 0.4f, 1.2f, 0.0f, 1.0f); 5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 5723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 2: 5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4( -0.9f, -0.3f, 0.0f, 1.0f); 5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4( 1.1f, -0.9f, 0.0f, 1.0f); 5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( -1.1f, -0.1f, 0.0f, 1.0f); 5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4(-0.11f, 0.2f, 0.0f, 1.0f); 5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4( 0.88f, 0.7f, 0.0f, 1.0f); 5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[5] = tcu::Vec4( -0.4f, 0.4f, 0.0f, 1.0f); 5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 5813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles.resize(2); 5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[0].positions[0] = outData[0]; outTriangles[0].sharedEdge[0] = false; 5853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[0].positions[1] = outData[1]; outTriangles[0].sharedEdge[1] = false; 5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[0].positions[2] = outData[2]; outTriangles[0].sharedEdge[2] = false; 5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[1].positions[0] = outData[3]; outTriangles[1].sharedEdge[0] = false; 5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[1].positions[1] = outData[4]; outTriangles[1].sharedEdge[1] = false; 5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[1].positions[2] = outData[5]; outTriangles[1].sharedEdge[2] = false; 5913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // log 5933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Rendering " << outTriangles.size() << " triangle(s):" << tcu::TestLog::EndMessage; 5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int triangleNdx = 0; triangleNdx < (int)outTriangles.size(); ++triangleNdx) 5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() 5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::Message 5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "Triangle " << (triangleNdx+1) << ":" 5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "\n\t" << outTriangles[triangleNdx].positions[0] 6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "\n\t" << outTriangles[triangleNdx].positions[1] 6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "\n\t" << outTriangles[triangleNdx].positions[2] 6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::EndMessage; 6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TriangleStripCase : public BaseTriangleCase 6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TriangleStripCase (Context& context, const char* name, const char* desc); 6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void generateTriangles (int iteration, std::vector<tcu::Vec4>& outData, std::vector<TriangleSceneSpec::SceneTriangle>& outTriangles); 6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6143c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTriangleStripCase::TriangleStripCase (Context& context, const char* name, const char* desc) 6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BaseTriangleCase(context, name, desc, GL_TRIANGLE_STRIP) 6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid TriangleStripCase::generateTriangles (int iteration, std::vector<tcu::Vec4>& outData, std::vector<TriangleSceneSpec::SceneTriangle>& outTriangles) 6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData.resize(5); 6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (iteration) 6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 0: 6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \note: these values are chosen arbitrarily 6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4(-0.504f, 0.8f, 0.0f, 1.0f); 6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4(-0.2f, -0.2f, 0.0f, 1.0f); 6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4(-0.2f, 0.199f, 0.0f, 1.0f); 6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4( 0.5f, 0.201f, 0.0f, 1.0f); 6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4( 1.5f, 0.4f, 0.0f, 1.0f); 6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 1: 6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4(-0.499f, 0.129f, 0.0f, 1.0f); 6363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4(-0.501f, -0.3f, 0.0f, 1.0f); 6373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.11f, -0.2f, 0.0f, 1.0f); 6383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4( 0.11f, -0.31f, 0.0f, 1.0f); 6393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4( 0.88f, 0.9f, 0.0f, 1.0f); 6403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 6413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 2: 6433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4( -0.9f, -0.3f, 0.0f, 1.0f); 6443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4( 1.1f, -0.9f, 0.0f, 1.0f); 6453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4(-0.87f, -0.1f, 0.0f, 1.0f); 6463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4(-0.11f, 0.19f, 0.0f, 1.0f); 6473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4( 0.88f, 0.7f, 0.0f, 1.0f); 6483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 6493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles.resize(3); 6523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[0].positions[0] = outData[0]; outTriangles[0].sharedEdge[0] = false; 6533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[0].positions[1] = outData[1]; outTriangles[0].sharedEdge[1] = true; 6543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[0].positions[2] = outData[2]; outTriangles[0].sharedEdge[2] = false; 6553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[1].positions[0] = outData[2]; outTriangles[1].sharedEdge[0] = true; 6573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[1].positions[1] = outData[1]; outTriangles[1].sharedEdge[1] = false; 6583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[1].positions[2] = outData[3]; outTriangles[1].sharedEdge[2] = true; 6593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[2].positions[0] = outData[2]; outTriangles[2].sharedEdge[0] = true; 6613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[2].positions[1] = outData[3]; outTriangles[2].sharedEdge[1] = false; 6623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[2].positions[2] = outData[4]; outTriangles[2].sharedEdge[2] = false; 6633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // log 6653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Rendering triangle strip, " << outData.size() << " vertices." << tcu::TestLog::EndMessage; 6663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)outData.size(); ++vtxNdx) 6673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() 6693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::Message 6703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "\t" << outData[vtxNdx] 6713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::EndMessage; 6723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6753c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TriangleFanCase : public BaseTriangleCase 6763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6773c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 6783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TriangleFanCase (Context& context, const char* name, const char* desc); 6793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void generateTriangles (int iteration, std::vector<tcu::Vec4>& outData, std::vector<TriangleSceneSpec::SceneTriangle>& outTriangles); 6813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 6823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6833c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTriangleFanCase::TriangleFanCase (Context& context, const char* name, const char* desc) 6843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BaseTriangleCase(context, name, desc, GL_TRIANGLE_FAN) 6853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6883c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid TriangleFanCase::generateTriangles (int iteration, std::vector<tcu::Vec4>& outData, std::vector<TriangleSceneSpec::SceneTriangle>& outTriangles) 6893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData.resize(5); 6913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (iteration) 6933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 0: 6953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \note: these values are chosen arbitrarily 6963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4( 0.01f, 0.0f, 0.0f, 1.0f); 6973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4( 0.5f, 0.2f, 0.0f, 1.0f); 6983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.46f, 0.3f, 0.0f, 1.0f); 6993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4(-0.5f, 0.2f, 0.0f, 1.0f); 7003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4(-1.5f, -0.4f, 0.0f, 1.0f); 7013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 7023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 1: 7043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4(-0.499f, 0.128f, 0.0f, 1.0f); 7053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4(-0.501f, -0.3f, 0.0f, 1.0f); 7063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.11f, -0.2f, 0.0f, 1.0f); 7073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4( 0.11f, 0.2f, 0.0f, 1.0f); 7083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4( 0.88f, 0.9f, 0.0f, 1.0f); 7093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 7103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 2: 7123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4( -0.9f, -0.3f, 0.0f, 1.0f); 7133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4( 1.1f, -0.9f, 0.0f, 1.0f); 7143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.7f, -0.1f, 0.0f, 1.0f); 7153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4( 0.11f, 0.2f, 0.0f, 1.0f); 7163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4( 0.88f, 0.7f, 0.0f, 1.0f); 7173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 7183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles.resize(3); 7213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[0].positions[0] = outData[0]; outTriangles[0].sharedEdge[0] = false; 7223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[0].positions[1] = outData[1]; outTriangles[0].sharedEdge[1] = false; 7233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[0].positions[2] = outData[2]; outTriangles[0].sharedEdge[2] = true; 7243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[1].positions[0] = outData[0]; outTriangles[1].sharedEdge[0] = true; 7263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[1].positions[1] = outData[2]; outTriangles[1].sharedEdge[1] = false; 7273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[1].positions[2] = outData[3]; outTriangles[1].sharedEdge[2] = true; 7283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[2].positions[0] = outData[0]; outTriangles[2].sharedEdge[0] = true; 7303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[2].positions[1] = outData[3]; outTriangles[2].sharedEdge[1] = false; 7313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles[2].positions[2] = outData[4]; outTriangles[2].sharedEdge[2] = false; 7323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // log 7343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Rendering triangle fan, " << outData.size() << " vertices." << tcu::TestLog::EndMessage; 7353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)outData.size(); ++vtxNdx) 7363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() 7383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::Message 7393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "\t" << outData[vtxNdx] 7403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::EndMessage; 7413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 7433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7443c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LinesCase : public BaseLineCase 7453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 7473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry LinesCase (Context& context, const char* name, const char* desc, PrimitiveWideness wideness); 7483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void generateLines (int iteration, std::vector<tcu::Vec4>& outData, std::vector<LineSceneSpec::SceneLine>& outLines); 7503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 7513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7523c827367444ee418f129b2c238299f49d3264554Jarkko PoyryLinesCase::LinesCase (Context& context, const char* name, const char* desc, PrimitiveWideness wideness) 7533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BaseLineCase(context, name, desc, GL_LINES, wideness) 7543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 7563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7573c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid LinesCase::generateLines (int iteration, std::vector<tcu::Vec4>& outData, std::vector<LineSceneSpec::SceneLine>& outLines) 7583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData.resize(6); 7603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (iteration) 7623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 0: 7643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \note: these values are chosen arbitrarily 7653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4( 0.01f, 0.0f, 0.0f, 1.0f); 7663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4( 0.5f, 0.2f, 0.0f, 1.0f); 7673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.46f, 0.3f, 0.0f, 1.0f); 7683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4(-0.3f, 0.2f, 0.0f, 1.0f); 7693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4(-1.5f, -0.4f, 0.0f, 1.0f); 7703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[5] = tcu::Vec4( 0.1f, 0.5f, 0.0f, 1.0f); 7713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 7723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 1: 7743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4(-0.499f, 0.128f, 0.0f, 1.0f); 7753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4(-0.501f, -0.3f, 0.0f, 1.0f); 7763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.11f, -0.2f, 0.0f, 1.0f); 7773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4( 0.11f, 0.2f, 0.0f, 1.0f); 7783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4( 0.88f, 0.9f, 0.0f, 1.0f); 7793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[5] = tcu::Vec4( 0.18f, -0.2f, 0.0f, 1.0f); 7803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 7813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 2: 7833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4( -0.9f, -0.3f, 0.0f, 1.0f); 7843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4( 1.1f, -0.9f, 0.0f, 1.0f); 7853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.7f, -0.1f, 0.0f, 1.0f); 7863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4( 0.11f, 0.2f, 0.0f, 1.0f); 7873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4( 0.88f, 0.7f, 0.0f, 1.0f); 7883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[5] = tcu::Vec4( 0.8f, -0.7f, 0.0f, 1.0f); 7893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 7903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines.resize(3); 7933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[0].positions[0] = outData[0]; 7943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[0].positions[1] = outData[1]; 7953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[1].positions[0] = outData[2]; 7963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[1].positions[1] = outData[3]; 7973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[2].positions[0] = outData[4]; 7983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[2].positions[1] = outData[5]; 7993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // log 8013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Rendering " << outLines.size() << " lines(s): (width = " << m_lineWidth << ")" << tcu::TestLog::EndMessage; 8023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int lineNdx = 0; lineNdx < (int)outLines.size(); ++lineNdx) 8033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 8043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() 8053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::Message 8063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "Line " << (lineNdx+1) << ":" 8073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "\n\t" << outLines[lineNdx].positions[0] 8083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "\n\t" << outLines[lineNdx].positions[1] 8093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::EndMessage; 8103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 8113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 8123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8133c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LineStripCase : public BaseLineCase 8143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8153c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 8163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry LineStripCase (Context& context, const char* name, const char* desc, PrimitiveWideness wideness); 8173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void generateLines (int iteration, std::vector<tcu::Vec4>& outData, std::vector<LineSceneSpec::SceneLine>& outLines); 8193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 8203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8213c827367444ee418f129b2c238299f49d3264554Jarkko PoyryLineStripCase::LineStripCase (Context& context, const char* name, const char* desc, PrimitiveWideness wideness) 8223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BaseLineCase(context, name, desc, GL_LINE_STRIP, wideness) 8233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 8253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8263c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid LineStripCase::generateLines (int iteration, std::vector<tcu::Vec4>& outData, std::vector<LineSceneSpec::SceneLine>& outLines) 8273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData.resize(4); 8293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (iteration) 8313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 8323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 0: 8333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \note: these values are chosen arbitrarily 8343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4( 0.01f, 0.0f, 0.0f, 1.0f); 8353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4( 0.5f, 0.2f, 0.0f, 1.0f); 8363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.46f, 0.3f, 0.0f, 1.0f); 8373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4(-0.5f, 0.2f, 0.0f, 1.0f); 8383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 8393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 1: 8413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4(-0.499f, 0.128f, 0.0f, 1.0f); 8423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4(-0.501f, -0.3f, 0.0f, 1.0f); 8433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.11f, -0.2f, 0.0f, 1.0f); 8443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4( 0.11f, 0.2f, 0.0f, 1.0f); 8453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 8463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 2: 8483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4( -0.9f, -0.3f, 0.0f, 1.0f); 8493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4( 1.1f, -0.9f, 0.0f, 1.0f); 8503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.7f, -0.1f, 0.0f, 1.0f); 8513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4( 0.11f, 0.2f, 0.0f, 1.0f); 8523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 8533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 8543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines.resize(3); 8563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[0].positions[0] = outData[0]; 8573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[0].positions[1] = outData[1]; 8583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[1].positions[0] = outData[1]; 8593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[1].positions[1] = outData[2]; 8603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[2].positions[0] = outData[2]; 8613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[2].positions[1] = outData[3]; 8623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // log 8643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Rendering line strip, width = " << m_lineWidth << ", " << outData.size() << " vertices." << tcu::TestLog::EndMessage; 8653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)outData.size(); ++vtxNdx) 8663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 8673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() 8683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::Message 8693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "\t" << outData[vtxNdx] 8703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::EndMessage; 8713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 8723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 8733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8743c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LineLoopCase : public BaseLineCase 8753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8763c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 8773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry LineLoopCase (Context& context, const char* name, const char* desc, PrimitiveWideness wideness); 8783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void generateLines (int iteration, std::vector<tcu::Vec4>& outData, std::vector<LineSceneSpec::SceneLine>& outLines); 8803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 8813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8823c827367444ee418f129b2c238299f49d3264554Jarkko PoyryLineLoopCase::LineLoopCase (Context& context, const char* name, const char* desc, PrimitiveWideness wideness) 8833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BaseLineCase(context, name, desc, GL_LINE_LOOP, wideness) 8843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 8863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8873c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid LineLoopCase::generateLines (int iteration, std::vector<tcu::Vec4>& outData, std::vector<LineSceneSpec::SceneLine>& outLines) 8883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData.resize(4); 8903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (iteration) 8923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 8933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 0: 8943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \note: these values are chosen arbitrarily 8953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4( 0.01f, 0.0f, 0.0f, 1.0f); 8963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4( 0.5f, 0.2f, 0.0f, 1.0f); 8973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.46f, 0.3f, 0.0f, 1.0f); 8983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4(-0.5f, 0.2f, 0.0f, 1.0f); 8993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 9003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 1: 9023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4(-0.499f, 0.128f, 0.0f, 1.0f); 9033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4(-0.501f, -0.3f, 0.0f, 1.0f); 9043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.11f, -0.2f, 0.0f, 1.0f); 9053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4( 0.11f, 0.2f, 0.0f, 1.0f); 9063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 9073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 2: 9093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4( -0.9f, -0.3f, 0.0f, 1.0f); 9103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4( 1.1f, -0.9f, 0.0f, 1.0f); 9113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4( 0.7f, -0.1f, 0.0f, 1.0f); 9123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4( 0.11f, 0.2f, 0.0f, 1.0f); 9133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 9143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 9153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines.resize(4); 9173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[0].positions[0] = outData[0]; 9183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[0].positions[1] = outData[1]; 9193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[1].positions[0] = outData[1]; 9203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[1].positions[1] = outData[2]; 9213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[2].positions[0] = outData[2]; 9223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[2].positions[1] = outData[3]; 9233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[3].positions[0] = outData[3]; 9243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines[3].positions[1] = outData[0]; 9253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // log 9273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Rendering line loop, width = " << m_lineWidth << ", " << outData.size() << " vertices." << tcu::TestLog::EndMessage; 9283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)outData.size(); ++vtxNdx) 9293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 9303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() 9313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::Message 9323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << "\t" << outData[vtxNdx] 9333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::EndMessage; 9343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 9353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 9363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9373c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FillRuleCase : public BaseRenderingCase 9383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 9393c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 9403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry enum FillRuleCaseType 9413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 9423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FILLRULECASE_BASIC = 0, 9433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FILLRULECASE_REVERSED, 9443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FILLRULECASE_CLIPPED_FULL, 9453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FILLRULECASE_CLIPPED_PARTIAL, 9463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FILLRULECASE_PROJECTED, 9473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FILLRULECASE_LAST 9493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 9503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FillRuleCase (Context& ctx, const char* name, const char* desc, FillRuleCaseType type); 9523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~FillRuleCase (void); 9533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 9543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9553c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 9563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int getRenderSize (FillRuleCase::FillRuleCaseType type) const; 9573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int getNumIterations (FillRuleCase::FillRuleCaseType type) const; 9583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void generateTriangles (int iteration, std::vector<tcu::Vec4>& outData) const; 9593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const FillRuleCaseType m_caseType; 9613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int m_iteration; 9623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int m_iterationCount; 9633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool m_allIterationsPassed; 9643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 9663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9673c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFillRuleCase::FillRuleCase (Context& ctx, const char* name, const char* desc, FillRuleCaseType type) 9683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BaseRenderingCase (ctx, name, desc, getRenderSize(type)) 9693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_caseType (type) 9703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_iteration (0) 9713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_iterationCount (getNumIterations(type)) 9723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_allIterationsPassed (true) 9733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 9743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(type < FILLRULECASE_LAST); 9753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 9763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9773c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFillRuleCase::~FillRuleCase (void) 9783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 9793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deinit(); 9803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 9813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9823c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFillRuleCase::IterateResult FillRuleCase::iterate (void) 9833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 9843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const std::string iterationDescription = "Test iteration " + de::toString(m_iteration+1) + " / " + de::toString(m_iterationCount); 9853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::ScopedLogSection section (m_testCtx.getLog(), iterationDescription, iterationDescription); 9863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int thresholdRed = 1 << (8 - m_context.getRenderTarget().getPixelFormat().redBits); 9873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int thresholdGreen = 1 << (8 - m_context.getRenderTarget().getPixelFormat().greenBits); 9883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int thresholdBlue = 1 << (8 - m_context.getRenderTarget().getPixelFormat().blueBits); 9893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Surface resultImage (m_renderSize, m_renderSize); 9903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<tcu::Vec4> drawBuffer; 9913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool imageShown = false; 9923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry generateTriangles(m_iteration, drawBuffer); 9943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // draw image 9963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 9973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::Functions& gl = m_context.getRenderContext().getFunctions(); 9983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const std::vector<tcu::Vec4> colorBuffer (drawBuffer.size(), tcu::Vec4(0.5f, 0.5f, 0.5f, 1.0f)); 9993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Drawing gray triangles with shared edges.\nEnabling additive blending to detect overlapping fragments." << tcu::TestLog::EndMessage; 10013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.enable(GL_BLEND); 10033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.blendEquation(GL_FUNC_ADD); 10043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.blendFunc(GL_ONE, GL_ONE); 10053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry drawPrimitives(resultImage, drawBuffer, colorBuffer, GL_TRIANGLES); 10063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 10073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // verify no overdraw 10093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 10103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::RGBA triangleColor = tcu::RGBA(127, 127, 127, 255); 10113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool overdraw = false; 10123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Verifying result." << tcu::TestLog::EndMessage; 10143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int y = 0; y < resultImage.getHeight(); ++y) 10163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int x = 0; x < resultImage.getWidth(); ++x) 10173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 10183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::RGBA color = resultImage.getPixel(x, y); 10193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // color values are greater than triangle color? Allow lower values for multisampled edges and background. 10213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((color.getRed() - triangleColor.getRed()) > thresholdRed || 10223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry (color.getGreen() - triangleColor.getGreen()) > thresholdGreen || 10233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry (color.getBlue() - triangleColor.getBlue()) > thresholdBlue) 10243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry overdraw = true; 10253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 10263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // results 10283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!overdraw) 10293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "No overlapping fragments detected." << tcu::TestLog::EndMessage; 10303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 10313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 10323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Overlapping fragments detected, image is not valid." << tcu::TestLog::EndMessage; 10333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::ImageSet("Result of rendering", "Result of rendering") 10343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::Image("Result", "Result", resultImage) 10353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::EndImageSet; 10363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry imageShown = true; 10383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_allIterationsPassed = false; 10393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 10403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 10413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // verify no missing fragments in the full viewport case 10433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_caseType == FILLRULECASE_CLIPPED_FULL) 10443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 10453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool missingFragments = false; 10463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Searching missing fragments." << tcu::TestLog::EndMessage; 10483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int y = 0; y < resultImage.getHeight(); ++y) 10503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int x = 0; x < resultImage.getWidth(); ++x) 10513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 10523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::RGBA color = resultImage.getPixel(x, y); 10533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // black? (background) 10553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (color.getRed() <= thresholdRed || 10563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry color.getGreen() <= thresholdGreen || 10573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry color.getBlue() <= thresholdBlue) 10583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry missingFragments = true; 10593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 10603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // results 10623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!missingFragments) 10633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "No missing fragments detected." << tcu::TestLog::EndMessage; 10643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 10653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 10663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Missing fragments detected, image is not valid." << tcu::TestLog::EndMessage; 10673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!imageShown) 10693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 10703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::ImageSet("Result of rendering", "Result of rendering") 10713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::Image("Result", "Result", resultImage) 10723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << tcu::TestLog::EndImageSet; 10733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 10743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_allIterationsPassed = false; 10763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 10773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 10783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // result 10803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (++m_iteration == m_iterationCount) 10813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 10823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_allIterationsPassed) 10833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 10843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 10853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Found invalid pixels"); 10863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 10883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 10893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 10903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return CONTINUE; 10913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 10923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10933c827367444ee418f129b2c238299f49d3264554Jarkko Poyryint FillRuleCase::getRenderSize (FillRuleCase::FillRuleCaseType type) const 10943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 10953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (type == FILLRULECASE_CLIPPED_FULL || type == FILLRULECASE_CLIPPED_PARTIAL) 10963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return 64; 10973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 10983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return 256; 10993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 11003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11013c827367444ee418f129b2c238299f49d3264554Jarkko Poyryint FillRuleCase::getNumIterations (FillRuleCase::FillRuleCaseType type) const 11023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 11033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (type == FILLRULECASE_CLIPPED_FULL || type == FILLRULECASE_CLIPPED_PARTIAL) 11043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return 15; 11053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 11063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return 2; 11073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 11083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11093c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FillRuleCase::generateTriangles (int iteration, std::vector<tcu::Vec4>& outData) const 11103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 11113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (m_caseType) 11123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 11133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case FILLRULECASE_BASIC: 11143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case FILLRULECASE_REVERSED: 11153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case FILLRULECASE_PROJECTED: 11163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 11173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int numRows = 4; 11183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int numColumns = 4; 11193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float quadSide = 0.15f; 11203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry de::Random rnd (0xabcd); 11213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData.resize(6 * numRows * numColumns); 11233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int col = 0; col < numColumns; ++col) 11253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int row = 0; row < numRows; ++row) 11263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 11273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec2 center = tcu::Vec2((row + 0.5f) / numRows * 2.0f - 1.0f, (col + 0.5f) / numColumns * 2.0f - 1.0f); 11283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float rotation = (iteration * numColumns * numRows + col * numRows + row) / (float)(m_iterationCount * numColumns * numRows) * DE_PI / 2.0f; 11293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec2 sideH = quadSide * tcu::Vec2(deFloatCos(rotation), deFloatSin(rotation)); 11303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec2 sideV = tcu::Vec2(sideH.y(), -sideH.x()); 11313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec2 quad[4] = 11323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 11333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry center + sideH + sideV, 11343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry center + sideH - sideV, 11353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry center - sideH - sideV, 11363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry center - sideH + sideV, 11373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 11383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_caseType == FILLRULECASE_BASIC) 11403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 11413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 0] = tcu::Vec4(quad[0].x(), quad[0].y(), 0.0f, 1.0f); 11423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 1] = tcu::Vec4(quad[1].x(), quad[1].y(), 0.0f, 1.0f); 11433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 2] = tcu::Vec4(quad[2].x(), quad[2].y(), 0.0f, 1.0f); 11443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 3] = tcu::Vec4(quad[2].x(), quad[2].y(), 0.0f, 1.0f); 11453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 4] = tcu::Vec4(quad[0].x(), quad[0].y(), 0.0f, 1.0f); 11463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 5] = tcu::Vec4(quad[3].x(), quad[3].y(), 0.0f, 1.0f); 11473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 11483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else if (m_caseType == FILLRULECASE_REVERSED) 11493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 11503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 0] = tcu::Vec4(quad[0].x(), quad[0].y(), 0.0f, 1.0f); 11513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 1] = tcu::Vec4(quad[1].x(), quad[1].y(), 0.0f, 1.0f); 11523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 2] = tcu::Vec4(quad[2].x(), quad[2].y(), 0.0f, 1.0f); 11533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 3] = tcu::Vec4(quad[0].x(), quad[0].y(), 0.0f, 1.0f); 11543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 4] = tcu::Vec4(quad[2].x(), quad[2].y(), 0.0f, 1.0f); 11553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 5] = tcu::Vec4(quad[3].x(), quad[3].y(), 0.0f, 1.0f); 11563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 11573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else if (m_caseType == FILLRULECASE_PROJECTED) 11583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 11593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float w0 = rnd.getFloat(0.1f, 4.0f); 11603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float w1 = rnd.getFloat(0.1f, 4.0f); 11613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float w2 = rnd.getFloat(0.1f, 4.0f); 11623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float w3 = rnd.getFloat(0.1f, 4.0f); 11633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 0] = tcu::Vec4(quad[0].x() * w0, quad[0].y() * w0, 0.0f, w0); 11653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 1] = tcu::Vec4(quad[1].x() * w1, quad[1].y() * w1, 0.0f, w1); 11663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 2] = tcu::Vec4(quad[2].x() * w2, quad[2].y() * w2, 0.0f, w2); 11673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 3] = tcu::Vec4(quad[2].x() * w2, quad[2].y() * w2, 0.0f, w2); 11683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 4] = tcu::Vec4(quad[0].x() * w0, quad[0].y() * w0, 0.0f, w0); 11693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[6 * (col * numRows + row) + 5] = tcu::Vec4(quad[3].x() * w3, quad[3].y() * w3, 0.0f, w3); 11703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 11713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 11723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(DE_FALSE); 11733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 11743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 11763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 11773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case FILLRULECASE_CLIPPED_PARTIAL: 11793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case FILLRULECASE_CLIPPED_FULL: 11803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 11813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float quadSide = (m_caseType == FILLRULECASE_CLIPPED_PARTIAL) ? (1.0f) : (2.0f); 11823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec2 center = (m_caseType == FILLRULECASE_CLIPPED_PARTIAL) ? (tcu::Vec2(0.5f, 0.5f)) : (tcu::Vec2(0.0f, 0.0f)); 11833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float rotation = (iteration) / (float)(m_iterationCount - 1) * DE_PI / 2.0f; 11843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec2 sideH = quadSide * tcu::Vec2(deFloatCos(rotation), deFloatSin(rotation)); 11853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec2 sideV = tcu::Vec2(sideH.y(), -sideH.x()); 11863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec2 quad[4] = 11873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 11883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry center + sideH + sideV, 11893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry center + sideH - sideV, 11903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry center - sideH - sideV, 11913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry center - sideH + sideV, 11923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 11933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData.resize(6); 11953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[0] = tcu::Vec4(quad[0].x(), quad[0].y(), 0.0f, 1.0f); 11963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[1] = tcu::Vec4(quad[1].x(), quad[1].y(), 0.0f, 1.0f); 11973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[2] = tcu::Vec4(quad[2].x(), quad[2].y(), 0.0f, 1.0f); 11983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[3] = tcu::Vec4(quad[2].x(), quad[2].y(), 0.0f, 1.0f); 11993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[4] = tcu::Vec4(quad[0].x(), quad[0].y(), 0.0f, 1.0f); 12003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[5] = tcu::Vec4(quad[3].x(), quad[3].y(), 0.0f, 1.0f); 12013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 12023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 12033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry default: 12053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(DE_FALSE); 12063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 12073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 12083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12093c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass CullingTest : public BaseRenderingCase 12103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 12113c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 12123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry CullingTest (Context& ctx, const char* name, const char* desc, glw::GLenum cullMode, glw::GLenum primitive, glw::GLenum faceOrder); 12133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~CullingTest (void); 12143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 12153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12163c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 12173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void generateVertices (std::vector<tcu::Vec4>& outData) const; 12183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void extractTriangles (std::vector<TriangleSceneSpec::SceneTriangle>& outTriangles, const std::vector<tcu::Vec4>& vertices) const; 12193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool triangleOrder (const tcu::Vec4& v0, const tcu::Vec4& v1, const tcu::Vec4& v2) const; 12203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::GLenum m_cullMode; 12223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::GLenum m_primitive; 12233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::GLenum m_faceOrder; 12243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 12253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12263c827367444ee418f129b2c238299f49d3264554Jarkko PoyryCullingTest::CullingTest (Context& ctx, const char* name, const char* desc, glw::GLenum cullMode, glw::GLenum primitive, glw::GLenum faceOrder) 12273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BaseRenderingCase (ctx, name, desc) 12283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_cullMode (cullMode) 12293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_primitive (primitive) 12303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_faceOrder (faceOrder) 12313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 12323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 12333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12343c827367444ee418f129b2c238299f49d3264554Jarkko PoyryCullingTest::~CullingTest (void) 12353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 12363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 12373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12383c827367444ee418f129b2c238299f49d3264554Jarkko PoyryCullingTest::IterateResult CullingTest::iterate (void) 12393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 12403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Surface resultImage(m_renderSize, m_renderSize); 12413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<tcu::Vec4> drawBuffer; 12423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<TriangleSceneSpec::SceneTriangle> triangles; 12433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // generate scene 12453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry generateVertices(drawBuffer); 12463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry extractTriangles(triangles, drawBuffer); 12473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // draw image 12493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 12503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::Functions& gl = m_context.getRenderContext().getFunctions(); 12513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.enable(GL_CULL_FACE); 12533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.cullFace(m_cullMode); 12543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.frontFace(m_faceOrder); 12553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Setting front face to " << glu::getWindingName(m_faceOrder) << tcu::TestLog::EndMessage; 12573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Setting cull face to " << glu::getFaceName(m_cullMode) << tcu::TestLog::EndMessage; 12583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Drawing test pattern (" << glu::getPrimitiveTypeName(m_primitive) << ")" << tcu::TestLog::EndMessage; 12593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry drawPrimitives(resultImage, drawBuffer, m_primitive); 12613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 12623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // compare 12643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 12653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry RasterizationArguments args; 12663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TriangleSceneSpec scene; 12673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.numSamples = m_numSamples; 12693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.subpixelBits = m_subpixelBits; 12703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.redBits = m_context.getRenderTarget().getPixelFormat().redBits; 12713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.greenBits = m_context.getRenderTarget().getPixelFormat().greenBits; 12723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.blueBits = m_context.getRenderTarget().getPixelFormat().blueBits; 12733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry scene.triangles.swap(triangles); 12753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (verifyTriangleGroupRasterization(resultImage, scene, args, m_testCtx.getLog(), VERIFICATIONMODE_WEAK)) 12773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 12783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 12793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Incorrect rendering"); 12803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 12813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 12833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 12843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12853c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid CullingTest::generateVertices (std::vector<tcu::Vec4>& outData) const 12863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 12873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry de::Random rnd(543210); 12883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData.resize(6); 12903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)outData.size(); ++vtxNdx) 12913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 12923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[vtxNdx].x() = rnd.getFloat(-0.9f, 0.9f); 12933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[vtxNdx].y() = rnd.getFloat(-0.9f, 0.9f); 12943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[vtxNdx].z() = 0.0f; 12953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outData[vtxNdx].w() = 1.0f; 12963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 12973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 12983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12993c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid CullingTest::extractTriangles (std::vector<TriangleSceneSpec::SceneTriangle>& outTriangles, const std::vector<tcu::Vec4>& vertices) const 13003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 13013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const bool cullDirection = (m_cullMode == GL_FRONT) ^ (m_faceOrder == GL_CCW); 13023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // No triangles 13043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_cullMode == GL_FRONT_AND_BACK) 13053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return; 13063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (m_primitive) 13083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 13093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_TRIANGLES: 13103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 13113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)vertices.size() - 2; vtxNdx += 3) 13123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 13133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec4& v0 = vertices[vtxNdx + 0]; 13143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec4& v1 = vertices[vtxNdx + 1]; 13153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec4& v2 = vertices[vtxNdx + 2]; 13163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (triangleOrder(v0, v1, v2) != cullDirection) 13183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 13193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TriangleSceneSpec::SceneTriangle tri; 13203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[0] = v0; tri.sharedEdge[0] = false; 13213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[1] = v1; tri.sharedEdge[1] = false; 13223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[2] = v2; tri.sharedEdge[2] = false; 13233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles.push_back(tri); 13253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 13263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 13273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 13283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 13293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_TRIANGLE_STRIP: 13313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 13323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)vertices.size() - 2; ++vtxNdx) 13333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 13343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec4& v0 = vertices[vtxNdx + 0]; 13353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec4& v1 = vertices[vtxNdx + 1]; 13363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec4& v2 = vertices[vtxNdx + 2]; 13373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (triangleOrder(v0, v1, v2) != (cullDirection ^ (vtxNdx % 2 != 0))) 13393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 13403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TriangleSceneSpec::SceneTriangle tri; 13413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[0] = v0; tri.sharedEdge[0] = false; 13423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[1] = v1; tri.sharedEdge[1] = false; 13433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[2] = v2; tri.sharedEdge[2] = false; 13443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles.push_back(tri); 13463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 13473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 13483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 13493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 13503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_TRIANGLE_FAN: 13523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 13533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 1; vtxNdx < (int)vertices.size() - 1; ++vtxNdx) 13543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 13553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec4& v0 = vertices[0]; 13563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec4& v1 = vertices[vtxNdx + 0]; 13573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec4& v2 = vertices[vtxNdx + 1]; 13583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (triangleOrder(v0, v1, v2) != cullDirection) 13603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 13613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TriangleSceneSpec::SceneTriangle tri; 13623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[0] = v0; tri.sharedEdge[0] = false; 13633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[1] = v1; tri.sharedEdge[1] = false; 13643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[2] = v2; tri.sharedEdge[2] = false; 13653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles.push_back(tri); 13673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 13683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 13693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 13703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 13713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry default: 13733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(false); 13743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 13753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 13763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13773c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool CullingTest::triangleOrder (const tcu::Vec4& v0, const tcu::Vec4& v1, const tcu::Vec4& v2) const 13783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 13793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec2 s0 = v0.swizzle(0, 1) / v0.w(); 13803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec2 s1 = v1.swizzle(0, 1) / v1.w(); 13813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec2 s2 = v2.swizzle(0, 1) / v2.w(); 13823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // cross 13843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return ((s1.x() - s0.x()) * (s2.y() - s0.y()) - (s2.x() - s0.x()) * (s1.y() - s0.y())) < 0; 13853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 13863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13873c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TriangleInterpolationTest : public BaseRenderingCase 13883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 13893c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 13903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TriangleInterpolationTest (Context& ctx, const char* name, const char* desc, glw::GLenum primitive, int flags); 13913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~TriangleInterpolationTest (void); 13923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 13933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13943c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 13953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void generateVertices (int iteration, std::vector<tcu::Vec4>& outVertices, std::vector<tcu::Vec4>& outColors) const; 13963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void extractTriangles (std::vector<TriangleSceneSpec::SceneTriangle>& outTriangles, const std::vector<tcu::Vec4>& vertices, const std::vector<tcu::Vec4>& colors) const; 13973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::GLenum m_primitive; 13993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const bool m_projective; 14003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int m_iterationCount; 14013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int m_iteration; 14033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool m_allIterationsPassed; 14043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 14053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14063c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTriangleInterpolationTest::TriangleInterpolationTest (Context& ctx, const char* name, const char* desc, glw::GLenum primitive, int flags) 14073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BaseRenderingCase (ctx, name, desc) 14083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_primitive (primitive) 14093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_projective ((flags & INTERPOLATIONFLAGS_PROJECTED) != 0) 14103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_iterationCount (3) 14113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_iteration (0) 14123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_allIterationsPassed (true) 14133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 14143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 14153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14163c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTriangleInterpolationTest::~TriangleInterpolationTest (void) 14173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 14183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deinit(); 14193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 14203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14213c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTriangleInterpolationTest::IterateResult TriangleInterpolationTest::iterate (void) 14223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 14233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const std::string iterationDescription = "Test iteration " + de::toString(m_iteration+1) + " / " + de::toString(m_iterationCount); 14243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::ScopedLogSection section (m_testCtx.getLog(), "Iteration" + de::toString(m_iteration+1), iterationDescription); 14253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Surface resultImage (m_renderSize, m_renderSize); 14263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<tcu::Vec4> drawBuffer; 14273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<tcu::Vec4> colorBuffer; 14283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<TriangleSceneSpec::SceneTriangle> triangles; 14293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // generate scene 14313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry generateVertices(m_iteration, drawBuffer, colorBuffer); 14323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry extractTriangles(triangles, drawBuffer, colorBuffer); 14333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // log 14353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 14363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Generated vertices:" << tcu::TestLog::EndMessage; 14373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)drawBuffer.size(); ++vtxNdx) 14383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "\t" << drawBuffer[vtxNdx] << ",\tcolor= " << colorBuffer[vtxNdx] << tcu::TestLog::EndMessage; 14393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 14403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // draw image 14423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry drawPrimitives(resultImage, drawBuffer, colorBuffer, m_primitive); 14433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // compare 14453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 14463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry RasterizationArguments args; 14473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TriangleSceneSpec scene; 14483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.numSamples = m_numSamples; 14503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.subpixelBits = m_subpixelBits; 14513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.redBits = m_context.getRenderTarget().getPixelFormat().redBits; 14523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.greenBits = m_context.getRenderTarget().getPixelFormat().greenBits; 14533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.blueBits = m_context.getRenderTarget().getPixelFormat().blueBits; 14543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry scene.triangles.swap(triangles); 14563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!verifyTriangleGroupInterpolation(resultImage, scene, args, m_testCtx.getLog())) 14583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_allIterationsPassed = false; 14593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 14603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // result 14623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (++m_iteration == m_iterationCount) 14633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 14643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_allIterationsPassed) 14653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 14663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 14673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Found invalid pixel values"); 14683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 14703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 14713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 14723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return CONTINUE; 14733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 14743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14753c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid TriangleInterpolationTest::generateVertices (int iteration, std::vector<tcu::Vec4>& outVertices, std::vector<tcu::Vec4>& outColors) const 14763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 14773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // use only red, green and blue 14783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec4 colors[] = 14793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 14803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Vec4(1.0f, 0.0f, 0.0f, 1.0f), 14813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Vec4(0.0f, 1.0f, 0.0f, 1.0f), 14823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f), 14833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 14843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry de::Random rnd(123 + iteration * 1000 + (int)m_primitive); 14863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices.resize(6); 14883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outColors.resize(6); 14893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)outVertices.size(); ++vtxNdx) 14913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 14923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].x() = rnd.getFloat(-0.9f, 0.9f); 14933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].y() = rnd.getFloat(-0.9f, 0.9f); 14943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].z() = 0.0f; 14953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!m_projective) 14973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].w() = 1.0f; 14983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 14993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 15003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float w = rnd.getFloat(0.2f, 4.0f); 15013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].x() *= w; 15033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].y() *= w; 15043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].z() *= w; 15053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].w() = w; 15063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 15073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outColors[vtxNdx] = colors[vtxNdx % DE_LENGTH_OF_ARRAY(colors)]; 15093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 15103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 15113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15123c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid TriangleInterpolationTest::extractTriangles (std::vector<TriangleSceneSpec::SceneTriangle>& outTriangles, const std::vector<tcu::Vec4>& vertices, const std::vector<tcu::Vec4>& colors) const 15133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 15143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (m_primitive) 15153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 15163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_TRIANGLES: 15173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 15183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)vertices.size() - 2; vtxNdx += 3) 15193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 15203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TriangleSceneSpec::SceneTriangle tri; 15213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[0] = vertices[vtxNdx + 0]; 15223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[1] = vertices[vtxNdx + 1]; 15233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[2] = vertices[vtxNdx + 2]; 15243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.sharedEdge[0] = false; 15253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.sharedEdge[1] = false; 15263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.sharedEdge[2] = false; 15273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.colors[0] = colors[vtxNdx + 0]; 15293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.colors[1] = colors[vtxNdx + 1]; 15303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.colors[2] = colors[vtxNdx + 2]; 15313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles.push_back(tri); 15333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 15343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 15353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 15363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_TRIANGLE_STRIP: 15383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 15393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)vertices.size() - 2; ++vtxNdx) 15403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 15413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TriangleSceneSpec::SceneTriangle tri; 15423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[0] = vertices[vtxNdx + 0]; 15433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[1] = vertices[vtxNdx + 1]; 15443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[2] = vertices[vtxNdx + 2]; 15453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.sharedEdge[0] = false; 15463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.sharedEdge[1] = false; 15473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.sharedEdge[2] = false; 15483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.colors[0] = colors[vtxNdx + 0]; 15503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.colors[1] = colors[vtxNdx + 1]; 15513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.colors[2] = colors[vtxNdx + 2]; 15523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles.push_back(tri); 15543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 15553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 15563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 15573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_TRIANGLE_FAN: 15593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 15603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 1; vtxNdx < (int)vertices.size() - 1; ++vtxNdx) 15613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 15623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TriangleSceneSpec::SceneTriangle tri; 15633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[0] = vertices[0]; 15643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[1] = vertices[vtxNdx + 0]; 15653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.positions[2] = vertices[vtxNdx + 1]; 15663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.sharedEdge[0] = false; 15673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.sharedEdge[1] = false; 15683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.sharedEdge[2] = false; 15693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.colors[0] = colors[0]; 15713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.colors[1] = colors[vtxNdx + 0]; 15723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tri.colors[2] = colors[vtxNdx + 1]; 15733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outTriangles.push_back(tri); 15753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 15763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 15773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 15783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry default: 15803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(false); 15813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 15823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 15833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15843c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LineInterpolationTest : public BaseRenderingCase 15853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 15863c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 15872306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry LineInterpolationTest (Context& ctx, const char* name, const char* desc, glw::GLenum primitive, int flags, float lineWidth); 15882306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry ~LineInterpolationTest (void); 15892306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry IterateResult iterate (void); 15903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15913c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 15922306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry void generateVertices (int iteration, std::vector<tcu::Vec4>& outVertices, std::vector<tcu::Vec4>& outColors) const; 15932306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry void extractLines (std::vector<LineSceneSpec::SceneLine>& outLines, const std::vector<tcu::Vec4>& vertices, const std::vector<tcu::Vec4>& colors) const; 15943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15952306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry const glw::GLenum m_primitive; 15962306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry const bool m_projective; 15972306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry const int m_iterationCount; 15983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15992306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry int m_iteration; 16002306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry tcu::ResultCollector m_result; 16013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 16023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16033c827367444ee418f129b2c238299f49d3264554Jarkko PoyryLineInterpolationTest::LineInterpolationTest (Context& ctx, const char* name, const char* desc, glw::GLenum primitive, int flags, float lineWidth) 16043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BaseRenderingCase (ctx, name, desc) 16053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_primitive (primitive) 16063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_projective ((flags & INTERPOLATIONFLAGS_PROJECTED) != 0) 16073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_iterationCount (3) 16083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_iteration (0) 16093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 16103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_lineWidth = lineWidth; 16113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 16123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16133c827367444ee418f129b2c238299f49d3264554Jarkko PoyryLineInterpolationTest::~LineInterpolationTest (void) 16143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 16153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deinit(); 16163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 16173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16183c827367444ee418f129b2c238299f49d3264554Jarkko PoyryLineInterpolationTest::IterateResult LineInterpolationTest::iterate (void) 16193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 16203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const std::string iterationDescription = "Test iteration " + de::toString(m_iteration+1) + " / " + de::toString(m_iterationCount); 16213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::ScopedLogSection section (m_testCtx.getLog(), "Iteration" + de::toString(m_iteration+1), iterationDescription); 16223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Surface resultImage (m_renderSize, m_renderSize); 16233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<tcu::Vec4> drawBuffer; 16243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<tcu::Vec4> colorBuffer; 16253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<LineSceneSpec::SceneLine> lines; 16263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // generate scene 16283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry generateVertices(m_iteration, drawBuffer, colorBuffer); 16293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry extractLines(lines, drawBuffer, colorBuffer); 16303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // log 16323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 16333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "Generated vertices:" << tcu::TestLog::EndMessage; 16343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)drawBuffer.size(); ++vtxNdx) 16353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.getLog() << tcu::TestLog::Message << "\t" << drawBuffer[vtxNdx] << ",\tcolor= " << colorBuffer[vtxNdx] << tcu::TestLog::EndMessage; 16363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 16373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // draw image 16393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry drawPrimitives(resultImage, drawBuffer, colorBuffer, m_primitive); 16403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // compare 16423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 16433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry RasterizationArguments args; 16443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry LineSceneSpec scene; 16452306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry LineInterpolationMethod iterationResult; 16463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.numSamples = m_numSamples; 16483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.subpixelBits = m_subpixelBits; 16493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.redBits = m_context.getRenderTarget().getPixelFormat().redBits; 16503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.greenBits = m_context.getRenderTarget().getPixelFormat().greenBits; 16513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry args.blueBits = m_context.getRenderTarget().getPixelFormat().blueBits; 16523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry scene.lines.swap(lines); 16543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry scene.lineWidth = m_lineWidth; 16553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16562306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry iterationResult = verifyLineGroupInterpolation(resultImage, scene, args, m_testCtx.getLog()); 16572306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry switch (iterationResult) 16582306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry { 16592306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry case LINEINTERPOLATION_STRICTLY_CORRECT: 16602306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry // line interpolation matches the specification 16612306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry m_result.addResult(QP_TEST_RESULT_PASS, "Pass"); 16622306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry break; 16632306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry 16642306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry case LINEINTERPOLATION_PROJECTED: 16652306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry // line interpolation weights are otherwise correct, but they are projected onto major axis 16662306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry m_testCtx.getLog() << tcu::TestLog::Message 16672306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry << "Interpolation was calculated using coordinates projected onto major axis. " 16682306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry "This method does not produce the same values as the non-projecting method defined in the specification." 16692306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry << tcu::TestLog::EndMessage; 16702306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry m_result.addResult(QP_TEST_RESULT_QUALITY_WARNING, "Interpolation was calculated using projected coordinateds"); 16712306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry break; 16722306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry 16732306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry case LINEINTERPOLATION_INCORRECT: 16742306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry // line interpolation is incorrect 16752306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry m_result.addResult(QP_TEST_RESULT_FAIL, "Found invalid pixel values"); 16762306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry break; 16772306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry 16782306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry default: 16792306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry DE_ASSERT(false); 16802306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry break; 16812306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry } 16823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 16833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // result 16853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (++m_iteration == m_iterationCount) 16863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 16872306a3bf8214ab2c51d8023ca1ccd979fb8d31bbJarkko Pöyry m_result.setTestContextResult(m_testCtx); 16883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 16893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 16903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 16913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return CONTINUE; 16923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 16933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16943c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid LineInterpolationTest::generateVertices (int iteration, std::vector<tcu::Vec4>& outVertices, std::vector<tcu::Vec4>& outColors) const 16953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 16963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // use only red, green and blue 16973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Vec4 colors[] = 16983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 16993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Vec4(1.0f, 0.0f, 0.0f, 1.0f), 17003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Vec4(0.0f, 1.0f, 0.0f, 1.0f), 17013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f), 17023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 17033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry de::Random rnd(123 + iteration * 1000 + (int)m_primitive); 17053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices.resize(6); 17073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outColors.resize(6); 17083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)outVertices.size(); ++vtxNdx) 17103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 17113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].x() = rnd.getFloat(-0.9f, 0.9f); 17123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].y() = rnd.getFloat(-0.9f, 0.9f); 17133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].z() = 0.0f; 17143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!m_projective) 17163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].w() = 1.0f; 17173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 17183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 17193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float w = rnd.getFloat(0.2f, 4.0f); 17203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].x() *= w; 17223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].y() *= w; 17233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].z() *= w; 17243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outVertices[vtxNdx].w() = w; 17253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 17263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outColors[vtxNdx] = colors[vtxNdx % DE_LENGTH_OF_ARRAY(colors)]; 17283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 17293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 17303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid LineInterpolationTest::extractLines (std::vector<LineSceneSpec::SceneLine>& outLines, const std::vector<tcu::Vec4>& vertices, const std::vector<tcu::Vec4>& colors) const 17323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 17333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (m_primitive) 17343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 17353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_LINES: 17363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 17373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)vertices.size() - 1; vtxNdx += 2) 17383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 17393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry LineSceneSpec::SceneLine line; 17403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry line.positions[0] = vertices[vtxNdx + 0]; 17413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry line.positions[1] = vertices[vtxNdx + 1]; 17423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry line.colors[0] = colors[vtxNdx + 0]; 17443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry line.colors[1] = colors[vtxNdx + 1]; 17453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines.push_back(line); 17473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 17483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 17493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 17503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_LINE_STRIP: 17523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 17533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)vertices.size() - 1; ++vtxNdx) 17543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 17553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry LineSceneSpec::SceneLine line; 17563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry line.positions[0] = vertices[vtxNdx + 0]; 17573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry line.positions[1] = vertices[vtxNdx + 1]; 17583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry line.colors[0] = colors[vtxNdx + 0]; 17603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry line.colors[1] = colors[vtxNdx + 1]; 17613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines.push_back(line); 17633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 17643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 17653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 17663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_LINE_LOOP: 17683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 17693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int vtxNdx = 0; vtxNdx < (int)vertices.size(); ++vtxNdx) 17703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 17713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry LineSceneSpec::SceneLine line; 17723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry line.positions[0] = vertices[(vtxNdx + 0) % (int)vertices.size()]; 17733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry line.positions[1] = vertices[(vtxNdx + 1) % (int)vertices.size()]; 17743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry line.colors[0] = colors[(vtxNdx + 0) % (int)vertices.size()]; 17763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry line.colors[1] = colors[(vtxNdx + 1) % (int)vertices.size()]; 17773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry outLines.push_back(line); 17793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 17803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 17813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 17823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry default: 17843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(false); 17853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 17863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 17873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous 17893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17903c827367444ee418f129b2c238299f49d3264554Jarkko PoyryRasterizationTests::RasterizationTests (Context& context) 17913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "rasterization", "Rasterization Tests") 17923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 17933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 17943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17953c827367444ee418f129b2c238299f49d3264554Jarkko PoyryRasterizationTests::~RasterizationTests (void) 17963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 17973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 17983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17993c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid RasterizationTests::init (void) 18003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 18013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // .primitives 18023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* const primitives = new tcu::TestCaseGroup(m_testCtx, "primitives", "Primitive rasterization"); 18043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(primitives); 18063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry primitives->addChild(new TrianglesCase (m_context, "triangles", "Render primitives as GL_TRIANGLES, verify rasterization result")); 18083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry primitives->addChild(new TriangleStripCase (m_context, "triangle_strip", "Render primitives as GL_TRIANGLE_STRIP, verify rasterization result")); 18093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry primitives->addChild(new TriangleFanCase (m_context, "triangle_fan", "Render primitives as GL_TRIANGLE_FAN, verify rasterization result")); 18103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry primitives->addChild(new LinesCase (m_context, "lines", "Render primitives as GL_LINES, verify rasterization result", PRIMITIVEWIDENESS_NARROW)); 18113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry primitives->addChild(new LineStripCase (m_context, "line_strip", "Render primitives as GL_LINE_STRIP, verify rasterization result", PRIMITIVEWIDENESS_NARROW)); 18123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry primitives->addChild(new LineLoopCase (m_context, "line_loop", "Render primitives as GL_LINE_LOOP, verify rasterization result", PRIMITIVEWIDENESS_NARROW)); 18133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry primitives->addChild(new LinesCase (m_context, "lines_wide", "Render primitives as GL_LINES with wide lines, verify rasterization result", PRIMITIVEWIDENESS_WIDE)); 18143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry primitives->addChild(new LineStripCase (m_context, "line_strip_wide", "Render primitives as GL_LINE_STRIP with wide lines, verify rasterization result", PRIMITIVEWIDENESS_WIDE)); 18153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry primitives->addChild(new LineLoopCase (m_context, "line_loop_wide", "Render primitives as GL_LINE_LOOP with wide lines, verify rasterization result", PRIMITIVEWIDENESS_WIDE)); 18163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry primitives->addChild(new PointCase (m_context, "points", "Render primitives as GL_POINTS, verify rasterization result", PRIMITIVEWIDENESS_WIDE)); 18173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 18183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // .fill_rules 18203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* const fillRules = new tcu::TestCaseGroup(m_testCtx, "fill_rules", "Primitive fill rules"); 18223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(fillRules); 18243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fillRules->addChild(new FillRuleCase(m_context, "basic_quad", "Verify fill rules", FillRuleCase::FILLRULECASE_BASIC)); 18263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fillRules->addChild(new FillRuleCase(m_context, "basic_quad_reverse", "Verify fill rules", FillRuleCase::FILLRULECASE_REVERSED)); 18273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fillRules->addChild(new FillRuleCase(m_context, "clipped_full", "Verify fill rules", FillRuleCase::FILLRULECASE_CLIPPED_FULL)); 18283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fillRules->addChild(new FillRuleCase(m_context, "clipped_partly", "Verify fill rules", FillRuleCase::FILLRULECASE_CLIPPED_PARTIAL)); 18293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fillRules->addChild(new FillRuleCase(m_context, "projected", "Verify fill rules", FillRuleCase::FILLRULECASE_PROJECTED)); 18303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 18313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // .culling 18333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static const struct CullMode 18353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glw::GLenum mode; 18373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const char* prefix; 18383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } cullModes[] = 18393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_FRONT, "front_" }, 18413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_BACK, "back_" }, 18423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_FRONT_AND_BACK, "both_" }, 18433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 18443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static const struct PrimitiveType 18453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glw::GLenum type; 18473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const char* name; 18483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } primitiveTypes[] = 18493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_TRIANGLES, "triangles" }, 18513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_TRIANGLE_STRIP, "triangle_strip" }, 18523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_TRIANGLE_FAN, "triangle_fan" }, 18533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 18543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static const struct FrontFaceOrder 18553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glw::GLenum mode; 18573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const char* postfix; 18583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } frontOrders[] = 18593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_CCW, "" }, 18613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_CW, "_reverse" }, 18623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 18633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* const culling = new tcu::TestCaseGroup(m_testCtx, "culling", "Culling"); 18653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(culling); 18673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int cullModeNdx = 0; cullModeNdx < DE_LENGTH_OF_ARRAY(cullModes); ++cullModeNdx) 18693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int primitiveNdx = 0; primitiveNdx < DE_LENGTH_OF_ARRAY(primitiveTypes); ++primitiveNdx) 18703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int frontOrderNdx = 0; frontOrderNdx < DE_LENGTH_OF_ARRAY(frontOrders); ++frontOrderNdx) 18713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const std::string name = std::string(cullModes[cullModeNdx].prefix) + primitiveTypes[primitiveNdx].name + frontOrders[frontOrderNdx].postfix; 18733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry culling->addChild(new CullingTest(m_context, name.c_str(), "Test primitive culling.", cullModes[cullModeNdx].mode, primitiveTypes[primitiveNdx].type, frontOrders[frontOrderNdx].mode)); 18753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 18763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 18773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // .interpolation 18793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* const interpolation = new tcu::TestCaseGroup(m_testCtx, "interpolation", "Test interpolation"); 18813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(interpolation); 18833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // .basic 18853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* const basic = new tcu::TestCaseGroup(m_testCtx, "basic", "Non-projective interpolation"); 18873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry interpolation->addChild(basic); 18893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry basic->addChild(new TriangleInterpolationTest (m_context, "triangles", "Verify triangle interpolation", GL_TRIANGLES, INTERPOLATIONFLAGS_NONE)); 18913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry basic->addChild(new TriangleInterpolationTest (m_context, "triangle_strip", "Verify triangle strip interpolation", GL_TRIANGLE_STRIP, INTERPOLATIONFLAGS_NONE)); 18923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry basic->addChild(new TriangleInterpolationTest (m_context, "triangle_fan", "Verify triangle fan interpolation", GL_TRIANGLE_FAN, INTERPOLATIONFLAGS_NONE)); 18933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry basic->addChild(new LineInterpolationTest (m_context, "lines", "Verify line interpolation", GL_LINES, INTERPOLATIONFLAGS_NONE, 1.0f)); 18943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry basic->addChild(new LineInterpolationTest (m_context, "line_strip", "Verify line strip interpolation", GL_LINE_STRIP, INTERPOLATIONFLAGS_NONE, 1.0f)); 18953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry basic->addChild(new LineInterpolationTest (m_context, "line_loop", "Verify line loop interpolation", GL_LINE_LOOP, INTERPOLATIONFLAGS_NONE, 1.0f)); 18963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry basic->addChild(new LineInterpolationTest (m_context, "lines_wide", "Verify wide line interpolation", GL_LINES, INTERPOLATIONFLAGS_NONE, 5.0f)); 18973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry basic->addChild(new LineInterpolationTest (m_context, "line_strip_wide", "Verify wide line strip interpolation", GL_LINE_STRIP, INTERPOLATIONFLAGS_NONE, 5.0f)); 18983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry basic->addChild(new LineInterpolationTest (m_context, "line_loop_wide", "Verify wide line loop interpolation", GL_LINE_LOOP, INTERPOLATIONFLAGS_NONE, 5.0f)); 18993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 19003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // .projected 19023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 19033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* const projected = new tcu::TestCaseGroup(m_testCtx, "projected", "Projective interpolation"); 19043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry interpolation->addChild(projected); 19063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry projected->addChild(new TriangleInterpolationTest (m_context, "triangles", "Verify triangle interpolation", GL_TRIANGLES, INTERPOLATIONFLAGS_PROJECTED)); 19083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry projected->addChild(new TriangleInterpolationTest (m_context, "triangle_strip", "Verify triangle strip interpolation", GL_TRIANGLE_STRIP, INTERPOLATIONFLAGS_PROJECTED)); 19093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry projected->addChild(new TriangleInterpolationTest (m_context, "triangle_fan", "Verify triangle fan interpolation", GL_TRIANGLE_FAN, INTERPOLATIONFLAGS_PROJECTED)); 19103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry projected->addChild(new LineInterpolationTest (m_context, "lines", "Verify line interpolation", GL_LINES, INTERPOLATIONFLAGS_PROJECTED, 1.0f)); 19113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry projected->addChild(new LineInterpolationTest (m_context, "line_strip", "Verify line strip interpolation", GL_LINE_STRIP, INTERPOLATIONFLAGS_PROJECTED, 1.0f)); 19123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry projected->addChild(new LineInterpolationTest (m_context, "line_loop", "Verify line loop interpolation", GL_LINE_LOOP, INTERPOLATIONFLAGS_PROJECTED, 1.0f)); 19133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry projected->addChild(new LineInterpolationTest (m_context, "lines_wide", "Verify wide line interpolation", GL_LINES, INTERPOLATIONFLAGS_PROJECTED, 5.0f)); 19143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry projected->addChild(new LineInterpolationTest (m_context, "line_strip_wide", "Verify wide line strip interpolation", GL_LINE_STRIP, INTERPOLATIONFLAGS_PROJECTED, 5.0f)); 19153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry projected->addChild(new LineInterpolationTest (m_context, "line_loop_wide", "Verify wide line loop interpolation", GL_LINE_LOOP, INTERPOLATIONFLAGS_PROJECTED, 5.0f)); 19163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 19173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 19183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 19193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional 19213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles2 19223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 1923