Commit f324fe10 by Alexis Hetu Committed by Alexis Hétu

Improve 565 and 5551 precision

As with 888 and 1010102, 565 and 5551 need to be rounded before being written. Bug: b/146633956 Change-Id: Ifea2e8f187a276a1f49effedc377612dbe338057 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40368 Presubmit-Ready: Alexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 1e8486b1
...@@ -1233,6 +1233,17 @@ void PixelRoutine::writeColor(int index, const Pointer<Byte> &cBuffer, const Int ...@@ -1233,6 +1233,17 @@ void PixelRoutine::writeColor(int index, const Pointer<Byte> &cBuffer, const Int
current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 10) + Short4(0x0020); current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 10) + Short4(0x0020);
current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 2) + Short4(0x2000); current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 2) + Short4(0x2000);
break; break;
case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 5) + Short4(0x0400);
current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 5) + Short4(0x0400);
current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 5) + Short4(0x0400);
current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 1) + Short4(0x4000);
break;
case VK_FORMAT_R5G6B5_UNORM_PACK16:
current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 5) + Short4(0x0400);
current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 6) + Short4(0x0200);
current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 5) + Short4(0x0400);
break;
default: default:
break; break;
} }
......
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