mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
util: replace format equality test with compatibility test in blit code
This lets us use the resource_copy_region() path when blitting from R8G8B8A8 to R8G8B8x8, for example. v2: be smarter when src_format==dst_format Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: José Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
ce671c7ace
commit
7f9692b97d
1 changed files with 21 additions and 1 deletions
|
|
@ -320,6 +320,26 @@ regions_overlap(int srcX0, int srcY0,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Can we blit from src format to dest format with a simple copy?
|
||||
*/
|
||||
static boolean
|
||||
formats_compatible(enum pipe_format src_format,
|
||||
enum pipe_format dst_format)
|
||||
{
|
||||
if (src_format == dst_format) {
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
const struct util_format_description *src_desc =
|
||||
util_format_description(src_format);
|
||||
const struct util_format_description *dst_desc =
|
||||
util_format_description(dst_format);
|
||||
return util_is_format_compatible(src_desc, dst_desc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy pixel block from src surface to dst surface.
|
||||
* Overlapping regions are acceptable.
|
||||
|
|
@ -377,7 +397,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
|
|||
* no overlapping.
|
||||
* Filter mode should not matter since there's no stretching.
|
||||
*/
|
||||
if (dst_format == src_format &&
|
||||
if (formats_compatible(src_format, dst_format) &&
|
||||
srcX0 < srcX1 &&
|
||||
dstX0 < dstX1 &&
|
||||
srcY0 < srcY1 &&
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue