Commit 1fc519880d0c3376bb826c372faaca23569d72ca

Ivan Epifanov 2021-06-15T18:49:55

Reset/re-apply viewport on frame start/target change. Fixes SDL_RenderSetLogicalSize on PSVita

diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c
index 9376d12..472e9e0 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm.c
@@ -157,6 +157,7 @@ StartDrawing(SDL_Renderer *renderer)
     data->drawstate.fragment_program = NULL;
     data->drawstate.last_command = -1;
     data->drawstate.texture_color = 0xFFFFFFFF;
+    data->drawstate.viewport_dirty = SDL_TRUE;
 
     // reset blend mode
 //    data->currentBlendMode = SDL_BLENDMODE_BLEND;
@@ -379,7 +380,10 @@ VITA_GXM_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture, SDL
 static int
 VITA_GXM_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
 {
-    return 0; // nothing to do here
+    VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata;
+
+    data->drawstate.viewport_dirty = SDL_TRUE;
+    return 0;
 }
 
 static void
@@ -417,7 +421,7 @@ VITA_GXM_SetBlendMode(VITA_GXM_RenderData *data, int blendMode)
 static int
 VITA_GXM_QueueSetViewport(SDL_Renderer * renderer, SDL_RenderCommand *cmd)
 {
-    return 0; // TODO
+    return 0;
 }
 
 static int