13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _ES31FMULTISAMPLESHADERRENDERCASE_HPP 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _ES31FMULTISAMPLESHADERRENDERCASE_HPP 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 3.1 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 Multisample shader render case 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuDefs.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tes31TestCase.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <map> 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace tcu 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Surface; 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // tcu 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace glu 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ShaderProgram; 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // glu 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles31 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace MultisampleShaderRenderUtil 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass QualityWarning : public tcu::Exception 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry QualityWarning (const std::string& message); 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass MultisampleRenderCase : public TestCase 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry enum RenderTarget 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TARGET_DEFAULT = 0, 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TARGET_TEXTURE, 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TARGET_RENDERBUFFER, 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TARGET_LAST 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry enum Flags 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FLAG_PER_ITERATION_SHADER = 1, 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FLAG_VERIFY_MSAA_TEXTURE_SAMPLE_BUFFERS = 2, // !< flag set: each sample layer is verified by verifySampleBuffer 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MultisampleRenderCase (Context& context, const char* name, const char* desc, int numSamples, RenderTarget target, int renderSize, int flags = 0); 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual ~MultisampleRenderCase (void); 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void init (void); 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void deinit (void); 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void preDraw (void); 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void postDraw (void); 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void preTest (void); 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void postTest (void); 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual std::string getIterationDescription (int iteration) const; 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void drawOneIteration (void); 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void verifyResultImageAndSetResult (const tcu::Surface& resultImage); 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void verifyResultBuffersAndSetResult (const std::vector<tcu::Surface>& resultBuffers); 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual std::string genVertexSource (int numTargetSamples) const; 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual std::string genFragmentSource (int numTargetSamples) const = 0; 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::string genMSSamplerSource (int numTargetSamples) const; 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::string genMSTextureResolverSource (int numTargetSamples) const; 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::string genMSTextureLayerFetchSource (int numTargetSamples) const; 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual bool verifyImage (const tcu::Surface& resultImage) = 0; 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual bool verifySampleBuffers (const std::vector<tcu::Surface>& resultBuffers); 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void setupRenderData (void); 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected: 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry struct Attrib 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int offset; 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int stride; 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int m_numRequestedSamples; 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderTarget m_renderTarget; 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int m_renderSize; 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const bool m_perIterationShader; 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const bool m_verifyTextureSampleBuffers; 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deInt32 m_numTargetSamples; 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_buffer; 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_resolveBuffer; 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ShaderProgram* m_program; 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_fbo; 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_fboTexture; 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ShaderProgram* m_textureSamplerProgram; 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_fboRbo; 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_resolveFbo; 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_resolveFboTexture; 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int m_iteration; 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int m_numIterations; 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_renderMode; 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deInt32 m_renderCount; 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_renderVao; 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_resolveVao; 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::string m_renderSceneDescription; 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::map<std::string, Attrib> m_renderAttribs; 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // MultisampleShaderRenderUtil 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles31 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _ES31FMULTISAMPLESHADERRENDERCASE_HPP 140