mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-23 18:19:21 +01:00
swrasterizer/proctex: Take regs and state by const reference
Avoids unnecessarily copying 512 bytes and 3584 bytes upon every invocation.
This commit is contained in:
parent
82b55b763c
commit
e2533e8edb
@ -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();
|
||||||
@ -154,7 +154,7 @@ static 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);
|
||||||
|
|
||||||
|
@ -9,6 +9,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
|
||||||
|
Loading…
Reference in New Issue
Block a user