Either<int, TestClassWithConstructor> either (intValue);
const Either<int, TestClassWithConstructor> otherEither (testObject);
-
- either = testObject;
+ either = otherEither;
TCU_CHECK(!either.isFirst());
TCU_CHECK(either.isSecond());
template <typename T, int Size>
inline Vector<T, Size> refract (const Vector<T, Size>& i, const Vector<T, Size>& n, T eta)
{
- Vector<T, Size> res;
T cosAngle = dot(n, i);
T k = T(1) - eta * eta * (T(1) - cosAngle * cosAngle);
if (k < T(0))
{
const int fragSampleNdx = regSampleNdx % numSamplesPerFragment;
const Fragment& frag = inputFragments[fragNdxOffset + regSampleNdx/numSamplesPerFragment];
- Vec4 combinedColor;
deUint8* dstPtr = basePtr + fragSampleNdx*fragStride + frag.pixelCoord.x()*xStride + frag.pixelCoord.y()*yStride;
dstPtr[0] = tcu::floatToU8(m_sampleRegister[regSampleNdx].blendedRGB.x());
// Bounding box \note: with wide lines, the line is actually moved as in the spec
const deInt32 lineWidthPixels = (lineWidth > 1.0f) ? (deInt32)floor(lineWidth + 0.5f) : 1;
- const tcu::IVec2 minorDirection = (isXMajor ? tcu::IVec2(0, 1) : tcu::IVec2(1, 0));
const tcu::Vector<deInt64,2> widthOffset = (isXMajor ? tcu::Vector<deInt64,2>(0, -1) : tcu::Vector<deInt64,2>(-1, 0)) * (toSubpixelCoord(lineWidthPixels - 1) / 2);
const deInt64 x0 = toSubpixelCoord(v0.x()) + widthOffset.x();
private:
UniquePtr<ImageSource> m_source;
- EGLint m_target;
};
class ImageTargetGLES2 : public ImageTestCase
#include "tcuCommandLine.hpp"
#include "deUniquePtr.hpp"
-#include "deRandom.hpp"
#include <string>
#include <vector>
const Library& egl = m_eglTestCtx.getLibrary();
tcu::TestLog& log = m_testCtx.getLog();
const eglu::Version version = eglu::getVersion(egl, display);
- de::Random rnd (deStringHash(m_name.c_str()) ^ 0xf215918f);
if (version.getMajor() == 1 && version.getMinor() == 0)
{
IterateResult ChangeSurfaceSizeCase::iterate (void)
{
const Library& egl = m_eglTestCtx.getLibrary();
- Surface oldSurface;
- Surface newSurface;
ScopedCurrentContext currentCtx (egl, m_display, **m_surface, **m_surface, **m_context);
IVec2 oldEglSize = checkSurfaceSize(egl,
m_display,
Interval approximateInt (int i)
{
- return (Interval(i) + Interval(-1.0, 1.0)) & Interval(0.0, TCU_INFINITY);
+ const Interval margin(-1.0, 1.0); // The resolution may be rounded
+
+ return (Interval(i) + margin) & Interval(0.0, TCU_INFINITY);
}
IvVec2 UpdateResolutionCase::getNativePixelsPerInch (void)
const IVec2 bufSize = eglu::getSurfaceSize(egl, m_display, **m_surface);
const IVec2 winSize = m_nativeWindow->getScreenSize();
const IVec2 bufPp10km = eglu::getSurfaceResolution(egl, m_display, **m_surface);
- const Interval margin (-1.0, 1.0); // The resolution may be rounded
const IvVec2 bufPpiI = (IvVec2(approximateInt(bufPp10km.x()),
approximateInt(bufPp10km.y()))
/ Interval(inchPer10km));
};
TestCaseWrapper::TestCaseWrapper (EglTestContext& eglTestCtx)
- : tcu::TestCaseWrapper (eglTestCtx.getTestContext())
- , m_eglTestCtx (eglTestCtx)
+ : tcu::TestCaseWrapper(eglTestCtx.getTestContext())
{
}
bool deinitTestCase (tcu::TestCase* testCase);
tcu::TestNode::IterateResult iterateTestCase (tcu::TestCase* testCase);
-
-private:
- EglTestContext& m_eglTestCtx;
};
class PackageContext
// Frames.
tcu::Surface rendered (viewportWidth, viewportHeight);
tcu::Surface reference (viewportWidth, viewportHeight);
- tcu::Surface diffMask (viewportWidth, viewportHeight);
// Render with GL.
glViewport(viewportX, viewportY, viewportWidth, viewportHeight);
{
const int height = src.getHeight();
const int width = src.getWidth();
- const tcu::IVec4 black = tcu::IVec4(0, 0, 0, 255);
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
void Incomplete2DEmptyObjectCase::createTexture (void)
{
- tcu::TextureFormat fmt = glu::mapGLTransferFormat(GL_RGBA, GL_UNSIGNED_BYTE);
- tcu::TextureLevel levelData (fmt);
-
GLuint texture;
glGenTextures (1, &texture);
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
void IncompleteCubeEmptyObjectCase::createTexture (void)
{
- tcu::TextureFormat fmt = glu::mapGLTransferFormat(GL_RGBA, GL_UNSIGNED_BYTE);
- tcu::TextureLevel levelData (fmt);
-
GLuint texture;
glGenTextures (1, &texture);
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
const deUint32 wrapT = GL_CLAMP_TO_EDGE;
const int numLevels = deLog2Floor32(de::max(m_width, m_height))+1;
- const tcu::Sampler sampler = glu::mapGLSampler(wrapS, wrapT, minFilter, magFilter);
tcu::Texture2D resultTexture (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), m_texture->getRefTexture().getWidth(), m_texture->getRefTexture().getHeight());
tcu::TextureCube resultTexture (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), m_size);
const int numLevels = deLog2Floor32(m_size)+1;
- tcu::Sampler sampler = glu::mapGLSampler(wrapS, wrapT, minFilter, magFilter);
vector<float> texCoord;
// Initialize texture level 0 with colored grid.
const float y = coord.y();
const float f0 = (x + y) * 0.5f;
const float f1 = 0.5f + (x - y) * 0.5f;
- const tcu::Vec4 fv = Vec4(f0, f1, 1.0f-f0, 1.0f-f1);
rr::writeFragmentOutput(context, packetNdx, fragNdx, 0, tcu::Vec4(f0, f1, 1.0f-f0, 1.0f-f1));
}
// Frames.
tcu::Surface rendered (viewportWidth, viewportHeight);
tcu::Surface reference (viewportWidth, viewportHeight);
- tcu::Surface diffMask (viewportWidth, viewportHeight);
// Render with GL.
glViewport(viewportX, viewportY, viewportWidth, viewportHeight);
{
const int height = src.getHeight();
const int width = src.getWidth();
- const tcu::IVec4 black = tcu::IVec4(0, 0, 0, 255);
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
// \note the green/yellow pattern is only for clarity. The test will only verify that all instances were drawn by looking for anything non-green/yellow.
using tcu::TestLog;
- const tcu::RGBA green (0, 255, 0, 255);
- const tcu::RGBA yellow (255, 255, 0, 255);
const int colorThreshold = 20;
tcu::Surface error (image.getWidth(), image.getHeight());
const deUint32 wrapT = GL_CLAMP_TO_EDGE;
const int numLevels = deLog2Floor32(de::max(m_width, m_height))+1;
- const tcu::Sampler sampler = glu::mapGLSampler(wrapS, wrapT, minFilter, magFilter);
tcu::Texture2D resultTexture (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), m_texture->getRefTexture().getWidth(), m_texture->getRefTexture().getHeight());
TestLog& log = m_testCtx.getLog();
const RandomViewport viewport (m_renderCtx.getRenderTarget(), VIEWPORT_WIDTH, VIEWPORT_HEIGHT, deStringHash(getName()) + m_caseNdx);
tcu::Surface renderedFrame (viewport.width, viewport.height);
- tcu::Surface referenceFrame (viewport.width, viewport.height);
ReferenceParams refParams (TEXTURETYPE_2D);
const tcu::TextureFormat texFormat = m_texture->getRefTexture().getFormat();
vector<float> texCoord;
{
using tcu::TestLog;
- const tcu::RGBA green (0, 255, 0, 255);
- const tcu::RGBA yellow (255, 255, 0, 255);
const int colorThreshold = 20;
tcu::Surface error (image.getWidth(), image.getHeight());
bool LayeredRenderCase::verifyProvokingVertexLayers (const tcu::Surface& layer0, const tcu::Surface& layer1)
{
- const tcu::Vec4 white = tcu::Vec4(1.0f, 1.0f, 1.0f, 1.0f);
const bool layer0Empty = verifyEmptyImage(layer0, false);
const bool layer1Empty = verifyEmptyImage(layer1, false);
bool error = false;
const int viewportHeight = RENDER_SIZE;
const int viewportX = (m_renderTarget == RENDERTARGET_DEFAULT) ? (rnd.getInt(0, renderCtx.getRenderTarget().getWidth() - viewportWidth)) : (0);
const int viewportY = (m_renderTarget == RENDERTARGET_DEFAULT) ? (rnd.getInt(0, renderCtx.getRenderTarget().getHeight() - viewportHeight)) : (0);
- const IVec3 imageSize = defaultImageSize(TEXTURETYPE_2D);
const glu::Texture texture (renderCtx);
de::MovePtr<glu::Framebuffer> fbo;
de::MovePtr<glu::Renderbuffer> colorAttachment;
{
const int imageWidth = 256;
const int imageHeight = 256;
- const Vec2 imageSizeFloat ((float)imageWidth, (float)imageHeight);
dst.setSize(imageWidth, imageHeight);
tcu::clear(dst.getAccess(), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
gridIndices.reserve(numIndices);
{
- Random constantSeedRnd(42);
-
for (int i = 0; i < gridHeight+1; i++)
for (int j = 0; j < gridWidth+1; j++)
{
TestLog& log = m_testCtx.getLog();
const tcu::ScopedLogSection iterationSection (log, "Iteration" + de::toString(m_currentIteration), "Iteration " + de::toString(m_currentIteration));
const glu::RenderContext& renderCtx = m_context.getRenderContext();
- const tcu::IVec2 renderSize = RENDER_SIZE;
const glw::Functions& gl = renderCtx.getFunctions();
const GatherArgs& gatherArgs = getGatherArgs(m_currentIteration);
const string refZExpr = "v_normalizedCoord.x";
{
using tcu::TestLog;
- const tcu::RGBA green (0, 255, 0, 255);
- const tcu::RGBA yellow (255, 255, 0, 255);
const int colorThreshold = 20;
tcu::Surface error (image.getWidth(), image.getHeight());
{
using tcu::TestLog;
- const tcu::RGBA green (0, 255, 0, 255);
- const tcu::RGBA yellow (255, 255, 0, 255);
const int colorThreshold = 20;
tcu::Surface error (image.getWidth(), image.getHeight());
const int nextEdgeNdx = (edgeNdx+1) % 3;
const I64Vec2 startPos ((startRounding&0x01) ? (triangleSubPixelSpaceFloor[edgeNdx].x()) : (triangleSubPixelSpaceCeil[edgeNdx].x()), (startRounding&0x02) ? (triangleSubPixelSpaceFloor[edgeNdx].y()) : (triangleSubPixelSpaceCeil[edgeNdx].y()));
const I64Vec2 endPos ((endRounding&0x01) ? (triangleSubPixelSpaceFloor[nextEdgeNdx].x()) : (triangleSubPixelSpaceCeil[nextEdgeNdx].x()), (endRounding&0x02) ? (triangleSubPixelSpaceFloor[nextEdgeNdx].y()) : (triangleSubPixelSpaceCeil[nextEdgeNdx].y()));
- const I64Vec2 edge = endPos - startPos;
for (int pixelEdgeNdx = 0; pixelEdgeNdx < 4; ++pixelEdgeNdx)
{
{
rr::FragmentPacket& packet = packets[packetNdx];
- const tcu::IVec2 position = packet.position;
-
const tcu::IVec2 position0 = packet.position + tcu::IVec2(0, 0);
const tcu::IVec2 position1 = packet.position + tcu::IVec2(1, 0);
const tcu::IVec2 position2 = packet.position + tcu::IVec2(0, 1);
void fetchTexture (const SurfaceAccess& dst, const tcu::ConstPixelBufferAccess& src, const float* texCoord, const tcu::Vec4& colorScale, const tcu::Vec4& colorBias)
{
const tcu::Vec4 sq = tcu::Vec4(texCoord[0], texCoord[1], texCoord[2], texCoord[3]);
- const tcu::IVec2 dstSize = tcu::IVec2(dst.getWidth(), dst.getHeight());
const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
for (int y = 0; y < dst.getHeight(); y++)
const float nxo = wxo/dstW;
const float nyo = wyo/dstH;
- const tcu::Vec2 coordO (projectedTriInterpolate(triS[triNdx], triW[triNdx], nxo, nyo),
- projectedTriInterpolate(triT[triNdx], triW[triNdx], nxo, nyo));
const tcu::Vec2 coordDxo = tcu::Vec2(triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
triDerivateX(triT[triNdx], triW[triNdx], wxo, dstW, nyo)) * srcSize.asFloat();
const tcu::Vec2 coordDyo = tcu::Vec2(triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo),
const float nxo = wxo/dstW;
const float nyo = wyo/dstH;
- const tcu::Vec3 coordO (projectedTriInterpolate(triS[triNdx], triW[triNdx], nxo, nyo),
- projectedTriInterpolate(triT[triNdx], triW[triNdx], nxo, nyo),
- projectedTriInterpolate(triR[triNdx], triW[triNdx], nxo, nyo));
const tcu::Vec3 coordDxo = tcu::Vec3(triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
triDerivateX(triT[triNdx], triW[triNdx], wxo, dstW, nyo),
triDerivateX(triR[triNdx], triW[triNdx], wxo, dstW, nyo)) * srcSize.asFloat();
const float nxo = wxo/dstW;
const float nyo = wyo/dstH;
- const tcu::Vec2 coordO (projectedTriInterpolate(triS[triNdx], triW[triNdx], nxo, nyo),
- projectedTriInterpolate(triT[triNdx], triW[triNdx], nxo, nyo));
const float coordDxo = triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo) * srcSize;
const float coordDyo = triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo) * srcSize;
const tcu::Vec2 lodO = tcu::computeLodBoundsFromDerivates(coordDxo, coordDyo, lodPrec);
const float nxo = wxo/dstW;
const float nyo = wyo/dstH;
- const tcu::Vec3 coordO (projectedTriInterpolate(triS[triNdx], triW[triNdx], nxo, nyo),
- projectedTriInterpolate(triT[triNdx], triW[triNdx], nxo, nyo),
- projectedTriInterpolate(triR[triNdx], triW[triNdx], nxo, nyo));
const tcu::Vec2 coordDxo = tcu::Vec2(triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
triDerivateX(triT[triNdx], triW[triNdx], wxo, dstW, nyo)) * srcSize;
const tcu::Vec2 coordDyo = tcu::Vec2(triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo),
const float nxo = wxo/dstW;
const float nyo = wyo/dstH;
- const tcu::Vec2 coordO (projectedTriInterpolate(triS[triNdx], triW[triNdx], nxo, nyo),
- projectedTriInterpolate(triT[triNdx], triW[triNdx], nxo, nyo));
const tcu::Vec2 coordDxo = tcu::Vec2(triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
triDerivateX(triT[triNdx], triW[triNdx], wxo, dstW, nyo)) * srcSize.asFloat();
const tcu::Vec2 coordDyo = tcu::Vec2(triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo),
const float nxo = wxo/dstW;
const float nyo = wyo/dstH;
- const tcu::Vec2 coordO (projectedTriInterpolate(triS[triNdx], triW[triNdx], nxo, nyo),
- projectedTriInterpolate(triT[triNdx], triW[triNdx], nxo, nyo));
const tcu::Vec2 coordDxo = tcu::Vec2(triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
triDerivateX(triT[triNdx], triW[triNdx], wxo, dstW, nyo)) * srcSize.asFloat();
const tcu::Vec2 coordDyo = tcu::Vec2(triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo),