mirror of
https://github.com/yuzu-emu/yuzu-mainline
synced 2024-11-23 16:53:46 +00:00
Merge pull request #1538 from lioncash/dot
shader_interpreter: use std::inner_product for the dot product
This commit is contained in:
commit
784c5539ea
1 changed files with 3 additions and 5 deletions
|
@ -2,10 +2,10 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <common/file_util.h>
|
#include <numeric>
|
||||||
|
|
||||||
#include <nihstro/shader_bytecode.h>
|
#include <nihstro/shader_bytecode.h>
|
||||||
|
|
||||||
|
#include "common/file_util.h"
|
||||||
#include "video_core/pica.h"
|
#include "video_core/pica.h"
|
||||||
#include "video_core/pica_state.h"
|
#include "video_core/pica_state.h"
|
||||||
#include "video_core/shader/shader.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)
|
if (opcode == OpCode::Id::DPH || opcode == OpCode::Id::DPHI)
|
||||||
src1[3] = float24::FromFloat32(1.0f);
|
src1[3] = float24::FromFloat32(1.0f);
|
||||||
|
|
||||||
float24 dot = float24::FromFloat32(0.f);
|
|
||||||
int num_components = (opcode == OpCode::Id::DP3) ? 3 : 4;
|
int num_components = (opcode == OpCode::Id::DP3) ? 3 : 4;
|
||||||
for (int i = 0; i < num_components; ++i)
|
float24 dot = std::inner_product(src1, src1 + num_components, src2, float24::FromFloat32(0.f));
|
||||||
dot = dot + src1[i] * src2[i];
|
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
if (!swizzle.DestComponentEnabled(i))
|
if (!swizzle.DestComponentEnabled(i))
|
||||||
|
|
Loading…
Reference in a new issue