[Bf-blender-cvs] [d36e63f8db4] tmp-workbench-rewrite: Workbench: Refactor: Only allocate id buffer if needed

Clément Foucault noreply at git.blender.org
Tue Mar 3 17:35:56 CET 2020


Commit: d36e63f8db49693fb1b0393acc9501a6986d8eee
Author: Clément Foucault
Date:   Sat Feb 29 23:53:29 2020 +0100
Branches: tmp-workbench-rewrite
https://developer.blender.org/rBd36e63f8db49693fb1b0393acc9501a6986d8eee

Workbench: Refactor: Only allocate id buffer if needed

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

M	source/blender/draw/engines/workbench/workbench_opaque.c

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

diff --git a/source/blender/draw/engines/workbench/workbench_opaque.c b/source/blender/draw/engines/workbench/workbench_opaque.c
index e5535c700fe..583c49996a9 100644
--- a/source/blender/draw/engines/workbench/workbench_opaque.c
+++ b/source/blender/draw/engines/workbench/workbench_opaque.c
@@ -32,19 +32,20 @@ void workbench_opaque_engine_init(WORKBENCH_Data *data)
   WORKBENCH_FramebufferList *fbl = data->fbl;
   WORKBENCH_PrivateData *wpd = data->stl->wpd;
   DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
+  const DrawEngineType *owner = (const DrawEngineType *)&workbench_opaque_engine_init;
 
-  const eGPUTextureFormat nor_tex_format = NORMAL_ENCODING_ENABLED() ? GPU_RG16 : GPU_RGBA32F;
-  const eGPUTextureFormat col_tex_format = workbench_color_texture_format(wpd);
-  const eGPUTextureFormat id_tex_format = OBJECT_ID_PASS_ENABLED(wpd) ? GPU_R32UI : GPU_R8;
+  /* Reused the same textures format for transparent pipeline to share the textures. */
+  const eGPUTextureFormat col_tex_format = GPU_RGBA16F;
+  const eGPUTextureFormat nor_tex_format = NORMAL_ENCODING_ENABLED() ? GPU_RG16 : GPU_RGBA16F;
+  const eGPUTextureFormat id_tex_format = GPU_R16UI;
 
   wpd->composite_buffer_tx = dtxl->color;
 
-  wpd->material_buffer_tx = DRW_texture_pool_query_fullscreen(col_tex_format,
-                                                              &draw_engine_workbench_solid);
-  wpd->object_id_tx = DRW_texture_pool_query_fullscreen(id_tex_format,
-                                                        &draw_engine_workbench_solid);
-  wpd->normal_buffer_tx = DRW_texture_pool_query_fullscreen(nor_tex_format,
-                                                            &draw_engine_workbench_solid);
+  wpd->material_buffer_tx = DRW_texture_pool_query_fullscreen(col_tex_format, owner);
+  wpd->normal_buffer_tx = DRW_texture_pool_query_fullscreen(nor_tex_format, owner);
+  if (OBJECT_ID_PASS_ENABLED(wpd)) {
+    wpd->object_id_tx = DRW_texture_pool_query_fullscreen(id_tex_format, owner);
+  }
 
   GPU_framebuffer_ensure_config(&fbl->prepass_fb,
                                 {



More information about the Bf-blender-cvs mailing list