Home | History | Annotate | Download | only in functional
      1 #ifndef _ES31FMULTISAMPLESHADERRENDERCASE_HPP
      2 #define _ES31FMULTISAMPLESHADERRENDERCASE_HPP
      3 /*-------------------------------------------------------------------------
      4  * drawElements Quality Program OpenGL ES 3.1 Module
      5  * -------------------------------------------------
      6  *
      7  * Copyright 2014 The Android Open Source Project
      8  *
      9  * Licensed under the Apache License, Version 2.0 (the "License");
     10  * you may not use this file except in compliance with the License.
     11  * You may obtain a copy of the License at
     12  *
     13  *      http://www.apache.org/licenses/LICENSE-2.0
     14  *
     15  * Unless required by applicable law or agreed to in writing, software
     16  * distributed under the License is distributed on an "AS IS" BASIS,
     17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     18  * See the License for the specific language governing permissions and
     19  * limitations under the License.
     20  *
     21  *//*!
     22  * \file
     23  * \brief Multisample shader render case
     24  *//*--------------------------------------------------------------------*/
     25 
     26 #include "tcuDefs.hpp"
     27 #include "tes31TestCase.hpp"
     28 
     29 #include <map>
     30 
     31 namespace tcu
     32 {
     33 class Surface;
     34 } // tcu
     35 
     36 namespace glu
     37 {
     38 class ShaderProgram;
     39 } // glu
     40 
     41 
     42 namespace deqp
     43 {
     44 namespace gles31
     45 {
     46 namespace Functional
     47 {
     48 namespace MultisampleShaderRenderUtil
     49 {
     50 
     51 class QualityWarning : public tcu::Exception
     52 {
     53 public:
     54 	QualityWarning (const std::string& message);
     55 };
     56 
     57 class MultisampleRenderCase : public TestCase
     58 {
     59 public:
     60 	enum RenderTarget
     61 	{
     62 		TARGET_DEFAULT = 0,
     63 		TARGET_TEXTURE,
     64 		TARGET_RENDERBUFFER,
     65 
     66 		TARGET_LAST
     67 	};
     68 	enum Flags
     69 	{
     70 		FLAG_PER_ITERATION_SHADER				= 1,
     71 		FLAG_VERIFY_MSAA_TEXTURE_SAMPLE_BUFFERS	= 2, // !< flag set: each sample layer is verified by verifySampleBuffer
     72 	};
     73 
     74 						MultisampleRenderCase			(Context& context, const char* name, const char* desc, int numSamples, RenderTarget target, int renderSize, int flags = 0);
     75 	virtual				~MultisampleRenderCase			(void);
     76 
     77 	virtual void		init							(void);
     78 	virtual void		deinit							(void);
     79 	IterateResult		iterate							(void);
     80 
     81 private:
     82 	virtual void		preDraw							(void);
     83 	virtual void		postDraw						(void);
     84 	virtual void		preTest							(void);
     85 	virtual void		postTest						(void);
     86 	virtual std::string	getIterationDescription			(int iteration) const;
     87 
     88 	void				drawOneIteration				(void);
     89 	void				verifyResultImageAndSetResult	(const tcu::Surface& resultImage);
     90 	void				verifyResultBuffersAndSetResult	(const std::vector<tcu::Surface>& resultBuffers);
     91 	virtual std::string	genVertexSource					(int numTargetSamples) const;
     92 	virtual std::string	genFragmentSource				(int numTargetSamples) const = 0;
     93 	std::string			genMSSamplerSource				(int numTargetSamples) const;
     94 	std::string			genMSTextureResolverSource		(int numTargetSamples) const;
     95 	std::string			genMSTextureLayerFetchSource	(int numTargetSamples) const;
     96 	virtual bool		verifyImage						(const tcu::Surface& resultImage) = 0;
     97 	virtual bool		verifySampleBuffers				(const std::vector<tcu::Surface>& resultBuffers);
     98 	virtual void		setupRenderData					(void);
     99 
    100 protected:
    101 	struct Attrib
    102 	{
    103 		int offset;
    104 		int stride;
    105 	};
    106 
    107 	const int			m_numRequestedSamples;
    108 	const RenderTarget	m_renderTarget;
    109 	const int			m_renderSize;
    110 	const bool			m_perIterationShader;
    111 	const bool			m_verifyTextureSampleBuffers;
    112 	deInt32				m_numTargetSamples;
    113 
    114 	deUint32			m_buffer;
    115 	deUint32			m_resolveBuffer;
    116 	glu::ShaderProgram*	m_program;
    117 	deUint32			m_fbo;
    118 	deUint32			m_fboTexture;
    119 	glu::ShaderProgram*	m_textureSamplerProgram;
    120 	deUint32			m_fboRbo;
    121 	deUint32			m_resolveFbo;
    122 	deUint32			m_resolveFboTexture;
    123 	int					m_iteration;
    124 	int					m_numIterations;
    125 	deUint32			m_renderMode;
    126 	deInt32				m_renderCount;
    127 	deUint32			m_renderVao;
    128 	deUint32			m_resolveVao;
    129 
    130 	std::string			m_renderSceneDescription;
    131 	std::map<std::string, Attrib> m_renderAttribs;
    132 };
    133 
    134 } // MultisampleShaderRenderUtil
    135 } // Functional
    136 } // gles31
    137 } // deqp
    138 
    139 #endif // _ES31FMULTISAMPLESHADERRENDERCASE_HPP
    140