diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-03-25 04:05:50 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-03-25 21:06:12 +0300 |
commit | f63bb98223794f63d18ebdaae16c073656204a91 (patch) | |
tree | fb2b2364829cf4e1e316667e9a7b52ee564b5016 | |
parent | b1c025d1e8dd3a26e66740eab102814da76c06bf (diff) |
GPUViewport: Remove depth debug.
This is not used anymore.
Debug visualisations should be moved to the draw manager.
-rw-r--r-- | source/blender/gpu/GPU_viewport.h | 9 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_viewport.c | 85 |
2 files changed, 0 insertions, 94 deletions
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; -} |