From 82b55b763c213ecd2e3af338b4fe631729fe6e93 Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Sat, 18 Apr 2020 22:09:34 -0400
Subject: [PATCH 1/2] swrasterizer/proctex: Make CombineAndMap() internally
 linked

This isn't used outside of this source file, so it can be marked
internally linked.
---
 src/video_core/swrasterizer/proctex.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/video_core/swrasterizer/proctex.cpp b/src/video_core/swrasterizer/proctex.cpp
index 80852da2e..3993726d3 100644
--- a/src/video_core/swrasterizer/proctex.cpp
+++ b/src/video_core/swrasterizer/proctex.cpp
@@ -112,8 +112,8 @@ static void ClampCoord(float& coord, ProcTexClamp mode) {
     }
 }
 
-float CombineAndMap(float u, float v, ProcTexCombiner combiner,
-                    const std::array<State::ProcTex::ValueEntry, 128>& map_table) {
+static float CombineAndMap(float u, float v, ProcTexCombiner combiner,
+                           const std::array<State::ProcTex::ValueEntry, 128>& map_table) {
     float f;
     switch (combiner) {
     case ProcTexCombiner::U:

From e2533e8edb79ecee2e47f181b06557a0f044e6b0 Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Sat, 18 Apr 2020 22:10:55 -0400
Subject: [PATCH 2/2] swrasterizer/proctex: Take regs and state by const
 reference

Avoids unnecessarily copying 512 bytes and 3584 bytes upon every
invocation.
---
 src/video_core/swrasterizer/proctex.cpp | 4 ++--
 src/video_core/swrasterizer/proctex.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/video_core/swrasterizer/proctex.cpp b/src/video_core/swrasterizer/proctex.cpp
index 3993726d3..23f7630de 100644
--- a/src/video_core/swrasterizer/proctex.cpp
+++ b/src/video_core/swrasterizer/proctex.cpp
@@ -45,7 +45,7 @@ static float NoiseRand2D(unsigned int x, unsigned int y) {
     return -1.0f + v2 * 2.0f / 15.0f;
 }
 
-static float NoiseCoef(float u, float v, TexturingRegs regs, State::ProcTex state) {
+static float NoiseCoef(float u, float v, const TexturingRegs& regs, const State::ProcTex& state) {
     const float freq_u = float16::FromRaw(regs.proctex_noise_frequency.u).ToFloat32();
     const float freq_v = float16::FromRaw(regs.proctex_noise_frequency.v).ToFloat32();
     const float phase_u = float16::FromRaw(regs.proctex_noise_u.phase).ToFloat32();
@@ -154,7 +154,7 @@ static float CombineAndMap(float u, float v, ProcTexCombiner combiner,
     return LookupLUT(map_table, f);
 }
 
-Common::Vec4<u8> ProcTex(float u, float v, TexturingRegs regs, State::ProcTex state) {
+Common::Vec4<u8> ProcTex(float u, float v, const TexturingRegs& regs, const State::ProcTex& state) {
     u = std::abs(u);
     v = std::abs(v);
 
diff --git a/src/video_core/swrasterizer/proctex.h b/src/video_core/swrasterizer/proctex.h
index 9c2d9c016..c3319b935 100644
--- a/src/video_core/swrasterizer/proctex.h
+++ b/src/video_core/swrasterizer/proctex.h
@@ -9,6 +9,6 @@
 namespace Pica::Rasterizer {
 
 /// Generates procedural texture color for the given coordinates
-Common::Vec4<u8> ProcTex(float u, float v, TexturingRegs regs, State::ProcTex state);
+Common::Vec4<u8> ProcTex(float u, float v, const TexturingRegs& regs, const State::ProcTex& state);
 
 } // namespace Pica::Rasterizer