Home | History | Annotate | Download | only in glshared
      1 #ifndef _GLSINTERACTIONTESTUTIL_HPP
      2 #define _GLSINTERACTIONTESTUTIL_HPP
      3 /*-------------------------------------------------------------------------
      4  * drawElements Quality Program OpenGL (ES) 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 Interaction test utilities.
     24  *//*--------------------------------------------------------------------*/
     25 
     26 #include "tcuDefs.hpp"
     27 #include "glsFragmentOpUtil.hpp"
     28 #include "gluRenderContext.hpp"
     29 #include "rrRenderState.hpp"
     30 
     31 namespace de
     32 {
     33 class Random;
     34 }
     35 
     36 namespace deqp
     37 {
     38 namespace gls
     39 {
     40 namespace InteractionTestUtil
     41 {
     42 
     43 struct BlendState
     44 {
     45 	deUint32	equation;
     46 	deUint32	srcFunc;
     47 	deUint32	dstFunc;
     48 
     49 	BlendState (void)
     50 		: equation	(0)
     51 		, srcFunc	(0)
     52 		, dstFunc	(0)
     53 	{
     54 	}
     55 };
     56 
     57 struct StencilState
     58 {
     59 	deUint32	function;
     60 	int			reference;
     61 	deUint32	compareMask;
     62 
     63 	deUint32	stencilFailOp;
     64 	deUint32	depthFailOp;
     65 	deUint32	depthPassOp;
     66 
     67 	deUint32	writeMask;
     68 
     69 	StencilState (void)
     70 		: function		(0)
     71 		, reference		(0)
     72 		, compareMask	(0)
     73 		, stencilFailOp	(0)
     74 		, depthFailOp	(0)
     75 		, depthPassOp	(0)
     76 		, writeMask		(0)
     77 	{
     78 	}
     79 };
     80 
     81 struct RenderState
     82 {
     83 	bool				scissorTestEnabled;
     84 	rr::WindowRectangle	scissorRectangle;
     85 
     86 	bool				stencilTestEnabled;
     87 	StencilState		stencil[rr::FACETYPE_LAST];
     88 
     89 	bool				depthTestEnabled;
     90 	deUint32			depthFunc;
     91 	bool				depthWriteMask;
     92 
     93 	bool				blendEnabled;
     94 	BlendState			blendRGBState;
     95 	BlendState			blendAState;
     96 	tcu::Vec4			blendColor;
     97 
     98 	bool				ditherEnabled;
     99 
    100 	tcu::BVec4			colorMask;
    101 
    102 	RenderState (void)
    103 		: scissorTestEnabled	(false)
    104 		, scissorRectangle		(0, 0, 0, 0)
    105 		, stencilTestEnabled	(false)
    106 		, depthTestEnabled		(false)
    107 		, depthFunc				(0)
    108 		, depthWriteMask		(false)
    109 		, blendEnabled			(false)
    110 		, ditherEnabled			(false)
    111 	{
    112 	}
    113 };
    114 
    115 struct RenderCommand
    116 {
    117 	gls::FragmentOpUtil::IntegerQuad	quad;
    118 	RenderState							state;
    119 };
    120 
    121 void		computeRandomRenderState		(de::Random& rnd, RenderState& state, glu::ApiType apiType, int targetWidth, int targetHeight);
    122 void		computeRandomQuad				(de::Random& rnd, gls::FragmentOpUtil::IntegerQuad& quad, int targetWidth, int targetHeight);
    123 void		computeRandomRenderCommands		(de::Random& rnd, glu::ApiType apiType, int numCommands, int targetW, int targetH, std::vector<RenderCommand>& dst);
    124 
    125 } // InteractionTestUtil
    126 } // gls
    127 } // deqp
    128 
    129 #endif // _GLSINTERACTIONTESTUTIL_HPP
    130