[Bf-blender-cvs] [803c757c2b6] blender2.8: Fix T52855: Eevee: viewport artifacts

Dalai Felinto noreply at git.blender.org
Thu Sep 21 17:46:49 CEST 2017


Commit: 803c757c2b64258890aa30d20187fd8daf83b5e4
Author: Dalai Felinto
Date:   Thu Sep 21 17:40:08 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB803c757c2b64258890aa30d20187fd8daf83b5e4

Fix T52855: Eevee: viewport artifacts

Partial revert of 9068c0743e08.
This commit tried to do two things:

(1) Fix UBO binding logic [good]
(2) "Improve" texture binding logic [bad]

Don't ever mix different fixes and refactors in the same commit.

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

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 94f42f1ec18..bc8adf7556a 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -364,8 +364,6 @@ static struct DRWResourceState {
 	GPUTexture **bound_texs;
 
 	bool *bound_tex_slots;
-
-	int bind_tex_inc;
 	int bind_ubo_inc;
 } RST = {NULL};
 
@@ -1839,11 +1837,10 @@ static void bind_texture(GPUTexture *tex)
 	int bind_num = GPU_texture_bound_number(tex);
 	if (bind_num == -1) {
 		for (int i = 0; i < GPU_max_textures(); ++i) {
-			RST.bind_tex_inc = (RST.bind_tex_inc + 1) % GPU_max_textures();
-			if (RST.bound_tex_slots[RST.bind_tex_inc] == false) {
-				GPU_texture_bind(tex, RST.bind_tex_inc);
-				RST.bound_texs[RST.bind_tex_inc] = tex;
-				RST.bound_tex_slots[RST.bind_tex_inc] = true;
+			if (RST.bound_tex_slots[i] == false) {
+				GPU_texture_bind(tex, i);
+				RST.bound_texs[i] = tex;
+				RST.bound_tex_slots[i] = true;
 				return;
 			}
 		}



More information about the Bf-blender-cvs mailing list