diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 84fd826..4215a2b 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -7646,6 +7646,42 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx, use_gl = true; } + if (!dst_res->y_0_top) { + dst_y1 = info->dst.box.y + info->dst.box.height; + dst_y2 = info->dst.box.y; + } else { + dst_y1 = dst_res->base.height0 - info->dst.box.y - info->dst.box.height; + dst_y2 = dst_res->base.height0 - info->dst.box.y; + } + + if (!src_res->y_0_top) { + src_y1 = info->src.box.y + info->src.box.height; + src_y2 = info->src.box.y; + } else { + src_y1 = src_res->base.height0 - info->src.box.y - info->src.box.height; + src_y2 = src_res->base.height0 - info->src.box.y; + } + + /* GLES generally doesn't support blitting to a multi-sample FB, and also not + * from a multi-sample FB where the regions are not exatly the same or the + * source and target format are different. For + * downsampling DS blits to zero samples we solve this by doing two blits */ + if (vrend_state.use_gles && + (info->mask & PIPE_MASK_RGBA) && + (dst_res->base.nr_samples > 1 || + (src_res->base.nr_samples > 1 && + (info->src.box.x != info->dst.box.x || + info->src.box.width != info->dst.box.width || + dst_y1 != src_y1 || dst_y2 != src_y2 || + info->src.format != info->dst.format)) + ) + ) { + VREND_DEBUG(dbg_blit, ctx, "Use GL fallback because dst:ms:%d src:ms:%d (%d %d %d %d) -> (%d %d %d %d)\n", + dst_res->base.nr_samples, src_res->base.nr_samples, info->src.box.x, info->src.box.x + info->src.box.width, + src_y1, src_y2, info->dst.box.x, info->dst.box.x + info->dst.box.width, dst_y1, dst_y2); + use_gl = true; + } + /* for 3D mipmapped blits - hand roll time */ if (info->src.box.depth != info->dst.box.depth) use_gl = true; @@ -7676,21 +7712,6 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx, if (info->mask & PIPE_MASK_RGBA) glmask |= GL_COLOR_BUFFER_BIT; - if (!dst_res->y_0_top) { - dst_y1 = info->dst.box.y + info->dst.box.height; - dst_y2 = info->dst.box.y; - } else { - dst_y1 = dst_res->base.height0 - info->dst.box.y - info->dst.box.height; - dst_y2 = dst_res->base.height0 - info->dst.box.y; - } - - if (!src_res->y_0_top) { - src_y1 = info->src.box.y + info->src.box.height; - src_y2 = info->src.box.y; - } else { - src_y1 = src_res->base.height0 - info->src.box.y - info->src.box.height; - src_y2 = src_res->base.height0 - info->src.box.y; - } if (info->scissor_enable) { glScissor(info->scissor.minx, info->scissor.miny, info->scissor.maxx - info->scissor.minx, info->scissor.maxy - info->scissor.miny);