Commit ca5dbef0 by Pujun Lun Committed by Commit Bot

Micro-optimization for loading 3-channel images.

This reduced the total time spent in LoadToNative3To4 by 10% in our micro-benchmark. Test: passed the CQ dry run. Bug: b/182513949 Change-Id: I5d1b1975f64e5b08bd0e65abc8f94fe62ef54321 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2752347 Commit-Queue: Pujun Lun <lunpujun@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent 4f6d4d6f
......@@ -81,9 +81,7 @@ inline void LoadToNative3To4(size_t width, size_t height, size_t depth,
type *dest = priv::OffsetDataPointer<type>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < width; x++)
{
dest[x * 4 + 0] = source[x * 3 + 0];
dest[x * 4 + 1] = source[x * 3 + 1];
dest[x * 4 + 2] = source[x * 3 + 2];
memcpy(&dest[x * 4], &source[x * 3], sizeof(type) * 3);
dest[x * 4 + 3] = fourthValue;
}
}
......
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