[Bf-blender-cvs] [5ae63f03d92] blender2.8: DRW: Fix texture binding logic.

Clément Foucault noreply at git.blender.org
Thu Sep 14 01:03:24 CEST 2017


Commit: 5ae63f03d926748028f52371383e6e239cd63ae7
Author: Clément Foucault
Date:   Thu Sep 14 01:02:38 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB5ae63f03d926748028f52371383e6e239cd63ae7

DRW: Fix texture binding logic.

===================================================================

M	source/blender/draw/intern/draw_manager.c

===================================================================

diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 1b372de8034..3072eb50429 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1835,21 +1835,19 @@ static void draw_geometry(DRWShadingGroup *shgroup, Gwn_Batch *geom, const float
 
 static void draw_bind_texture(GPUTexture *tex)
 {
-	int bind = GPU_texture_bound_number(tex);
-	if (bind == -1) {
+	if (RST.bound_texs[RST.bind_tex_inc] != tex) {
 		if (RST.bind_tex_inc >= 0) {
 			if (RST.bound_texs[RST.bind_tex_inc] != NULL) {
 				GPU_texture_unbind(RST.bound_texs[RST.bind_tex_inc]);
 			}
 			RST.bound_texs[RST.bind_tex_inc] = tex;
 			GPU_texture_bind(tex, RST.bind_tex_inc);
-
-			RST.bind_tex_inc--;
 		}
 		else {
 			printf("Not enough texture slots! Reduce number of textures used by your shader.\n");
 		}
 	}
+	RST.bind_tex_inc--;
 }
 
 static void draw_bind_ubo(GPUUniformBuffer *ubo)



More information about the Bf-blender-cvs mailing list