src/image_util/LoadToNative_unittest.cpp


Log

Author Commit Date CI Message
Amirali Abdolrashidi ed97adba 2024-01-05T17:00:03 Add more RGB-to-RGBA byte loading functions Following the optimization of RGB8-to-RGBA8 for ubytes with 0xFF as the fourth component, the other byte functions can be optimized in a similar fashion. * Added the following specialized template functions for byte loads: (based on 3To4 byte loading functions in load_functions_table*.cpp) * GLubyte, 0x01 * GLbyte, 0x7F * GLbyte, 0x01 * Renamed LoadToNativeUbyte3To4Impl() to *Byte*. * For the unit tests, refactored some of the repeated test code into functions. Bug: b/313526661 Change-Id: I017829bf765f0b417448bd5dca59be26c1665379 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5372971 Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 716c5d00 2023-11-13T10:23:10 Vulkan: Add RGB8-to-RGBA8 ubyte loading function Currently, to update RGB8 on desktop, ANGLE uses memcpy for each pixel, which is suboptimal. This CL adds a loading function to improve the copy time for RGB textures where RGBA is needed on the hardware. * Added a specialization to LoadToNative3To4() for unsigned bytes using 0xFF as the fourth component. * It is optimized for unsigned bytes when converting an RGB format to its corresponding RGBA format, e.g., RGB8 to RGBA8. * It uses uint32_t operations to speed up the process. * Added unit tests for the specialized LoadToNative3To4. * LoadToNative_unittest.cpp * Added perf test for RGB8 image allocation and loading. * RGBImageAllocationBenchmark in RGBImageAllocation.cpp. * RGBImageAllocationBenchmark shows some improvement in cpu_time and wall_time on a Linux and a Windows device. (Results below using aligned source pointer and texture size of 2048): * On Windows: +~85% cpu_time, +~71% wall_time * On Linux: +~26% cpu_time, +~27% wall_time Bug: b/308177124 Change-Id: I421d83f75fdc513b0111dffb0a5d5e74682dd6fb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4995489 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>