1 #ifndef _GLSFRAGMENTOPUTIL_HPP
2 #define _GLSFRAGMENTOPUTIL_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program OpenGL (ES) Module
5 * -----------------------------------------------
7 * Copyright 2014 The Android Open Source Project
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 * \brief Fragment operation test utilities.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "gluShaderUtil.hpp"
28 #include "tcuVector.hpp"
29 #include "tcuTexture.hpp"
30 #include "rrFragmentOperations.hpp"
42 namespace FragmentOpUtil
50 // Normalized device coordinates (range [-1, 1]).
51 // In order (A.x, A.y), (A.x, B.y), (B.x, A.y), (B.x, B.y)
60 for (int i = 0; i < DE_LENGTH_OF_ARRAY(depth); i++)
68 QuadRenderer (const glu::RenderContext& context, glu::GLSLVersion glslVersion);
71 void render (const Quad& quad) const;
74 QuadRenderer (const QuadRenderer& other); // Not allowed!
75 QuadRenderer& operator= (const QuadRenderer& other); // Not allowed!
77 const glu::RenderContext& m_context;
78 glu::ShaderProgram* m_program;
82 const bool m_blendFuncExt;
90 // Viewport coordinates (depth in range [0, 1]).
91 // In order (A.x, A.y), (A.x, B.y), (B.x, A.y), (B.x, B.y)
96 IntegerQuad (int windowWidth, int windowHeight)
98 , posB(windowWidth-1, windowHeight-1)
100 for (int i = 0; i < DE_LENGTH_OF_ARRAY(depth); i++)
108 for (int i = 0; i < DE_LENGTH_OF_ARRAY(depth); i++)
113 class ReferenceQuadRenderer
116 ReferenceQuadRenderer (void);
118 void render (const tcu::PixelBufferAccess& colorBuffer,
119 const tcu::PixelBufferAccess& depthBuffer,
120 const tcu::PixelBufferAccess& stencilBuffer,
121 const IntegerQuad& quad,
122 const rr::FragmentOperationState& state);
127 MAX_FRAGMENT_BUFFER_SIZE = 1024
130 void flushFragmentBuffer (const rr::MultisamplePixelBufferAccess& colorBuffer,
131 const rr::MultisamplePixelBufferAccess& depthBuffer,
132 const rr::MultisamplePixelBufferAccess& stencilBuffer,
133 rr::FaceType faceType,
134 const rr::FragmentOperationState& state);
136 rr::Fragment m_fragmentBuffer[MAX_FRAGMENT_BUFFER_SIZE];
137 float m_fragmentDepths[MAX_FRAGMENT_BUFFER_SIZE];
138 int m_fragmentBufferSize;
140 rr::FragmentProcessor m_fragmentProcessor;
144 // These functions take a normally-indexed 2d pixel buffer and return a pixel buffer access
145 // that indexes the same memory area, but using the multisample indexing convention.
146 tcu::PixelBufferAccess getMultisampleAccess(const tcu::PixelBufferAccess& original);
147 tcu::ConstPixelBufferAccess getMultisampleAccess(const tcu::ConstPixelBufferAccess& original);
153 #endif // _GLSFRAGMENTOPUTIL_HPP