Snippets back

(L) [2006/09/04] [Phantom] [Snippets] Wayback!

I would like to use this thread to exchange some snippets. Here's one that I divised today, it converts 16 floating point colors (b, g, r, a) to 16 32bit integer colors. At the same time, it multiplies with a brightness multiplier (brightness * 255, stored in __m128 brightness4) and clips to 1 (or rather, 255).
(L) [2006/09/04] [Phantom] [Snippets] Wayback!

Here's my MLRTA kernel, for reference.
(L) [2006/09/04] [tbp] [Snippets] Wayback!

Quick look at your first snippet.


In your initial clamping, you don't need to use a conditionnal move when you can min/max; and you forgot to clamp negative values.
(L) [2006/09/04] [Phantom] [Snippets] Wayback!

You're right, that snippet was silly. I updated it. Point is (and remains), that this is vastly superior to a component-by-component float approach, and even still way superior to doing the __m128's one by one. I was amazed with the extra performance, especially in the context of the entire application, so I wanted to drop that on the forum. I'm glad I did; I got an extra % thanks to your remark.
_________________
--------------------------------------------------------------

Whatever
(L) [2006/09/04] [tbp] [Snippets] Wayback!

[LINK http://www.pixeltoaster.com/forum/viewtopic.php?t=15] [SMILEY Wink]


Now as much as it makes sense to do that right on the tail of shading, the mem bandwidth required to do proper tonemappage is better left as an exercise for GPUs, without any prior conversion.
_________________
May you live in interesting times.

[LINK https://gna.org/projects/radius/ radius] | [LINK http://ompf.org/ ompf] | [LINK http://ompf.org/wiki/ WompfKi]

back