[Bf-blender-cvs] [f63bb982237] blender2.8: GPUViewport: Remove depth debug.

Clément Foucault noreply at git.blender.org
Sun Mar 25 21:33:10 CEST 2018


Commit: f63bb98223794f63d18ebdaae16c073656204a91
Author: Clément Foucault
Date:   Sun Mar 25 03:05:50 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBf63bb98223794f63d18ebdaae16c073656204a91

GPUViewport: Remove depth debug.

This is not used anymore.
Debug visualisations should be moved to the draw manager.

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

M	source/blender/gpu/GPU_viewport.h
M	source/blender/gpu/intern/gpu_viewport.c

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

diff --git a/source/blender/gpu/GPU_viewport.h b/source/blender/gpu/GPU_viewport.h
index 20d468459e6..ca7d5ae7ceb 100644
--- a/source/blender/gpu/GPU_viewport.h
+++ b/source/blender/gpu/GPU_viewport.h
@@ -125,13 +125,4 @@ GPUTexture *GPU_viewport_texture_pool_query(GPUViewport *viewport, void *engine,
 bool GPU_viewport_engines_data_validate(GPUViewport *viewport, unsigned int hash);
 void GPU_viewport_cache_release(GPUViewport *viewport);
 
-/* debug */
-bool GPU_viewport_debug_depth_create(GPUViewport *viewport, int width, int height, char err_out[256]);
-void GPU_viewport_debug_depth_free(GPUViewport *viewport);
-void GPU_viewport_debug_depth_store(GPUViewport *viewport, const int x, const int y);
-void GPU_viewport_debug_depth_draw(GPUViewport *viewport, const float znear, const float zfar);
-bool GPU_viewport_debug_depth_is_valid(GPUViewport *viewport);
-int GPU_viewport_debug_depth_width(const GPUViewport *viewport);
-int GPU_viewport_debug_depth_height(const GPUViewport *viewport);
-
 #endif // __GPU_VIEWPORT_H__
diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c
index 9d60afe372a..7518537fcdb 100644
--- a/source/blender/gpu/intern/gpu_viewport.c
+++ b/source/blender/gpu/intern/gpu_viewport.c
@@ -68,10 +68,6 @@ typedef struct ViewportTempTexture {
 } ViewportTempTexture;
 
 struct GPUViewport {
-	float pad[4];
-
-	/* debug */
-	GPUTexture *debug_depth;
 	int size[2];
 
 	int samples;
@@ -668,86 +664,5 @@ void GPU_viewport_free(GPUViewport *viewport)
 	DRW_instance_data_list_free(viewport->idatalist);
 	MEM_freeN(viewport->idatalist);
 
-	GPU_viewport_debug_depth_free(viewport);
-
 	MEM_freeN(viewport);
 }
-
-/****************** debug ********************/
-
-bool GPU_viewport_debug_depth_create(GPUViewport *viewport, int width, int height, char err_out[256])
-{
-	viewport->debug_depth = GPU_texture_create_2D_custom(width, height, 4, GPU_RGBA16F, NULL, err_out);
-	return (viewport->debug_depth != NULL);
-}
-
-void GPU_viewport_debug_depth_free(GPUViewport *viewport)
-{
-	if (viewport->debug_depth != NULL) {
-		MEM_freeN(viewport->debug_depth);
-		viewport->debug_depth = NULL;
-	}
-}
-
-void GPU_viewport_debug_depth_store(GPUViewport *viewport, const int x, const int y)
-{
-	const int w = GPU_texture_width(viewport->debug_depth);
-	const int h = GPU_texture_height(viewport->debug_depth);
-
-	GPU_texture_bind(viewport->debug_depth, 0);
-	glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, x, y, w, h, 0);
-	GPU_texture_unbind(viewport->debug_depth);
-}
-
-void GPU_viewport_debug_depth_draw(GPUViewport *viewport, const float znear, const float zfar)
-{
-	const float w = (float)GPU_texture_width(viewport->debug_depth);
-	const float h = (float)GPU_texture_height(viewport->debug_depth);
-
-	Gwn_VertFormat *format = immVertexFormat();
-	unsigned int texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
-	unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
-
-	immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_DEPTH);
-
-	GPU_texture_bind(viewport->debug_depth, 0);
-
-	immUniform1f("znear", znear);
-	immUniform1f("zfar", zfar);
-	immUniform1i("image", 0); /* default GL_TEXTURE0 unit */
-
-	immBegin(GWN_PRIM_TRI_STRIP, 4);
-
-	immAttrib2f(texcoord, 0.0f, 0.0f);
-	immVertex2f(pos, 0.0f, 0.0f);
-
-	immAttrib2f(texcoord, 1.0f, 0.0f);
-	immVertex2f(pos, w, 0.0f);
-
-	immAttrib2f(texcoord, 0.0f, 1.0f);
-	immVertex2f(pos, 0.0f, h);
-
-	immAttrib2f(texcoord, 1.0f, 1.0f);
-	immVertex2f(pos, w, h);
-
-	immEnd();
-
-	GPU_texture_unbind(viewport->debug_depth);
-
-	immUnbindProgram();
-}
-
-int GPU_viewport_debug_depth_width(const GPUViewport *viewport)
-{
-	return GPU_texture_width(viewport->debug_depth);
-}
-
-int GPU_viewport_debug_depth_height(const GPUViewport *viewport)
-{
-	return GPU_texture_height(viewport->debug_depth);
-}
-
-bool GPU_viewport_debug_depth_is_valid(GPUViewport *viewport)
-{
-	return viewport->debug_depth != NULL;
-}



More information about the Bf-blender-cvs mailing list