[SDL] <DKIM> Re: pixel from SDL_Texture
sanette-linux at laposte.net
Thu Sep 11 09:35:47 PDT 2014
In my experience, keeping a surface and modifying it and converting to
texture is SLOWER (*) than keeping the pixel array (given by
RenderReadPixels) and modifying it and updating the texture with
And if you don't want to "keep anything around"; then still, the whole
process [changing render target, RenderReadPixels --->
SDL_UpdateTexture] is faster (**) than converting a surface to a texture.
(*) = by a factor 1/2 or even 1/4 depending on the complexity of the image
(**) but onyl slightly faster, by a factor 1.2 or 1.5 in my case.
Le 03/09/2014 02:01, Mason Wheeler a écrit :
> You know, every time this topic comes up, I see that same warning come
> out again and again, and nothing to back it up.
> How great an impact does it have on rendering performance? What is
> the expected data transfer rate from GPU->main memory like? How does
> it differ between different video card models?
> Also, does anyone ever stop to consider, before saying something like
> this, that there's very little overlap in the set of scenarios in
> which a person would want to do this and the set of scenarios in which
> a high frame rate is of paramount importance?
> The simple fact is, if it's the only way to do it, and that's what you
> want to accomplish, then that's how you have to accomplish it. And
> saying "just keep the surface around" is kind of silly; why would
> anyone *need* to read back texture data that they already have in the
> first place? It seems to me that the only reason to try and do
> something like this is to read the results back off of a texture with
> a render target attached, in which case the standard "just keep the
> surface around" line is worse than useless as advice.
> Just sayin'...
> On Friday, August 29, 2014 5:45 PM, Sik the hedgehog
> <sik.the.hedgehog at gmail.com> wrote:
> Yeah, but reading from textures can absolutely destroy rendering
> performance, so avoid that unless you're absolutely sure about what
> you're doing. Surfaces are to be used CPU-side, textures are to be
> used GPU-side.
> SDL mailing list
> SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
> SDL mailing list
> SDL at lists.libsdl.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SDL