namespace tcu
{
-const RGBA RGBA::red (0xFF, 0x0, 0x0, 0xFF);
-const RGBA RGBA::green (0x0, 0xFF, 0x0, 0xFF);
-const RGBA RGBA::blue (0x0, 0x0, 0xFF, 0xFF);
-const RGBA RGBA::gray (0x80, 0x80, 0x80, 0xFF);
-const RGBA RGBA::white (0xFF, 0xFF, 0xFF, 0xFF);
-const RGBA RGBA::black (0x0, 0x0, 0x0, 0xFF);
-
RGBA::RGBA (const Vec4& v)
{
const deUint32 r = (deUint32)floatToU8(v.x());
bool operator== (const RGBA& v) const { return (m_value == v.m_value); }
bool operator!= (const RGBA& v) const { return (m_value != v.m_value); }
- // Color constants
- const static RGBA red;
- const static RGBA green;
- const static RGBA blue;
- const static RGBA gray;
- const static RGBA white;
- const static RGBA black;
+ // Color constants. Designed as methods to avoid static-initialization-order fiasco.
+ static inline const RGBA red (void) { return RGBA(0xFF, 0x0, 0x0, 0xFF); }
+ static inline const RGBA green (void) { return RGBA(0x0, 0xFF, 0x0, 0xFF); }
+ static inline const RGBA blue (void) { return RGBA(0x0, 0x0, 0xFF, 0xFF); }
+ static inline const RGBA gray (void) { return RGBA(0x80, 0x80, 0x80, 0xFF); }
+ static inline const RGBA white (void) { return RGBA(0xFF, 0xFF, 0xFF, 0xFF); }
+ static inline const RGBA black (void) { return RGBA(0x0, 0x0, 0x0, 0xFF); }
private:
deUint32 m_value;
{
EGLint api = contexts[0].first;
EGLContext context = contexts[0].second;
- ClearOp clear (0, 0, width, height, RGBA::black);
+ ClearOp clear (0, 0, width, height, RGBA::black());
egl.makeCurrent(display, surface, surface, context);
EGLU_CHECK_MSG(egl, "eglMakeCurrent");
{
// First clear is always full-screen black.
if (threadNdx == 0 && packetNdx == 0 && clearNdx == 0)
- packet.clears[clearNdx] = ClearOp(0, 0, width, height, RGBA::black);
+ packet.clears[clearNdx] = ClearOp(0, 0, width, height, RGBA::black());
else
packet.clears[clearNdx] = computeRandomClear(rnd, width, height);
}
tcu::RGBA exampleColor;
tcu::IVec2 examplePos;
- tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toIVec());
+ tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toIVec());
m_testCtx.getLog() << tcu::TestLog::Message << "Verifying rendered image. Expecting color " << refColor << ", threshold " << colorThreshold << tcu::TestLog::EndMessage;
}
error = true;
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
}
}
float d = depthRangeTransform(triQuadInterpolate(xf, yf, m_depthCoord), m_zNear, m_zFar);
bool dpass = compare(m_compareFunc, d, constDepth*0.5f + 0.5f);
- referenceFrame.setPixel(x, y, dpass ? tcu::RGBA::green : tcu::RGBA::blue);
+ referenceFrame.setPixel(x, y, dpass ? tcu::RGBA::green() : tcu::RGBA::blue());
}
// Fill right half - comparison to interpolated depth
float d = depthRangeTransform(triQuadInterpolate(xf, yf, m_depthCoord), m_zNear, m_zFar);
bool dpass = compare(m_compareFunc, d, rd);
- referenceFrame.setPixel(x, y, dpass ? tcu::RGBA::green : tcu::RGBA::blue);
+ referenceFrame.setPixel(x, y, dpass ? tcu::RGBA::green() : tcu::RGBA::blue());
}
}
const tcu::RenderTarget& renderTarget = renderCtx.getRenderTarget();
// Clear surface to red.
- tcu::clear(dst.getAccess(), tcu::RGBA::red.toVec());
+ tcu::clear(dst.getAccess(), tcu::RGBA::red().toVec());
if (m_testDepth)
{
if (!checkColor(inputClr, renderedImg.getPixel(x, y), colorChoicesOk))
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
if (colorChoicesOk)
{
}
}
else
- errorMask.setPixel(x, y, tcu::RGBA::green);
+ errorMask.setPixel(x, y, tcu::RGBA::green());
}
}
{
if (!checkColor(quadColor, renderedImg.getPixel(x, y), colorChoicesOk))
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
if (colorChoicesOk)
{
}
}
else
- errorMask.setPixel(x, y, tcu::RGBA::green);
+ errorMask.setPixel(x, y, tcu::RGBA::green());
}
}
{
if (!tcu::compareThreshold(img.getPixel(x, y), refColor, tcu::RGBA(3, 3, 3, 3)))
{
- img.setPixel(x, y, tcu::RGBA::red);
+ img.setPixel(x, y, tcu::RGBA::red());
errorImg.setPixel(Vec4(1.0f, 0.0f, 0.0f, 1.0f), x, y);
}
}
for (int x = 0; x < clearedImg.getWidth(); x++)
{
const tcu::RGBA& clr = clearedImg.getPixel(x, y);
- if (clr != tcu::RGBA::black)
+ if (clr != tcu::RGBA::black())
{
log << TestLog::Message << "Failure: first non-black pixel, color " << clr << ", detected at coordinates (" << x << ", " << y << ")" << TestLog::EndMessage;
log << TestLog::Image("ClearedImg", "Image after clearing, erroneously non-black", clearedImg);
for (int y = 0; y < refImg.getHeight(); y++)
{
for (int x = 0; x < refImg.getWidth()/2; x++)
- refImg.setPixel(x, y, tcu::RGBA::green);
+ refImg.setPixel(x, y, tcu::RGBA::green());
for (int x = refImg.getWidth()/2; x < refImg.getWidth(); x++)
- refImg.setPixel(x, y, tcu::RGBA::blue);
+ refImg.setPixel(x, y, tcu::RGBA::blue());
}
// Compare
glu::readPixels(renderCtx, 0, 0, result.getAccess());
GLU_EXPECT_NO_ERROR(gl.getError(), "Reading pixels failed");
- isOk = compareSingleColor(m_testCtx.getLog(), result, tcu::RGBA::green, threshold);
+ isOk = compareSingleColor(m_testCtx.getLog(), result, tcu::RGBA::green(), threshold);
m_testCtx.setTestResult(isOk ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_FAIL,
isOk ? "Pass" : "Image comparison failed");
{
for (int x = 0; x < renderedImg.getWidth(); x++)
{
- if (renderedImg.getPixel(x, y) != tcu::RGBA::white)
+ if (renderedImg.getPixel(x, y) != tcu::RGBA::white())
numFailedPixels += 1;
}
}
const tcu::RGBA col = result.getPixel(x, y);
if (col.getGreen() == 255)
- errorMask.setPixel(x, y, tcu::RGBA::green);
+ errorMask.setPixel(x, y, tcu::RGBA::green());
else
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
error = true;
}
}
colorDiff.y() > formatThreshold.getGreen() + colorThreshold ||
colorDiff.z() > formatThreshold.getBlue() + colorThreshold)
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
error = true;
}
else
- errorMask.setPixel(x, y, tcu::RGBA::green);
+ errorMask.setPixel(x, y, tcu::RGBA::green());
}
// report error
// Check results
{
tcu::Surface errorMask (TEST_CANVAS_SIZE, TEST_CANVAS_SIZE);
- const tcu::RGBA badPixelColor = tcu::RGBA::red;
- const tcu::RGBA okPixelColor = tcu::RGBA::green;
+ const tcu::RGBA badPixelColor = tcu::RGBA::red();
+ const tcu::RGBA okPixelColor = tcu::RGBA::green();
int badPixels = 0;
m_testCtx.getLog() << tcu::TestLog::Message << "Checking passes have identical red and blue channels and the green channel is correct in the constant pass." << tcu::TestLog::EndMessage;
// Check results
{
tcu::Surface errorMask (TEST_CANVAS_SIZE, TEST_CANVAS_SIZE);
- const tcu::RGBA badPixelColor = tcu::RGBA::red;
- const tcu::RGBA okPixelColor = tcu::RGBA::green;
+ const tcu::RGBA badPixelColor = tcu::RGBA::red();
+ const tcu::RGBA okPixelColor = tcu::RGBA::green();
int badPixels = 0;
m_testCtx.getLog() << tcu::TestLog::Message << "Checking patterns are identical." << tcu::TestLog::EndMessage;
maxDiffDst = tcu::max(maxDiffDst, diff);
- errorMaskDst.setPixel(x, y, isOk ? tcu::RGBA::green : tcu::RGBA::red);
+ errorMaskDst.setPixel(x, y, isOk ? tcu::RGBA::green() : tcu::RGBA::red());
if (!isOk && firstFailedBlockCoordDst.x() == -1)
firstFailedBlockCoordDst = blockCoord;
tcu::RGBA exampleColor;
tcu::IVec2 examplePos;
- tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toIVec());
+ tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toIVec());
m_testCtx.getLog() << tcu::TestLog::Message << "Verifying rendered image. Expecting color " << refColor << ", threshold " << colorThreshold << tcu::TestLog::EndMessage;
}
error = true;
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
}
}
const tcu::RenderTarget& renderTarget = renderCtx.getRenderTarget();
// Clear surface to red.
- tcu::clear(dst.getAccess(), tcu::RGBA::red.toVec());
+ tcu::clear(dst.getAccess(), tcu::RGBA::red().toVec());
if (m_testDepth)
{
if (!checkColor(inputClr, renderedImg.getPixel(x, y), colorChoicesOk))
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
if (colorChoicesOk)
{
}
}
else
- errorMask.setPixel(x, y, tcu::RGBA::green);
+ errorMask.setPixel(x, y, tcu::RGBA::green());
}
}
{
if (!checkColor(quadColor, renderedImg.getPixel(x, y), colorChoicesOk))
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
if (colorChoicesOk)
{
}
}
else
- errorMask.setPixel(x, y, tcu::RGBA::green);
+ errorMask.setPixel(x, y, tcu::RGBA::green());
}
}
float d = m_evalFunc(Vec2(xf, yf));
bool dpass = compare(m_compareFunc, d, constDepth*0.5f + 0.5f);
- referenceFrame.setPixel(x, y, dpass ? tcu::RGBA::green : tcu::RGBA::blue);
+ referenceFrame.setPixel(x, y, dpass ? tcu::RGBA::green() : tcu::RGBA::blue());
}
// Fill right half - comparison to interpolated depth
float d = m_evalFunc(Vec2(xf, yf));
bool dpass = compare(m_compareFunc, d, rd);
- referenceFrame.setPixel(x, y, dpass ? tcu::RGBA::green : tcu::RGBA::blue);
+ referenceFrame.setPixel(x, y, dpass ? tcu::RGBA::green() : tcu::RGBA::blue());
}
}
if (!isValidColor)
{
- errorMask.setPixel(destinationArea.x() + dx, destinationArea.y() + dy, tcu::RGBA::red);
+ errorMask.setPixel(destinationArea.x() + dx, destinationArea.y() + dy, tcu::RGBA::red());
error = true;
}
}
if (resultSign != correctSign)
{
- errorMask.setPixel(destinationArea.x() + dx, destinationArea.y() + dy, tcu::RGBA::red);
+ errorMask.setPixel(destinationArea.x() + dx, destinationArea.y() + dy, tcu::RGBA::red());
error = true;
}
}
{
if (!tcu::compareThreshold(img.getPixel(x, y), refColor, tcu::RGBA(3, 3, 3, 3)))
{
- img.setPixel(x, y, tcu::RGBA::red);
+ img.setPixel(x, y, tcu::RGBA::red());
errorImg.setPixel(Vec4(1.0f, 0.0f, 0.0f, 1.0f), x, y);
}
}
for (int x = 0; x < clearedImg.getWidth(); x++)
{
const tcu::RGBA& clr = clearedImg.getPixel(x, y);
- if (clr != tcu::RGBA::black)
+ if (clr != tcu::RGBA::black())
{
log << TestLog::Message << "Failure: first non-black pixel, color " << clr << ", detected at coordinates (" << x << ", " << y << ")" << TestLog::EndMessage;
log << TestLog::Image("ClearedImg", "Image after clearing, erroneously non-black", clearedImg);
for (int y = 0; y < refImg.getHeight(); y++)
{
for (int x = 0; x < refImg.getWidth()/2; x++)
- refImg.setPixel(x, y, tcu::RGBA::green);
+ refImg.setPixel(x, y, tcu::RGBA::green());
for (int x = refImg.getWidth()/2; x < refImg.getWidth(); x++)
- refImg.setPixel(x, y, tcu::RGBA::blue);
+ refImg.setPixel(x, y, tcu::RGBA::blue());
}
// Compare
<< ", at x = " << x << ", y = " << y
<< TestLog::EndMessage;
numFailedPixels += 1;
- errorMask.setPixel(tcu::RGBA::red.toVec(), x, y);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), x, y);
}
}
}
// Verify
{
tcu::Surface errorMask(result.getWidth(), result.getHeight());
- tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toVec());
+ tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toVec());
const bool isOk = verify(result.getAccess(), errorMask.getAccess());
glu::readPixels(renderCtx, 0, 0, result.getAccess());
GLU_EXPECT_NO_ERROR(gl.getError(), "Reading pixels failed");
- isOk = compareSingleColor(m_testCtx.getLog(), result, tcu::RGBA::green, threshold);
+ isOk = compareSingleColor(m_testCtx.getLog(), result, tcu::RGBA::green(), threshold);
m_testCtx.setTestResult(isOk ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_FAIL,
isOk ? "Pass" : "Image comparison failed");
gl.drawBuffers(DE_LENGTH_OF_ARRAY(drawBuffers), &drawBuffers[0]);
}
- gl.clearBufferfv(GL_COLOR, 0, tcu::RGBA::red.toVec().getPtr());
- gl.clearBufferfv(GL_COLOR, 1, tcu::RGBA::red.toVec().getPtr());
+ gl.clearBufferfv(GL_COLOR, 0, tcu::RGBA::red().toVec().getPtr());
+ gl.clearBufferfv(GL_COLOR, 1, tcu::RGBA::red().toVec().getPtr());
gl.viewport (0, 0, width, height);
gl.useProgram (program.getProgram());
glu::readPixels(renderCtx, 0, 0, result.getAccess());
GLU_EXPECT_NO_ERROR(gl.getError(), "Reading pixels failed");
- if (!compareSingleColor(m_testCtx.getLog(), result, ndx == 0 ? tcu::RGBA::green : tcu::RGBA::red, threshold))
+ if (!compareSingleColor(m_testCtx.getLog(), result, ndx == 0 ? tcu::RGBA::green() : tcu::RGBA::red(), threshold))
allOk = false;
}
{
for (int x = 0; x < renderedImg.getWidth(); x++)
{
- if (renderedImg.getPixel(x, y) != tcu::RGBA::white)
+ if (renderedImg.getPixel(x, y) != tcu::RGBA::white())
numFailedPixels += 1;
}
}
const tcu::RGBA col = result.getPixel(x, y);
if (col.getGreen() == 255)
- errorMask.setPixel(x, y, tcu::RGBA::green);
+ errorMask.setPixel(x, y, tcu::RGBA::green());
else
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
error = true;
}
}
colorDiff.y() > formatThreshold.getGreen() + colorThreshold ||
colorDiff.z() > formatThreshold.getBlue() + colorThreshold)
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
error = true;
}
else
- errorMask.setPixel(x, y, tcu::RGBA::green);
+ errorMask.setPixel(x, y, tcu::RGBA::green());
}
// report error
// Check results
{
tcu::Surface errorMask (TEST_CANVAS_SIZE, TEST_CANVAS_SIZE);
- const tcu::RGBA badPixelColor = tcu::RGBA::red;
- const tcu::RGBA okPixelColor = tcu::RGBA::green;
+ const tcu::RGBA badPixelColor = tcu::RGBA::red();
+ const tcu::RGBA okPixelColor = tcu::RGBA::green();
int badPixels = 0;
m_testCtx.getLog() << tcu::TestLog::Message << "Checking passes have identical red and blue channels and the green channel is correct in the constant pass." << tcu::TestLog::EndMessage;
// Check results
{
tcu::Surface errorMask (TEST_CANVAS_SIZE, TEST_CANVAS_SIZE);
- const tcu::RGBA badPixelColor = tcu::RGBA::red;
- const tcu::RGBA okPixelColor = tcu::RGBA::green;
+ const tcu::RGBA badPixelColor = tcu::RGBA::red();
+ const tcu::RGBA okPixelColor = tcu::RGBA::green();
int badPixels = 0;
m_testCtx.getLog() << tcu::TestLog::Message << "Checking patterns are identical." << tcu::TestLog::EndMessage;
if (logging)
m_testCtx.getLog() << tcu::TestLog::Message << "Expecting all pixels with distance less or equal to (about) " << barLength << " pixels from left border to be of color " << barColor.swizzle(0,1,2) << "." << tcu::TestLog::EndMessage;
- tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toIVec());
+ tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toIVec());
for (int y = 0; y < layer.getHeight(); ++y)
for (int x = 0; x < layer.getWidth(); ++x)
allPixelsOk &= isOk;
if (!isOk)
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
}
if (allPixelsOk)
if (error)
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
anyError = true;
}
}
if (error)
{
anyError = true;
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
}
}
if (error)
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
anyError = true;
}
}
tcu::Surface errorMask (withoutBBox.getWidth(), withoutBBox.getHeight());
bool anyError = false;
- tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toIVec());
+ tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toIVec());
for (int y = 0; y < withoutBBox.getHeight(); ++y)
for (int x = 0; x < withoutBBox.getWidth(); ++x)
{
if (withoutBBox.getPixelInt(x, y) != withBBox.getPixelInt(x, y))
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
anyError = true;
}
}
tcu::Surface errorMask (result.getWidth(), result.getHeight());
bool anyError = false;
- tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toIVec());
+ tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toIVec());
for (int y = 0; y < result.getHeight(); ++y)
for (int x = 0; x < result.getWidth(); ++x)
// allow green, yellow and any shade between
if (pixel[1] != 255 || pixel[2] != 0)
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
anyError = true;
}
}
tcu::Surface errorMask (result.getWidth(), result.getHeight());
bool anyError = false;
- tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toIVec());
+ tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toIVec());
for (int y = 0; y < result.getHeight(); ++y)
for (int x = 0; x < result.getWidth(); ++x)
if ((insideMeshArea && (pixel[1] != 255 || pixel[2] != 0)) ||
(outsideMeshArea && (pixel[0] != 0 || pixel[1] != 0 || pixel[2] != 0)))
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
anyError = true;
}
}
{
for (int x = 0; x < renderedImg.getWidth(); x++)
{
- if (renderedImg.getPixel(x, y) != tcu::RGBA::green)
+ if (renderedImg.getPixel(x, y) != tcu::RGBA::green())
numFailedPixels += 1;
}
}
if (!verifier.verify(color, tcu::IVec2(x,y)))
{
error = true;
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
}
}
samplePosNotUnique = true;
uniquenessOk = false;
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
}
}
}
}
distibutionError = true;
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
}
}
maskNdxNotUnique = true;
uniquenessOk = false;
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
}
}
}
// Color must be a linear combination of green and yellow
if (color.getGreen() < 255 - threshold || color.getBlue() > threshold)
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
foundError = true;
}
}
tcu::clear(dst.getAccess(), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
for (int i = 0; i < (int)coords.size(); i++)
- drawTessCoordPoint(dst, primitiveType, coords[i], tcu::RGBA::white, 2);
+ drawTessCoordPoint(dst, primitiveType, coords[i], tcu::RGBA::white(), 2);
}
static int binarySearchFirstVec3WithXAtLeast (const vector<Vec3>& sorted, float x)
drawTessCoordVisualization(resVisual, primitiveType, resCoords);
// Check that all points in reference also exist in result.
- success = oneWayComparePointSets(log, refVisual, primitiveType, refCoords, resCoords, "reference", "result", tcu::RGBA::blue) && success;
+ success = oneWayComparePointSets(log, refVisual, primitiveType, refCoords, resCoords, "reference", "result", tcu::RGBA::blue()) && success;
// Check that all points in result also exist in reference.
- success = oneWayComparePointSets(log, resVisual, primitiveType, resCoords, refCoords, "result", "reference", tcu::RGBA::red) && success;
+ success = oneWayComparePointSets(log, resVisual, primitiveType, resCoords, refCoords, "result", "reference", tcu::RGBA::red()) && success;
if (!success)
{
for (int y = 0; y < rendered.getHeight(); y++)
for (int x = 0; x < rendered.getWidth(); x++)
{
- numWhitePixels += rendered.getPixel(x, y) == tcu::RGBA::white ? 1 : 0;
- numRedPixels += rendered.getPixel(x, y) == tcu::RGBA::red ? 1 : 0;
+ numWhitePixels += rendered.getPixel(x, y) == tcu::RGBA::white() ? 1 : 0;
+ numRedPixels += rendered.getPixel(x, y) == tcu::RGBA::red() ? 1 : 0;
}
DE_ASSERT(numWhitePixels + numRedPixels <= totalNumPixels);
for (int y = 0; y < rendered.getHeight(); y++)
for (int x = 0; x < rendered.getWidth(); x++)
{
- if (rendered.getPixel(x, y) != tcu::RGBA::white)
+ if (rendered.getPixel(x, y) != tcu::RGBA::white())
{
log << TestLog::Message << "Failure: expected all white pixels" << TestLog::EndMessage;
m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Image verification failed");
if (isMSAA)
{
- if (pixels.getPixel(x, y) != tcu::RGBA::black)
+ if (pixels.getPixel(x, y) != tcu::RGBA::black())
pixelOk = true;
}
else
{
- if (pixels.getPixel(x, y) == tcu::RGBA::white)
+ if (pixels.getPixel(x, y) == tcu::RGBA::white())
pixelOk = true;
}
}
{
if (y > lastWhitePixelRow || (y > secondToLastWhitePixelRow && x > lastWhitePixelColumnOnSecondToLastWhitePixelRow))
{
- if (pixels.getPixel(x, y) != tcu::RGBA::black)
+ if (pixels.getPixel(x, y) != tcu::RGBA::black())
{
log << TestLog::Message << "Failure: expected all pixels to be black in the area "
<< (lastWhitePixelColumnOnSecondToLastWhitePixelRow < pixels.getWidth()-1
tcu::Surface errorMask (renderedFrame.getWidth(), renderedFrame.getHeight());
int numFailedPixels = 0;
- tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toVec());
+ tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toVec());
for (int py = 0; py < reference.getHeight(); ++py)
for (int px = 0; px < reference.getWidth(); ++px)
{
if (!tcu::isGatherOffsetsResultValid(effectiveView, samplerParams.sampler, lookupPrecision, texCoord, 0, glu::getDefaultGatherOffsets(), resultValue))
{
- errorMask.setPixel(px, py, tcu::RGBA::red);
+ errorMask.setPixel(px, py, tcu::RGBA::red());
++numFailedPixels;
}
}
int numFailedPixels = 0;
bool lowQuality = false;
- tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toVec());
+ tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toVec());
for (int py = 0; py < reference.getHeight(); ++py)
for (int px = 0; px < reference.getWidth(); ++px)
// fall back to low quality verification
if (!tcu::isGatherOffsetsCompareResultValid(effectiveView, samplerParams.sampler, lowQualityTexComparePrecision, texCoord, glu::getDefaultGatherOffsets(), refZ, resultValue))
{
- errorMask.setPixel(px, py, tcu::RGBA::red);
+ errorMask.setPixel(px, py, tcu::RGBA::red());
++numFailedPixels;
}
}
tcu::Surface errorMask (width, height);
bool success = true;
- tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toVec());
+ tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toVec());
for (int py = 0; py < height; py++)
for (int px = 0; px < width; px++)
{
if (!isGatherOffsetsResultValid(texture, sampler, lookupPrec, texCoord, componentNdx, offsets, resultPix))
{
- errorMask.setPixel(px, py, tcu::RGBA::red);
+ errorMask.setPixel(px, py, tcu::RGBA::red());
success = false;
}
}
tcu::Surface errorMask (width, height);
bool success = true;
- tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toVec());
+ tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toVec());
for (int py = 0; py < height; py++)
for (int px = 0; px < width; px++)
{
if (!isGatherOffsetsCompareResultValid(texture, sampler, compPrec, texCoord, offsets, refZ, resultPix))
{
- errorMask.setPixel(px, py, tcu::RGBA::red);
+ errorMask.setPixel(px, py, tcu::RGBA::red());
success = false;
}
}
tcu::Surface errorMask (width, height);
bool success = true;
- tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toVec());
+ tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toVec());
tcu::clear(idealAccess, refColor);
for (int py = 0; py < height; py++)
{
if (result.getPixel(px, py) != refColor)
{
- errorMask.setPixel(px, py, tcu::RGBA::red);
+ errorMask.setPixel(px, py, tcu::RGBA::red());
success = false;
}
}
tcu::Surface errorMask (m_canvasSize, m_canvasSize);
bool error = false;
- tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toVec());
+ tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toVec());
// Draw sample:
// Sample sampleNdx is set to red channel
if (color.getGreen() != 0)
{
error = true;
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
}
// enabled sample was not written to
else if (color.getRed() != 255 && !allowMissingCoverage)
{
error = true;
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
}
}
// Color must be a linear combination of green and yellow
if (color.getGreen() < 255 - threshold || color.getBlue() > threshold)
{
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
foundError = true;
}
}
for (int x = 0; x < referenceLineMap.getWidth(); ++x)
{
const bool reference = referenceLineMap.getAccess().getPixelInt(x, y).x() != 0;
- const bool result = compareColors(surface.getPixel(x, y), tcu::RGBA::white, args.redBits, args.greenBits, args.blueBits);
+ const bool result = compareColors(surface.getPixel(x, y), tcu::RGBA::white(), args.redBits, args.greenBits, args.blueBits);
if (reference)
++referenceFragments;
for (int dy = -1; dy < 2 && !foundFragment; ++dy)
for (int dx = -1; dx < 2 && !foundFragment; ++dx)
{
- if (compareColors(surface.getPixel(x+dx, y+dy), tcu::RGBA::white, args.redBits, args.greenBits, args.blueBits))
+ if (compareColors(surface.getPixel(x+dx, y+dy), tcu::RGBA::white(), args.redBits, args.greenBits, args.blueBits))
foundFragment = true;
}
if (!foundFragment)
{
missingFragments = true;
- errorMask.setPixel(x, y, tcu::RGBA::red);
+ errorMask.setPixel(x, y, tcu::RGBA::red());
}
}
}
for (int y = 0; y < surface.getHeight(); ++y)
for (int x = 0; x < surface.getWidth(); ++x)
if (referenceLineMap.getAccess().getPixelInt(x, y).x())
- reference.setPixel(x, y, tcu::RGBA::white);
+ reference.setPixel(x, y, tcu::RGBA::white());
log << tcu::TestLog::Message << "Invalid fragment count in result image." << tcu::TestLog::EndMessage;
log << tcu::TestLog::ImageSet("Verification result", "Result of rendering")
for (int x = 1; x < referenceLineMap.getWidth() - 1; ++x)
{
- const bool result = compareColors(surface.getPixel(x, y), tcu::RGBA::white, args.redBits, args.greenBits, args.blueBits);
+ const bool result = compareColors(surface.getPixel(x, y), tcu::RGBA::white(), args.redBits, args.greenBits, args.blueBits);
int lineID = 0;
// Which line does this fragment belong to?
for (int y = 1; y < referenceLineMap.getHeight() - 1; ++y)
{
- const bool result = compareColors(surface.getPixel(x, y), tcu::RGBA::white, args.redBits, args.greenBits, args.blueBits);
+ const bool result = compareColors(surface.getPixel(x, y), tcu::RGBA::white(), args.redBits, args.greenBits, args.blueBits);
int lineID = 0;
// Which line does this fragment belong to?
}
// background color is possible?
- if (lineSurroundingCoverage == 0 && compareColors(color, tcu::RGBA::black, args.redBits, args.greenBits, args.blueBits))
+ if (lineSurroundingCoverage == 0 && compareColors(color, tcu::RGBA::black(), args.redBits, args.greenBits, args.blueBits))
continue;
// Check those lines
}
// background color is possible?
- if (lineSurroundingCoverage == 0 && compareColors(color, tcu::RGBA::black, args.redBits, args.greenBits, args.blueBits))
+ if (lineSurroundingCoverage == 0 && compareColors(color, tcu::RGBA::black(), args.redBits, args.greenBits, args.blueBits))
continue;
// Check those lines
tcu::Vec2( 0, +1),
};
- tcu::clear(errorMask, tcu::RGBA::green.toVec());
+ tcu::clear(errorMask, tcu::RGBA::green().toVec());
for (int py = 0; py < result.getHeight(); py++)
{
if (!isOk)
{
- errorMask.setPixel(tcu::RGBA::red.toVec(), px, py);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
numFailed += 1;
}
}
tcu::Vec2( 0, +1),
};
- tcu::clear(errorMask, tcu::RGBA::green.toVec());
+ tcu::clear(errorMask, tcu::RGBA::green().toVec());
for (int py = 0; py < result.getHeight(); py++)
{
if (!isOk)
{
- errorMask.setPixel(tcu::RGBA::red.toVec(), px, py);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
numFailed += 1;
}
}
tcu::Vec2(+1, +1),
};
- tcu::clear(errorMask, tcu::RGBA::green.toVec());
+ tcu::clear(errorMask, tcu::RGBA::green().toVec());
for (int py = 0; py < result.getHeight(); py++)
{
if (!isOk)
{
- errorMask.setPixel(tcu::RGBA::red.toVec(), px, py);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
numFailed += 1;
}
}
tcu::Vec2( 0, +1),
};
- tcu::clear(errorMask, tcu::RGBA::green.toVec());
+ tcu::clear(errorMask, tcu::RGBA::green().toVec());
for (int py = 0; py < result.getHeight(); py++)
{
if (!isOk)
{
- errorMask.setPixel(tcu::RGBA::red.toVec(), px, py);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
numFailed += 1;
}
}
tcu::Vec2( 0, +1),
};
- tcu::clear(errorMask, tcu::RGBA::green.toVec());
+ tcu::clear(errorMask, tcu::RGBA::green().toVec());
for (int py = 0; py < result.getHeight(); py++)
{
if (!isOk)
{
- errorMask.setPixel(tcu::RGBA::red.toVec(), px, py);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
numFailed += 1;
}
}
tcu::Vec2( 0, +1),
};
- tcu::clear(errorMask, tcu::RGBA::green.toVec());
+ tcu::clear(errorMask, tcu::RGBA::green().toVec());
for (int py = 0; py < result.getHeight(); py++)
{
if (!isOk)
{
- errorMask.setPixel(tcu::RGBA::red.toVec(), px, py);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
numFailed += 1;
}
}
tcu::Vec2(+1, +1),
};
- tcu::clear(errorMask, tcu::RGBA::green.toVec());
+ tcu::clear(errorMask, tcu::RGBA::green().toVec());
for (int py = 0; py < result.getHeight(); py++)
{
if (!isOk)
{
- errorMask.setPixel(tcu::RGBA::red.toVec(), px, py);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
numFailed += 1;
}
}
tcu::Vec2( 0, +1),
};
- tcu::clear(errorMask, tcu::RGBA::green.toVec());
+ tcu::clear(errorMask, tcu::RGBA::green().toVec());
for (int py = 0; py < result.getHeight(); py++)
{
// Other channels should trivially match to reference.
if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(refPix.swizzle(1,2,3) - resPix.swizzle(1,2,3)), nonShadowThreshold)))
{
- errorMask.setPixel(tcu::RGBA::red.toVec(), px, py);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
numFailed += 1;
continue;
}
if (!isOk)
{
- errorMask.setPixel(tcu::RGBA::red.toVec(), px, py);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
numFailed += 1;
}
}
tcu::Vec2( 0, +1),
};
- tcu::clear(errorMask, tcu::RGBA::green.toVec());
+ tcu::clear(errorMask, tcu::RGBA::green().toVec());
for (int py = 0; py < result.getHeight(); py++)
{
// Other channels should trivially match to reference.
if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(refPix.swizzle(1,2,3) - resPix.swizzle(1,2,3)), nonShadowThreshold)))
{
- errorMask.setPixel(tcu::RGBA::red.toVec(), px, py);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
numFailed += 1;
continue;
}
if (!isOk)
{
- errorMask.setPixel(tcu::RGBA::red.toVec(), px, py);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
numFailed += 1;
}
}
tcu::Vec2( 0, +1),
};
- tcu::clear(errorMask, tcu::RGBA::green.toVec());
+ tcu::clear(errorMask, tcu::RGBA::green().toVec());
for (int py = 0; py < result.getHeight(); py++)
{
// Other channels should trivially match to reference.
if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(refPix.swizzle(1,2,3) - resPix.swizzle(1,2,3)), nonShadowThreshold)))
{
- errorMask.setPixel(tcu::RGBA::red.toVec(), px, py);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
numFailed += 1;
continue;
}
if (!isOk)
{
- errorMask.setPixel(tcu::RGBA::red.toVec(), px, py);
+ errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
numFailed += 1;
}
}
const float cy = (float(y)+0.5f) / dstH * srcH;
const bool isOk = tcu::isLinearSampleResultValid(src, sampler, lookupPrec, tcu::Vec2(cx, cy), 0, result);
- errorMask.setPixel(isOk ? tcu::RGBA::green.toVec() : tcu::RGBA::red.toVec(), x, y);
+ errorMask.setPixel(isOk ? tcu::RGBA::green().toVec() : tcu::RGBA::red().toVec(), x, y);
if (!isOk)
numFailed += 1;
}
const float cy = deFloatFloor(float(y) / dstH * srcH) + 1.0f;
const bool isOk = tcu::isLinearSampleResultValid(src, sampler, lookupPrec, tcu::Vec2(cx, cy), 0, result);
- errorMask.setPixel(isOk ? tcu::RGBA::green.toVec() : tcu::RGBA::red.toVec(), x, y);
+ errorMask.setPixel(isOk ? tcu::RGBA::green().toVec() : tcu::RGBA::red().toVec(), x, y);
if (!isOk)
numFailed += 1;
}
isOk = boolAll(logicalAnd(lessThanEqual(minVal, result), lessThanEqual(result, maxVal)));
- errorMask.setPixel(isOk ? tcu::RGBA::green.toVec() : tcu::RGBA::red.toVec(), x, y);
+ errorMask.setPixel(isOk ? tcu::RGBA::green().toVec() : tcu::RGBA::red().toVec(), x, y);
if (!isOk)
numFailed += 1;
}
{
for (int x = 0; x < pixels.getWidth(); x++)
{
- if (pixels.getPixel(x, y) != tcu::RGBA::white)
+ if (pixels.getPixel(x, y) != tcu::RGBA::white())
numFailedPixels += 1;
}
}