blitter: remove useless duplications and simplify handling

Related: https://gitlab.freedesktop.org/virgl/virglrenderer/-/issues/125

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>.
macos/master
Gert Wollny 3 years ago
parent 17593a2bd1
commit d7cc9787d7
  1. 9
      src/vrend_blitter.c

@ -698,8 +698,6 @@ void vrend_renderer_blit_gl(ASSERTED struct vrend_context *ctx,
const struct vrend_blit_info *info) const struct vrend_blit_info *info)
{ {
struct vrend_blitter_ctx *blit_ctx = &vrend_blit_ctx; struct vrend_blitter_ctx *blit_ctx = &vrend_blit_ctx;
GLuint buffers;
GLuint prog_id;
GLuint fs_id; GLuint fs_id;
int dst_z; int dst_z;
@ -717,7 +715,7 @@ void vrend_renderer_blit_gl(ASSERTED struct vrend_context *ctx,
vrend_renderer_init_blit_ctx(blit_ctx); vrend_renderer_init_blit_ctx(blit_ctx);
blitter_set_points(blit_ctx, &info->b, src_res, dst_res, &src0, &src1); blitter_set_points(blit_ctx, &info->b, src_res, dst_res, &src0, &src1);
prog_id = glCreateProgram(); GLuint prog_id = glCreateProgram();
glAttachShader(prog_id, blit_ctx->vs); glAttachShader(prog_id, blit_ctx->vs);
if (blit_depth) { if (blit_depth) {
@ -741,7 +739,7 @@ void vrend_renderer_blit_gl(ASSERTED struct vrend_context *ctx,
glBindFramebuffer(GL_FRAMEBUFFER, blit_ctx->fb_id); glBindFramebuffer(GL_FRAMEBUFFER, blit_ctx->fb_id);
vrend_fb_bind_texture_id(dst_res, info->dst_view, 0, info->b.dst.level, info->b.dst.box.z, 0); vrend_fb_bind_texture_id(dst_res, info->dst_view, 0, info->b.dst.level, info->b.dst.box.z, 0);
buffers = GL_COLOR_ATTACHMENT0; GLuint buffers = GL_COLOR_ATTACHMENT0;
glDrawBuffers(1, &buffers); glDrawBuffers(1, &buffers);
glBindTexture(src_res->target, info->src_view); glBindTexture(src_res->target, info->src_view);
@ -778,11 +776,8 @@ void vrend_renderer_blit_gl(ASSERTED struct vrend_context *ctx,
dst_res->target == GL_TEXTURE_1D_ARRAY || dst_res->target == GL_TEXTURE_1D_ARRAY ||
dst_res->target == GL_TEXTURE_2D_ARRAY) ? info->b.dst.box.z : dst_z; dst_res->target == GL_TEXTURE_2D_ARRAY) ? info->b.dst.box.z : dst_z;
glBindFramebuffer(GL_FRAMEBUFFER, blit_ctx->fb_id);
vrend_fb_bind_texture_id(dst_res, info->dst_view, 0, info->b.dst.level, layer, 0); vrend_fb_bind_texture_id(dst_res, info->dst_view, 0, info->b.dst.level, layer, 0);
buffers = GL_COLOR_ATTACHMENT0;
glDrawBuffers(1, &buffers);
blitter_set_texcoords(blit_ctx, src_res, info->b.src.level, blitter_set_texcoords(blit_ctx, src_res, info->b.src.level,
info->b.src.box.z + src_z, 0, info->b.src.box.z + src_z, 0,
src0.x, src0.y, src1.x, src1.y); src0.x, src0.y, src1.x, src1.y);

Loading…
Cancel
Save