Lines Matching +full:test +full:. +full:rgb
8 * you may not use this file except in compliance with the License.
11 * http://www.apache.org/licenses/LICENSE-2.0
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * limitations under the License.
21 * \brief Blend tests.
24 #include "es3fBlendTests.hpp"
25 #include "gluStrUtil.hpp"
26 #include "glsFragmentOpUtil.hpp"
27 #include "gluPixelTransfer.hpp"
28 #include "tcuPixelFormat.hpp"
29 #include "tcuTexture.hpp"
30 #include "tcuTextureUtil.hpp"
31 #include "tcuImageCompare.hpp"
32 #include "tcuRenderTarget.hpp"
33 #include "tcuTestLog.hpp"
34 #include "deRandom.hpp"
35 #include "rrFragmentOperations.hpp"
36 #include "sglrReferenceUtils.hpp"
41 #include "glw.h"
69 // pixels.
72 const int width = src.getWidth(); in sRGBAToLinear()
73 const int height = src.getHeight(); in sRGBAToLinear()
77 dst.setPixel(tcu::sRGBToLinear(src.getPixel(x, y)), x, y); in sRGBAToLinear()
163 , m_renderWidth (m_useSrgbFbo ? 2*MAX_VIEWPORT_WIDTH : m_context.getRenderTarget().getWidth()) in BlendCase()
164 , m_renderHeight (m_useSrgbFbo ? 2*MAX_VIEWPORT_HEIGHT : m_context.getRenderTarget().getHeight()) in BlendCase()
168 DE_ASSERT(!m_paramSets.empty()); in BlendCase()
173 bool useRGB = !m_useSrgbFbo && m_context.getRenderTarget().getPixelFormat().alphaBits == 0; in init()
183 …DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(m_firstQuad.color) == DE_LENGTH_OF_ARRAY(m_firstQuadInt.color)… in init()
184 for (int i = 0; i < DE_LENGTH_OF_ARRAY(m_firstQuad.color); i++) in init()
186 m_firstQuad.color[i] = (baseGradientColors[i] - 0.5f) * 0.2f + 0.5f; in init()
187 m_firstQuadInt.color[i] = m_firstQuad.color[i]; in init()
189 m_secondQuad.color[i] = (Vec4(1.0f) - baseGradientColors[i] - 0.5f) * 1.0f + 0.5f; in init()
190 m_secondQuadInt.color[i] = m_secondQuad.color[i]; in init()
196 m_firstQuadInt.posA = tcu::IVec2(0, 0); in init()
197 m_secondQuadInt.posA = tcu::IVec2(0, 0); in init()
198 m_firstQuadInt.posB = tcu::IVec2(m_viewportWidth-1, m_viewportHeight-1); in init()
199 m_secondQuadInt.posB = tcu::IVec2(m_viewportWidth-1, m_viewportHeight-1); in init()
205 m_renderer = new QuadRenderer(m_context.getRenderContext(), glu::GLSL_VERSION_300_ES); in init()
207 …extureFormat(m_useSrgbFbo ? TextureFormat::sRGBA : useRGB ? TextureFormat::RGB : TextureFormat::RG… in init()
214 …m_testCtx.getLog() << TestLog::Message << "Using FBO of size (" << m_renderWidth << ", " << m_rend… in init()
259 int viewportX = rnd.getInt(0, m_renderWidth - m_viewportWidth); in iterate()
260 int viewportY = rnd.getInt(0, m_renderHeight - m_viewportHeight); in iterate()
262 TextureLevel referenceImg (renderedImg.getFormat(), m_viewportWidth, m_viewportHeight); in iterate()
263 TestLog& log (m_testCtx.getLog()); in iterate()
267 // Log the blend parameters. in iterate()
269 …log << TestLog::Message << "RGB equation = " << getBlendEquationName(paramSet.equationRGB) << Test… in iterate()
270 …log << TestLog::Message << "RGB src func = " << getBlendFactorName(paramSet.srcFuncRGB) << TestLog… in iterate()
271 …log << TestLog::Message << "RGB dst func = " << getBlendFactorName(paramSet.dstFuncRGB) << TestLog… in iterate()
272 …log << TestLog::Message << "Alpha equation = " << getBlendEquationName(paramSet.equationAlpha) << … in iterate()
273 …log << TestLog::Message << "Alpha src func = " << getBlendFactorName(paramSet.srcFuncAlpha) << Tes… in iterate()
274 …log << TestLog::Message << "Alpha dst func = " << getBlendFactorName(paramSet.dstFuncAlpha) << Tes… in iterate()
275 …r = (" << paramSet.blendColor.x() << ", " << paramSet.blendColor.y() << ", " << paramSet.blendColo… in iterate()
277 // Set GL state. in iterate()
279 GLU_CHECK_CALL(glBlendEquationSeparate(paramSet.equationRGB, paramSet.equationAlpha)); in iterate()
280 …GLU_CHECK_CALL(glBlendFuncSeparate(paramSet.srcFuncRGB, paramSet.dstFuncRGB, paramSet.srcFuncAlpha… in iterate()
281 …_CHECK_CALL(glBlendColor(paramSet.blendColor.x(), paramSet.blendColor.y(), paramSet.blendColor.z()… in iterate()
283 // Set reference state. in iterate()
285 referenceState.blendRGBState.equation = sglr::rr_util::mapGLBlendEquation(paramSet.equationRGB); in iterate()
286 referenceState.blendRGBState.srcFunc = sglr::rr_util::mapGLBlendFunc(paramSet.srcFuncRGB); in iterate()
287 referenceState.blendRGBState.dstFunc = sglr::rr_util::mapGLBlendFunc(paramSet.dstFuncRGB); in iterate()
288 referenceState.blendAState.equation = sglr::rr_util::mapGLBlendEquation(paramSet.equationAlpha); in iterate()
289 referenceState.blendAState.srcFunc = sglr::rr_util::mapGLBlendFunc(paramSet.srcFuncAlpha); in iterate()
290 referenceState.blendAState.dstFunc = sglr::rr_util::mapGLBlendFunc(paramSet.dstFuncAlpha); in iterate()
291 referenceState.blendColor = paramSet.blendColor; in iterate()
293 // Render with GL. in iterate()
302 // Render reference. in iterate()
306 referenceState.blendMode = rr::BLENDMODE_NONE; in iterate()
308 referenceState.blendMode = rr::BLENDMODE_STANDARD; in iterate()
314 // Read GL image. in iterate()
316 glu::readPixels(m_context.getRenderContext(), viewportX, viewportY, renderedImg.getAccess()); in iterate()
318 // Compare images. in iterate()
319 // \note In sRGB cases, convert to linear space for comparison. in iterate()
327 … ? tcu::PixelFormat(8, 8, 8, 8) : m_context.getRenderTarget().getPixelFormat()).getColorThreshold(… in iterate()
328 … // \note Non-scientific ad hoc formula. Need big threshold when few color bits; blending brings e… in iterate()
330 …bool comparePass = tcu::intThresholdCompare(m_testCtx.getLog(), "CompareResult", "Image Comparison… in iterate()
331 referenceImg.getAccess(), renderedImg.getAccess(), in iterate()
334 // Fail now if images don't match. in iterate()
338 m_context.getTestContext().setTestResult(QP_TEST_RESULT_FAIL, "Image compare failed"); in iterate()
342 // Continue if param sets still remain in m_paramSets; otherwise stop. in iterate()
346 if (m_curParamSetNdx < (int)m_paramSets.size()) in iterate()
350 m_context.getTestContext().setTestResult(QP_TEST_RESULT_PASS, "Passed"); in iterate()
408 …// Test all blend equation, src blend function, dst blend function combinations. RGB and alpha mod… in init()
422 …if ((eq.glValue == GL_MIN || eq.glValue == GL_MAX) && (srcFuncNdx > 0 || dstFuncNdx > 0)) // MIN a… in init()
425 string name = eq.nameStr; in init()
427 "Equations " + getBlendEquationName(eq.glValue) + in init()
428 ", src funcs " + getBlendFactorName(src.glValue) + in init()
429 ", dst funcs " + getBlendFactorName(dst.glValue); in init()
431 if (eq.glValue != GL_MIN && eq.glValue != GL_MAX) in init()
432 name += string("") + "_" + src.nameStr + "_" + dst.nameStr; in init()
435 …paramSets.push_back(BlendParams(eq.glValue, src.glValue, dst.glValue, eq.glValue, src.glValue, dst… in init()
437 …group->addChild(new BlendCase(m_context, name.c_str(), description.c_str(), paramSets, useSrgbFbo)… in init()
441 // Test all RGB src, alpha src and RGB dst, alpha dst combinations. Equations are ADD. in init()
442 …// \note For all RGB src, alpha src combinations, also test a couple of different RGBA dst functio… in init()
445 …oup = new TestCaseGroup(m_context, "rgb_func_alpha_func", "Combinations of RGB and Alpha Functions… in init()
462 string name = string("") + funcRGB.nameStr + "_" + funcAlpha.nameStr; in init()
464 "RGB " + dstOrSrcStr + " func " + getBlendFactorName(funcRGB.glValue) + in init()
465 ", alpha " + dstOrSrcStr + " func " + getBlendFactorName(funcAlpha.glValue); in init()
467 // First, make param sets as if this was a src case. in init()
470 …paramSets.push_back(BlendParams(GL_FUNC_ADD, funcRGB.glValue, GL_ONE, GL_FUNC_ADD, funcAlpha.glV… in init()
471 …paramSets.push_back(BlendParams(GL_FUNC_ADD, funcRGB.glValue, GL_ZERO, GL_FUNC_ADD, funcAlpha.gl… in init()
472 …paramSets.push_back(BlendParams(GL_FUNC_ADD, funcRGB.glValue, GL_SRC_COLOR, GL_FUNC_ADD, funcAlph… in init()
473 …paramSets.push_back(BlendParams(GL_FUNC_ADD, funcRGB.glValue, GL_DST_COLOR, GL_FUNC_ADD, funcAlph… in init()
475 // Swap src and dst params if this is a dst case. in init()
479 for (int i = 0; i < (int)paramSets.size(); i++) in init()
481 std::swap(paramSets[i].srcFuncRGB, paramSets[i].dstFuncRGB); in init()
482 std::swap(paramSets[i].srcFuncAlpha, paramSets[i].dstFuncAlpha); in init()
486 …curGroup->addChild(new BlendCase(m_context, name.c_str(), description.c_str(), paramSets, useSrgbF… in init()
490 // Test all RGB and alpha equation combinations. Src and dst funcs are ONE for both. in init()
493 …w TestCaseGroup(m_context, "rgb_equation_alpha_equation", "Combinations of RGB and Alpha Equation … in init()
502 string name = string("") + eqRGB.nameStr + "_" + eqAlpha.nameStr; in init()
504 "RGB equation " + getBlendEquationName(eqRGB.glValue) + in init()
505 ", alpha equation " + getBlendEquationName(eqAlpha.glValue); in init()
508 …paramSets.push_back(BlendParams(eqRGB.glValue, GL_ONE, GL_ONE, eqAlpha.glValue, GL_ONE, GL_ONE, de… in init()
510 …group->addChild(new BlendCase(m_context, name.c_str(), description.c_str(), paramSets, useSrgbFbo)… in init()