summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/shader_interpreter.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-08-23 23:56:35 +0200
committerbunnei <bunneidev@gmail.com>2015-08-23 23:56:35 +0200
commit83c214f6d8b1434503b6d8219bdac7064b8df2ca (patch)
tree8762cf0a0399b5fff978f098504dc9f918d2b4ee /src/video_core/shader/shader_interpreter.cpp
parentMerge pull request #1057 from aroulin/shader-dph-dphi (diff)
parentShader: Use std::sqrt for float instead of sqrt (diff)
downloadyuzu-83c214f6d8b1434503b6d8219bdac7064b8df2ca.tar
yuzu-83c214f6d8b1434503b6d8219bdac7064b8df2ca.tar.gz
yuzu-83c214f6d8b1434503b6d8219bdac7064b8df2ca.tar.bz2
yuzu-83c214f6d8b1434503b6d8219bdac7064b8df2ca.tar.lz
yuzu-83c214f6d8b1434503b6d8219bdac7064b8df2ca.tar.xz
yuzu-83c214f6d8b1434503b6d8219bdac7064b8df2ca.tar.zst
yuzu-83c214f6d8b1434503b6d8219bdac7064b8df2ca.zip
Diffstat (limited to 'src/video_core/shader/shader_interpreter.cpp')
-rw-r--r--src/video_core/shader/shader_interpreter.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp
index 6b83d2c1c..ae5a30441 100644
--- a/src/video_core/shader/shader_interpreter.cpp
+++ b/src/video_core/shader/shader_interpreter.cpp
@@ -228,13 +228,12 @@ void RunInterpreter(UnitState<Debug>& state) {
{
Record<DebugDataRecord::SRC1>(state.debug, iteration, src1);
Record<DebugDataRecord::DEST_IN>(state.debug, iteration, dest);
+ float24 rcp_res = float24::FromFloat32(1.0f / src1[0].ToFloat32());
for (int i = 0; i < 4; ++i) {
if (!swizzle.DestComponentEnabled(i))
continue;
- // TODO: Be stable against division by zero!
- // TODO: I think this might be wrong... we should only use one component here
- dest[i] = float24::FromFloat32(1.0f / src1[i].ToFloat32());
+ dest[i] = rcp_res;
}
Record<DebugDataRecord::DEST_OUT>(state.debug, iteration, dest);
break;
@@ -245,13 +244,12 @@ void RunInterpreter(UnitState<Debug>& state) {
{
Record<DebugDataRecord::SRC1>(state.debug, iteration, src1);
Record<DebugDataRecord::DEST_IN>(state.debug, iteration, dest);
+ float24 rsq_res = float24::FromFloat32(1.0f / std::sqrt(src1[0].ToFloat32()));
for (int i = 0; i < 4; ++i) {
if (!swizzle.DestComponentEnabled(i))
continue;
- // TODO: Be stable against division by zero!
- // TODO: I think this might be wrong... we should only use one component here
- dest[i] = float24::FromFloat32(1.0f / sqrt(src1[i].ToFloat32()));
+ dest[i] = rsq_res;
}
Record<DebugDataRecord::DEST_OUT>(state.debug, iteration, dest);
break;