mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 02:28:10 +02:00
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 <marek.olsak@amd.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4315> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4315>
This commit is contained in:
parent
0847fe6e7f
commit
dac1573a35
1 changed files with 9 additions and 0 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue