# SDL: VITA: fix yuv texture update (217bc)

**URL:** <https://discourse.libsdl.org/t/sdl-vita-fix-yuv-texture-update-217bc/55048>\
**Category:** SDL Commits\
**Created:** [October 17, 2024, 2:54pm UTC](https://discourse.libsdl.org/t/sdl-vita-fix-yuv-texture-update-217bc/55048 "2024-10-17T14:54:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [October 17, 2024, 2:54pm UTC](https://discourse.libsdl.org/t/sdl-vita-fix-yuv-texture-update-217bc/55048/1 "2024-10-17T14:54:46Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/217bc17a21a91737365475b5b44637eba82158f4>
>
> (cherry picked from commit 86fd4ed83cdcf71fef6a57766b126e88f923acd3)

```diff
From 217bc17a21a91737365475b5b44637eba82158f4 Mon Sep 17 00:00:00 2001
From: Ivan Epifanov <[EMAIL REDACTED]>
Date: Thu, 17 Oct 2024 17:41:35 +0300
Subject: [PATCH] VITA: fix yuv texture update

(cherry picked from commit 86fd4ed83cdcf71fef6a57766b126e88f923acd3)
---
 src/render/vitagxm/SDL_render_vita_gxm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c
index 7d8085902d4c9..c8cbcb5d85a6f 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm.c
@@ -366,6 +366,7 @@ static int VITA_GXM_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
     length = rect->w * SDL_BYTESPERPIXEL(texture->format);
     if (length == pitch && length == dpitch) {
         SDL_memcpy(dst, pixels, length * rect->h);
+ pixels += pitch * rect->h;
     } else {
         for (row = 0; row < rect->h; ++row) {
             SDL_memcpy(dst, pixels, length);
@@ -393,6 +394,7 @@ static int VITA_GXM_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
         // U plane
         if (length == uv_src_pitch && length == uv_pitch) {
             SDL_memcpy(Udst, pixels, length * UVrect.h);
+ pixels += uv_src_pitch * UVrect.h;
         } else {
             for (row = 0; row < UVrect.h; ++row) {
                 SDL_memcpy(Udst, pixels, length);

```
