set(DEQP_SUPPORT_EGL OFF) # Is EGL supported
set(DEQP_EGL_LIBRARIES ) # EGL libraries
+set(DEQP_SUPPORT_GLX OFF) # Is GLX supported
+set(DEQP_SUPPORT_WGL OFF) # Is WGL supported
+
set(DEQP_PLATFORM_LIBRARIES ) # Other platform libraries
set(DEQP_SUPPORT_OPENGL OFF) # Is OpenGL supported on platform
message(STATUS "DEQP_EGL_LIBRARIES = ${DEQP_EGL_LIBRARIES}")
message(STATUS "DEQP_SUPPORT_OPENGL = ${DEQP_SUPPORT_OPENGL}")
message(STATUS "DEQP_PLATFORM_LIBRARIES = ${DEQP_PLATFORM_LIBRARIES}")
+message(STATUS "DEQP_SUPPORT_WGL = ${DEQP_SUPPORT_WGL}")
+message(STATUS "DEQP_SUPPORT_GLX = ${DEQP_SUPPORT_GLX}")
# Defines
add_definitions(-DDEQP_TARGET_NAME="${DEQP_TARGET_NAME}")
dEQP-GLES3.functional.rasterization.interpolation.basic.triangles
dEQP-GLES3.functional.rasterization.interpolation.basic.triangle_strip
dEQP-GLES3.functional.rasterization.interpolation.basic.triangle_fan
-dEQP-GLES3.functional.rasterization.interpolation.basic.line_loop
dEQP-GLES3.functional.rasterization.interpolation.projected.triangles
dEQP-GLES3.functional.rasterization.interpolation.projected.triangle_strip
dEQP-GLES3.functional.rasterization.interpolation.projected.triangle_fan
-dEQP-GLES3.functional.rasterization.interpolation.projected.line_strip
dEQP-GLES3.functional.rasterization.flatshading.triangles
dEQP-GLES3.functional.rasterization.flatshading.triangle_strip
dEQP-GLES3.functional.rasterization.flatshading.triangle_fan
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))
+++ /dev/null
-# Script for checking which projects have unsubmitted modifications in them.
-#
-# Usage:
-# - recommended to add a alias/bat/sh for a shorter command
-# - running without parameters will check any existing known dE projects.
-# - can give projects names on command line, if only wish to check a sub-set
-# e.g., git-check.py delibs deqp
-
-import os
-import sys
-
-COMMANDS = ["pull", "push", "check"]
-ALL_REPOS = ["delibs", "deqp", "movies", "domeni", "demisc"]
-
-# Defaults.
-command = "check"
-repos = ALL_REPOS
-
-# Parse command line.
-numArgs = len(sys.argv)
-if (numArgs == 1):
- pass
-else:
- if (sys.argv[1] in COMMANDS):
- command = sys.argv[1]
- if (numArgs > 2):
- repos = sys.argv[2:]
- else:
- repos = sys.argv[1:]
-
-def findRepo(x):
- for repo in ALL_REPOS:
- if repo.startswith(x):
- return repo
- print "%s not a valid repository directory" % x
- sys.exit(1)
-
-repoDirs = [findRepo(x) for x in repos]
-
-# Find git base repo directory.
-oldDir = os.getcwd()
-baseDir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "../.."))
-foundAny = False
-
-# Execute the command.
-print "## Executing '%s' on repos: %s" % (command.upper(), ", ".join(repoDirs))
-print ""
-
-for gitDir in repoDirs:
- subDir = os.path.join(baseDir, gitDir)
- if os.path.exists(subDir):
- foundAny = True
- print "***** Check directory '%s' *****" % subDir
- os.chdir(subDir)
- if command == "check":
- os.system("git status")
- os.system("git push --dry-run")
- elif command == "push":
- os.system("git push")
- elif command == "pull":
- os.system("git pull")
- else:
- assert False
- print ""
-
-if not foundAny:
- print "No subdirs found -- tried %s" % repoDirs
- print "Searching in '%s'" % baseDir
-
-os.chdir(oldDir)
}
}
+bool isCompressedFormat (deUint32 internalFormat)
+{
+ switch (internalFormat)
+ {
+ case GL_ETC1_RGB8_OES:
+ case GL_COMPRESSED_R11_EAC:
+ case GL_COMPRESSED_SIGNED_R11_EAC:
+ case GL_COMPRESSED_RG11_EAC:
+ case GL_COMPRESSED_SIGNED_RG11_EAC:
+ case GL_COMPRESSED_RGB8_ETC2:
+ case GL_COMPRESSED_SRGB8_ETC2:
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+ case GL_COMPRESSED_RGBA8_ETC2_EAC:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
+ case GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
+ case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:
+ case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:
+ case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:
+ case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:
+ case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:
+ case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:
+ case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:
+ case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:
+ case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:
+ case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:
+ case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:
+ case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
+ case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
static tcu::TextureFormat::ChannelType mapGLChannelType (deUint32 dataType, bool normalized)
{
// \note Normalized bit is ignored where it doesn't apply.
}
}
-static inline tcu::Sampler::FilterMode mapGLFilterMode (deUint32 filterMode)
+static inline tcu::Sampler::FilterMode mapGLMinFilterMode (deUint32 filterMode)
{
switch (filterMode)
{
case GL_LINEAR_MIPMAP_NEAREST: return tcu::Sampler::LINEAR_MIPMAP_NEAREST;
case GL_LINEAR_MIPMAP_LINEAR: return tcu::Sampler::LINEAR_MIPMAP_LINEAR;
default:
- throw tcu::InternalError("Can't map GL filter mode" + tcu::toHex(filterMode).toString());
+ throw tcu::InternalError("Can't map GL min filter mode" + tcu::toHex(filterMode).toString());
+ }
+}
+
+static inline tcu::Sampler::FilterMode mapGLMagFilterMode (deUint32 filterMode)
+{
+ switch (filterMode)
+ {
+ case GL_NEAREST: return tcu::Sampler::NEAREST;
+ case GL_LINEAR: return tcu::Sampler::LINEAR;
+ default:
+ throw tcu::InternalError("Can't map GL mag filter mode" + tcu::toHex(filterMode).toString());
}
}
tcu::Sampler mapGLSampler (deUint32 wrapS, deUint32 wrapT, deUint32 wrapR, deUint32 minFilter, deUint32 magFilter)
{
return tcu::Sampler(mapGLWrapMode(wrapS), mapGLWrapMode(wrapT), mapGLWrapMode(wrapR),
- mapGLFilterMode(minFilter), mapGLFilterMode(magFilter),
+ mapGLMinFilterMode(minFilter), mapGLMagFilterMode(magFilter),
0.0f /* lod threshold */,
true /* normalized coords */,
tcu::Sampler::COMPAREMODE_NONE /* no compare */,
DataType getSamplerCubeArrayType (tcu::TextureFormat format);
bool isSizedFormatColorRenderable (const RenderContext& renderCtx, const ContextInfo& contextInfo, deUint32 sizedFormat);
+bool isCompressedFormat (deUint32 internalFormat);
} // glu
{
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
, m_dataType (dataType)
, m_width (width)
, m_height (height)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
{
}
, m_width (0)
, m_height (0)
, m_filenames (filenames)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
{
}
, m_dataType (dataType)
, m_width (width)
, m_height (height)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
{
}
, m_width (0)
, m_height (0)
, m_filenames (filenames)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
{
}
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES,
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES,
renderCtxInfo.isFragmentHighPrecisionSupported() ? glu::PRECISION_HIGHP // Use highp if available.
: glu::PRECISION_MEDIUMP)
{
, m_dataType (dataType)
, m_size (size)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES,
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES,
renderCtxInfo.isFragmentHighPrecisionSupported() ? glu::PRECISION_HIGHP // Use highp if available.
: glu::PRECISION_MEDIUMP)
{
// 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++)
int viewportWidth = de::min(64, m_renderCtx.getRenderTarget().getWidth());
int viewportHeight = de::min(64, m_renderCtx.getRenderTarget().getHeight());
TestLog& log = m_testCtx.getLog();
- TextureRenderer renderer (m_renderCtx, m_testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP);
+ TextureRenderer renderer (m_renderCtx, log, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP);
tcu::Surface renderedFrame (viewportWidth, viewportHeight);
vector<float> texCoord;
int viewportHeight = de::min(64, m_renderCtx.getRenderTarget().getHeight());
bool allFacesOk = true;
TestLog& log = m_testCtx.getLog();
- TextureRenderer renderer (m_renderCtx, m_testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP);
+ TextureRenderer renderer (m_renderCtx, log, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP);
tcu::Surface renderedFrame (viewportWidth, viewportHeight);
vector<float> texCoord;
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);
, m_dataType (dataType)
, m_width (width)
, m_height (height)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
, m_caseNdx (0)
{
}
, m_width (0)
, m_height (0)
, m_filenames (filenames)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
, m_caseNdx (0)
{
}
, m_dataType (dataType)
, m_width (width)
, m_height (height)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
, m_caseNdx (0)
{
}
, m_width (0)
, m_height (0)
, m_filenames (filenames)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
, m_caseNdx (0)
{
}
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
{
}
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
, m_curFace (0)
, m_isOk (false)
{
, m_renderCtxInfo (renderCtxInfo)
, m_filenames (filenames)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
{
}
, m_renderCtxInfo (renderCtxInfo)
, m_filenames (filenames)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
, m_curFace (0)
, m_isOk (false)
{
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES,
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES,
renderCtxInfo.isFragmentHighPrecisionSupported() ? glu::PRECISION_HIGHP // Use highp if available.
: glu::PRECISION_MEDIUMP)
{
, m_dataType (dataType)
, m_size (size)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES,
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES,
renderCtxInfo.isFragmentHighPrecisionSupported() ? glu::PRECISION_HIGHP // Use highp if available.
: glu::PRECISION_MEDIUMP)
{
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
{
}
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());
, m_hint (hint)
, m_size (size)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
{
}
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.
, m_height (height)
, m_useMipmaps (mipmaps)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
{
}
, m_height (height)
, m_useMipmaps (mipmaps)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
, m_curFace (0)
, m_isOk (false)
{
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));
}
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
{
}
, m_height (0)
, m_filenames (filenames)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_MEDIUMP)
{
}
, m_internalFormat (internalFormat)
, m_width (width)
, m_height (height)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_width (0)
, m_height (0)
, m_filenames (filenames)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_100_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_100_ES, glu::PRECISION_HIGHP)
{
}
, m_internalFormat (internalFormat)
, m_width (width)
, m_height (height)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_width (0)
, m_height (0)
, m_filenames (filenames)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_dataType (dataType)
, m_size (size)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
// Frames.
tcu::Surface rendered (viewportWidth, viewportHeight);
tcu::Surface reference (viewportWidth, viewportHeight);
- tcu::Surface diffMask (viewportWidth, viewportHeight);
// Render with GL.
glViewport(viewportX, viewportY, viewportWidth, viewportHeight);
CompressedTexFormat format,
deUint32 randomSeed)
: m_context (context)
- , m_renderer (context.getRenderContext(), context.getTestContext(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (context.getRenderContext(), context.getTestContext().getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_format (format)
, m_blockSize (tcu::getBlockPixelSize(format).xy())
, m_astcSupport (ASTCSUPPORTLEVEL_NONE)
{
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());
, m_internalFormat (internalFormat)
, m_width (width)
, m_height (height)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_caseNdx (0)
{
}
, m_width (0)
, m_height (0)
, m_filenames (filenames)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_caseNdx (0)
{
}
, m_internalFormat (internalFormat)
, m_width (width)
, m_height (height)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_caseNdx (0)
{
}
, m_width (0)
, m_height (0)
, m_filenames (filenames)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_caseNdx (0)
{
}
, m_numLayers (numLayers)
, m_gradientTex (DE_NULL)
, m_gridTex (DE_NULL)
- , m_renderer (m_context.getRenderContext(), context.getTestContext(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (context.getRenderContext(), context.getTestContext().getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_caseNdx (0)
{
}
, m_depth (depth)
, m_gradientTex (DE_NULL)
, m_gridTex (DE_NULL)
- , m_renderer (m_context.getRenderContext(), context.getTestContext(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (context.getRenderContext(), context.getTestContext().getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_caseNdx (0)
{
}
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_curFace (0)
, m_isOk (false)
{
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_curFace (0)
, m_isOk (false)
{
, m_height (height)
, m_numLayers (numLayers)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_curLayer (0)
{
}
, m_height (height)
, m_numLayers (numLayers)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_curLayer (0)
{
}
, m_height (height)
, m_depth (depth)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_curSlice (0)
{
}
, m_height (height)
, m_depth (depth)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_curSlice (0)
{
}
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_curFace (0)
, m_isOk (false)
{
, m_renderCtxInfo (renderCtxInfo)
, m_filenames (filenames)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_renderCtxInfo (renderCtxInfo)
, m_filenames (filenames)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_curFace (0)
, m_isOk (false)
{
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_dataType (dataType)
, m_size (size)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_width (width)
, m_height (height)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
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());
, m_hint (hint)
, m_size (size)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_height (height)
, m_depth (depth)
, m_texture (DE_NULL)
- , m_renderer (context.getRenderContext(), m_context.getTestContext(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (context.getRenderContext(), context.getTestContext().getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_texHeight (64)
, m_minFilter (minFilter)
, m_texture (DE_NULL)
- , m_renderer (context.getRenderContext(), m_context.getTestContext(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (context.getRenderContext(), context.getTestContext().getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_texSize (64)
, m_minFilter (minFilter)
, m_texture (DE_NULL)
- , m_renderer (context.getRenderContext(), context.getTestContext(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (context.getRenderContext(), context.getTestContext().getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_texDepth (32)
, m_minFilter (minFilter)
, m_texture (DE_NULL)
- , m_renderer (context.getRenderContext(), m_context.getTestContext(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (context.getRenderContext(), context.getTestContext().getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_width (width)
, m_height (height)
, m_compareFunc (compareFunc)
- , m_renderer (context.getRenderContext(), context.getTestContext(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (context.getRenderContext(), context.getTestContext().getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_caseNdx (0)
{
}
, m_compareFunc (compareFunc)
, m_gradientTex (DE_NULL)
, m_gridTex (DE_NULL)
- , m_renderer (context.getRenderContext(), m_context.getTestContext(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (context.getRenderContext(), context.getTestContext().getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_caseNdx (0)
{
}
, m_compareFunc (compareFunc)
, m_gradientTex (DE_NULL)
, m_gridTex (DE_NULL)
- , m_renderer (context.getRenderContext(), context.getTestContext(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (context.getRenderContext(), context.getTestContext().getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
, m_caseNdx (0)
{
}
, m_height (height)
, m_useMipmaps (mipmaps)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_MEDIUMP)
{
}
, m_height (height)
, m_useMipmaps (mipmaps)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_MEDIUMP)
, m_curFace (0)
, m_isOk (false)
{
, m_swizzleB (swizzleB)
, m_swizzleA (swizzleA)
, m_texture (DE_NULL)
- , m_renderer (context.getRenderContext(), context.getTestContext(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
+ , m_renderer (context.getRenderContext(), context.getTestContext().getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_HIGHP)
{
}
, m_height (height)
, m_caseNdx (0)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_MEDIUMP)
{
}
, m_filenames (filenames)
, m_caseNdx (0)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_MEDIUMP)
{
}
, m_height (height)
, m_caseNdx (0)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_300_ES, glu::PRECISION_MEDIUMP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_300_ES, glu::PRECISION_MEDIUMP)
{
}
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;
}
}
-bool isCompressedFormat (deUint32 format)
-{
- switch (format)
- {
- case GL_COMPRESSED_R11_EAC:
- case GL_COMPRESSED_SIGNED_R11_EAC:
- case GL_COMPRESSED_RG11_EAC:
- case GL_COMPRESSED_SIGNED_RG11_EAC:
- case GL_COMPRESSED_RGB8_ETC2:
- case GL_COMPRESSED_SRGB8_ETC2:
- case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case GL_COMPRESSED_RGBA8_ETC2_EAC:
- case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
- case GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
- case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:
- case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:
- case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:
- case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:
- case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:
- case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:
- case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:
- case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:
- case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:
- case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:
- case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:
- case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
- case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
- return true;
-
- default:
- return false;
- }
-}
-
string formatToName (deUint32 format)
{
string enumName;
- if (isCompressedFormat(format))
+ if (glu::isCompressedFormat(format))
enumName = glu::getCompressedTexFormatStr(format).toString().substr(14); // Strip GL_COMPRESSED_
else
enumName = glu::getPixelFormatStr(format).toString().substr(3); // Strip GL_
bool isFloatFormat (deUint32 format)
{
- if (isCompressedFormat(format))
+ if (glu::isCompressedFormat(format))
return false;
else
return tcu::getTextureChannelClass(glu::mapGLInternalFormat(format).type) == tcu::TEXTURECHANNELCLASS_FLOATING_POINT;
bool isUintFormat (deUint32 format)
{
- if (isCompressedFormat(format))
+ if (glu::isCompressedFormat(format))
return false;
else
return tcu::getTextureChannelClass(glu::mapGLInternalFormat(format).type) == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER;
bool isIntFormat (deUint32 format)
{
- if (isCompressedFormat(format))
+ if (glu::isCompressedFormat(format))
return false;
else
return tcu::getTextureChannelClass(glu::mapGLInternalFormat(format).type) == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER;
, m_size (size)
{
DE_ASSERT(m_target == GL_TEXTURE_2D_ARRAY || m_target == GL_TEXTURE_3D || m_size.z() == 1);
- DE_ASSERT(isTextureTarget(m_target) || !isCompressedFormat(m_target));
+ DE_ASSERT(isTextureTarget(m_target) || !glu::isCompressedFormat(m_target));
}
{
if (formatA == formatB)
return formatA;
- else if (isCompressedFormat(formatA) && isAstcFormat(glu::mapGLCompressedTexFormat(formatA)))
+ else if (glu::isCompressedFormat(formatA) && isAstcFormat(glu::mapGLCompressedTexFormat(formatA)))
return formatA;
- else if (isCompressedFormat(formatB) && isAstcFormat(glu::mapGLCompressedTexFormat(formatB)))
+ else if (glu::isCompressedFormat(formatB) && isAstcFormat(glu::mapGLCompressedTexFormat(formatB)))
return formatB;
else if (isFloatFormat(formatA))
{
return formatB;
}
- else if (isCompressedFormat(formatA))
+ else if (glu::isCompressedFormat(formatA))
{
return formatA;
}
- else if (isCompressedFormat(formatB))
+ else if (glu::isCompressedFormat(formatB))
{
return formatB;
}
int getTexelBlockSize (deUint32 format)
{
- if (isCompressedFormat(format))
+ if (glu::isCompressedFormat(format))
return tcu::getBlockSize(glu::mapGLCompressedTexFormat(format));
else
return glu::mapGLInternalFormat(format).getPixelSize();
IVec3 getTexelBlockPixelSize (deUint32 format)
{
- if (isCompressedFormat(format))
+ if (glu::isCompressedFormat(format))
return tcu::getBlockPixelSize(glu::mapGLCompressedTexFormat(format));
else
return IVec3(1, 1, 1);
access.setPixel(color, texelNdx, 0, 0);
}
}
- else if (isCompressedFormat(glFormat))
+ else if (glu::isCompressedFormat(glFormat))
{
const tcu::CompressedTexFormat compressedFormat = glu::mapGLCompressedTexFormat(glFormat);
DE_ASSERT(target == GL_TEXTURE_CUBE_MAP || faceNdx == 0);
- if (isCompressedFormat(format))
+ if (glu::isCompressedFormat(format))
{
switch (getTargetTexDims(target))
{
DE_ASSERT(info.getTarget() == GL_RENDERBUFFER);
DE_ASSERT(info.getSize().z() == 1);
DE_ASSERT(getLevelCount(info) == 1);
- DE_ASSERT(!isCompressedFormat(info.getFormat()));
+ DE_ASSERT(!glu::isCompressedFormat(info.getFormat()));
glu::Framebuffer framebuffer(gl);
const vector<ArrayBuffer<deUint8> >& data,
const ImageInfo& info)
{
- if (isCompressedFormat(info.getFormat()))
+ if (glu::isCompressedFormat(info.getFormat()))
{
vector<de::ArrayBuffer<deUint8> > levelDatas;
vector<tcu::PixelBufferAccess> levelAccesses;
const vector<ArrayBuffer<deUint8> >& data,
const ImageInfo& info)
{
- if (isCompressedFormat(info.getFormat()))
+ if (glu::isCompressedFormat(info.getFormat()))
{
vector<de::ArrayBuffer<deUint8> > levelDatas;
vector<tcu::PixelBufferAccess> levelAccesses;
const vector<ArrayBuffer<deUint8> >& data,
const ImageInfo& info)
{
- if (isCompressedFormat(info.getFormat()))
+ if (glu::isCompressedFormat(info.getFormat()))
{
const tcu::CompressedTexFormat& compressedFormat = glu::mapGLCompressedTexFormat(info.getFormat());
const tcu::TextureFormat& decompressedFormat = tcu::getUncompressedFormat(compressedFormat);
const vector<ArrayBuffer<deUint8> >& data,
const ImageInfo& info)
{
- if (isCompressedFormat(info.getFormat()))
+ if (glu::isCompressedFormat(info.getFormat()))
{
vector<de::ArrayBuffer<deUint8> > levelDatas;
vector<tcu::PixelBufferAccess> levelAccesses;
struct State
{
State (int seed,
- tcu::TestContext& testContext,
+ tcu::TestLog& log,
glu::RenderContext& renderContext)
: rng (seed)
- , results (testContext.getLog())
+ , results (log)
, srcImage (NULL)
, dstImage (NULL)
- , textureRenderer (renderContext, testContext, glu::GLSL_VERSION_310_ES, glu::PRECISION_HIGHP)
+ , textureRenderer (renderContext, log, glu::GLSL_VERSION_310_ES, glu::PRECISION_HIGHP)
{
}
void checkFormatSupport (glu::ContextInfo& info, deUint32 format)
{
- if (isCompressedFormat(format))
+ if (glu::isCompressedFormat(format))
{
if (isAstcFormat(glu::mapGLCompressedTexFormat(format)))
{
<< m_srcImageInfo
<< m_dstImageInfo;
- m_state = new State(builder.get(), m_testCtx, m_context.getRenderContext());
+ m_state = new State(builder.get(), m_testCtx.getLog(), m_context.getRenderContext());
}
}
const IVec3 srcTexelBlockPixelSize = getTexelBlockPixelSize(srcFormat);
const bool srcIs3D = srcTarget == GL_TEXTURE_2D_ARRAY || srcTarget == GL_TEXTURE_3D;
- if (isCompressedFormat(srcFormat) && srcTarget == GL_RENDERBUFFER)
+ if (glu::isCompressedFormat(srcFormat) && srcTarget == GL_RENDERBUFFER)
continue;
if (srcTarget == GL_RENDERBUFFER && !isColorRenderable(srcFormat))
continue;
- if (isCompressedFormat(srcFormat) && !tcu::isAstcFormat(glu::mapGLCompressedTexFormat(srcFormat)) && srcIs3D)
+ if (glu::isCompressedFormat(srcFormat) && !tcu::isAstcFormat(glu::mapGLCompressedTexFormat(srcFormat)) && srcIs3D)
continue;
for (int dstTargetNdx = 0; dstTargetNdx < DE_LENGTH_OF_ARRAY(targets); dstTargetNdx++)
const IVec3 dstTexelBlockPixelSize = getTexelBlockPixelSize(dstFormat);
const bool dstIs3D = dstTarget == GL_TEXTURE_2D_ARRAY || dstTarget == GL_TEXTURE_3D;
- if (isCompressedFormat(dstFormat) && dstTarget == GL_RENDERBUFFER)
+ if (glu::isCompressedFormat(dstFormat) && dstTarget == GL_RENDERBUFFER)
continue;
if (dstTarget == GL_RENDERBUFFER && !isColorRenderable(dstFormat))
continue;
- if (isCompressedFormat(dstFormat) && !tcu::isAstcFormat(glu::mapGLCompressedTexFormat(dstFormat)) && dstIs3D)
+ if (glu::isCompressedFormat(dstFormat) && !tcu::isAstcFormat(glu::mapGLCompressedTexFormat(dstFormat)) && dstIs3D)
continue;
const string targetTestName = string(targetToName(srcTarget)) + "_to_" + targetToName(dstTarget);
{
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++)
{
, m_onlySampleFaceInterior (onlySampleFaceInterior)
, m_gradientTex (DE_NULL)
, m_gridTex (DE_NULL)
- , m_renderer (m_context.getRenderContext(), context.getTestContext(), glu::GLSL_VERSION_310_ES, glu::PRECISION_HIGHP)
+ , m_renderer (context.getRenderContext(), context.getTestContext().getLog(), glu::GLSL_VERSION_310_ES, glu::PRECISION_HIGHP)
, m_caseNdx (0)
{
}
, m_size (size)
, m_depth (depth)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_310_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_310_ES, glu::PRECISION_HIGHP)
, m_curLayerFace (0)
{
}
, m_size (size)
, m_depth (depth)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_310_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_310_ES, glu::PRECISION_HIGHP)
, m_curLayerFace (0)
{
}
, m_format (internalFormat)
, m_width (width)
, m_texture (DE_NULL)
- , m_renderer (renderCtx, testCtx, glu::GLSL_VERSION_310_ES, glu::PRECISION_HIGHP)
+ , m_renderer (renderCtx, testCtx.getLog(), glu::GLSL_VERSION_310_ES, glu::PRECISION_HIGHP)
{
}
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++)
y = rnd.getInt(0, renderTarget.getHeight() - height);
}
-ProgramLibrary::ProgramLibrary (const glu::RenderContext& context, tcu::TestContext& testCtx, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision)
+ProgramLibrary::ProgramLibrary (const glu::RenderContext& context, tcu::TestLog& log, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision)
: m_context (context)
- , m_testCtx (testCtx)
+ , m_log (log)
, m_glslVersion (glslVersion)
, m_texCoordPrecision (texCoordPrecision)
{
glu::ShaderProgram* ProgramLibrary::getProgram (Program program)
{
- TestLog& log = m_testCtx.getLog();
-
if (m_programs.find(program) != m_programs.end())
return m_programs[program]; // Return from cache.
glu::ShaderProgram* progObj = new glu::ShaderProgram(m_context, glu::makeVtxFragSources(vertSrc, fragSrc));
if (!progObj->isOk())
{
- log << *progObj;
+ m_log << *progObj;
delete progObj;
TCU_FAIL("Failed to compile shader program");
}
return progObj;
}
-TextureRenderer::TextureRenderer (const glu::RenderContext& context, tcu::TestContext& testCtx, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision)
+TextureRenderer::TextureRenderer (const glu::RenderContext& context, tcu::TestLog& log, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision)
: m_renderCtx (context)
- , m_testCtx (testCtx)
- , m_programLibrary (context, testCtx, glslVersion, texCoordPrecision)
+ , m_log (log)
+ , m_programLibrary (context, log, glslVersion, texCoordPrecision)
{
}
const glw::Functions& gl = m_renderCtx.getFunctions();
tcu::Vec4 wCoord = params.flags & RenderParams::PROJECTED ? params.w : tcu::Vec4(1.0f);
bool useBias = !!(params.flags & RenderParams::USE_BIAS);
- TestLog& log = m_testCtx.getLog();
bool logUniforms = !!(params.flags & RenderParams::LOG_UNIFORMS);
// Render quad with texture.
// \todo [2012-09-26 pyry] Move to ProgramLibrary and log unique programs only(?)
if (params.flags & RenderParams::LOG_PROGRAMS)
- log << *program;
+ m_log << *program;
GLU_EXPECT_NO_ERROR(gl.getError(), "Set vertex attributes");
gl.uniform1i(gl.getUniformLocation(prog, "u_sampler"), texUnit);
if (logUniforms)
- log << TestLog::Message << "u_sampler = " << texUnit << TestLog::EndMessage;
+ m_log << TestLog::Message << "u_sampler = " << texUnit << TestLog::EndMessage;
if (useBias)
{
gl.uniform1f(gl.getUniformLocation(prog, "u_bias"), params.bias);
if (logUniforms)
- log << TestLog::Message << "u_bias = " << params.bias << TestLog::EndMessage;
+ m_log << TestLog::Message << "u_bias = " << params.bias << TestLog::EndMessage;
}
if (params.samplerType == SAMPLERTYPE_SHADOW)
{
gl.uniform1f(gl.getUniformLocation(prog, "u_ref"), params.ref);
if (logUniforms)
- log << TestLog::Message << "u_ref = " << params.ref << TestLog::EndMessage;
+ m_log << TestLog::Message << "u_ref = " << params.ref << TestLog::EndMessage;
}
gl.uniform4fv(gl.getUniformLocation(prog, "u_colorScale"), 1, params.colorScale.getPtr());
if (logUniforms)
{
- log << TestLog::Message << "u_colorScale = " << params.colorScale << TestLog::EndMessage;
- log << TestLog::Message << "u_colorBias = " << params.colorBias << TestLog::EndMessage;
+ m_log << TestLog::Message << "u_colorScale = " << params.colorScale << TestLog::EndMessage;
+ m_log << TestLog::Message << "u_colorBias = " << params.colorBias << TestLog::EndMessage;
}
GLU_EXPECT_NO_ERROR(gl.getError(), "Set program state");
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),
class ProgramLibrary
{
public:
- ProgramLibrary (const glu::RenderContext& context, tcu::TestContext& testCtx, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision);
+ ProgramLibrary (const glu::RenderContext& context, tcu::TestLog& log, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision);
~ProgramLibrary (void);
glu::ShaderProgram* getProgram (Program program);
ProgramLibrary& operator= (const ProgramLibrary& other);
const glu::RenderContext& m_context;
- tcu::TestContext& m_testCtx;
+ tcu::TestLog& m_log;
glu::GLSLVersion m_glslVersion;
glu::Precision m_texCoordPrecision;
std::map<Program, glu::ShaderProgram*> m_programs;
class TextureRenderer
{
public:
- TextureRenderer (const glu::RenderContext& context, tcu::TestContext& testCtx, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision);
+ TextureRenderer (const glu::RenderContext& context, tcu::TestLog& log, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision);
~TextureRenderer (void);
void clear (void); //!< Frees allocated resources. Destructor will call clear() as well.
TextureRenderer& operator= (const TextureRenderer& other);
const glu::RenderContext& m_renderCtx;
- tcu::TestContext& m_testCtx;
+ tcu::TestLog& m_log;
ProgramLibrary m_programLibrary;
};
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-#-------------------------------------------------------------------------
-# drawElements Quality Program utilities
-# --------------------------------------
-#
-# Copyright 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#-------------------------------------------------------------------------
-
-import os
-import sys
-from fnmatch import fnmatch
-from optparse import OptionParser
-
-HEADER_PATTERNS = ["*.hpp", "*.h"]
-INDENTED_INCLUDE_PREFIX = "#\tinclude "
-IFNDEF_PREFIX = "#ifndef "
-
-def getIncludeGuardName (headerFile):
- return '_' + os.path.basename(headerFile).upper().replace('.', '_')
-
-def getRedundantIncludeGuardErrors (fileName):
- f = open(fileName, 'rb')
- errors = []
-
- lineNumber = 1
- prevLine = None
- for line in f:
- if line.startswith(INDENTED_INCLUDE_PREFIX):
- if prevLine is not None and prevLine.startswith(IFNDEF_PREFIX):
- ifndefName = prevLine[len(IFNDEF_PREFIX):-1] # \note -1 to take out the newline.
- includeName = line[len(INDENTED_INCLUDE_PREFIX)+1:-2] # \note +1 to take out the beginning quote, -2 to take out the newline and the ending quote.
- if getIncludeGuardName(includeName) != ifndefName:
- errors.append("Invalid redundant include guard around line %d:" % lineNumber)
- errors.append("guard is %s but included file is %s" % (ifndefName, includeName))
-
- prevLine = line
- lineNumber += 1
-
- f.close()
- return errors
-
-def isHeader (filename):
- for pattern in HEADER_PATTERNS:
- if fnmatch(filename, pattern):
- return True
- return False
-
-def getFileList (path):
- allFiles = []
- if os.path.isfile(path):
- if isHeader(path):
- allFiles.append(path)
- else:
- for root, dirs, files in os.walk(path):
- for file in files:
- if isHeader(file):
- allFiles.append(os.path.join(root, file))
- return allFiles
-
-if __name__ == "__main__":
- parser = OptionParser()
- parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, help="only print files with errors")
-
- (options, args) = parser.parse_args()
- quiet = options.quiet
- files = []
- invalidFiles = []
-
- for dir in args:
- files += getFileList(os.path.normpath(dir))
-
- print "Checking..."
- for file in files:
- if not quiet:
- print " %s" % file
-
- errors = getRedundantIncludeGuardErrors(file)
- if errors:
- if quiet:
- print " %s" % file
- for err in errors:
- print " %s" % err
- invalidFiles.append(file)
-
- print ""
- if len(invalidFiles) > 0:
- print "Found %d files with invalid redundant include guards:" % len(invalidFiles)
-
- for file in invalidFiles:
- print " %s" % file
-
- sys.exit(-1)
- else:
- print "All files have valid redundant include guards."
--- /dev/null
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#-------------------------------------------------------------------------
+
+import sys
+from argparse import ArgumentParser
+from common import getChangedFiles, getAllProjectFiles
+from check_include_guards import checkIncludeGuards
+from check_whitespace import checkWhitespace
+
+if __name__ == "__main__":
+ parser = ArgumentParser()
+ parser.add_argument("-e", "--only-errors", action="store_true", dest="onlyErrors", default=False, help="Print only on error")
+ parser.add_argument("-i", "--only-changed", action="store_true", dest="useGitIndex", default=False, help="Check only modified files. Uses git.")
+
+ args = parser.parse_args()
+
+ if args.useGitIndex:
+ files = getChangedFiles()
+ else:
+ files = getAllProjectFiles()
+
+ error = not all([
+ checkWhitespace(files),
+ checkIncludeGuards(files),
+ #todo checkRedundantIncludeGuards(files),
+ ])
+
+ if error:
+ print "One or more checks failed"
+ sys.exit(1)
+ if not args.onlyErrors:
+ print "All checks passed"
headers.append(os.path.join(root, file))
return headers
+def checkIncludeGuards (files):
+ error = False
+ for file in files:
+ if isHeader(file):
+ if not hasValidIncludeGuard(file):
+ error = True
+ print "File %s contains invalid include guards" % file
+ return not error
+
if __name__ == "__main__":
parser = OptionParser()
parser.add_option("-x", "--fix", action="store_true", dest="fix", default=False, help="attempt to fix include guards (use with caution)")
--- /dev/null
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#-------------------------------------------------------------------------
+
+import sys
+from argparse import ArgumentParser
+from common import getChangedFiles, getAllProjectFiles, isTextFile
+
+def checkFileWhitespace (file):
+ f = open(file, 'rb')
+ error = False
+ for lineNum, line in enumerate(f):
+ if line.endswith(" \n") or line.endswith("\t\n"):
+ error = True
+ print "%s:%i trailing whitespace" % (file, lineNum+1)
+ if " \t" in line:
+ error = True
+ print "%s:%i merged <space><tab>" % (file, lineNum+1)
+ f.close()
+
+ return not error
+
+def checkWhitespace (files):
+ error = False
+ for file in files:
+ if isTextFile(file):
+ if not checkFileWhitespace(file):
+ error = True
+
+ return not error
+
+if __name__ == "__main__":
+ parser = ArgumentParser()
+ parser.add_argument("-e", "--only-errors", action="store_true", dest="onlyErrors", default=False, help="Print only on error")
+ parser.add_argument("-i", "--only-changed", action="store_true", dest="useGitIndex", default=False, help="Check only modified files. Uses git.")
+
+ args = parser.parse_args()
+
+ if args.useGitIndex:
+ files = getChangedFiles()
+ else:
+ files = getAllProjectFiles()
+
+ error = not checkWhitespace(files)
+
+ if error:
+ print "One or more checks failed"
+ sys.exit(1)
+ if not args.onlyErrors:
+ print "All checks passed"
--- /dev/null
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#-------------------------------------------------------------------------
+
+import os
+import subprocess
+
+TEXT_FILE_EXTENSION = [
+ ".bat",
+ ".c",
+ ".cfg",
+ ".cmake",
+ ".cpp",
+ ".css",
+ ".h",
+ ".hh",
+ ".hpp",
+ ".html",
+ ".inl",
+ ".java",
+ ".js",
+ ".m",
+ ".mk",
+ ".mm",
+ ".py",
+ ".rule",
+ ".sh",
+ ".test",
+ ".txt",
+ ".xml",
+ ".xsl",
+ ]
+
+BINARY_FILE_EXTENSION = [
+ ".png",
+ ".pkm",
+ ".xcf",
+ ]
+
+def isTextFile (filePath):
+ ext = os.path.splitext(filePath)[1]
+ if ext in TEXT_FILE_EXTENSION:
+ return True
+ if ext in BINARY_FILE_EXTENSION:
+ return False
+
+ # Analyze file contents, zero byte is the marker for a binary file
+ f = open(filePath, "rb")
+
+ TEST_LIMIT = 1024
+ nullFound = False
+ numBytesTested = 0
+
+ byte = f.read(1)
+ while byte and numBytesTested < TEST_LIMIT:
+ if byte == "\0":
+ nullFound = True
+ break
+
+ byte = f.read(1)
+ numBytesTested += 1
+
+ f.close()
+ return not nullFound
+
+def getProjectPath ():
+ # File system hierarchy is fixed
+ scriptDir = os.path.dirname(os.path.abspath(__file__))
+ projectDir = os.path.normpath(os.path.join(scriptDir, "../.."))
+ return projectDir
+
+def git (*args):
+ process = subprocess.Popen(['git'] + list(args), cwd=getProjectPath(), stdout=subprocess.PIPE)
+ output = process.communicate()[0]
+ if process.returncode != 0:
+ raise Exception("Failed to execute '%s', got %d" % (str(args), process.returncode))
+ return output
+
+def getAbsolutePathPathFromProjectRelativePath (projectRelativePath):
+ return os.path.normpath(os.path.join(getProjectPath(), projectRelativePath))
+
+def getChangedFiles ():
+ # Added, Copied, Moved, Renamed
+ output = git('diff', '--cached', '--name-only', '-z', '--diff-filter=ACMR')
+ relativePaths = output.split('\0')[:-1] # remove trailing ''
+ return [getAbsolutePathPathFromProjectRelativePath(path) for path in relativePaths]
+
+def getAllProjectFiles ():
+ output = git('ls-files', '--cached', '-z')
+ relativePaths = output.split('\0')[:-1] # remove trailing ''
+ return [getAbsolutePathPathFromProjectRelativePath(path) for path in relativePaths]