}
#endif // DE_DEBUG
+static inline float lookupDepth (const ConstPixelBufferAccess& access, int i, int j, int k = 0)
+{
+ return access.getPixDepth(i, j, k);
+}
+
struct CmpResultSet
{
bool isTrue;
{
const int x = wrap(sampler.wrapS, i, level.getWidth());
const int y = wrap(sampler.wrapT, j, level.getHeight());
- const float depth = level.getPixDepth(x, y, coordZ);
+ const float depth = lookupDepth(level, x, y, coordZ);
const CmpResultSet resSet = execCompare(sampler.compare, depth, cmpReference, prec.referenceBits, isFixedPointDepth);
if (isResultInSet(resSet, result, prec.resultBits))
const float minB = de::clamp((vBounds.x()-0.5f)-float(j), 0.0f, 1.0f);
const float maxB = de::clamp((vBounds.y()-0.5f)-float(j), 0.0f, 1.0f);
- const Vec4 depths (level.getPixDepth(x0, y0, coordZ),
- level.getPixDepth(x1, y0, coordZ),
- level.getPixDepth(x0, y1, coordZ),
- level.getPixDepth(x1, y1, coordZ));
+ const Vec4 depths (lookupDepth(level, x0, y0, coordZ),
+ lookupDepth(level, x1, y0, coordZ),
+ lookupDepth(level, x0, y1, coordZ),
+ lookupDepth(level, x1, y1, coordZ));
if (isBilinearCompareValid(sampler.compare, prec, depths, Vec2(minA, maxA), Vec2(minB, maxB), cmpReference, result, isFixedPointDepth))
return true;
{
for (int i0 = minI0; i0 <= maxI0; i0++)
{
- const float depth0 = level0.getPixDepth(wrap(sampler.wrapS, i0, w0), wrap(sampler.wrapT, j0, h0), coordZ);
+ const float depth0 = lookupDepth(level0, wrap(sampler.wrapS, i0, w0), wrap(sampler.wrapT, j0, h0), coordZ);
for (int j1 = minJ1; j1 <= maxJ1; j1++)
{
for (int i1 = minI1; i1 <= maxI1; i1++)
{
- const float depth1 = level1.getPixDepth(wrap(sampler.wrapS, i1, w1), wrap(sampler.wrapT, j1, h1), coordZ);
+ const float depth1 = lookupDepth(level1, wrap(sampler.wrapS, i1, w1), wrap(sampler.wrapT, j1, h1), coordZ);
if (isLinearCompareValid(sampler.compare, prec, Vec2(depth0, depth1), fBounds, cmpReference, result, isFixedPointDepth))
return true;
const int y0 = wrap(sampler.wrapT, j0 , h0);
const int y1 = wrap(sampler.wrapT, j0+1, h0);
- depths0[0] = level0.getPixDepth(x0, y0, coordZ);
- depths0[1] = level0.getPixDepth(x1, y0, coordZ);
- depths0[2] = level0.getPixDepth(x0, y1, coordZ);
- depths0[3] = level0.getPixDepth(x1, y1, coordZ);
+ depths0[0] = lookupDepth(level0, x0, y0, coordZ);
+ depths0[1] = lookupDepth(level0, x1, y0, coordZ);
+ depths0[2] = lookupDepth(level0, x0, y1, coordZ);
+ depths0[3] = lookupDepth(level0, x1, y1, coordZ);
}
for (int j1 = minJ1; j1 <= maxJ1; j1++)
const int y0 = wrap(sampler.wrapT, j1 , h1);
const int y1 = wrap(sampler.wrapT, j1+1, h1);
- depths1[0] = level1.getPixDepth(x0, y0, coordZ);
- depths1[1] = level1.getPixDepth(x1, y0, coordZ);
- depths1[2] = level1.getPixDepth(x0, y1, coordZ);
- depths1[3] = level1.getPixDepth(x1, y1, coordZ);
+ depths1[0] = lookupDepth(level1, x0, y0, coordZ);
+ depths1[1] = lookupDepth(level1, x1, y0, coordZ);
+ depths1[2] = lookupDepth(level1, x0, y1, coordZ);
+ depths1[3] = lookupDepth(level1, x1, y1, coordZ);
}
if (isTrilinearCompareValid(sampler.compare, prec, depths0, depths1,
if (c00.face == CUBEFACE_LAST || c01.face == CUBEFACE_LAST || c10.face == CUBEFACE_LAST || c11.face == CUBEFACE_LAST)
return true;
- depths0[0] = faces0[c00.face].getPixDepth(c00.s, c00.t);
- depths0[1] = faces0[c10.face].getPixDepth(c10.s, c10.t);
- depths0[2] = faces0[c01.face].getPixDepth(c01.s, c01.t);
- depths0[3] = faces0[c11.face].getPixDepth(c11.s, c11.t);
+ depths0[0] = lookupDepth(faces0[c00.face], c00.s, c00.t);
+ depths0[1] = lookupDepth(faces0[c10.face], c10.s, c10.t);
+ depths0[2] = lookupDepth(faces0[c01.face], c01.s, c01.t);
+ depths0[3] = lookupDepth(faces0[c11.face], c11.s, c11.t);
}
for (int j1 = minJ1; j1 <= maxJ1; j1++)
if (c00.face == CUBEFACE_LAST || c01.face == CUBEFACE_LAST || c10.face == CUBEFACE_LAST || c11.face == CUBEFACE_LAST)
return true;
- depths1[0] = faces1[c00.face].getPixDepth(c00.s, c00.t);
- depths1[1] = faces1[c10.face].getPixDepth(c10.s, c10.t);
- depths1[2] = faces1[c01.face].getPixDepth(c01.s, c01.t);
- depths1[3] = faces1[c11.face].getPixDepth(c11.s, c11.t);
+ depths1[0] = lookupDepth(faces1[c00.face], c00.s, c00.t);
+ depths1[1] = lookupDepth(faces1[c10.face], c10.s, c10.t);
+ depths1[2] = lookupDepth(faces1[c01.face], c01.s, c01.t);
+ depths1[3] = lookupDepth(faces1[c11.face], c11.s, c11.t);
}
const float maxB = de::clamp((vBounds.y()-0.5f)-float(j), 0.0f, 1.0f);
Vec4 depths;
- depths[0] = faces[c00.face].getPixDepth(c00.s, c00.t);
- depths[1] = faces[c10.face].getPixDepth(c10.s, c10.t);
- depths[2] = faces[c01.face].getPixDepth(c01.s, c01.t);
- depths[3] = faces[c11.face].getPixDepth(c11.s, c11.t);
+ depths[0] = lookupDepth(faces[c00.face], c00.s, c00.t);
+ depths[1] = lookupDepth(faces[c10.face], c10.s, c10.t);
+ depths[2] = lookupDepth(faces[c01.face], c01.s, c01.t);
+ depths[3] = lookupDepth(faces[c11.face], c11.s, c11.t);
if (isBilinearCompareValid(sampler.compare, prec, depths, Vec2(minA, maxA), Vec2(minB, maxB), cmpReference, result, isFixedPointDepth))
return true;
const int minLayer = de::clamp(deFloorFloatToInt32(minZ + 0.5f), 0, texture.getNumLayers()-1);
const int maxLayer = de::clamp(deFloorFloatToInt32(maxZ + 0.5f), 0, texture.getNumLayers()-1);
+ DE_ASSERT(isSamplerSupported(sampler));
+
for (int layer = minLayer; layer <= maxLayer; layer++)
{
const float minLod = lodBounds.x();
const bool canBeMagnified = minLod <= sampler.lodThreshold;
const bool canBeMinified = maxLod > sampler.lodThreshold;
- DE_ASSERT(isSamplerSupported(sampler));
-
if (canBeMagnified)
{
if (isLevelCompareResultValid(texture.getLevel(0), sampler, sampler.magFilter, prec, coord.swizzle(0,1), layer, cmpReference, result))
// offNdx-th coordinate offset and then wrapped.
const int x = wrap(sampler.wrapS, i+offsets[offNdx].x(), w);
const int y = wrap(sampler.wrapT, j+offsets[offNdx].y(), h);
- const float depth = texture.getPixDepth(x, y, coordZ);
+ const float depth = lookupDepth(texture, x, y, coordZ);
const CmpResultSet resSet = execCompare(sampler.compare, depth, cmpReference, prec.referenceBits, isFixedPointDepth);
if (!isResultInSet(resSet, result[offNdx], prec.resultBits))
float cmpReference,
const Vec4& result)
{
+ DE_ASSERT(isSamplerSupported(sampler));
+
return isGatherOffsetsCompareResultValid(texture.getLevel(0), sampler, prec, coord, 0, offsets, cmpReference, result);
}
const int minLayer = de::clamp(deFloorFloatToInt32(minZ + 0.5f), 0, texture.getNumLayers()-1);
const int maxLayer = de::clamp(deFloorFloatToInt32(maxZ + 0.5f), 0, texture.getNumLayers()-1);
+ DE_ASSERT(isSamplerSupported(sampler));
+
for (int layer = minLayer; layer <= maxLayer; layer++)
{
if (isGatherOffsetsCompareResultValid(texture.getLevel(0), sampler, prec, coord.swizzle(0,1), layer, offsets, cmpReference, result))
if (c.face == CUBEFACE_LAST)
return true;
- const float depth = faces[c.face].getPixDepth(c.s, c.t);
+ const float depth = lookupDepth(faces[c.face], c.s, c.t);
const CmpResultSet resSet = execCompare(sampler.compare, depth, cmpReference, prec.referenceBits, isFixedPointDepth);
if (!isResultInSet(resSet, result[offNdx], prec.resultBits))
int numPossibleFaces = 0;
CubeFace possibleFaces[CUBEFACE_LAST];
+ DE_ASSERT(isSamplerSupported(sampler));
+
getPossibleCubeFaces(coord, prec.coordBits, &possibleFaces[0], numPossibleFaces);
if (numPossibleFaces == 0)