mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-25 02:31:14 +00:00
sdl2: potential huge perf. boost to software
SDL_UpdateTexture is apparently not good for streaming textures. So instead, I did SDL_LockTexture/Unlock.
This commit is contained in:
parent
005b502756
commit
8b0f374bfe
1 changed files with 18 additions and 1 deletions
|
@ -1381,8 +1381,25 @@ void I_FinishUpdate(void)
|
||||||
}
|
}
|
||||||
if (bufSurface) //Alam: New Way to send video data
|
if (bufSurface) //Alam: New Way to send video data
|
||||||
{
|
{
|
||||||
|
void *pixels;
|
||||||
|
int pitch;
|
||||||
|
|
||||||
SDL_BlitSurface(bufSurface, NULL, vidSurface, &rect);
|
SDL_BlitSurface(bufSurface, NULL, vidSurface, &rect);
|
||||||
SDL_UpdateTexture(texture, NULL, vidSurface->pixels, realwidth * 4);
|
// Fury -- streaming textures are bad on UpdateTexture
|
||||||
|
SDL_LockSurface(vidSurface);
|
||||||
|
SDL_LockTexture(texture, &rect, &pixels, &pitch);
|
||||||
|
if (pitch == vidSurface->pitch)
|
||||||
|
{
|
||||||
|
M_Memcpy(pixels, vidSurface->pixels, (pitch * vid.height));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SDL_UnlockTexture(texture);
|
||||||
|
SDL_UnlockSurface(vidSurface);
|
||||||
|
I_Error("The intermediate buffer and final texture types are not the same.\n");
|
||||||
|
}
|
||||||
|
SDL_UnlockTexture(texture);
|
||||||
|
SDL_UnlockSurface(vidSurface);
|
||||||
}
|
}
|
||||||
// Blit buffer to texture
|
// Blit buffer to texture
|
||||||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||||
|
|
Loading…
Reference in a new issue