mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-09-06 20:49:20 +01:00
GPU: Use shifts instead of multiplications to calculate the actual size of the output.
This commit is contained in:
parent
6a0eea93e0
commit
8ee814ec27
1 changed files with 6 additions and 6 deletions
|
@ -125,11 +125,11 @@ inline void Write(u32 addr, const T data) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned horizontal_scale = (config.scaling != config.NoScale) ? 2 : 1;
|
bool horizontal_scale = config.scaling != config.NoScale;
|
||||||
unsigned vertical_scale = (config.scaling == config.ScaleXY) ? 2 : 1;
|
bool vertical_scale = config.scaling == config.ScaleXY;
|
||||||
|
|
||||||
u32 output_width = config.output_width / horizontal_scale;
|
u32 output_width = config.output_width >> horizontal_scale;
|
||||||
u32 output_height = config.output_height / vertical_scale;
|
u32 output_height = config.output_height >> vertical_scale;
|
||||||
|
|
||||||
u32 input_size = config.input_width * config.input_height * GPU::Regs::BytesPerPixel(config.input_format);
|
u32 input_size = config.input_width * config.input_height * GPU::Regs::BytesPerPixel(config.input_format);
|
||||||
u32 output_size = output_width * output_height * GPU::Regs::BytesPerPixel(config.output_format);
|
u32 output_size = output_width * output_height * GPU::Regs::BytesPerPixel(config.output_format);
|
||||||
|
@ -161,8 +161,8 @@ inline void Write(u32 addr, const T data) {
|
||||||
|
|
||||||
// Calculate the [x,y] position of the input image
|
// Calculate the [x,y] position of the input image
|
||||||
// based on the current output position and the scale
|
// based on the current output position and the scale
|
||||||
u32 input_x = x * horizontal_scale;
|
u32 input_x = x << horizontal_scale;
|
||||||
u32 input_y = y * vertical_scale;
|
u32 input_y = y << vertical_scale;
|
||||||
|
|
||||||
if (config.flip_vertically) {
|
if (config.flip_vertically) {
|
||||||
// Flip the y value of the output data,
|
// Flip the y value of the output data,
|
||||||
|
|
Loading…
Reference in a new issue