vrend: correct blit/copy_image code path

Gallium copy_image redirects calls to resource_copy_region for equal src
and dst formats or if at least one of the two is compressed. Handle the
condition for selecting blit vs. glCopyImageSubRegion accordingly.

Fixes piglit: bptc-float-modes

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Gert Wollny 6 years ago committed by Dave Airlie
parent d4ea73104d
commit 257cf11b52
  1. 6
      src/vrend_formats.c
  2. 28
      src/vrend_renderer.c
  3. 3
      src/vrend_renderer.h

@ -581,7 +581,8 @@ static boolean format_compressed_compressed_copy_compatible(enum pipe_format src
return false; return false;
} }
boolean format_is_copy_compatible(enum pipe_format src, enum pipe_format dst) boolean format_is_copy_compatible(enum pipe_format src, enum pipe_format dst,
boolean allow_compressed)
{ {
int r; int r;
@ -594,6 +595,9 @@ boolean format_is_copy_compatible(enum pipe_format src, enum pipe_format dst)
return util_is_format_compatible(src_desc, dst_desc); return util_is_format_compatible(src_desc, dst_desc);
} }
if (!allow_compressed)
return false;
/* compressed-uncompressed */ /* compressed-uncompressed */
r = format_uncompressed_compressed_copy_compatible(src, dst); r = format_uncompressed_compressed_copy_compatible(src, dst);
if (r) if (r)

@ -7033,13 +7033,12 @@ void vrend_renderer_resource_copy_region(struct vrend_context *ctx,
return; return;
} }
if (has_feature(feat_copy_image)) { if (has_feature(feat_copy_image) &&
if (format_is_copy_compatible(src_res->base.format,dst_res->base.format) && format_is_copy_compatible(src_res->base.format,dst_res->base.format, true) &&
src_res->base.nr_samples == dst_res->base.nr_samples) { src_res->base.nr_samples == dst_res->base.nr_samples) {
vrend_copy_sub_image(src_res, dst_res, src_level, src_box, vrend_copy_sub_image(src_res, dst_res, src_level, src_box,
dst_level, dstx, dsty, dstz); dst_level, dstx, dsty, dstz);
return; return;
}
} }
if (!vrend_format_can_render(src_res->base.format) || if (!vrend_format_can_render(src_res->base.format) ||
@ -7325,13 +7324,16 @@ void vrend_renderer_blit(struct vrend_context *ctx,
if (info->render_condition_enable == false) if (info->render_condition_enable == false)
vrend_pause_render_condition(ctx, true); vrend_pause_render_condition(ctx, true);
/* The gallium blit function can be called for a general blit that may /* The Gallium blit function can be called for a general blit that may
* scale, convert the data, and apply some rander states or if is called via * scale, convert the data, and apply some rander states, or it is called via
* glCopyImageSubData. For the latter case forward the call to the * glCopyImageSubData. If the src or the dst image are equal, or the two
* glCopyImageSubData function, otherwise use a framebuffer blit. * images formats are the same, then Galliums such calles are redirected
*/ * to resource_copy_region, in this case and if no render states etx need
* to be applied, forward the call to glCopyImageSubData, otherwise do a
* normal blit. */
if (has_feature(feat_copy_image) && !info->render_condition_enable && if (has_feature(feat_copy_image) && !info->render_condition_enable &&
format_is_copy_compatible(info->src.format,info->dst.format) && (src_res->base.format != dst_res->base.format) &&
format_is_copy_compatible(info->src.format,info->dst.format, false) &&
!info->scissor_enable && (info->filter == PIPE_TEX_FILTER_NEAREST) && !info->scissor_enable && (info->filter == PIPE_TEX_FILTER_NEAREST) &&
!info->alpha_blend && (info->mask == PIPE_MASK_RGBA) && !info->alpha_blend && (info->mask == PIPE_MASK_RGBA) &&
(src_res->base.nr_samples == dst_res->base.nr_samples) && (src_res->base.nr_samples == dst_res->base.nr_samples) &&

@ -390,7 +390,8 @@ void vrend_fb_bind_texture(struct vrend_resource *res,
uint32_t level, uint32_t layer); uint32_t level, uint32_t layer);
bool vrend_is_ds_format(enum virgl_formats format); bool vrend_is_ds_format(enum virgl_formats format);
bool vrend_format_is_emulated_alpha(enum virgl_formats format); bool vrend_format_is_emulated_alpha(enum virgl_formats format);
boolean format_is_copy_compatible(enum pipe_format src, enum pipe_format dst); boolean format_is_copy_compatible(enum pipe_format src, enum pipe_format dst,
boolean allow_compressed);
/* blitter interface */ /* blitter interface */
void vrend_renderer_blit_gl(struct vrend_context *ctx, void vrend_renderer_blit_gl(struct vrend_context *ctx,

Loading…
Cancel
Save