13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _GLSSHADERRENDERCASE_HPP 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _GLSSHADERRENDERCASE_HPP 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL (ES) Module 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ----------------------------------------------- 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Shader execute test. 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuDefs.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestCase.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuVector.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuMatrix.hpp" 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTexture.hpp" 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuSurface.hpp" 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp" 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluContextInfo.hpp" 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluShaderProgram.hpp" 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <sstream> 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <string> 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace glu 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass RenderContext; 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Texture2D; 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TextureCube; 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Texture2DArray; 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Texture3D; 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // glu 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gls 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// LineStream \todo [2011-10-17 pyry] Move to proper place! 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LineStream 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry LineStream (int indent = 0) { m_indent = indent; } 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~LineStream (void) {} 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const char* str (void) const { m_string = m_stream.str(); return m_string.c_str(); } 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry LineStream& operator<< (const char* line) { for (int i = 0; i < m_indent; i++) { m_stream << "\t"; } m_stream << line << "\n"; return *this; } 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int m_indent; 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::ostringstream m_stream; 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry mutable std::string m_string; 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass QuadGrid; 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// TextureBinding 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TextureBinding 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry enum Type 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_NONE = 0, 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_2D, 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_CUBE_MAP, 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_2D_ARRAY, 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_3D, 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TYPE_LAST 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureBinding (const glu::Texture2D* tex2D, const tcu::Sampler& sampler); 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureBinding (const glu::TextureCube* texCube, const tcu::Sampler& sampler); 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureBinding (const glu::Texture2DArray* tex2DArray, const tcu::Sampler& sampler); 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureBinding (const glu::Texture3D* tex3D, const tcu::Sampler& sampler); 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureBinding (void); 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void setSampler (const tcu::Sampler& sampler); 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void setTexture (const glu::Texture2D* tex2D); 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void setTexture (const glu::TextureCube* texCube); 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void setTexture (const glu::Texture2DArray* tex2DArray); 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void setTexture (const glu::Texture3D* tex3D); 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Type getType (void) const { return m_type; } 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Sampler& getSampler (void) const { return m_sampler; } 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glu::Texture2D* get2D (void) const { DE_ASSERT(getType() == TYPE_2D); return m_binding.tex2D; } 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glu::TextureCube* getCube (void) const { DE_ASSERT(getType() == TYPE_CUBE_MAP); return m_binding.texCube; } 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glu::Texture2DArray* get2DArray (void) const { DE_ASSERT(getType() == TYPE_2D_ARRAY); return m_binding.tex2DArray;} 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glu::Texture3D* get3D (void) const { DE_ASSERT(getType() == TYPE_3D); return m_binding.tex3D; } 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Type m_type; 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Sampler m_sampler; 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry union 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glu::Texture2D* tex2D; 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glu::TextureCube* texCube; 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glu::Texture2DArray* tex2DArray; 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glu::Texture3D* tex3D; 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } m_binding; 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// ShaderEvalContext. 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ShaderEvalContext 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Limits. 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry enum 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MAX_USER_ATTRIBS = 4, 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MAX_TEXTURES = 4, 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry struct ShaderSampler 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Sampler sampler; 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Texture2D* tex2D; 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::TextureCube* texCube; 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Texture2DArray* tex2DArray; 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Texture3D* tex3D; 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry inline ShaderSampler (void) 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : tex2D (DE_NULL) 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , texCube (DE_NULL) 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , tex2DArray(DE_NULL) 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , tex3D (DE_NULL) 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ShaderEvalContext (const QuadGrid& quadGrid); 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~ShaderEvalContext (void); 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void reset (float sx, float sy); 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Inputs. 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Vec4 coords; 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Vec4 unitCoords; 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Vec4 constCoords; 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Vec4 in[MAX_USER_ATTRIBS]; 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ShaderSampler textures[MAX_TEXTURES]; 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Output. 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Vec4 color; 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool isDiscarded; 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Functions. 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry inline void discard (void) { isDiscarded = true; } 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Vec4 texture2D (int unitNdx, const tcu::Vec2& coords); 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const QuadGrid& quadGrid; 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// ShaderEvalFunc. 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytypedef void (*ShaderEvalFunc) (ShaderEvalContext& c); 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void evalCoordsPassthroughX (ShaderEvalContext& c) { c.color.x() = c.coords.x(); } 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void evalCoordsPassthroughXY (ShaderEvalContext& c) { c.color.xy() = c.coords.swizzle(0,1); } 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void evalCoordsPassthroughXYZ (ShaderEvalContext& c) { c.color.xyz() = c.coords.swizzle(0,1,2); } 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void evalCoordsPassthrough (ShaderEvalContext& c) { c.color = c.coords; } 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void evalCoordsSwizzleWZYX (ShaderEvalContext& c) { c.color = c.coords.swizzle(3,2,1,0); } 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// ShaderEvaluator 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Either inherit a class with overridden evaluate() or just pass in an evalFunc. 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ShaderEvaluator 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ShaderEvaluator (void); 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ShaderEvaluator (ShaderEvalFunc evalFunc); 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual ~ShaderEvaluator (void); 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void evaluate (ShaderEvalContext& ctx); 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ShaderEvaluator (const ShaderEvaluator&); // not allowed! 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ShaderEvaluator& operator= (const ShaderEvaluator&); // not allowed! 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ShaderEvalFunc m_evalFunc; 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// ShaderRenderCase. 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ShaderRenderCase : public tcu::TestCase 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ShaderRenderCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const glu::ContextInfo& ctxInfo, const char* name, const char* description, bool isVertexCase, ShaderEvalFunc evalFunc); 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ShaderRenderCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const glu::ContextInfo& ctxInfo, const char* name, const char* description, bool isVertexCase, ShaderEvaluator& evaluator); 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual ~ShaderRenderCase (void); 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void); 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void deinit (void); 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected: 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void setupShaderData (void); 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void setup (int programID); 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void setupUniforms (int programID, const tcu::Vec4& constCoords); 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::IVec2 getViewportSize (void) const; 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry class CompileFailed : public tcu::TestError 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry public: 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry inline CompileFailed (const char* file, int line) : tcu::TestError("Failed to compile shader program", DE_NULL, file, line) {} 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ShaderRenderCase (const ShaderRenderCase&); // not allowed! 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ShaderRenderCase& operator= (const ShaderRenderCase&); // not allowed! 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void setupDefaultInputs (int programID); 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void render (tcu::Surface& result, int programID, const QuadGrid& quadGrid); 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void computeVertexReference (tcu::Surface& result, const QuadGrid& quadGrid); 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void computeFragmentReference(tcu::Surface& result, const QuadGrid& quadGrid); 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool compareImages (const tcu::Surface& resImage, const tcu::Surface& refImage, float errorThreshold); 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected: 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::RenderContext& m_renderCtx; 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glu::ContextInfo& m_ctxInfo; 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool m_isVertexCase; 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ShaderEvaluator m_defaultEvaluator; 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ShaderEvaluator& m_evaluator; 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::string m_vertShaderSource; 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::string m_fragShaderSource; 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Vec4 m_clearColor; 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<tcu::Mat4> m_userAttribTransforms; 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<TextureBinding> m_textures; 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ShaderProgram* m_program; 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Helpers. 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// \todo [2012-04-10 pyry] Move these to separate utility? 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst char* getIntUniformName (int number); 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst char* getFloatUniformName (int number); 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst char* getFloatFractionUniformName (int number); 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid setupDefaultUniforms (const glu::RenderContext& context, deUint32 programID); 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gls 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _GLSSHADERRENDERCASE_HPP 270