Commit 34cab51b by Alexis Hetu Committed by Alexis Hétu

Blitter fix

Conversion from a float format to a non float format was broken in the blitter because the clamp operation, either to the [0,1] range or the [-1,1] range, was happening after the scaling operation, so non float types were becoming either -1, 0 or 1, which was wrong. Change-Id: I3e1290313043fc49030454916b6e4ea6666f8343 Reviewed-on: https://swiftshader-review.googlesource.com/4290Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 1edcd8b6
...@@ -752,12 +752,12 @@ namespace sw ...@@ -752,12 +752,12 @@ namespace sw
if(Surface::isFloatFormat(state.sourceFormat) && !Surface::isFloatFormat(state.destFormat)) if(Surface::isFloatFormat(state.sourceFormat) && !Surface::isFloatFormat(state.destFormat))
{ {
color = Min(color, Float4(1.0f, 1.0f, 1.0f, 1.0f)); color = Min(color, Float4(scale.x, scale.y, scale.z, scale.w));
color = Max(color, Float4(Surface::isUnsignedComponent(state.destFormat, 0) ? 0.0f : -1.0f, color = Max(color, Float4(Surface::isUnsignedComponent(state.destFormat, 0) ? 0.0f : -scale.x,
Surface::isUnsignedComponent(state.destFormat, 1) ? 0.0f : -1.0f, Surface::isUnsignedComponent(state.destFormat, 1) ? 0.0f : -scale.y,
Surface::isUnsignedComponent(state.destFormat, 2) ? 0.0f : -1.0f, Surface::isUnsignedComponent(state.destFormat, 2) ? 0.0f : -scale.z,
Surface::isUnsignedComponent(state.destFormat, 3) ? 0.0f : -1.0f)); Surface::isUnsignedComponent(state.destFormat, 3) ? 0.0f : -scale.w));
} }
Pointer<Byte> d = destLine + i * Surface::bytes(state.destFormat); Pointer<Byte> d = destLine + i * Surface::bytes(state.destFormat);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment