Jump to content
  • Advertisement
Sign in to follow this  
S

Convert RGBA buffer to ARGB

This topic is 2204 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well doing it in a pixel shader for every pixel rendered will likely quickly have a higher total cost than just converting the thing and realistically the basic loop. Not sure I would even both with SSE for this (and don't recall libpng bothering either) since I generally have no need to convert thousands of images a second. I am also sure loading and decompressing the PNG data takes far longer.

Edited by SyncViews

Share this post


Link to post
Share on other sites
Advertisement

You could also switch the channels of the image in GIMP or Pohotoshop. Probably won't become faster than that.

Share this post


Link to post
Share on other sites

 

This is also embarrassingly parallel, so we could do some concurrent looping, or use the GPU. A pixel shader could do it in no time.

 

Computationally, its a good fit, but going across the PCIe bus and back again would probably kill any performance wins unless the image is really huge.

 

Sir, you're missing the point. We're no longer optimizing. We've entered the realm of derptimizing. The objective is to over-engineer until no one can read the code. wink.png

 

Really I don't think any kind of optimization is necessary here unless the images actually are incredibly large. I think concurrent looping might also create more overhead than it would provide help. This would be a once per resource load thing, so even if it takes a full tenth of a second, you only have to do it very occasionally. I think Olof's method is probably best, and let the compiler give it a little speed, though libpng can just unpack it properly in the first place.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!