mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-03-22 17:46:08 -04:00
perf(vulkan): use double viewport math only when scale < 1
Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -67,13 +67,14 @@ struct DrawParams {
|
|||||||
VkViewport GetViewportState(const Device& device, const Maxwell& regs, size_t index, float scale) {
|
VkViewport GetViewportState(const Device& device, const Maxwell& regs, size_t index, float scale) {
|
||||||
const auto& src = regs.viewport_transform[index];
|
const auto& src = regs.viewport_transform[index];
|
||||||
const auto conv = [scale](float value) {
|
const auto conv = [scale](float value) {
|
||||||
const double new_value = static_cast<double>(value) * static_cast<double>(scale);
|
if (scale >= 1.0f) {
|
||||||
if (scale < 1.0f) {
|
return value * scale;
|
||||||
const bool sign = std::signbit(value);
|
|
||||||
double rounded = std::round(std::abs(new_value));
|
|
||||||
return static_cast<float>(sign ? -rounded : rounded);
|
|
||||||
}
|
}
|
||||||
return static_cast<float>(new_value);
|
// Use double only when scaling down to avoid sub-pixel jitter (MP4 fix)
|
||||||
|
const double new_value = static_cast<double>(value) * static_cast<double>(scale);
|
||||||
|
const bool sign = std::signbit(value);
|
||||||
|
const double rounded = std::round(std::abs(new_value));
|
||||||
|
return static_cast<float>(sign ? -rounded : rounded);
|
||||||
};
|
};
|
||||||
const float x = conv(src.translate_x - src.scale_x);
|
const float x = conv(src.translate_x - src.scale_x);
|
||||||
const float width = conv(src.scale_x * 2.0f);
|
const float width = conv(src.scale_x * 2.0f);
|
||||||
|
|||||||
Reference in New Issue
Block a user