In addition to plaes answer ..
Under the hood, it SDL_CreateTextureFromSurfacecalls SDL_CreateTexture, which also needs Renderer to create a new texture of the same size as the one transferred on the surface.
SDL_UpdateTexture () , , SDL_CreateTextureFromSurface. , , .
SDL_CreateTexture, GPU, ( ), Renderer .
Renderer .
, , SDL_render.c SDL2.
SDL_CreateTextureFromSurface:
texture = SDL_CreateTexture(renderer, format, SDL_TEXTUREACCESS_STATIC,
surface->w, surface->h);
if (!texture) {
return NULL;
}
if (format == surface->format->format) {
if (SDL_MUSTLOCK(surface)) {
SDL_LockSurface(surface);
SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch);
SDL_UnlockSurface(surface);
} else {
SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch);
}
}