[Bf-blender-cvs] [2a0c91b70c4] blender2.8: GPUViewport: Make Depth texture not depth testable.

Clément Foucault noreply at git.blender.org
Sun May 7 15:52:06 CEST 2017


Commit: 2a0c91b70c40485c05151fba5e3313cf4800559b
Author: Clément Foucault
Date:   Sun May 7 14:29:51 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB2a0c91b70c40485c05151fba5e3313cf4800559b

GPUViewport: Make Depth texture not depth testable.

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

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

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

diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 253b3e680c9..010684889bc 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1443,7 +1443,6 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
 				}
 				tex = *((GPUTexture **)uni->value);
 				GPU_texture_bind(tex, uni->bindloc);
-				GPU_texture_compare_mode(tex, false);
 
 				bound_tex = MEM_callocN(sizeof(DRWBoundTexture), "DRWBoundTexture");
 				bound_tex->tex = tex;
diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c
index 98c3613e1e2..c116d035f60 100644
--- a/source/blender/gpu/intern/gpu_viewport.c
+++ b/source/blender/gpu/intern/gpu_viewport.c
@@ -267,11 +267,20 @@ void GPU_viewport_bind(GPUViewport *viewport, const rcti *rect)
 
 		/* Depth */
 		dtxl->depth = GPU_texture_create_depth(rect_w, rect_h, NULL);
-		if (!dtxl->depth) {
+
+		if (dtxl->depth) {
+			/* Define texture parameters */
+			GPU_texture_bind(dtxl->depth, 0);
+			GPU_texture_compare_mode(dtxl->depth, false);
+			GPU_texture_filter_mode(dtxl->depth, true);
+			GPU_texture_unbind(dtxl->depth);
+		}
+		else {
 			ok = false;
 			goto cleanup;
 		}
-		else if (!GPU_framebuffer_texture_attach(dfbl->default_fb, dtxl->depth, 0, 0)) {
+
+		if (!GPU_framebuffer_texture_attach(dfbl->default_fb, dtxl->depth, 0, 0)) {
 			ok = false;
 			goto cleanup;
 		}




More information about the Bf-blender-cvs mailing list