Commit 5f4e70b8 by Nicolas Capens Committed by Nicolas Capens

Remove float division-by-zero prevention

We now deal with NaN and Inf results from the cube map face projection in the SamplerCore:address() method by clamping to the [0.0, 1.0) range, so we can just let the pathological division-by-zero cases happen and not spend more cycles on preventing it. Bug: b/169802633 Change-Id: I329420415f6e3b913d912b357758f92f8e0ee7f4 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/48828 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent 635de036
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include "System/Debug.hpp" #include "System/Debug.hpp"
#include "Vulkan/VkSampler.hpp" #include "Vulkan/VkSampler.hpp"
#include <limits>
namespace sw { namespace sw {
SamplerCore::SamplerCore(Pointer<Byte> &constants, const Sampler &state) SamplerCore::SamplerCore(Pointer<Byte> &constants, const Sampler &state)
...@@ -1339,7 +1337,7 @@ Int4 SamplerCore::cubeFace(Float4 &U, Float4 &V, Float4 &x, Float4 &y, Float4 &z ...@@ -1339,7 +1337,7 @@ Int4 SamplerCore::cubeFace(Float4 &U, Float4 &V, Float4 &x, Float4 &y, Float4 &z
face.z = (faces >> 8) & 0x7; face.z = (faces >> 8) & 0x7;
face.w = (faces >> 12) & 0x7; face.w = (faces >> 12) & 0x7;
M = Max(Max(absX, absY), Max(absZ, Float4(std::numeric_limits<float>::min()))); M = Max(Max(absX, absY), absZ);
// U = xMajor ? (neg ^ -z) : ((zMajor & neg) ^ x) // U = xMajor ? (neg ^ -z) : ((zMajor & neg) ^ x)
U = As<Float4>((xMajor & (n ^ As<Int4>(-z))) | (~xMajor & ((zMajor & n) ^ As<Int4>(x)))); U = As<Float4>((xMajor & (n ^ As<Int4>(-z))) | (~xMajor & ((zMajor & n) ^ As<Int4>(x))));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment