mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-25 10:20:14 +00:00
Rasterizer: Add Ceil and Floor to Fix12P4
This commit is contained in:
parent
537ba32167
commit
2d848836c1
@ -290,6 +290,14 @@ struct Fix12P4 {
|
|||||||
return static_cast<u16>(val & FracMask());
|
return static_cast<u16>(val & FracMask());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Fix12P4 Ceil() const {
|
||||||
|
return FromRaw(static_cast<s16>(val + FracMask())).Floor();
|
||||||
|
}
|
||||||
|
|
||||||
|
Fix12P4 Floor() const {
|
||||||
|
return FromRaw(static_cast<s16>(val & IntMask()));
|
||||||
|
}
|
||||||
|
|
||||||
operator s16() const {
|
operator s16() const {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -387,11 +395,10 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0,
|
|||||||
|
|
||||||
// TODO: Proper scissor rect test!
|
// TODO: Proper scissor rect test!
|
||||||
|
|
||||||
Fix12P4 frac = Fix12P4::FromInt(0, Fix12P4::FracMask());
|
min_x = min_x.Floor();
|
||||||
min_x = Fix12P4::FromInt(min_x.Int(), 0);
|
min_y = min_y.Floor();
|
||||||
min_y = Fix12P4::FromInt(min_y.Int(), 0);
|
max_x = max_x.Ceil();
|
||||||
max_x = Fix12P4::FromInt((max_x + frac).Int());
|
max_y = max_y.Ceil();
|
||||||
max_y = Fix12P4::FromInt((max_y + frac).Int());
|
|
||||||
|
|
||||||
// Keep pixels inside framebuffer
|
// Keep pixels inside framebuffer
|
||||||
min_x = std::max(min_x, Fix12P4::Zero());
|
min_x = std::max(min_x, Fix12P4::Zero());
|
||||||
|
Loading…
Reference in New Issue
Block a user