Lines Matching refs:Lod
100 Float lod;
109 computeLod(texture, lod, anisotropy, uDelta, vDelta, uuuu, vvvv, bias.x, dsx, dsy, function);
115 computeLodCube(texture, lod, u, v, w, bias.x, dsx, dsy, M, function);
120 computeLod3D(texture, lod, uuuu, vvvv, wwww, bias.x, dsx, dsy, function);
125 c = sampleFilter(texture, uuuu, vvvv, wwww, offset, lod, anisotropy, uDelta, vDelta, face, function);
129 Vector4f cf = sampleFloatFilter(texture, uuuu, vvvv, wwww, qqqq, offset, lod, anisotropy, uDelta, vDelta, face, function);
264 Float lod;
273 computeLod(texture, lod, anisotropy, uDelta, vDelta, uuuu, vvvv, bias.x, dsx, dsy, function);
279 computeLodCube(texture, lod, u, v, w, bias.x, dsx, dsy, M, function);
284 computeLod3D(texture, lod, uuuu, vvvv, wwww, bias.x, dsx, dsy, function);
287 c = sampleFloatFilter(texture, uuuu, vvvv, wwww, qqqq, offset, lod, anisotropy, uDelta, vDelta, face, function);
411 Vector4f SamplerCore::textureSize(Pointer<Byte> &texture, Float4 &lod)
418 Pointer<Byte> mipmap = texture + OFFSET(Texture, mipmap) + (As<Int>(Extract(lod, i)) + baseLevel) * sizeof(Mipmap);
438 Short4 SamplerCore::offsetSample(Short4 &uvw, Pointer<Byte> &mipmap, int halfOffset, bool wrap, int count, Float &lod)
444 offset &= Short4(CmpNLE(Float4(lod), Float4(0.0f)));
448 offset &= Short4(CmpLE(Float4(lod), Float4(0.0f)));
475 Vector4s SamplerCore::sampleFilter(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Int face[4], SamplerFunction function)
477 Vector4s c = sampleAniso(texture, u, v, w, offset, lod, anisotropy, uDelta, vDelta, face, false, function);
486 Vector4s cc = sampleAniso(texture, u, v, w, offset, lod, anisotropy, uDelta, vDelta, face, true, function);
488 lod *= Float(1 << 16);
490 UShort4 utri = UShort4(Float4(lod)); // FIXME: Optimize
576 Vector4s SamplerCore::sampleAniso(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Int face[4], bool secondLOD, SamplerFunction function)
580 if(state.textureFilter != FILTER_ANISOTROPIC || function == Lod || function == Fetch)
582 c = sampleQuad(texture, u, v, w, offset, lod, face, secondLOD, function);
613 c = sampleQuad(texture, u0, v0, w, offset, lod, face, secondLOD, function);
636 Vector4s SamplerCore::sampleQuad(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, Int face[4], bool secondLOD, SamplerFunction function)
640 return sampleQuad2D(texture, u, v, w, offset, lod, face, secondLOD, function);
644 return sample3D(texture, u, v, w, offset, lod, secondLOD, function);
648 Vector4s SamplerCore::sampleQuad2D(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, Int face[4], bool secondLOD, SamplerFunction function)
658 selectMipmap(texture, buffer, mipmap, lod, face, secondLOD);
672 Short4 uuuu0 = offsetSample(uuuu, mipmap, OFFSET(Mipmap,uHalf), state.addressingModeU == ADDRESSING_WRAP, gather ? 0 : -1, lod);
673 Short4 vvvv0 = offsetSample(vvvv, mipmap, OFFSET(Mipmap,vHalf), state.addressingModeV == ADDRESSING_WRAP, gather ? 0 : -1, lod);
674 Short4 uuuu1 = offsetSample(uuuu, mipmap, OFFSET(Mipmap,uHalf), state.addressingModeU == ADDRESSING_WRAP, gather ? 2 : +1, lod);
675 Short4 vvvv1 = offsetSample(vvvv, mipmap, OFFSET(Mipmap,vHalf), state.addressingModeV == ADDRESSING_WRAP, gather ? 2 : +1, lod);
843 Vector4s SamplerCore::sample3D(Pointer<Byte> &texture, Float4 &u_, Float4 &v_, Float4 &w_, Vector4f &offset, Float &lod, bool secondLOD, SamplerFunction function)
853 selectMipmap(texture, buffer, mipmap, lod, face, secondLOD);
879 u[i][j][k] = offsetSample(uuuu, mipmap, OFFSET(Mipmap,uHalf), state.addressingModeU == ADDRESSING_WRAP, i * 2 - 1, lod);
880 v[i][j][k] = offsetSample(vvvv, mipmap, OFFSET(Mipmap,vHalf), state.addressingModeV == ADDRESSING_WRAP, j * 2 - 1, lod);
881 s[i][j][k] = offsetSample(wwww, mipmap, OFFSET(Mipmap,wHalf), state.addressingModeW == ADDRESSING_WRAP, k * 2 - 1, lod);
968 Vector4f SamplerCore::sampleFloatFilter(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &offset, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Int face[4], SamplerFunction function)
970 Vector4f c = sampleFloatAniso(texture, u, v, w, q, offset, lod, anisotropy, uDelta, vDelta, face, false, function);
979 Vector4f cc = sampleFloatAniso(texture, u, v, w, q, offset, lod, anisotropy, uDelta, vDelta, face, true, function);
981 Float4 lod4 = Float4(Frac(lod));
1048 Vector4f SamplerCore::sampleFloatAniso(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &offset, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Int face[4], bool secondLOD, SamplerFunction function)
1052 if(state.textureFilter != FILTER_ANISOTROPIC || function == Lod || function == Fetch)
1054 c = sampleFloat(texture, u, v, w, q, offset, lod, face, secondLOD, function);
1083 c = sampleFloat(texture, u0, v0, w, q, offset, lod, face, secondLOD, function);
1106 Vector4f SamplerCore::sampleFloat(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &offset, Float &lod, Int face[4], bool secondLOD, SamplerFunction function)
1110 return sampleFloat2D(texture, u, v, w, q, offset, lod, face, secondLOD, function);
1114 return sampleFloat3D(texture, u, v, w, offset, lod, secondLOD, function);
1118 Vector4f SamplerCore::sampleFloat2D(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &offset, Float &lod, Int face[4], bool secondLOD, SamplerFunction function)
1128 selectMipmap(texture, buffer, mipmap, lod, face, secondLOD);
1132 Int4 filter = computeFilterOffset(lod);
1187 Vector4f SamplerCore::sampleFloat3D(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, bool secondLOD, SamplerFunction function)
1197 selectMipmap(texture, buffer, mipmap, lod, face, secondLOD);
1201 Int4 filter = computeFilterOffset(lod);
1271 Float SamplerCore::log2sqrt(Float lod)
1273 // log2(sqrt(lod)) // Equals 0.25 * log2(lod^2).
1274 lod *= lod; // Squaring doubles the exponent and produces an extra bit of precision.
1275 lod = Float(As<Int>(lod)) - Float(0x3F800000); // Interpret as integer and subtract the exponent bias.
1276 lod *= As<Float>(Int(0x33000000)); // Scale by 0.25 * 2^-23 (mantissa length).
1278 return lod;
1281 Float SamplerCore::log2(Float lod)
1283 lod *= lod; // Squaring doubles the exponent and produces an extra bit of precision.
1284 lod = Float(As<Int>(lod)) - Float(0x3F800000); // Interpret as integer and subtract the exponent bias.
1285 lod *= As<Float>(Int(0x33800000)); // Scale by 0.5 * 2^-23 (mantissa length).
1287 return lod;
1290 void SamplerCore::computeLod(Pointer<Byte> &texture, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Float4 &uuuu, Float4 &vvvv, const Float &lodBias, Vector4f &dsx, Vector4f &dsy, SamplerFunction function)
1292 if(function != Lod && function != Fetch)
1308 // Scale by texture dimensions and global LOD.
1314 lod = Max(Float(dUV2.x), Float(dUV2.y)); // Square length of major axis
1329 anisotropy = lod * Rcp_pp(det);
1332 lod *= Rcp_pp(anisotropy * anisotropy);
1335 lod = log2sqrt(lod); // log2(sqrt(lod))
1339 lod += lodBias;
1342 else if(function == Lod)
1344 lod = lodBias;
1349 lod = Float(As<Int>(lodBias));
1353 lod = Float(0);
1357 lod = Max(lod, *Pointer<Float>(texture + OFFSET(Texture, minLod)));
1358 lod = Min(lod, *Pointer<Float>(texture + OFFSET(Texture, maxLod)));
1361 void SamplerCore::computeLodCube(Pointer<Byte> &texture, Float &lod, Float4 &u, Float4 &v, Float4 &w, const Float &lodBias, Vector4f &dsx, Vector4f &dsy, Float4 &M, SamplerFunction function)
1363 if(function != Lod && function != Fetch)
1396 lod = Max(Float(dudxy.y), Float(dudxy.z)); // FIXME: Max(dudxy.y, dudxy.z);
1398 // Scale by texture dimension and global LOD.
1399 lod *= *Pointer<Float>(texture + OFFSET(Texture,widthLOD));
1401 lod = log2(lod);
1405 lod += lodBias;
1408 else if(function == Lod)
1410 lod = lodBias;
1415 lod = Float(As<Int>(lodBias));
1419 lod = Float(0);
1423 lod = Max(lod, *Pointer<Float>(texture + OFFSET(Texture, minLod)));
1424 lod = Min(lod, *Pointer<Float>(texture + OFFSET(Texture, maxLod)));
1427 void SamplerCore::computeLod3D(Pointer<Byte> &texture, Float &lod, Float4 &uuuu, Float4 &vvvv, Float4 &wwww, const Float &lodBias, Vector4f &dsx, Vector4f &dsy, SamplerFunction function)
1429 if(function != Lod && function != Fetch)
1446 // Scale by texture dimensions and global LOD.
1458 lod = Max(Float(dudxy.y), Float(dudxy.z)); // FIXME: Max(dudxy.y, dudxy.z);
1460 lod = log2sqrt(lod); // log2(sqrt(lod))
1464 lod += lodBias;
1467 else if(function == Lod)
1469 lod = lodBias;
1474 lod = Float(As<Int>(lodBias));
1478 lod = Float(0);
1482 lod = Max(lod, *Pointer<Float>(texture + OFFSET(Texture, minLod)));
1483 lod = Min(lod, *Pointer<Float>(texture + OFFSET(Texture, maxLod)));
2092 void SamplerCore::selectMipmap(Pointer<Byte> &texture, Pointer<Byte> buffer[4], Pointer<Byte> &mipmap, Float &lod, Int face[4], bool secondLOD)
2104 ilod = RoundInt(lod);
2108 ilod = Int(lod);
2133 Int4 SamplerCore::computeFilterOffset(Float &lod)
2143 filter = CmpNLE(Float4(lod), Float4(0.0f));
2147 filter = CmpLE(Float4(lod), Float4(0.0f));