shithub: qk1

Download patch

ref: 23ae8382f4e27c5246acd4df7a0a4183027f40a0
parent: 6d916b0985f31acc22b98bb53a42086c63367baa
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Dec 31 16:25:29 EST 2023

vid_sdl: no longer a streaming texture

--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -39,7 +39,7 @@
 
 	if(fbi != nil)
 		SDL_DestroyTexture(fbi);
-	fbi = SDL_CreateTexture(rend, SDL_PIXELFORMAT_RGB888, SDL_TEXTUREACCESS_STREAMING, vid.width, vid.height);
+	fbi = SDL_CreateTexture(rend, SDL_PIXELFORMAT_RGB888, SDL_TEXTUREACCESS_STATIC, vid.width, vid.height);
 	if(fbi == NULL)
 		fatal("SDL_CreateTexture: %s", SDL_GetError());
 	SDL_SetTextureBlendMode(fbi, SDL_BLENDMODE_NONE);
@@ -70,9 +70,6 @@
 void
 flipfb(void)
 {
-	int pitch;
-	void *p;
-
 	if(resized){		/* skip this frame if window resize */
 		stopfb();
 		resized = 0;
@@ -83,10 +80,8 @@
 		return;
 	}
 
-	SDL_LockTexture(fbi, NULL, &p, &pitch);
-	memmove(p, vidbuffer, vid.width*vid.height*4);
-	SDL_UnlockTexture(fbi);
-	SDL_RenderCopy(rend, fbi, NULL, NULL);
+	SDL_UpdateTexture(fbi, nil, vidbuffer, vid.width*4);
+	SDL_RenderCopy(rend, fbi, nil, nil);
 	SDL_RenderPresent(rend);
 }