Skip to content

Commit 84b95e4

Browse files
committed
render/wiiu: Fix scaling mode for windowTex
Previously the driver would always end up using point scaling as the final windows texture scaling mode and thus the screen output
1 parent ba2980b commit 84b95e4

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎src/render/wiiu/SDL_render_wiiu.c‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "../../video/wiiu/SDL_wiiuvideo.h"
2727
#include "../../video/wiiu/wiiu_shaders.h"
2828
#include "../SDL_sysrender.h"
29+
#include "SDL_hints.h"
2930
#include "SDL_render_wiiu.h"
3031

3132
#include <gx2/event.h>
@@ -114,17 +115,34 @@ SDL_Renderer *WIIU_SDL_CreateRenderer(SDL_Window * window, Uint32 flags)
114115
void WIIU_SDL_CreateWindowTex(SDL_Renderer * renderer, SDL_Window * window)
115116
{
116117
WIIU_RenderData *data = (WIIU_RenderData *) renderer->driverdata;
118+
const char *s_hint;
119+
SDL_ScaleMode s_mode;
117120

118121
if (data->windowTex.driverdata) {
119122
WIIU_SDL_DestroyTexture(renderer, &data->windowTex);
120123
data->windowTex = (SDL_Texture) {0};
121124
}
122125

126+
/* Setup scaling mode; this is normally handled by
127+
SDL_CreateTexture/SDL_GetScaleMode, but those can't
128+
be called before fully initializinig the renderer */
129+
s_hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
130+
if (!s_hint || SDL_strcasecmp(s_hint, "nearest") == 0) {
131+
s_mode = SDL_ScaleModeNearest;
132+
} else if (SDL_strcasecmp(s_hint, "linear") == 0) {
133+
s_mode = SDL_ScaleModeLinear;
134+
} else if (SDL_strcasecmp(s_hint, "best") == 0) {
135+
s_mode = SDL_ScaleModeBest;
136+
} else {
137+
s_mode = (SDL_ScaleMode)SDL_atoi(s_hint);
138+
}
139+
123140
/* Allocate a buffer for the window */
124141
data->windowTex = (SDL_Texture) {
125142
.format = SDL_PIXELFORMAT_RGBA8888,
126143
.r = 255, .g = 255, .b = 255, .a = 255,
127144
.driverdata = WIIU_TEXTURE_MEM1_MAGIC,
145+
.scaleMode = s_mode,
128146
};
129147

130148
SDL_GetWindowSize(window, &data->windowTex.w, &data->windowTex.h);

0 commit comments

Comments
 (0)
⌂