summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2016-03-20 05:35:06 +0100
committerbunnei <bunneidev@gmail.com>2016-03-20 05:35:06 +0100
commit784c5539eaadb69c36363c89008e3a37ab9e9ae7 (patch)
treec084be223588127266f1b9c3c9f9c44a10795eeb
parentMerge pull request #1522 from MerryMage/dylibbundler (diff)
parentshader_interpreter: use std::inner_product for the dot product (diff)
downloadyuzu-784c5539eaadb69c36363c89008e3a37ab9e9ae7.tar
yuzu-784c5539eaadb69c36363c89008e3a37ab9e9ae7.tar.gz
yuzu-784c5539eaadb69c36363c89008e3a37ab9e9ae7.tar.bz2
yuzu-784c5539eaadb69c36363c89008e3a37ab9e9ae7.tar.lz
yuzu-784c5539eaadb69c36363c89008e3a37ab9e9ae7.tar.xz
yuzu-784c5539eaadb69c36363c89008e3a37ab9e9ae7.tar.zst
yuzu-784c5539eaadb69c36363c89008e3a37ab9e9ae7.zip
-rw-r--r--src/video_core/shader/shader_interpreter.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp
index 02e1a1cb1..9b978583e 100644
--- a/src/video_core/shader/shader_interpreter.cpp
+++ b/src/video_core/shader/shader_interpreter.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include <common/file_util.h>
-
+#include <numeric>
#include <nihstro/shader_bytecode.h>
+#include "common/file_util.h"
#include "video_core/pica.h"
#include "video_core/pica_state.h"
#include "video_core/shader/shader.h"
@@ -214,10 +214,8 @@ void RunInterpreter(UnitState<Debug>& state) {
if (opcode == OpCode::Id::DPH || opcode == OpCode::Id::DPHI)
src1[3] = float24::FromFloat32(1.0f);
- float24 dot = float24::FromFloat32(0.f);
int num_components = (opcode == OpCode::Id::DP3) ? 3 : 4;
- for (int i = 0; i < num_components; ++i)
- dot = dot + src1[i] * src2[i];
+ float24 dot = std::inner_product(src1, src1 + num_components, src2, float24::FromFloat32(0.f));
for (int i = 0; i < 4; ++i) {
if (!swizzle.DestComponentEnabled(i))