From 94f4e7c8f7eb2ec658b897a07b7443612d0ed62e Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Thu, 18 Jul 2019 05:31:32 +0200 Subject: [PATCH] vrend,blitter: Unbind texture targets after use There are more instances where the sampler view and the texture are not in the same context. So do more un-binding of textures after they were used. Related: #112 Signed-off-by: Gert Wollny's avatarGert Wollny Reviewed-by: Gurchetan Singh --- src/vrend_blitter.c | 1 + src/vrend_renderer.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/vrend_blitter.c b/src/vrend_blitter.c index c2d11ff..f49a444 100644 --- a/src/vrend_blitter.c +++ b/src/vrend_blitter.c @@ -894,6 +894,7 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx, GL_TEXTURE_2D, 0, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); + glBindTexture(src_res->target, 0); } void vrend_blitter_fini(void) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 7ff95f3..20be470 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -6887,6 +6887,7 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx, if (!vrend_state.use_core_profile) glPixelTransferf(GL_DEPTH_SCALE, 1.0); } + glBindTexture(res->target, 0); } if (stride && !need_temp) { @@ -6988,6 +6989,7 @@ static int vrend_transfer_send_getteximage(struct vrend_resource *res, info->stride, info->box, info->level, info->offset, false); free(data); + glBindTexture(res->target, 0); return 0; } @@ -7433,6 +7435,7 @@ void vrend_set_polygon_stipple(struct vrend_context *ctx, glBindTexture(GL_TEXTURE_2D, ctx->pstipple_tex_id); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 32, 32, GL_RED, GL_UNSIGNED_BYTE, stip); + glBindTexture(GL_TEXTURE_2D, 0); free(stip); return; @@ -7737,6 +7740,7 @@ static void vrend_resource_copy_fallback(struct vrend_resource *src_res, glPixelStorei(GL_UNPACK_ALIGNMENT, 4); free(tptr); + glBindTexture(GL_TEXTURE_2D, 0); } static inline @@ -9510,7 +9514,7 @@ void *vrend_renderer_get_cursor_contents(uint32_t res_handle, uint32_t *width, u memcpy(data2 + doff, data + soff, res->base.width0 * blsize); } free(data); - + glBindTexture(res->target, 0); return data2; }