ref: 169a49a564acc57a58352e3940a1e1819c0cdfdb
parent: caf7461a4075352fd77b45dff58533900bd96e03
author: Fabian Greffrath <[email protected]>
date: Thu Feb 12 04:44:16 EST 2015
Video: Set correct texture access mode for the SDL_Texture SDL_Textures created by SDL_CreateTextureFromSurface will always have their texture access mode set to SDL_TEXTUREACCESS_STATIC, which means "changes rarely" and is plain wrong in our case. However, it is impossible to change this mode once a texture is created. Now, we create the texture with the correct texture access mode, but since we are not creating it from the RGBA surface anymore, we have to set pixel format and dimensions explicitely. We can cope with that. ;-) TODO: Find out what's the matter with SDL_TEXTUREACCESS_TARGET.
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1857,8 +1857,13 @@
SDL_FillRect(rgbabuffer, NULL, 0);
// Create the texture that the RGBA surface gets loaded into.
+ // SDL_TEXTUREACCESS_STREAMING means that this texture's content
+ // are going to change frequently.
- texture = SDL_CreateTextureFromSurface(renderer, rgbabuffer);
+ texture = SDL_CreateTexture(renderer,
+ SDL_PIXELFORMAT_ARGB8888,
+ SDL_TEXTUREACCESS_STREAMING,
+ SCREENWIDTH, SCREENHEIGHT);
// Save screen mode.