Merge pull request #5247 from lioncash/copy3

swrasterizer/proctex: Take regs by const reference
This commit is contained in:
Pengfei Zhu 2020-04-24 22:07:03 +08:00 committed by GitHub
commit 77ffe37c46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -45,7 +45,7 @@ static float NoiseRand2D(unsigned int x, unsigned int y) {
return -1.0f + v2 * 2.0f / 15.0f; 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_u = float16::FromRaw(regs.proctex_noise_frequency.u).ToFloat32();
const float freq_v = float16::FromRaw(regs.proctex_noise_frequency.v).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(); const float phase_u = float16::FromRaw(regs.proctex_noise_u.phase).ToFloat32();
@ -112,8 +112,8 @@ static void ClampCoord(float& coord, ProcTexClamp mode) {
} }
} }
float CombineAndMap(float u, float v, ProcTexCombiner combiner, static float CombineAndMap(float u, float v, ProcTexCombiner combiner,
const std::array<State::ProcTex::ValueEntry, 128>& map_table) { const std::array<State::ProcTex::ValueEntry, 128>& map_table) {
float f; float f;
switch (combiner) { switch (combiner) {
case ProcTexCombiner::U: case ProcTexCombiner::U:
@ -154,7 +154,7 @@ float CombineAndMap(float u, float v, ProcTexCombiner combiner,
return LookupLUT(map_table, f); 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); u = std::abs(u);
v = std::abs(v); v = std::abs(v);

View File

@ -11,6 +11,6 @@
namespace Pica::Rasterizer { namespace Pica::Rasterizer {
/// Generates procedural texture color for the given coordinates /// 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 } // namespace Pica::Rasterizer