mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-04 22:12:46 +01:00
Improved performance of FromAttributeBuffer
Ternary operator is optimized by the compiler whereas std::min() is meant to return a value. I've noticed a 5%-10% emulation speed increase.
This commit is contained in:
parent
255fd8768d
commit
a234e4c200
1 changed files with 2 additions and 1 deletions
|
@ -52,7 +52,8 @@ OutputVertex OutputVertex::FromAttributeBuffer(const RasterizerRegs& regs,
|
||||||
// The hardware takes the absolute and saturates vertex colors like this, *before* doing
|
// The hardware takes the absolute and saturates vertex colors like this, *before* doing
|
||||||
// interpolation
|
// interpolation
|
||||||
for (unsigned i = 0; i < 4; ++i) {
|
for (unsigned i = 0; i < 4; ++i) {
|
||||||
ret.color[i] = float24::FromFloat32(std::fmin(std::fabs(ret.color[i].ToFloat32()), 1.0f));
|
float c = std::fabs(ret.color[i].ToFloat32());
|
||||||
|
ret.color[i] = float24::FromFloat32(c < 1.0f ? c : 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_TRACE(HW_GPU, "Output vertex: pos(%.2f, %.2f, %.2f, %.2f), quat(%.2f, %.2f, %.2f, %.2f), "
|
LOG_TRACE(HW_GPU, "Output vertex: pos(%.2f, %.2f, %.2f, %.2f), quat(%.2f, %.2f, %.2f, %.2f), "
|
||||||
|
|
Loading…
Reference in a new issue