diff options
author | Icecream95 <[email protected]> | 2020-03-25 20:01:08 +1300 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-26 13:36:47 +0000 |
commit | dac1573a3586565b8b78bd6aab3664921cc1adb1 (patch) | |
tree | d131bcfc89ef2f9fd15219d6db14375147b9646c /src/mesa | |
parent | 0847fe6e7fa6ee07420c6eed95bfee036748bc6a (diff) |
mesa/format_utils: Add a fast-path for RGBA to BGRA
This is similar to an existing fast-path, but this is for an array
source while the existing one is for an array destination.
Firefox can hit this case for WebGL when GL compositing is not used.
For a WebGL sample on the Panfrost driver, the frame-rate increased
from 19.4 fps to 20.6 fps, which is a 6% gain.
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4315>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4315>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/format_utils.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c index 2bdb77c34fc..732e2424cbb 100644 --- a/src/mesa/main/format_utils.c +++ b/src/mesa/main/format_utils.c @@ -36,6 +36,10 @@ const mesa_array_format RGBA8_UBYTE = MESA_ARRAY_FORMAT(MESA_ARRAY_FORMAT_BASE_FORMAT_RGBA_VARIANTS, 1, 0, 0, 1, 4, 0, 1, 2, 3); +const mesa_array_format BGRA8_UBYTE = + MESA_ARRAY_FORMAT(MESA_ARRAY_FORMAT_BASE_FORMAT_RGBA_VARIANTS, + 1, 0, 0, 1, 4, 2, 1, 0, 3); + const mesa_array_format RGBA32_UINT = MESA_ARRAY_FORMAT(MESA_ARRAY_FORMAT_BASE_FORMAT_RGBA_VARIANTS, 4, 0, 0, 0, 4, 0, 1, 2, 3); @@ -350,6 +354,11 @@ _mesa_format_convert(void *void_dst, uint32_t dst_format, size_t dst_stride, dst += dst_stride; } return; + } else if (dst_array_format == BGRA8_UBYTE && + src_format == MESA_FORMAT_R8G8B8A8_UNORM) { + convert_ubyte_rgba_to_bgra(width, height, src, src_stride, + dst, dst_stride); + return; } else if (dst_array_format == RGBA32_UINT && _mesa_is_format_unsigned(src_format)) { assert(_mesa_is_format_integer_color(src_format)); |