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 uint32_t equation; 46 uint32_t srcFunc; 47 uint32_t dstFunc; 48 BlendStatedeqp::gls::InteractionTestUtil::BlendState49 BlendState(void) : equation(0), srcFunc(0), dstFunc(0) 50 { 51 } 52 }; 53 54 struct StencilState 55 { 56 uint32_t function; 57 int reference; 58 uint32_t compareMask; 59 60 uint32_t stencilFailOp; 61 uint32_t depthFailOp; 62 uint32_t depthPassOp; 63 64 uint32_t writeMask; 65 StencilStatedeqp::gls::InteractionTestUtil::StencilState66 StencilState(void) 67 : function(0) 68 , reference(0) 69 , compareMask(0) 70 , stencilFailOp(0) 71 , depthFailOp(0) 72 , depthPassOp(0) 73 , writeMask(0) 74 { 75 } 76 }; 77 78 struct RenderState 79 { 80 bool scissorTestEnabled; 81 rr::WindowRectangle scissorRectangle; 82 83 bool stencilTestEnabled; 84 StencilState stencil[rr::FACETYPE_LAST]; 85 86 bool depthTestEnabled; 87 uint32_t depthFunc; 88 bool depthWriteMask; 89 90 bool blendEnabled; 91 BlendState blendRGBState; 92 BlendState blendAState; 93 tcu::Vec4 blendColor; 94 95 bool ditherEnabled; 96 97 tcu::BVec4 colorMask; 98 RenderStatedeqp::gls::InteractionTestUtil::RenderState99 RenderState(void) 100 : scissorTestEnabled(false) 101 , scissorRectangle(0, 0, 0, 0) 102 , stencilTestEnabled(false) 103 , depthTestEnabled(false) 104 , depthFunc(0) 105 , depthWriteMask(false) 106 , blendEnabled(false) 107 , ditherEnabled(false) 108 { 109 } 110 }; 111 112 struct RenderCommand 113 { 114 gls::FragmentOpUtil::IntegerQuad quad; 115 RenderState state; 116 }; 117 118 void computeRandomRenderState(de::Random &rnd, RenderState &state, glu::ApiType apiType, int targetWidth, 119 int targetHeight); 120 void computeRandomQuad(de::Random &rnd, gls::FragmentOpUtil::IntegerQuad &quad, int targetWidth, int targetHeight); 121 void computeRandomRenderCommands(de::Random &rnd, glu::ApiType apiType, int numCommands, int targetW, int targetH, 122 std::vector<RenderCommand> &dst); 123 124 } // namespace InteractionTestUtil 125 } // namespace gls 126 } // namespace deqp 127 128 #endif // _GLSINTERACTIONTESTUTIL_HPP 129