[Bf-blender-cvs] [ca8ffc523e3] master: fix flush

2020-09-07 Thread Clément Foucault
Commit: ca8ffc523e3d08fc55c5cf000fa9fc3888950bf7
Author: Clément Foucault
Date:   Tue Sep 8 03:15:06 2020 +0200
Branches: master
https://developer.blender.org/rBca8ffc523e3d08fc55c5cf000fa9fc3888950bf7

fix flush

===

M   source/blender/draw/intern/draw_manager.c
M   source/blender/draw/intern/draw_manager_shader.c

===

diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 8d69ed05fc6..f7c126d2e99 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2862,7 +2862,6 @@ void DRW_opengl_render_context_enable(void *re_gl_context)
 
 void DRW_opengl_render_context_disable(void *re_gl_context)
 {
-  GPU_flush();
   WM_opengl_context_release(re_gl_context);
   /* TODO get rid of the blocking. */
   BLI_ticket_mutex_unlock(DST.gl_context_mutex);
@@ -2880,6 +2879,7 @@ void DRW_gpu_render_context_enable(void *re_gpu_context)
 /* Needs to be called BEFORE DRW_opengl_render_context_disable() */
 void DRW_gpu_render_context_disable(void *UNUSED(re_gpu_context))
 {
+  GPU_flush();
   GPU_context_active_set(NULL);
 }
 
diff --git a/source/blender/draw/intern/draw_manager_shader.c 
b/source/blender/draw/intern/draw_manager_shader.c
index 7eeb5a2fb67..85c04b73529 100644
--- a/source/blender/draw/intern/draw_manager_shader.c
+++ b/source/blender/draw/intern/draw_manager_shader.c
@@ -29,6 +29,7 @@
 #include "BLI_string_utils.h"
 #include "BLI_threads.h"
 
+#include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_main.h"
 
@@ -41,6 +42,8 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "wm_window.h"
+
 #include "draw_manager.h"
 
 extern char datatoc_gpu_shader_2D_vert_glsl[];
@@ -73,6 +76,7 @@ typedef struct DRWShaderCompiler {
   ThreadMutex compilation_lock;
 
   void *gl_context;
+  GPUContext *gpu_context;
   bool own_context;
 
   int shaders_done; /* To compute progress. */
@@ -102,10 +106,10 @@ static void drw_deferred_shader_compilation_exec(
 {
   DRWShaderCompiler *comp = (DRWShaderCompiler *)custom_data;
   void *gl_context = comp->gl_context;
+  GPUContext *gpu_context = comp->gpu_context;
 
-#if TRUST_NO_ONE
   BLI_assert(gl_context != NULL);
-#endif
+  BLI_assert(gpu_context != NULL);
 
   const bool use_main_context_workaround = GPU_use_main_context_workaround();
   if (use_main_context_workaround) {
@@ -114,6 +118,7 @@ static void drw_deferred_shader_compilation_exec(
   }
 
   WM_opengl_context_activate(gl_context);
+  GPU_context_active_set(gpu_context);
 
   while (true) {
 BLI_spin_lock(>list_lock);
@@ -160,6 +165,7 @@ static void drw_deferred_shader_compilation_exec(
 BLI_spin_unlock(>list_lock);
   }
 
+  GPU_context_active_set(NULL);
   WM_opengl_context_release(gl_context);
   if (use_main_context_workaround) {
 GPU_context_main_unlock();
@@ -188,7 +194,12 @@ static void drw_deferred_shader_compilation_free(void 
*custom_data)
 
   if (comp->own_context) {
 /* Only destroy if the job owns the context. */
+WM_opengl_context_activate(comp->gl_context);
+GPU_context_active_set(comp->gpu_context);
+GPU_context_discard(comp->gpu_context);
 WM_opengl_context_dispose(comp->gl_context);
+
+wm_window_reset_drawable();
   }
 
   MEM_freeN(comp);
@@ -238,6 +249,7 @@ static void drw_deferred_shader_add(GPUMaterial *mat, bool 
deferred)
 /* Do not recreate context, just pass ownership. */
 if (old_comp->gl_context) {
   comp->gl_context = old_comp->gl_context;
+  comp->gpu_context = old_comp->gpu_context;
   old_comp->own_context = false;
   comp->own_context = job_own_context;
 }
@@ -249,10 +261,15 @@ static void drw_deferred_shader_add(GPUMaterial *mat, 
bool deferred)
   if (comp->gl_context == NULL) {
 if (use_main_context) {
   comp->gl_context = DST.gl_context;
+  comp->gpu_context = DST.gpu_context;
 }
 else {
   comp->gl_context = WM_opengl_context_create();
+  comp->gpu_context = GPU_context_create(NULL);
+  GPU_context_active_set(NULL);
+
   WM_opengl_context_activate(DST.gl_context);
+  GPU_context_active_set(DST.gpu_context);
 }
 comp->own_context = job_own_context;
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d2e9de93b8d] master: GPU: Cleanup implementation casts

2020-09-07 Thread Clément Foucault
Commit: d2e9de93b8d1d6cd45abce8164d0f92af8f636d0
Author: Clément Foucault
Date:   Tue Sep 8 03:34:47 2020 +0200
Branches: master
https://developer.blender.org/rBd2e9de93b8d1d6cd45abce8164d0f92af8f636d0

GPU: Cleanup implementation casts

- Use the syntactic wrap/unwrap method to make code more readable.
- Update comment about hidden struct behind opaque types.
- Cleanup GPUDrawList type.

===

M   source/blender/gpu/GPU_drawlist.h
M   source/blender/gpu/GPU_framebuffer.h
M   source/blender/gpu/GPU_index_buffer.h
M   source/blender/gpu/GPU_texture.h
M   source/blender/gpu/GPU_uniform_buffer.h
M   source/blender/gpu/GPU_vertex_buffer.h
M   source/blender/gpu/intern/gpu_drawlist.cc
M   source/blender/gpu/intern/gpu_drawlist_private.hh
M   source/blender/gpu/intern/gpu_framebuffer.cc
M   source/blender/gpu/intern/gpu_framebuffer_private.hh
M   source/blender/gpu/intern/gpu_shader.cc
M   source/blender/gpu/intern/gpu_shader_private.hh
M   source/blender/gpu/intern/gpu_texture_private.hh
M   source/blender/gpu/intern/gpu_uniform_buffer.cc
M   source/blender/gpu/intern/gpu_uniform_buffer_private.hh
M   source/blender/gpu/intern/gpu_vertex_buffer_private.hh

===

diff --git a/source/blender/gpu/GPU_drawlist.h 
b/source/blender/gpu/GPU_drawlist.h
index 27f70da8cf8..485b90f48d4 100644
--- a/source/blender/gpu/GPU_drawlist.h
+++ b/source/blender/gpu/GPU_drawlist.h
@@ -32,14 +32,15 @@ extern "C" {
 
 struct GPUBatch;
 
-typedef void *GPUDrawList; /* Opaque pointer. */
+/** Opaque type hiding blender::gpu::DrawList. */
+typedef struct GPUDrawList GPUDrawList;
 
 /* Create a list with at least length drawcalls. Length can affect 
performance. */
-GPUDrawList GPU_draw_list_create(int length);
-void GPU_draw_list_discard(GPUDrawList list);
+GPUDrawList *GPU_draw_list_create(int length);
+void GPU_draw_list_discard(GPUDrawList *list);
 
-void GPU_draw_list_append(GPUDrawList list, GPUBatch *batch, int i_first, int 
i_count);
-void GPU_draw_list_submit(GPUDrawList list);
+void GPU_draw_list_append(GPUDrawList *list, GPUBatch *batch, int i_first, int 
i_count);
+void GPU_draw_list_submit(GPUDrawList *list);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/gpu/GPU_framebuffer.h 
b/source/blender/gpu/GPU_framebuffer.h
index c0391d96e06..be55cd7af2d 100644
--- a/source/blender/gpu/GPU_framebuffer.h
+++ b/source/blender/gpu/GPU_framebuffer.h
@@ -54,10 +54,8 @@ typedef enum eGPUBackBuffer {
   GPU_BACKBUFFER_RIGHT,
 } eGPUBackBuffer;
 
-/** Opaque pointer hiding blender::gpu::FrameBuffer. */
-typedef struct GPUFrameBuffer {
-  void *dummy;
-} GPUFrameBuffer;
+/** Opaque type hiding blender::gpu::FrameBuffer. */
+typedef struct GPUFrameBuffer GPUFrameBuffer;
 
 typedef struct GPUOffScreen GPUOffScreen;
 
diff --git a/source/blender/gpu/GPU_index_buffer.h 
b/source/blender/gpu/GPU_index_buffer.h
index df24e07caef..0c71dd539a6 100644
--- a/source/blender/gpu/GPU_index_buffer.h
+++ b/source/blender/gpu/GPU_index_buffer.h
@@ -31,11 +31,7 @@
 extern "C" {
 #endif
 
-/**
- * IMPORTANT: Do not allocate manually as the real struct is bigger (i.e: 
GLIndexBuf). This is only
- * the common and "public" part of the struct. Use the provided allocator.
- * TODO(fclem) Make the content of this struct hidden and expose 
getters/setters.
- **/
+/** Opaque type hiding blender::gpu::IndexBuf. */
 typedef struct GPUIndexBuf GPUIndexBuf;
 
 GPUIndexBuf *GPU_indexbuf_calloc(void);
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index f2ddb5d8a22..2ce2ba093cf 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -36,6 +36,8 @@ struct MovieClipUser;
 struct PreviewImage;
 
 struct GPUFrameBuffer;
+
+/** Opaque type hiding blender::gpu::Texture. */
 typedef struct GPUTexture GPUTexture;
 
 /* GPU Samplers state
diff --git a/source/blender/gpu/GPU_uniform_buffer.h 
b/source/blender/gpu/GPU_uniform_buffer.h
index 605e2b14434..ebcaa80e6f6 100644
--- a/source/blender/gpu/GPU_uniform_buffer.h
+++ b/source/blender/gpu/GPU_uniform_buffer.h
@@ -36,10 +36,8 @@ extern "C" {
 
 struct ListBase;
 
-/** Opaque pointer hiding blender::gpu::UniformBuf. */
-typedef struct GPUUniformBuf {
-  void *dummy;
-} GPUUniformBuf;
+/** Opaque type hiding blender::gpu::UniformBuf. */
+typedef struct GPUUniformBuf GPUUniformBuf;
 
 GPUUniformBuf *GPU_uniformbuf_create_ex(size_t size, const void *data, const 
char *name);
 GPUUniformBuf *GPU_uniformbuf_create_from_list(struct ListBase *inputs, const 
char *name);
diff --git a/source/blender/gpu/GPU_vertex_buffer.h 
b/source/blender/gpu/GPU_vertex_buffer.h
index 80f0501edc0..2af9929db35 100644
--- a/source/blender/gpu/GPU_vertex_buffer.h
+++ b/source/blender/gpu/GPU_vertex_buffer.h
@@ -61,6 +61,7 @@ typedef enum {
   GPU_USAGE_DYNAMIC,
 } GPUUsageType;
 
+/** Opaque type 

[Bf-blender-cvs] [a30ad3634d2] master: Cleanup: DRW: Replace 0 by NULL in GPU_context_create calls

2020-09-07 Thread Clément Foucault
Commit: a30ad3634d2ed489d0c285b2ea77bc1c69e23826
Author: Clément Foucault
Date:   Tue Sep 8 03:19:15 2020 +0200
Branches: master
https://developer.blender.org/rBa30ad3634d2ed489d0c285b2ea77bc1c69e23826

Cleanup: DRW: Replace 0 by NULL in GPU_context_create calls

This was left from a previous refactor.

===

M   source/blender/draw/engines/eevee/eevee_lightcache.c
M   source/blender/draw/intern/draw_manager.c
M   source/blender/draw/tests/shaders_test.cc
M   source/blender/render/intern/source/pipeline.c

===

diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c 
b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 5a676bf4004..f23cca41215 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -526,7 +526,7 @@ static void eevee_lightbake_context_enable(EEVEE_LightBake 
*lbake)
   if (lbake->gl_context) {
 DRW_opengl_render_context_enable(lbake->gl_context);
 if (lbake->gpu_context == NULL) {
-  lbake->gpu_context = GPU_context_create(0);
+  lbake->gpu_context = GPU_context_create(NULL);
 }
 DRW_gpu_render_context_enable(lbake->gpu_context);
   }
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index d2a95f9b7b3..e6d51bce54e 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2771,7 +2771,7 @@ void DRW_opengl_context_create(void)
   DST.gl_context = WM_opengl_context_create();
   WM_opengl_context_activate(DST.gl_context);
   /* Be sure to create gpu_context too. */
-  DST.gpu_context = GPU_context_create(0);
+  DST.gpu_context = GPU_context_create(NULL);
   /* So we activate the window's one afterwards. */
   wm_window_reset_drawable();
 }
diff --git a/source/blender/draw/tests/shaders_test.cc 
b/source/blender/draw/tests/shaders_test.cc
index a3a0b792a24..b82746e4609 100644
--- a/source/blender/draw/tests/shaders_test.cc
+++ b/source/blender/draw/tests/shaders_test.cc
@@ -27,7 +27,7 @@ class DrawTest : public ::testing::Test {
 GHOST_GLSettings glSettings = {0};
 ghost_system = GHOST_CreateSystem();
 ghost_context = GHOST_CreateOpenGLContext(ghost_system, glSettings);
-context = GPU_context_create(0);
+context = GPU_context_create(NULL);
 GPU_init();
 DRW_draw_state_init_gtests(GPU_SHADER_CFG_DEFAULT);
   }
diff --git a/source/blender/render/intern/source/pipeline.c 
b/source/blender/render/intern/source/pipeline.c
index 8c61fd5b971..2d581a4765e 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1113,7 +1113,7 @@ void *RE_gl_context_get(Render *re)
 void *RE_gpu_context_get(Render *re)
 {
   if (re->gpu_context == NULL) {
-re->gpu_context = GPU_context_create(0);
+re->gpu_context = GPU_context_create(NULL);
   }
   return re->gpu_context;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ccc512cc619] master: GPUImmediate: Make activation / deactivation implicit

2020-09-07 Thread Clément Foucault
Commit: ccc512cc619dc9f0e6fd79270a7a96ece34d23b5
Author: Clément Foucault
Date:   Tue Sep 8 03:18:49 2020 +0200
Branches: master
https://developer.blender.org/rBccc512cc619dc9f0e6fd79270a7a96ece34d23b5

GPUImmediate: Make activation / deactivation implicit

This avoids unecessary complexity.

Also makes the GPUImmediate threadsafe by using a threadlocal imm variable.

===

M   intern/ghost/test/multitest/MultiTest.c
M   source/blender/draw/intern/draw_manager.c
M   source/blender/gpu/GPU_immediate.h
M   source/blender/gpu/intern/gpu_immediate.cc
M   source/blender/gpu/intern/gpu_immediate_private.hh
M   source/blender/gpu/intern/gpu_init_exit.c
M   source/blender/gpu/opengl/gl_context.cc
M   source/blender/windowmanager/intern/wm_playanim.c
M   source/blender/windowmanager/intern/wm_surface.c
M   source/blender/windowmanager/intern/wm_window.c

===

diff --git a/intern/ghost/test/multitest/MultiTest.c 
b/intern/ghost/test/multitest/MultiTest.c
index cf7a06bf3e5..b6b83f2a47d 100644
--- a/intern/ghost/test/multitest/MultiTest.c
+++ b/intern/ghost/test/multitest/MultiTest.c
@@ -439,7 +439,6 @@ static void loggerwindow_do_draw(LoggerWindow *lw)
 
   GHOST_ActivateWindowDrawingContext(lw->win);
   GPU_context_active_set(lw->gpu_context);
-  immActivate();
 
   glClearColor(1, 1, 1, 1);
   glClear(GL_COLOR_BUFFER_BIT);
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index f7c126d2e99..d2a95f9b7b3 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2767,17 +2767,11 @@ void DRW_opengl_context_create(void)
   BLI_assert(DST.gl_context == NULL); /* Ensure it's called once */
 
   DST.gl_context_mutex = BLI_ticket_mutex_alloc();
-  if (!G.background) {
-immDeactivate();
-  }
   /* This changes the active context. */
   DST.gl_context = WM_opengl_context_create();
   WM_opengl_context_activate(DST.gl_context);
   /* Be sure to create gpu_context too. */
   DST.gpu_context = GPU_context_create(0);
-  if (!G.background) {
-immActivate();
-  }
   /* So we activate the window's one afterwards. */
   wm_window_reset_drawable();
 }
@@ -2794,25 +2788,15 @@ void DRW_opengl_context_destroy(void)
   }
 }
 
-void DRW_opengl_context_enable_ex(bool restore)
+void DRW_opengl_context_enable_ex(bool UNUSED(restore))
 {
   if (DST.gl_context != NULL) {
 /* IMPORTANT: We dont support immediate mode in render mode!
  * This shall remain in effect until immediate mode supports
  * multiple threads. */
 BLI_ticket_mutex_lock(DST.gl_context_mutex);
-if (BLI_thread_is_main() && restore) {
-  if (!G.background) {
-immDeactivate();
-  }
-}
 WM_opengl_context_activate(DST.gl_context);
 GPU_context_active_set(DST.gpu_context);
-if (BLI_thread_is_main() && restore) {
-  if (!G.background) {
-immActivate();
-  }
-}
   }
 }
 
diff --git a/source/blender/gpu/GPU_immediate.h 
b/source/blender/gpu/GPU_immediate.h
index 6057770d2d9..edb7c9fe5b5 100644
--- a/source/blender/gpu/GPU_immediate.h
+++ b/source/blender/gpu/GPU_immediate.h
@@ -145,12 +145,6 @@ void immUniformThemeColorBlendShade(int color_id1, int 
color_id2, float fac, int
 void immUniformThemeColorBlend(int color_id1, int color_id2, float fac);
 void immThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset);
 
-/* These are called by the system -- not part of drawing API. */
-void immInit(void);
-void immActivate(void);
-void immDeactivate(void);
-void immDestroy(void);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/gpu/intern/gpu_immediate.cc 
b/source/blender/gpu/intern/gpu_immediate.cc
index dd3e5bea604..9fc5e03a796 100644
--- a/source/blender/gpu/intern/gpu_immediate.cc
+++ b/source/blender/gpu/intern/gpu_immediate.cc
@@ -39,12 +39,7 @@
 
 using namespace blender::gpu;
 
-static Immediate *imm = NULL;
-
-void immInit(void)
-{
-  /* TODO Remove */
-}
+static thread_local Immediate *imm = NULL;
 
 void immActivate(void)
 {
@@ -56,11 +51,6 @@ void immDeactivate(void)
   imm = NULL;
 }
 
-void immDestroy(void)
-{
-  /* TODO Remove */
-}
-
 GPUVertFormat *immVertexFormat(void)
 {
   GPU_vertformat_clear(>vertex_format);
diff --git a/source/blender/gpu/intern/gpu_immediate_private.hh 
b/source/blender/gpu/intern/gpu_immediate_private.hh
index aa99fb9a438..38db8131942 100644
--- a/source/blender/gpu/intern/gpu_immediate_private.hh
+++ b/source/blender/gpu/intern/gpu_immediate_private.hh
@@ -63,4 +63,7 @@ class Immediate {
   virtual void end(void) = 0;
 };
 
-}  // namespace blender::gpu
\ No newline at end of file
+}  // namespace blender::gpu
+
+void immActivate(void);
+void immDeactivate(void);
\ No newline at end of file
diff --git a/source/blender/gpu/intern/gpu_init_exit.c 

[Bf-blender-cvs] [28ea459a61f] master: GPUState: Encapsulate glPixelStorei inside the GLStateManager

2020-09-07 Thread Clément Foucault
Commit: 28ea459a61f65de03724db8709271d41f6bf135b
Author: Clément Foucault
Date:   Tue Sep 8 00:30:38 2020 +0200
Branches: master
https://developer.blender.org/rB28ea459a61f65de03724db8709271d41f6bf135b

GPUState: Encapsulate glPixelStorei inside the GLStateManager

Part of the Vulkan task T68990

Isolate the last remaining gl functions.

===

M   source/blender/gpu/GPU_state.h
M   source/blender/gpu/GPU_texture.h
M   source/blender/gpu/intern/gpu_state.cc
M   source/blender/gpu/intern/gpu_state_private.hh
M   source/blender/gpu/intern/gpu_texture.cc
M   source/blender/gpu/opengl/gl_state.cc
M   source/blender/gpu/opengl/gl_state.hh

===

diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h
index 869e8c32861..5e872001267 100644
--- a/source/blender/gpu/GPU_state.h
+++ b/source/blender/gpu/GPU_state.h
@@ -128,7 +128,6 @@ void GPU_write_mask(eGPUWriteMask mask);
 void GPU_color_mask(bool r, bool g, bool b, bool a);
 void GPU_depth_mask(bool depth);
 bool GPU_depth_mask_get(void);
-void GPU_unpack_row_length_set(uint len);
 void GPU_shadow_offset(bool enable);
 void GPU_clip_distances(int distances_enabled);
 bool GPU_mipmap_enabled(void);
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index bae5bfbaae8..b31cb42d38d 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -228,6 +228,7 @@ void GPU_texture_update_sub(GPUTexture *tex,
 int width,
 int height,
 int depth);
+void GPU_unpack_row_length_set(uint len);
 
 void *GPU_texture_read(GPUTexture *tex, eGPUDataFormat data_format, int 
miplvl);
 void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat data_format, const void 
*data);
diff --git a/source/blender/gpu/intern/gpu_state.cc 
b/source/blender/gpu/intern/gpu_state.cc
index a88dc1beb00..68f0c290bc6 100644
--- a/source/blender/gpu/intern/gpu_state.cc
+++ b/source/blender/gpu/intern/gpu_state.cc
@@ -303,11 +303,6 @@ void GPU_finish(void)
   GPU_context_active_get()->finish();
 }
 
-void GPU_unpack_row_length_set(uint len)
-{
-  glPixelStorei(GL_UNPACK_ROW_LENGTH, len);
-}
-
 /** \} */
 
 /*  */
diff --git a/source/blender/gpu/intern/gpu_state_private.hh 
b/source/blender/gpu/intern/gpu_state_private.hh
index 6ce240df108..9fee45e7bd4 100644
--- a/source/blender/gpu/intern/gpu_state_private.hh
+++ b/source/blender/gpu/intern/gpu_state_private.hh
@@ -166,6 +166,8 @@ class GPUStateManager {
   virtual void texture_bind(Texture *tex, eGPUSamplerState sampler, int unit) 
= 0;
   virtual void texture_unbind(Texture *tex) = 0;
   virtual void texture_unbind_all(void) = 0;
+
+  virtual void texture_unpack_row_length_set(uint len) = 0;
 };
 
 }  // namespace gpu
diff --git a/source/blender/gpu/intern/gpu_texture.cc 
b/source/blender/gpu/intern/gpu_texture.cc
index 0aa1a6553f9..95f922173b5 100644
--- a/source/blender/gpu/intern/gpu_texture.cc
+++ b/source/blender/gpu/intern/gpu_texture.cc
@@ -380,6 +380,13 @@ void GPU_texture_update(GPUTexture *tex, eGPUDataFormat 
data_format, const void
   reinterpret_cast(tex)->update(data_format, data);
 }
 
+/* Makes data interpretation aware of the source layout.
+ * Skipping pixels correctly when changing rows when doing partial update.*/
+void GPU_unpack_row_length_set(uint len)
+{
+  GPU_context_active_get()->state_manager->texture_unpack_row_length_set(len);
+}
+
 void GPU_invalid_tex_init(void)
 {
   /* TODO remove */
diff --git a/source/blender/gpu/opengl/gl_state.cc 
b/source/blender/gpu/opengl/gl_state.cc
index b43b01aed4f..6dcb56288e8 100644
--- a/source/blender/gpu/opengl/gl_state.cc
+++ b/source/blender/gpu/opengl/gl_state.cc
@@ -520,6 +520,11 @@ void GLStateManager::texture_bind_apply(void)
   }
 }
 
+void GLStateManager::texture_unpack_row_length_set(uint len)
+{
+  glPixelStorei(GL_UNPACK_ROW_LENGTH, len);
+}
+
 uint64_t GLStateManager::bound_texture_slots(void)
 {
   uint64_t bound_slots = 0;
diff --git a/source/blender/gpu/opengl/gl_state.hh 
b/source/blender/gpu/opengl/gl_state.hh
index d5622b4ab89..db9b9721ad5 100644
--- a/source/blender/gpu/opengl/gl_state.hh
+++ b/source/blender/gpu/opengl/gl_state.hh
@@ -74,6 +74,8 @@ class GLStateManager : public GPUStateManager {
   void texture_unbind(Texture *tex) override;
   void texture_unbind_all(void) override;
 
+  void texture_unpack_row_length_set(uint len) override;
+
   uint64_t bound_texture_slots(void);
 
  private:

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [33b25b6a9e8] master: GPUTexture: Remove unused functions and avoid GPU_texture_opengl_bindcode

2020-09-07 Thread Clément Foucault
Commit: 33b25b6a9e86082a40a24b14bb0a6aad708dfb11
Author: Clément Foucault
Date:   Tue Sep 8 03:22:35 2020 +0200
Branches: master
https://developer.blender.org/rB33b25b6a9e86082a40a24b14bb0a6aad708dfb11

GPUTexture: Remove unused functions and avoid GPU_texture_opengl_bindcode

This is a cleanup.

===

M   source/blender/gpu/GPU_texture.h
M   source/blender/gpu/intern/gpu_framebuffer.cc
M   source/blender/gpu/intern/gpu_texture.cc
M   source/blender/gpu/intern/gpu_texture_private.hh
M   source/blender/gpu/opengl/gl_framebuffer.cc
M   source/blender/gpu/opengl/gl_texture.hh

===

diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index b31cb42d38d..f2ddb5d8a22 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -233,10 +233,6 @@ void GPU_unpack_row_length_set(uint len);
 void *GPU_texture_read(GPUTexture *tex, eGPUDataFormat data_format, int 
miplvl);
 void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat data_format, const void 
*data);
 
-void GPU_invalid_tex_init(void);
-void GPU_invalid_tex_bind(int mode);
-void GPU_invalid_tex_free(void);
-
 void GPU_texture_free(GPUTexture *tex);
 
 void GPU_texture_ref(GPUTexture *tex);
@@ -262,7 +258,6 @@ int GPU_texture_orig_width(const GPUTexture *tex);
 int GPU_texture_orig_height(const GPUTexture *tex);
 void GPU_texture_orig_size_set(GPUTexture *tex, int w, int h);
 eGPUTextureFormat GPU_texture_format(const GPUTexture *tex);
-int GPU_texture_samples(const GPUTexture *tex);
 bool GPU_texture_array(const GPUTexture *tex);
 bool GPU_texture_cube(const GPUTexture *tex);
 bool GPU_texture_depth(const GPUTexture *tex);
diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc 
b/source/blender/gpu/intern/gpu_framebuffer.cc
index f9caa8df143..05cc8a30a43 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.cc
+++ b/source/blender/gpu/intern/gpu_framebuffer.cc
@@ -455,11 +455,6 @@ void GPU_framebuffer_blit(GPUFrameBuffer *gpufb_read,
 BLI_assert(GPU_texture_stencil(read_tex) && 
GPU_texture_stencil(write_tex));
 BLI_assert(GPU_texture_format(read_tex) == GPU_texture_format(write_tex));
   }
-  if (GPU_texture_samples(write_tex) != 0 || GPU_texture_samples(read_tex) != 
0) {
-/* Can only blit multisample textures to another texture of the same size. 
*/
-BLI_assert((GPU_texture_width(write_tex) == GPU_texture_width(read_tex)) &&
-   (GPU_texture_height(write_tex) == 
GPU_texture_height(read_tex)));
-  }
 #endif
 
   fb_read->blit_to(blit_buffers, read_slot, fb_write, write_slot, 0, 0);
diff --git a/source/blender/gpu/intern/gpu_texture.cc 
b/source/blender/gpu/intern/gpu_texture.cc
index 95f922173b5..05b97129f00 100644
--- a/source/blender/gpu/intern/gpu_texture.cc
+++ b/source/blender/gpu/intern/gpu_texture.cc
@@ -190,7 +190,7 @@ uint GPU_texture_memory_usage_get(void)
   return 0;
 }
 
-/* -- Texture Creation -- */
+/* -- Creation -- */
 
 static inline GPUTexture *gpu_texture_create(const char *name,
  const int w,
@@ -329,6 +329,8 @@ GPUTexture *GPU_texture_create_error(int dimension, bool 
is_array)
   return gpu_texture_create("invalid_tex", w, h, d, type, 1, GPU_RGBA8, pixel);
 }
 
+/* -- Update -- */
+
 void GPU_texture_update_mipmap(GPUTexture *tex_,
int miplvl,
eGPUDataFormat data_format,
@@ -387,20 +389,7 @@ void GPU_unpack_row_length_set(uint len)
   GPU_context_active_get()->state_manager->texture_unpack_row_length_set(len);
 }
 
-void GPU_invalid_tex_init(void)
-{
-  /* TODO remove */
-}
-
-void GPU_invalid_tex_bind(int UNUSED(mode))
-{
-  /* TODO remove */
-}
-
-void GPU_invalid_tex_free(void)
-{
-  /* TODO remove */
-}
+/* -- Binding -- */
 
 void GPU_texture_bind_ex(GPUTexture *tex_,
  eGPUSamplerState state,
@@ -547,12 +536,6 @@ eGPUTextureFormat GPU_texture_format(const GPUTexture *tex)
   return reinterpret_cast(tex)->format_get();
 }
 
-/* TODO remove */
-int GPU_texture_samples(const GPUTexture *UNUSED(tex))
-{
-  return 0;
-}
-
 bool GPU_texture_depth(const GPUTexture *tex)
 {
   return (reinterpret_cast(tex)->format_flag_get() & 
GPU_FORMAT_DEPTH) != 0;
diff --git a/source/blender/gpu/intern/gpu_texture_private.hh 
b/source/blender/gpu/intern/gpu_texture_private.hh
index d237540f654..19022b228b2 100644
--- a/source/blender/gpu/intern/gpu_texture_private.hh
+++ b/source/blender/gpu/intern/gpu_texture_private.hh
@@ -241,6 +241,20 @@ class Texture {
   virtual bool init_internal(GPUVertBuf *vbo) = 0;
 };
 
+/* Syntacting suggar. */
+static inline GPUTexture *wrap(Texture *vert)
+{
+  return reinterpret_cast(vert);
+}
+static inline Texture *unwrap(GPUTexture *vert)
+{
+  return reinterpret_cast(vert);
+}
+static inline const Texture 

[Bf-blender-cvs] [48690d967a7] master: GPUContext: Move GPUContext to gpu::Context for more consistency

2020-09-07 Thread Clément Foucault
Commit: 48690d967a7731367cda01ab8dca64e7f4c3f6b5
Author: Clément Foucault
Date:   Tue Sep 8 04:12:12 2020 +0200
Branches: master
https://developer.blender.org/rB48690d967a7731367cda01ab8dca64e7f4c3f6b5

GPUContext: Move GPUContext to gpu::Context for more consistency

This makes the GPUContext follow the same naming convention as the rest
of the module.

Also add a static getter for extra bonus style (no need for casts):
- Context::get()
- GLContext::get()

===

M   source/blender/gpu/GPU_context.h
M   source/blender/gpu/intern/gpu_backend.hh
M   source/blender/gpu/intern/gpu_batch.cc
M   source/blender/gpu/intern/gpu_capabilities.cc
M   source/blender/gpu/intern/gpu_context.cc
M   source/blender/gpu/intern/gpu_context_private.hh
M   source/blender/gpu/intern/gpu_framebuffer.cc
M   source/blender/gpu/intern/gpu_immediate.cc
M   source/blender/gpu/intern/gpu_matrix.cc
M   source/blender/gpu/intern/gpu_shader.cc
M   source/blender/gpu/intern/gpu_state.cc
M   source/blender/gpu/intern/gpu_texture.cc
M   source/blender/gpu/opengl/gl_backend.hh
M   source/blender/gpu/opengl/gl_batch.cc
M   source/blender/gpu/opengl/gl_context.cc
M   source/blender/gpu/opengl/gl_context.hh
M   source/blender/gpu/opengl/gl_debug.cc
M   source/blender/gpu/opengl/gl_drawlist.cc
M   source/blender/gpu/opengl/gl_framebuffer.cc
M   source/blender/gpu/opengl/gl_immediate.cc
M   source/blender/gpu/opengl/gl_shader.cc
M   source/blender/gpu/opengl/gl_texture.cc
M   source/blender/gpu/opengl/gl_uniform_buffer.cc
M   source/blender/gpu/opengl/gl_vertex_array.cc
M   source/blender/gpu/opengl/gl_vertex_buffer.cc

===

diff --git a/source/blender/gpu/GPU_context.h b/source/blender/gpu/GPU_context.h
index be7e604fb96..82f13424502 100644
--- a/source/blender/gpu/GPU_context.h
+++ b/source/blender/gpu/GPU_context.h
@@ -32,8 +32,6 @@
 extern "C" {
 #endif
 
-typedef struct GPUContext GPUContext;
-
 typedef enum eGPUBackendType {
   GPU_BACKEND_NONE = 0,
   GPU_BACKEND_OPENGL,
@@ -42,6 +40,9 @@ typedef enum eGPUBackendType {
 void GPU_backend_init(eGPUBackendType backend);
 void GPU_backend_exit(void);
 
+/** Opaque type hiding blender::gpu::Context. */
+typedef struct GPUContext GPUContext;
+
 GPUContext *GPU_context_create(void *ghost_window);
 void GPU_context_discard(GPUContext *);
 
diff --git a/source/blender/gpu/intern/gpu_backend.hh 
b/source/blender/gpu/intern/gpu_backend.hh
index 1a6a6668b42..04ec82a9213 100644
--- a/source/blender/gpu/intern/gpu_backend.hh
+++ b/source/blender/gpu/intern/gpu_backend.hh
@@ -25,11 +25,11 @@
 
 #pragma once
 
-struct GPUContext;
-
 namespace blender {
 namespace gpu {
 
+class Context;
+
 class Batch;
 class DrawList;
 class FrameBuffer;
@@ -48,7 +48,7 @@ class GPUBackend {
 
   virtual void samplers_update(void) = 0;
 
-  virtual GPUContext *context_alloc(void *ghost_window) = 0;
+  virtual Context *context_alloc(void *ghost_window) = 0;
 
   virtual Batch *batch_alloc(void) = 0;
   virtual DrawList *drawlist_alloc(int list_length) = 0;
diff --git a/source/blender/gpu/intern/gpu_batch.cc 
b/source/blender/gpu/intern/gpu_batch.cc
index d6f4f223a83..de079a89de7 100644
--- a/source/blender/gpu/intern/gpu_batch.cc
+++ b/source/blender/gpu/intern/gpu_batch.cc
@@ -258,7 +258,7 @@ void GPU_batch_draw_instanced(GPUBatch *batch, int i_count)
 void GPU_batch_draw_advanced(
 GPUBatch *gpu_batch, int v_first, int v_count, int i_first, int i_count)
 {
-  BLI_assert(GPU_context_active_get()->shader != NULL);
+  BLI_assert(Context::get()->shader != NULL);
   Batch *batch = static_cast(gpu_batch);
 
   if (v_count == 0) {
diff --git a/source/blender/gpu/intern/gpu_capabilities.cc 
b/source/blender/gpu/intern/gpu_capabilities.cc
index 0ee25ea2569..a79ce27ba63 100644
--- a/source/blender/gpu/intern/gpu_capabilities.cc
+++ b/source/blender/gpu/intern/gpu_capabilities.cc
@@ -115,13 +115,13 @@ bool GPU_mem_stats_supported(void)
 
 void GPU_mem_stats_get(int *totalmem, int *freemem)
 {
-  GPU_context_active_get()->memory_statistics_get(totalmem, freemem);
+  Context::get()->memory_statistics_get(totalmem, freemem);
 }
 
 /* Return support for the active context + window. */
 bool GPU_stereo_quadbuffer_support(void)
 {
-  return GPU_context_active_get()->front_right != nullptr;
+  return Context::get()->front_right != nullptr;
 }
 
 /** \} */
diff --git a/source/blender/gpu/intern/gpu_context.cc 
b/source/blender/gpu/intern/gpu_context.cc
index 8ebd49a658e..188225b3eed 100644
--- a/source/blender/gpu/intern/gpu_context.cc
+++ b/source/blender/gpu/intern/gpu_context.cc
@@ -54,20 +54,22 @@
 
 using namespace blender::gpu;
 
-static thread_local GPUContext *active_ctx = NULL;
+static thread_local Context *active_ctx = NULL;
 
 /*  */

[Bf-blender-cvs] [77f60a09310] master: GPUState: Encapsulate glFlush and glFinish inside the GLContext

2020-09-07 Thread Clément Foucault
Commit: 77f60a09310dad0cb41e2e2ec4a71f9bdb762e67
Author: Clément Foucault
Date:   Tue Sep 8 00:10:37 2020 +0200
Branches: master
https://developer.blender.org/rB77f60a09310dad0cb41e2e2ec4a71f9bdb762e67

GPUState: Encapsulate glFlush and glFinish inside the GLContext

Part of the Vulkan task T68990

Isolate the few remaining gl functions.

===

M   source/blender/gpu/intern/gpu_context_private.hh
M   source/blender/gpu/intern/gpu_state.cc
M   source/blender/gpu/opengl/gl_context.cc
M   source/blender/gpu/opengl/gl_context.hh

===

diff --git a/source/blender/gpu/intern/gpu_context_private.hh 
b/source/blender/gpu/intern/gpu_context_private.hh
index 3d92b4eb587..5344cc6fb87 100644
--- a/source/blender/gpu/intern/gpu_context_private.hh
+++ b/source/blender/gpu/intern/gpu_context_private.hh
@@ -76,6 +76,12 @@ struct GPUContext {
 
   virtual void activate(void) = 0;
   virtual void deactivate(void) = 0;
+
+  /* Will push all pending commands to the GPU. */
+  virtual void flush(void) = 0;
+  /* Will wait until the GPU has finished executing all command. */
+  virtual void finish(void) = 0;
+
   virtual void memory_statistics_get(int *total_mem, int *free_mem) = 0;
 
   bool is_active_on_thread(void);
diff --git a/source/blender/gpu/intern/gpu_state.cc 
b/source/blender/gpu/intern/gpu_state.cc
index 90c6efad2e8..a88dc1beb00 100644
--- a/source/blender/gpu/intern/gpu_state.cc
+++ b/source/blender/gpu/intern/gpu_state.cc
@@ -295,12 +295,12 @@ bool GPU_mipmap_enabled(void)
 
 void GPU_flush(void)
 {
-  glFlush();
+  GPU_context_active_get()->flush();
 }
 
 void GPU_finish(void)
 {
-  glFinish();
+  GPU_context_active_get()->finish();
 }
 
 void GPU_unpack_row_length_set(uint len)
diff --git a/source/blender/gpu/opengl/gl_context.cc 
b/source/blender/gpu/opengl/gl_context.cc
index 5633d28023a..1f7e191d394 100644
--- a/source/blender/gpu/opengl/gl_context.cc
+++ b/source/blender/gpu/opengl/gl_context.cc
@@ -160,6 +160,22 @@ void GLContext::deactivate(void)
 
 /** \} */
 
+/*  */
+/** \name Flush, Finish & sync
+ * \{ */
+
+void GLContext::flush(void)
+{
+  glFlush();
+}
+
+void GLContext::finish(void)
+{
+  glFinish();
+}
+
+/** \} */
+
 /*  */
 /** \name Safe object deletion
  *
diff --git a/source/blender/gpu/opengl/gl_context.hh 
b/source/blender/gpu/opengl/gl_context.hh
index 8bce0d2e345..ef0c13719e2 100644
--- a/source/blender/gpu/opengl/gl_context.hh
+++ b/source/blender/gpu/opengl/gl_context.hh
@@ -97,6 +97,10 @@ class GLContext : public GPUContext {
 
   void activate(void) override;
   void deactivate(void) override;
+
+  void flush(void);
+  void finish(void);
+
   void memory_statistics_get(int *total_mem, int *free_mem) override;
 
   static inline GLStateManager *state_manager_active_get()

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f23400490e2] master: Cleanup: doxygen syntax for idtype.c

2020-09-07 Thread Campbell Barton
Commit: f23400490e236ebbb01e6d2abfae6d8041aac2b1
Author: Campbell Barton
Date:   Tue Sep 8 10:41:12 2020 +1000
Branches: master
https://developer.blender.org/rBf23400490e236ebbb01e6d2abfae6d8041aac2b1

Cleanup: doxygen syntax for idtype.c

===

M   source/blender/blenkernel/intern/idtype.c

===

diff --git a/source/blender/blenkernel/intern/idtype.c 
b/source/blender/blenkernel/intern/idtype.c
index 4ab7d362e0e..6ef3817bc1c 100644
--- a/source/blender/blenkernel/intern/idtype.c
+++ b/source/blender/blenkernel/intern/idtype.c
@@ -155,10 +155,10 @@ static const IDTypeInfo *idtype_get_info_from_name(const 
char *idtype_name)
   return NULL;
 }
 
-/* Various helpers/wrappers around IDTypeInfo structure. */
+/* Various helpers/wrappers around #IDTypeInfo structure. */
 
 /**
- * Convert an idcode into a name.
+ * Convert an \a idcode into a name.
  *
  * \param idcode: The code to convert.
  * \return A static string representing the name of
@@ -172,7 +172,7 @@ const char *BKE_idtype_idcode_to_name(const short idcode)
 }
 
 /**
- * Convert an idcode into a name (plural).
+ * Convert an \a idcode into a name (plural).
  *
  * \param idcode: The code to convert.
  * \return A static string representing the name of
@@ -186,7 +186,7 @@ const char *BKE_idtype_idcode_to_name_plural(const short 
idcode)
 }
 
 /**
- * Convert an idcode into its translations' context.
+ * Convert an \a idcode into its translations' context.
  *
  * \param idcode: The code to convert.
  * \return A static string representing the i18n context of the code.
@@ -199,10 +199,10 @@ const char 
*BKE_idtype_idcode_to_translation_context(const short idcode)
 }
 
 /**
- * Convert an IDType name into an idcode (ie. ID_SCE)
+ * Convert an ID-type name into an \a idcode (ie. #ID_SCE)
  *
- * \param idtype_name: The IDType's 'user visible name' to convert.
- * \return The idcode for the name, or 0 if invalid.
+ * \param idtype_name: The ID-type's "user visible name" to convert.
+ * \return The \a idcode for the name, or 0 if invalid.
  */
 short BKE_idtype_idcode_from_name(const char *idtype_name)
 {
@@ -236,7 +236,7 @@ bool BKE_idtype_idcode_is_linkable(const short idcode)
 }
 
 /**
- * Convert an idcode into an idfilter (e.g. ID_OB -> FILTER_ID_OB).
+ * Convert an \a idcode into an \a idfilter (e.g. ID_OB -> FILTER_ID_OB).
  */
 uint64_t BKE_idtype_idcode_to_idfilter(const short idcode)
 {
@@ -288,7 +288,7 @@ uint64_t BKE_idtype_idcode_to_idfilter(const short idcode)
 }
 
 /**
- * Convert an idfilter into an idcode (e.g. FILTER_ID_OB -> ID_OB).
+ * Convert an \a idfilter into an \a idcode (e.g. #FILTER_ID_OB -> #ID_OB).
  */
 short BKE_idtype_idcode_from_idfilter(const uint64_t idfilter)
 {
@@ -339,7 +339,7 @@ short BKE_idtype_idcode_from_idfilter(const uint64_t 
idfilter)
 }
 
 /**
- * Convert an idcode into an index (e.g. ID_OB -> INDEX_ID_OB).
+ * Convert an \a idcode into an index (e.g. #ID_OB -> #INDEX_ID_OB).
  */
 int BKE_idtype_idcode_to_index(const short idcode)
 {
@@ -401,7 +401,7 @@ int BKE_idtype_idcode_to_index(const short idcode)
 }
 
 /**
- * Get an idcode from an index (e.g. INDEX_ID_OB -> ID_OB).
+ * Get an \a idcode from an index (e.g. #INDEX_ID_OB -> #ID_OB).
  */
 short BKE_idtype_idcode_from_index(const int index)
 {
@@ -473,7 +473,9 @@ short BKE_idtype_idcode_iter_step(int *index)
   return (*index < ARRAY_SIZE(id_types)) ? 
BKE_idtype_idcode_from_index((*index)++) : 0;
 }
 
-/** Wrapper around IDTypeInfo foreach_cache that also handles embedded IDs. */
+/**
+ * Wrapper around #IDTypeInfo foreach_cache that also handles embedded IDs.
+ */
 void BKE_idtype_id_foreach_cache(struct ID *id,
  IDTypeForeachCacheFunctionCallback 
function_callback,
  void *user_data)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [80d134b6d10] master: Cleanup: remove unused source file

2020-09-07 Thread Campbell Barton
Commit: 80d134b6d102d604e5b977219997975abf429018
Author: Campbell Barton
Date:   Tue Sep 8 09:28:43 2020 +1000
Branches: master
https://developer.blender.org/rB80d134b6d102d604e5b977219997975abf429018

Cleanup: remove unused source file

FX_shader_light.c was added by accident in 66da2f537ae80ce2.

===

D   source/blender/shader_fx/intern/FX_shader_light.c

===

diff --git a/source/blender/shader_fx/intern/FX_shader_light.c 
b/source/blender/shader_fx/intern/FX_shader_light.c
deleted file mode 100644
index 2fd93bff8aa..000
--- a/source/blender/shader_fx/intern/FX_shader_light.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2018, Blender Foundation
- * This is a new part of Blender
- */
-
-/** \file
- * \ingroup shader_fx
- */
-
-#include 
-
-#include "DNA_gpencil_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-
-#include "BLI_utildefines.h"
-
-#include "BKE_context.h"
-#include "BKE_lib_query.h"
-#include "BKE_modifier.h"
-#include "BKE_screen.h"
-#include "BKE_shader_fx.h"
-
-#include "UI_interface.h"
-#include "UI_resources.h"
-
-#include "RNA_access.h"
-
-#include "FX_shader_types.h"
-#include "FX_ui_common.h"
-
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
-
-static void initData(ShaderFxData *fx)
-{
-  LightShaderFxData *gpfx = (LightShaderFxData *)fx;
-  gpfx->energy = 10.0f;
-  gpfx->ambient = 5.0f;
-  gpfx->object = NULL;
-}
-
-static void copyData(const ShaderFxData *md, ShaderFxData *target)
-{
-  BKE_shaderfx_copydata_generic(md, target);
-}
-
-static void updateDepsgraph(ShaderFxData *md, const 
ModifierUpdateDepsgraphContext *ctx)
-{
-  LightShaderFxData *fxd = (LightShaderFxData *)md;
-  if (fxd->object != NULL) {
-DEG_add_object_relation(ctx->node, fxd->object, DEG_OB_COMP_TRANSFORM, 
"Light ShaderFx");
-  }
-  DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, 
"Light ShaderFx");
-}
-
-static bool isDisabled(ShaderFxData *fx, int UNUSED(userRenderParams))
-{
-  LightShaderFxData *fxd = (LightShaderFxData *)fx;
-
-  return !fxd->object;
-}
-
-static void foreachObjectLink(ShaderFxData *fx,
-  Object *ob,
-  ShaderFxObjectWalkFunc walk,
-  void *userData)
-{
-  LightShaderFxData *fxd = (LightShaderFxData *)fx;
-
-  walk(userData, ob, >object, IDWALK_CB_NOP);
-}
-
-ShaderFxTypeInfo shaderfx_Type_Light = {
-/* name */ "Light",
-/* structName */ "LightShaderFxData",
-/* structSize */ sizeof(LightShaderFxData),
-/* type */ eShaderFxType_GpencilType,
-/* flags */ 0,
-
-/* copyData */ copyData,
-
-/* initData */ initData,
-/* freeData */ NULL,
-/* isDisabled */ isDisabled,
-/* updateDepsgraph */ updateDepsgraph,
-/* dependsOnTime */ NULL,
-/* foreachObjectLink */ foreachObjectLink,
-/* foreachIDLink */ NULL,
-/* panelRegister */ NULL,
-};

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [38b1450848d] master: Cleanup: tabs to spaces

2020-09-07 Thread Campbell Barton
Commit: 38b1450848d89aae8b5888afdaf143b150ff3f1f
Author: Campbell Barton
Date:   Tue Sep 8 09:23:02 2020 +1000
Branches: master
https://developer.blender.org/rB38b1450848d89aae8b5888afdaf143b150ff3f1f

Cleanup: tabs to spaces

===

M   build_files/cmake/platform/platform_win32.cmake
M   source/blender/blenkernel/intern/unit.c

===

diff --git a/build_files/cmake/platform/platform_win32.cmake 
b/build_files/cmake/platform/platform_win32.cmake
index 007f77a583f..64e4b276610 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -149,8 +149,8 @@ 
include(build_files/cmake/platform/platform_win32_bundle_crt.cmake)
 remove_cc_flag("/MDd" "/MD" "/Zi")
 
 if(WITH_WINDOWS_PDB)
-   set(PDB_INFO_OVERRIDE_FLAGS "/Z7")
-   set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF 
/INCREMENTAL:NO")
+  set(PDB_INFO_OVERRIDE_FLAGS "/Z7")
+  set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF 
/INCREMENTAL:NO")
 endif()
 
 if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
diff --git a/source/blender/blenkernel/intern/unit.c 
b/source/blender/blenkernel/intern/unit.c
index babb4965b1e..f4a280581f3 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -80,7 +80,7 @@
 #define UN_SC_LB0.45359237f
 #define UN_SC_OZ0.028349523125f
 
-#define UN_SC_FAH  0.f
+#define UN_SC_FAH   0.f
 
 /* clang-format on */
 
@@ -334,15 +334,15 @@ static struct bUnitCollection buPowerCollection = 
{buPowerDef, 3, 0, UNIT_COLLEC
 /* Temperature */
 static struct bUnitDef buMetricTempDef[] = {
   {"kelvin",  "kelvin",  "K",  NULL, "Kelvin",  "KELVIN",  1.0f, 0.0,
B_UNIT_DEF_NONE}, /* Base unit. */
-   {"celsius", "celsius", "°C", "C",  "Celsius", "CELCIUS", 1.0f, 273.15, 
B_UNIT_DEF_NONE},
-   NULL_UNIT,
+  {"celsius", "celsius", "°C", "C",  "Celsius", "CELCIUS", 1.0f, 273.15, 
B_UNIT_DEF_NONE},
+  NULL_UNIT,
 };
 static struct bUnitCollection buMetricTempCollection = {buMetricTempDef, 0, 0, 
UNIT_COLLECTION_LENGTH(buMetricTempDef)};
 
 static struct bUnitDef buImperialTempDef[] = {
   {"kelvin", "kelvin", "K",  NULL, "Kelvin", "KELVIN", 1.0f,   
   0.0,B_UNIT_DEF_NONE}, /* Base unit. */
-   {"fahrenheit", "fahrenheit", "°F", "F",  "Fahrenheit", "FAHRENHEIT", 
UN_SC_FAH, 459.67, B_UNIT_DEF_NONE},
-   NULL_UNIT,
+  {"fahrenheit", "fahrenheit", "°F", "F",  "Fahrenheit", "FAHRENHEIT", 
UN_SC_FAH, 459.67, B_UNIT_DEF_NONE},
+  NULL_UNIT,
 };
 static struct bUnitCollection buImperialTempCollection = {
 buImperialTempDef, 1, 0, UNIT_COLLECTION_LENGTH(buImperialTempDef)};

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bedc68a8388] master: Cleanup: consistent syntax for doxygen parameters

2020-09-07 Thread Campbell Barton
Commit: bedc68a83881b209b399bb5135fb08b0968b145a
Author: Campbell Barton
Date:   Tue Sep 8 09:10:17 2020 +1000
Branches: master
https://developer.blender.org/rBbedc68a83881b209b399bb5135fb08b0968b145a

Cleanup: consistent syntax for doxygen parameters

Also use back-slash instead of '@'.

===

M   intern/guardedalloc/MEM_guardedalloc.h
M   source/blender/blenkernel/intern/collection.c
M   source/blender/blenkernel/intern/lib_override.c
M   source/blender/blenkernel/intern/unit.c
M   source/blender/editors/interface/interface_panel.c
M   source/blender/gpu/intern/gpu_texture.cc
M   source/blender/gpu/opengl/gl_framebuffer.hh

===

diff --git a/intern/guardedalloc/MEM_guardedalloc.h 
b/intern/guardedalloc/MEM_guardedalloc.h
index c05bda030ad..71d3c512306 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -165,7 +165,7 @@ extern void (*MEM_set_error_callback)(void (*func)(const 
char *));
 /**
  * Are the start/end block markers still correct ?
  *
- * @retval true for correct memory, false for corrupted memory. */
+ * \retval true for correct memory, false for corrupted memory. */
 extern bool (*MEM_consistency_check)(void);
 
 /** Attempt to enforce OSX (or other OS's) to have malloc and stack nonzero */
diff --git a/source/blender/blenkernel/intern/collection.c 
b/source/blender/blenkernel/intern/collection.c
index 8975be2b618..836ce542793 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -1182,10 +1182,10 @@ static bool 
collection_instance_find_recursive(Collection *collection,
 /**
  * Find potential cycles in collections.
  *
- * \param new_ancestor the potential new owner of given \a collection, or the 
collection to check
- * if the later is NULL.
- * \param collection the collection we want to add to \a new_ancestor, may be 
NULL if we just want
- *   to ensure \a new_ancestor does not already have cycles.
+ * \param new_ancestor: the potential new owner of given \a collection,
+ * or the collection to check if the later is NULL.
+ * \param collection: the collection we want to add to \a new_ancestor,
+ * may be NULL if we just want to ensure \a new_ancestor does not already have 
cycles.
  * \return true if a cycle is found.
  */
 bool BKE_collection_cycle_find(Collection *new_ancestor, Collection 
*collection)
@@ -1254,7 +1254,7 @@ static bool collection_cycle_fix_recursive(Main *bmain,
 /**
  * Find and fix potential cycles in collections.
  *
- * \param collection the collection to check for existing cycles.
+ * \param collection: The collection to check for existing cycles.
  * \return true if cycles are found and fixed.
  */
 bool BKE_collection_cycles_fix(Main *bmain, Collection *collection)
diff --git a/source/blender/blenkernel/intern/lib_override.c 
b/source/blender/blenkernel/intern/lib_override.c
index 2908ef133f0..48ecbcae90c 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -409,9 +409,9 @@ static bool lib_override_hierarchy_recursive_tag(Main 
*bmain,
  *
  * This will include all local IDs, and all IDs from the same library as the 
\a id_root.
  *
- * \param id_root The root of the hierarchy of dependencies to be tagged.
- * \param do_create_main_relashionships Whether main relations needs to be 
created or already exist
- *  (in any case, they will be freed by 
this function).
+ * \param id_root: The root of the hierarchy of dependencies to be tagged.
+ * \param do_create_main_relashionships: Whether main relations needs to be 
created or already
+ * exist (in any case, they will be freed by this function).
  */
 void BKE_lib_override_library_dependencies_tag(Main *bmain,
ID *id_root,
@@ -435,9 +435,9 @@ void BKE_lib_override_library_dependencies_tag(Main *bmain,
  * That is, all other liboverrides IDs (in)directly used by \a is_root one, 
sharing the same
  * library for their reference IDs.
  *
- * \param id_root The root of the hierarchy of liboverride dependencies to be 
tagged.
- * \param do_create_main_relashionships Whether main relations needs to be 
created or already exist
- *  (in any case, they will be freed by 
this function).
+ * \param id_root: The root of the hierarchy of liboverride dependencies to be 
tagged.
+ * \param do_create_main_relashionships: Whether main relations needs to be 
created or already
+ * exist (in any case, they will be freed by this function).
  */
 void BKE_lib_override_library_override_group_tag(Main *bmain,
  ID *id_root,
@@ -640,10 +640,10 @@ static void lib_override_library_create_post_process(
  * \note In 

[Bf-blender-cvs] [5c2ac8520e0] master: GPUQuery: GL Backend isolation

2020-09-07 Thread Clément Foucault
Commit: 5c2ac8520e070db2085b7d95d9d232b567edb247
Author: Clément Foucault
Date:   Mon Sep 7 23:52:55 2020 +0200
Branches: master
https://developer.blender.org/rB5c2ac8520e070db2085b7d95d9d232b567edb247

GPUQuery: GL Backend isolation

This is part of the Vulkan task T68990.

This introduce a new GLQueryPool for managing queries in an
implementation agnostic manner.

This modify the GPU selection query to use this new object.
This also make use of blender::Vector for better code quality.

No real functionnal change.

===

M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/intern/gpu_backend.hh
A   source/blender/gpu/intern/gpu_query.cc
A   source/blender/gpu/intern/gpu_query.hh
M   source/blender/gpu/intern/gpu_select_private.h
R068source/blender/gpu/intern/gpu_select_sample_query.c 
source/blender/gpu/intern/gpu_select_sample_query.cc
M   source/blender/gpu/opengl/gl_backend.hh
M   source/blender/gpu/opengl/gl_context.hh
A   source/blender/gpu/opengl/gl_query.cc
A   source/blender/gpu/opengl/gl_query.hh

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 6fdd510ad28..0a372125391 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -74,9 +74,10 @@ set(SRC
   intern/gpu_matrix.cc
   intern/gpu_node_graph.c
   intern/gpu_platform.cc
+  intern/gpu_query.cc
   intern/gpu_select.c
   intern/gpu_select_pick.c
-  intern/gpu_select_sample_query.c
+  intern/gpu_select_sample_query.cc
   intern/gpu_shader.cc
   intern/gpu_shader_builtin.c
   intern/gpu_shader_interface.cc
@@ -95,6 +96,7 @@ set(SRC
   opengl/gl_framebuffer.cc
   opengl/gl_immediate.cc
   opengl/gl_index_buffer.cc
+  opengl/gl_query.cc
   opengl/gl_shader.cc
   opengl/gl_shader_interface.cc
   opengl/gl_state.cc
@@ -146,6 +148,7 @@ set(SRC
   intern/gpu_node_graph.h
   intern/gpu_private.h
   intern/gpu_platform_private.hh
+  intern/gpu_query.hh
   intern/gpu_select_private.h
   intern/gpu_shader_private.hh
   intern/gpu_shader_interface.hh
@@ -164,6 +167,7 @@ set(SRC
   opengl/gl_immediate.hh
   opengl/gl_index_buffer.hh
   opengl/gl_primitive.hh
+  opengl/gl_query.hh
   opengl/gl_shader.hh
   opengl/gl_shader_interface.hh
   opengl/gl_state.hh
diff --git a/source/blender/gpu/intern/gpu_backend.hh 
b/source/blender/gpu/intern/gpu_backend.hh
index d074350e8d0..1a6a6668b42 100644
--- a/source/blender/gpu/intern/gpu_backend.hh
+++ b/source/blender/gpu/intern/gpu_backend.hh
@@ -34,6 +34,7 @@ class Batch;
 class DrawList;
 class FrameBuffer;
 class IndexBuf;
+class QueryPool;
 class Shader;
 class Texture;
 class UniformBuf;
@@ -53,6 +54,7 @@ class GPUBackend {
   virtual DrawList *drawlist_alloc(int list_length) = 0;
   virtual FrameBuffer *framebuffer_alloc(const char *name) = 0;
   virtual IndexBuf *indexbuf_alloc(void) = 0;
+  virtual QueryPool *querypool_alloc(void) = 0;
   virtual Shader *shader_alloc(const char *name) = 0;
   virtual Texture *texture_alloc(const char *name) = 0;
   virtual UniformBuf *uniformbuf_alloc(int size, const char *name) = 0;
diff --git a/source/blender/gpu/intern/gpu_select_private.h 
b/source/blender/gpu/intern/gpu_query.cc
similarity index 52%
copy from source/blender/gpu/intern/gpu_select_private.h
copy to source/blender/gpu/intern/gpu_query.cc
index e364b78bff2..ad9b6d21420 100644
--- a/source/blender/gpu/intern/gpu_select_private.h
+++ b/source/blender/gpu/intern/gpu_query.cc
@@ -13,32 +13,16 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * The Original Code is Copyright (C) 2014 Blender Foundation.
+ * Copyright 2020, Blender Foundation.
  * All rights reserved.
  */
 
 /** \file
  * \ingroup gpu
- *
- * Selection implementations.
  */
 
-#pragma once
-
-/* gpu_select_pick */
-void gpu_select_pick_begin(uint (*buffer)[4], uint bufsize, const rcti *input, 
char mode);
-bool gpu_select_pick_load_id(uint id, bool end);
-uint gpu_select_pick_end(void);
-
-void gpu_select_pick_cache_begin(void);
-void gpu_select_pick_cache_end(void);
-bool gpu_select_pick_is_cached(void);
-void gpu_select_pick_cache_load_id(void);
+#include "gpu_query.hh"
 
-/* gpu_select_sample_query */
-void gpu_select_query_begin(
-uint (*buffer)[4], uint bufsize, const rcti *input, char mode, int 
oldhits);
-bool gpu_select_query_load_id(uint id);
-uint gpu_select_query_end(void);
+using namespace blender::gpu;
 
-#define SELECT_ID_NONE ((uint)0x)
+/* TODO(fclem) Make the associated C-API to use inside DRW profiler. */
diff --git a/source/blender/gpu/intern/gpu_query.hh 
b/source/blender/gpu/intern/gpu_query.hh
new file mode 100644
index 000..5e3159a94f7
--- /dev/null
+++ b/source/blender/gpu/intern/gpu_query.hh
@@ -0,0 +1,59 @@
+/*
+ * This program is free software; 

[Bf-blender-cvs] [b7a28b315a0] master: GPUFramebuffer: Make GPU_framebuffer_read_depth more flexible

2020-09-07 Thread Clément Foucault
Commit: b7a28b315a0ba85f9796845718e578abf5379f7d
Author: Clément Foucault
Date:   Mon Sep 7 21:08:31 2020 +0200
Branches: master
https://developer.blender.org/rBb7a28b315a0ba85f9796845718e578abf5379f7d

GPUFramebuffer: Make GPU_framebuffer_read_depth more flexible

This is to make use of it in selection code.

===

M   source/blender/draw/engines/gpencil/gpencil_render.c
M   source/blender/draw/engines/workbench/workbench_render.c
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/gpu/GPU_framebuffer.h
M   source/blender/gpu/intern/gpu_framebuffer.cc

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_render.c 
b/source/blender/draw/engines/gpencil/gpencil_render.c
index 5d417d995ac..b18013d742a 100644
--- a/source/blender/draw/engines/gpencil/gpencil_render.c
+++ b/source/blender/draw/engines/gpencil/gpencil_render.c
@@ -182,6 +182,7 @@ static void GPENCIL_render_result_z(struct RenderLayer *rl,
rect->ymin,
BLI_rcti_size_x(rect),
BLI_rcti_size_y(rect),
+   GPU_DATA_FLOAT,
rp->rect);
 
 float winmat[4][4];
diff --git a/source/blender/draw/engines/workbench/workbench_render.c 
b/source/blender/draw/engines/workbench/workbench_render.c
index 8760f2651ee..2c3b5a5f935 100644
--- a/source/blender/draw/engines/workbench/workbench_render.c
+++ b/source/blender/draw/engines/workbench/workbench_render.c
@@ -124,6 +124,7 @@ static void workbench_render_result_z(struct RenderLayer 
*rl,
rect->ymin,
BLI_rcti_size_x(rect),
BLI_rcti_size_y(rect),
+   GPU_DATA_FLOAT,
rp->rect);
 
 float winmat[4][4];
diff --git a/source/blender/editors/space_view3d/view3d_draw.c 
b/source/blender/editors/space_view3d/view3d_draw.c
index c4da39bca2f..6cd940244b4 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2157,8 +2157,13 @@ static void view3d_opengl_read_Z_pixels(GPUViewport 
*viewport, rcti *rect, void
   GPU_framebuffer_texture_attach(tmp_fb, dtxl->depth, 0, 0);
   GPU_framebuffer_bind(tmp_fb);
 
-  GPU_framebuffer_read_depth(
-  tmp_fb, rect->xmin, rect->ymin, BLI_rcti_size_x(rect), 
BLI_rcti_size_y(rect), data);
+  GPU_framebuffer_read_depth(tmp_fb,
+ rect->xmin,
+ rect->ymin,
+ BLI_rcti_size_x(rect),
+ BLI_rcti_size_y(rect),
+ GPU_DATA_FLOAT,
+ data);
 
   GPU_framebuffer_restore();
   GPU_framebuffer_free(tmp_fb);
diff --git a/source/blender/gpu/GPU_framebuffer.h 
b/source/blender/gpu/GPU_framebuffer.h
index f4599ac44bb..c0391d96e06 100644
--- a/source/blender/gpu/GPU_framebuffer.h
+++ b/source/blender/gpu/GPU_framebuffer.h
@@ -188,7 +188,8 @@ void GPU_framebuffer_clear(GPUFrameBuffer *fb,
 
 void GPU_framebuffer_multi_clear(GPUFrameBuffer *fb, const float 
(*clear_cols)[4]);
 
-void GPU_framebuffer_read_depth(GPUFrameBuffer *fb, int x, int y, int w, int 
h, float *data);
+void GPU_framebuffer_read_depth(
+GPUFrameBuffer *fb, int x, int y, int w, int h, eGPUDataFormat format, 
void *data);
 void GPU_framebuffer_read_color(GPUFrameBuffer *fb,
 int x,
 int y,
diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc 
b/source/blender/gpu/intern/gpu_framebuffer.cc
index a0b05df583a..f9caa8df143 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.cc
+++ b/source/blender/gpu/intern/gpu_framebuffer.cc
@@ -393,10 +393,11 @@ void GPU_clear_depth(float depth)
   GPU_context_active_get()->active_fb->clear(GPU_DEPTH_BIT, clear_col, depth, 
0x0);
 }
 
-void GPU_framebuffer_read_depth(GPUFrameBuffer *gpu_fb, int x, int y, int w, 
int h, float *data)
+void GPU_framebuffer_read_depth(
+GPUFrameBuffer *gpu_fb, int x, int y, int w, int h, eGPUDataFormat format, 
void *data)
 {
   int rect[4] = {x, y, w, h};
-  reinterpret_cast(gpu_fb)->read(GPU_DEPTH_BIT, GPU_DATA_FLOAT, 
rect, 1, 1, data);
+  reinterpret_cast(gpu_fb)->read(GPU_DEPTH_BIT, format, rect, 
1, 1, data);
 }
 
 void GPU_framebuffer_read_color(GPUFrameBuffer *gpu_fb,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d4fd363d059] master: GPU: Select Pick: Remove last GL call

2020-09-07 Thread Clément Foucault
Commit: d4fd363d05943eaf021ef3bff8756cdf96241c0e
Author: Clément Foucault
Date:   Mon Sep 7 21:09:18 2020 +0200
Branches: master
https://developer.blender.org/rBd4fd363d05943eaf021ef3bff8756cdf96241c0e

GPU: Select Pick: Remove last GL call

This is part of the Vulkan task T68990
This is just a cleanup.

===

M   source/blender/gpu/intern/gpu_select_pick.c

===

diff --git a/source/blender/gpu/intern/gpu_select_pick.c 
b/source/blender/gpu/intern/gpu_select_pick.c
index c3ccb68a998..769b52bf593 100644
--- a/source/blender/gpu/intern/gpu_select_pick.c
+++ b/source/blender/gpu/intern/gpu_select_pick.c
@@ -346,16 +346,9 @@ void gpu_select_pick_begin(uint (*buffer)[4], uint 
bufsize, const rcti *input, c
 ps->gl.rect_depth = depth_buf_malloc(rect_len);
 
 /* set initial 'far' value */
-#if 0
-glReadPixels(UNPACK4(ps->gl.clip_readpixels),
- GL_DEPTH_COMPONENT,
- GL_UNSIGNED_INT,
- ps->gl.rect_depth->buf);
-#else
 for (uint i = 0; i < rect_len; i++) {
   ps->gl.rect_depth->buf[i] = DEPTH_MAX;
 }
-#endif
 
 ps->gl.is_init = false;
 ps->gl.prev_id = 0;
@@ -486,10 +479,9 @@ bool gpu_select_pick_load_id(uint id, bool end)
 }
 
 const uint rect_len = ps->src.rect_len;
-glReadPixels(UNPACK4(ps->gl.clip_readpixels),
- GL_DEPTH_COMPONENT,
- GL_UNSIGNED_INT,
- ps->gl.rect_depth_test->buf);
+GPUFrameBuffer *fb = GPU_framebuffer_active_get();
+GPU_framebuffer_read_depth(
+fb, UNPACK4(ps->gl.clip_readpixels), GPU_DATA_UNSIGNED_INT, 
ps->gl.rect_depth_test->buf);
 /* perform initial check since most cases the array remains unchanged  */
 
 bool do_pass = false;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [97c6c4e4788] master: Decimate Modifier: Restore vertex group factor property in UI

2020-09-07 Thread Hans Goudey
Commit: 97c6c4e478830bd9a38873c5208e1ca37840b69a
Author: Hans Goudey
Date:   Mon Sep 7 15:34:32 2020 -0500
Branches: master
https://developer.blender.org/rB97c6c4e478830bd9a38873c5208e1ca37840b69a

Decimate Modifier: Restore vertex group factor property in UI

This property was inadvertently removed from the modifier's panel and
it wasn't caught in time for the release of 2.90. Thanks to the user
"VermossomreV" for bringing this to my attention.

Differential Revision: https://developer.blender.org/D8790

===

M   source/blender/modifiers/intern/MOD_decimate.c

===

diff --git a/source/blender/modifiers/intern/MOD_decimate.c 
b/source/blender/modifiers/intern/MOD_decimate.c
index 68c330452b3..72a868cc6a7 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -257,6 +257,10 @@ static void panel_draw(const bContext *UNUSED(C), Panel 
*panel)
 uiItemR(layout, ptr, "use_collapse_triangulate", 0, NULL, ICON_NONE);
 
 modifier_vgroup_ui(layout, ptr, _ptr, "vertex_group", 
"invert_vertex_group", NULL);
+sub = uiLayoutRow(layout, true);
+bool has_vertex_group = RNA_string_length(ptr, "vertex_group") != 0;
+uiLayoutSetActive(sub, has_vertex_group);
+uiItemR(sub, ptr, "vertex_group_factor", 0, NULL, ICON_NONE);
   }
   else if (decimate_type == MOD_DECIM_MODE_UNSUBDIV) {
 uiItemR(layout, ptr, "iterations", 0, NULL, ICON_NONE);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [36aeb0ec1e2] master: UI: Add temperature units

2020-09-07 Thread Hans Goudey
Commit: 36aeb0ec1e2ec8cd6a3690ac11cd3c50f3851802
Author: Hans Goudey
Date:   Mon Sep 7 14:59:07 2020 -0500
Branches: master
https://developer.blender.org/rB36aeb0ec1e2ec8cd6a3690ac11cd3c50f3851802

UI: Add temperature units

Based on the original patch by Vaishnav S (@padthai), this adds
support for temperature units. Initially supported units are Celsius,
Kelvin, and Fahrenheit.

The units aren't used anywhere with this commit. Those changes should
happen in separate patches by adding PROP_TEMPERATURE to RNA property
definitions. But it should be ensured that the various solvers and
simulations actually properly use real units.

The complexity of some of the changes comes from the fact that these
units have offsets from each other as well as coefficients. This also
makes the implementation in the current unit system troublesome.
For example, entering 0C evaluates correctly to 273K, but 0C + 0C
doubles that result, because each unit value is evaluated separately.
This is quite hard to solve in the general case with Blender's current
unit system, though, so it is not handled in this commit.

Differential Revision: https://developer.blender.org/D4401

===

M   release/scripts/startup/bl_ui/properties_scene.py
M   source/blender/blenkernel/BKE_unit.h
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenkernel/intern/unit.c
M   source/blender/editors/util/numinput.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/RNA_types.h
M   source/blender/makesrna/intern/makesrna.c
M   source/blender/makesrna/intern/rna_rna.c
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/python/intern/bpy_props.c

===

diff --git a/release/scripts/startup/bl_ui/properties_scene.py 
b/release/scripts/startup/bl_ui/properties_scene.py
index df4793cab19..8618c201312 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -92,6 +92,7 @@ class SCENE_PT_unit(SceneButtonsPanel, Panel):
 subcol.prop(unit, "length_unit", text="Length")
 subcol.prop(unit, "mass_unit", text="Mass")
 subcol.prop(unit, "time_unit", text="Time")
+subcol.prop(unit, "temperature_unit", text="Temperature")
 
 
 class SceneKeyingSetsPanel:
diff --git a/source/blender/blenkernel/BKE_unit.h 
b/source/blender/blenkernel/BKE_unit.h
index a797cff..d47cebb5dc8 100644
--- a/source/blender/blenkernel/BKE_unit.h
+++ b/source/blender/blenkernel/BKE_unit.h
@@ -46,8 +46,8 @@ bool bUnit_ReplaceString(
 /* return true if the string contains any valid unit for the given type */
 bool bUnit_ContainsUnit(const char *str, int type);
 
-/* if user does not specify a unit, multiply with this value */
-double bUnit_PreferredInputUnitScalar(const struct UnitSettings *settings, int 
type);
+/* If user does not specify a unit, this converts it to the unit from the 
settings. */
+double bUnit_ApplyPreferredUnit(const struct UnitSettings *settings, int type, 
double value);
 
 /* make string keyboard-friendly: 10µm --> 10um */
 void bUnit_ToUnitAltName(char *str, int len_max, const char *orig_str, int 
system, int type);
@@ -86,7 +86,8 @@ enum {
   B_UNIT_ACCELERATION = 8,
   B_UNIT_CAMERA = 9,
   B_UNIT_POWER = 10,
-  B_UNIT_TYPE_TOT = 11,
+  B_UNIT_TEMPERATURE = 11,
+  B_UNIT_TYPE_TOT = 12,
 };
 
 #ifdef __cplusplus
diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index 00218b1be51..a1f74dddbad 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -157,6 +157,8 @@ static void scene_init_data(ID *id)
   scene->unit.length_unit = (uchar)bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, 
B_UNIT_LENGTH);
   scene->unit.mass_unit = (uchar)bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, 
B_UNIT_MASS);
   scene->unit.time_unit = (uchar)bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, 
B_UNIT_TIME);
+  scene->unit.temperature_unit = 
(uchar)bUnit_GetBaseUnitOfType(USER_UNIT_METRIC,
+
B_UNIT_TEMPERATURE);
 
   /* Anti-Aliasing threshold. */
   scene->grease_pencil_settings.smaa_threshold = 1.0f;
diff --git a/source/blender/blenkernel/intern/unit.c 
b/source/blender/blenkernel/intern/unit.c
index 5af24152972..c5782d846bb 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -80,6 +80,8 @@
 #define UN_SC_LB0.45359237f
 #define UN_SC_OZ0.028349523125f
 
+#define UN_SC_FAH  0.f
+
 /* clang-format on */
 
 /* Define a single unit. */
@@ -101,7 +103,7 @@ typedef struct bUnitDef {
   const char *identifier;
 
   double scalar;
-  /** Not used yet, needed for converting temperature. */
+  /** Needed for converting temperatures. */
   double bias;
   int flag;
 } bUnitDef;

[Bf-blender-cvs] [d4cca7b7b0d] master: UI: Changes to timeline playback popover

2020-09-07 Thread Hans Goudey
Commit: d4cca7b7b0d858a45c684fd0725344881e0c1c63
Author: Hans Goudey
Date:   Mon Sep 7 14:22:29 2020 -0500
Branches: master
https://developer.blender.org/rBd4cca7b7b0d858a45c684fd0725344881e0c1c63

UI: Changes to timeline playback popover

The current playback popover has some issues:
 - Using labels instead of headers is inconsistent with
   the rest of the interface
 - Incomplete context and description for some properties
 - Ugly large spacing

This commit fixes these problems by using headers.

Differential Revision: https://developer.blender.org/D8434

===

M   release/scripts/startup/bl_ui/space_time.py

===

diff --git a/release/scripts/startup/bl_ui/space_time.py 
b/release/scripts/startup/bl_ui/space_time.py
index 1a9244a3051..68b5f8acd38 100644
--- a/release/scripts/startup/bl_ui/space_time.py
+++ b/release/scripts/startup/bl_ui/space_time.py
@@ -230,34 +230,37 @@ class TimelinePanelButtons:
 class TIME_PT_playback(TimelinePanelButtons, Panel):
 bl_label = "Playback"
 bl_region_type = 'HEADER'
+bl_ui_units_x = 11
 
 def draw(self, context):
 layout = self.layout
+layout.use_property_split = True
+layout.use_property_decorate = False
 
 screen = context.screen
 scene = context.scene
 
-layout.prop(scene, "sync_mode", text="")
-layout.prop(scene, "use_audio_scrub")
-layout.prop(scene, "use_audio", text="Mute Audio")
-
-layout.prop(scene, "show_subframe", text="Subframes")
-
-layout.prop(scene, "lock_frame_selection_to_range", text="Limit 
Playback to Frame Range")
-layout.prop(screen, "use_follow", text="Follow Current Frame")
-
-layout.separator()
-
 col = layout.column()
-col.label(text="Play Animation In:")
-layout.prop(screen, "use_play_top_left_3d_editor", text="Active Editor 
Only")
-layout.prop(screen, "use_play_3d_editors")
-layout.prop(screen, "use_play_animation_editors")
-layout.prop(screen, "use_play_properties_editors")
-layout.prop(screen, "use_play_image_editors")
-layout.prop(screen, "use_play_sequence_editors")
-layout.prop(screen, "use_play_node_editors")
-layout.prop(screen, "use_play_clip_editors")
+col.prop(scene, "sync_mode", text="Audio")
+col.prop(scene, "use_audio_scrub", text="Scrubbing")
+col.prop(scene, "use_audio", text="Mute")
+
+col = layout.column(heading="Playback")
+col.prop(scene, "lock_frame_selection_to_range", text="Limit to Frame 
Range")
+col.prop(screen, "use_follow", text="Follow Current Frame")
+
+col = layout.column(heading="Play In")
+col.prop(screen, "use_play_top_left_3d_editor", text="Active Editor")
+col.prop(screen, "use_play_3d_editors", text="3D Viewport")
+col.prop(screen, "use_play_animation_editors", text="Animation 
Editors")
+col.prop(screen, "use_play_image_editors", text="Image Editor")
+col.prop(screen, "use_play_properties_editors", text="Properties 
Editor")
+col.prop(screen, "use_play_clip_editors", text="Movie Clip Editor")
+col.prop(screen, "use_play_node_editors", text="Node Editors")
+col.prop(screen, "use_play_sequence_editors", text="Video Sequencer")
+
+col = layout.column(heading="Show")
+col.prop(scene, "show_subframe", text="Subframes")
 
 layout.separator()

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5eb5978043c] master: Generate Xcode scheme files during configuration.

2020-09-07 Thread Ankit
Commit: 5eb5978043c8e7036e15572ea43b083965140e77
Author: Ankit
Date:   Tue Sep 8 00:24:59 2020 +0530
Branches: master
https://developer.blender.org/rB5eb5978043c8e7036e15572ea43b083965140e77

Generate Xcode scheme files during configuration.

Every time CMake is re-run, Xcode shows a popup asking if
user wants to manage schemes automatically or manually.
Building Blender wiki page recommends managing schemes automatically.

This change sets the default behavior to "automatically" and generates
the .xcscheme files while CMake is running, instead of hogging Xcode
later on. With tests enabled, the number of schemes is 203.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8820

===

M   build_files/cmake/platform/platform_apple_xcode.cmake

===

diff --git a/build_files/cmake/platform/platform_apple_xcode.cmake 
b/build_files/cmake/platform/platform_apple_xcode.cmake
index 3a43ca317dd..7e6bd14ecc3 100644
--- a/build_files/cmake/platform/platform_apple_xcode.cmake
+++ b/build_files/cmake/platform/platform_apple_xcode.cmake
@@ -154,3 +154,11 @@ if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} 
-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
   add_definitions("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
 endif()
+
+if(${CMAKE_GENERATOR} MATCHES "Xcode")
+  # Generate schemes in Blender.xcodeproj/xcshareddata/xcschemes/ early, at
+  # configuration time, not when Xcode is opened.
+  # This gets rid of "Manage schemes automatically" confirmation dialog that
+  # appears whenever CMake is run.
+  set(CMAKE_XCODE_GENERATE_SCHEME ON)
+endif()

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6aaa6c96a1c] master: Tests: set build directory using build type

2020-09-07 Thread Ankit
Commit: 6aaa6c96a1c5b1cfb093433f96999086534ef18b
Author: Ankit
Date:   Tue Sep 8 00:22:39 2020 +0530
Branches: master
https://developer.blender.org/rB6aaa6c96a1c5b1cfb093433f96999086534ef18b

Tests: set build directory using build type

Similar to {rB0a5f7061369d53b4eac55362ad2}
but also for Xcode and Ninja multi-config.

This silences 44 pairs of warnings like:

/bin/rm -f build_full/bin/tests/BLI_ghash_performance_test
"build_full/CMakeScripts/XCODE_DEPEND_HELPER.make:42: warning:
ignoring old commands for target
`build_full/bin/tests/BLI_ghash_performance_test'"

/bin/rm -f build_full/bin/tests/BLI_ghash_performance_test
"build_full/CMakeScripts/XCODE_DEPEND_HELPER.make:3523: warning:
overriding commands for target
`build_full/bin/tests/BLI_ghash_performance_test'"

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8815

===

M   CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f72ccd857b3..cfc49505a0b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -128,7 +128,9 @@ enable_testing()
 
 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE)
 set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE)
-if(MSVC)
+
+get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY 
GENERATOR_IS_MULTI_CONFIG)
+if(GENERATOR_IS_MULTI_CONFIG)
   set(TESTS_OUTPUT_DIR ${EXECUTABLE_OUTPUT_PATH}/tests/$/ CACHE 
INTERNAL "" FORCE)
 else()
   set(TESTS_OUTPUT_DIR ${EXECUTABLE_OUTPUT_PATH}/tests/ CACHE INTERNAL "" 
FORCE)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [40dcf686f04] master: Support ASan library on macOS for all generators.

2020-09-07 Thread Ankit
Commit: 40dcf686f04f7db8110f9c85621eb8a0bd764080
Author: Ankit
Date:   Tue Sep 8 00:17:17 2020 +0530
Branches: master
https://developer.blender.org/rB40dcf686f04f7db8110f9c85621eb8a0bd764080

Support ASan library on macOS for all generators.

This change allows macOS developers to use
`WITH_COMPILER_ASAN` with every generator.

`CMAKE_C_IMPLICIT_LINK_DIRECTORIES` on macOS points to
`Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib`
which is not where the Sanitizer libraries are.

To link the library, rpath could be used but that seems complex,
so linker flags are passed as the documentation says. [1]

If users have `ASAN_OPTIONS=detect_leaks=1` in their environment
variables, it should be removed to avoid a feature-unsupported error
while compiling.

[1]: http://clang.llvm.org/docs/AddressSanitizer.html#usage

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8817

===

M   CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 76d2d578dc3..f72ccd857b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -510,9 +510,21 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES 
"Clang")
 -fno-sanitize=alignment \
 ")
 
-if(NOT MSVC) # not all sanitizers are supported with clang-cl, these two 
however are very vocal about it
-  set(_asan_defaults "${_asan_defaults} -fsanitize=leak 
-fsanitize=object-size" )
+if(MSVC)
+  # clang-cl doesn't support all sanitizers, but leak and object-size give 
errors/warnings.
+  set(_asan_defaults "${_asan_defaults}")
+elseif(APPLE)
+  # AppleClang doesn't support all sanitizers, but leak gives error.
+  if(CMAKE_BUILD_TYPE MATCHES "Debug")
+# Silence the warning that object-size is not effective in -O0.
+set(_asan_defaults "${_asan_defaults}")
+  else()
+set(_asan_defaults "${_asan_defaults} -fsanitize=object-size")
+  endif()
+else()
+  set(_asan_defaults "${_asan_defaults} -fsanitize=leak 
-fsanitize=object-size")
 endif()
+
 set(COMPILER_ASAN_CFLAGS "${_asan_defaults}" CACHE STRING "C flags for 
address sanitizer")
 mark_as_advanced(COMPILER_ASAN_CFLAGS)
 set(COMPILER_ASAN_CXXFLAGS "${_asan_defaults}" CACHE STRING "C++ flags for 
address sanitizer")
@@ -520,16 +532,31 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES 
"Clang")
 
 unset(_asan_defaults)
 
-if(NOT MSVC)
-  find_library(COMPILER_ASAN_LIBRARY asan 
${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
-else()
-  find_library(
-COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
+if(MSVC)
+find_library(
+  COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
 PATHS
 
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/7.0.0/lib/windows
 
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/6.0.0/lib/windows
   )
+elseif(APPLE)
+  execute_process(COMMAND ${CMAKE_CXX_COMPILER} 
+-print-file-name=lib 
+OUTPUT_VARIABLE CLANG_LIB_DIR
+  )
+  string(STRIP "${CLANG_LIB_DIR}" CLANG_LIB_DIR)
+  find_library(
+COMPILER_ASAN_LIBRARY NAMES libclang_rt.asan_osx_dynamic.dylib
+PATHS 
+"${CLANG_LIB_DIR}/darwin/"
+  )
+  unset(CLANG_LIB_DIR)
+else()
+  find_library(
+COMPILER_ASAN_LIBRARY asan ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}
+  )
 endif()
+
 mark_as_advanced(COMPILER_ASAN_LIBRARY)
   endif()
 endif()
@@ -823,6 +850,9 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Release")
 if(MSVC)
   set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6")
 endif()
+if(APPLE)
+  set(COMPILER_ASAN_LINKER_FLAGS "-fno-omit-frame-pointer 
-fsanitize=address")
+endif(APPLE)
 if(COMPILER_ASAN_LIBRARY)
   set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}")
   set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} 
${COMPILER_ASAN_LINKER_FLAGS}")

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [de21ab418d6] master: Add a Self option to the Exact boolean modifier. Fixes T52425.

2020-09-07 Thread Howard Trickey
Commit: de21ab418d69ca82a07ec7c836b1deca09bbd57f
Author: Howard Trickey
Date:   Mon Sep 7 14:26:00 2020 -0400
Branches: master
https://developer.blender.org/rBde21ab418d69ca82a07ec7c836b1deca09bbd57f

Add a Self option to the Exact boolean modifier. Fixes T52425.

With this option, self-intersections in either or both operands
will be handled properly (if both sides are piecewise winding
number constant, and maybe some other cases too).
In the Boolean tool, this flag was there already but the code
forced a unary operation in that case; this commit corrects it
to make a binary operation. This flag makes the code slower, which
is why it is an option and not an always-on thing.

===

M   source/blender/blenloader/intern/versioning_290.c
M   source/blender/bmesh/tools/bmesh_boolean.cc
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/modifiers/intern/MOD_boolean.c

===

diff --git a/source/blender/blenloader/intern/versioning_290.c 
b/source/blender/blenloader/intern/versioning_290.c
index b970f18933f..7dc1aab833e 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -513,6 +513,7 @@ void blo_do_versions_290(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
   if (md->type == eModifierType_Boolean) {
 BooleanModifierData *bmd = (BooleanModifierData *)md;
 bmd->solver = eBooleanModifierSolver_Fast;
+bmd->flag = 0;
   }
 }
   }
diff --git a/source/blender/bmesh/tools/bmesh_boolean.cc 
b/source/blender/bmesh/tools/bmesh_boolean.cc
index 5d410d60496..d2f73dd63ec 100644
--- a/source/blender/bmesh/tools/bmesh_boolean.cc
+++ b/source/blender/bmesh/tools/bmesh_boolean.cc
@@ -340,8 +340,8 @@ static bool bmesh_boolean(BMesh *bm,
   IMesh m_in = mesh_from_bm(bm, looptris, looptris_tot, _triangulated, 
);
   std::function shape_fn;
   int nshapes;
-  if (use_self) {
-/* Unary boolean operation. Want every face where test_fn doesn't return 
-1. */
+  if (use_self && boolean_mode == BoolOpType::None) {
+/* Unary knife operation. Want every face where test_fn doesn't return -1. 
*/
 nshapes = 1;
 shape_fn = [bm, test_fn, user_data](int f) {
   BMFace *bmf = BM_face_at_index(bm, f);
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index 2839d826df9..a9f1d5bcfc4 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -863,7 +863,7 @@ typedef struct BooleanModifierData {
   struct Object *object;
   char operation;
   char solver;
-  char _pad[1];
+  char flag;
   char bm_flag;
   float double_threshold;
 } BooleanModifierData;
@@ -879,6 +879,10 @@ typedef enum {
   eBooleanModifierSolver_Exact = 1,
 } BooleanModifierSolver;
 
+enum {
+  eBooleanModifierFlag_Self = (1 << 0),
+};
+
 /* bm_flag only used when G_DEBUG. */
 enum {
   eBooleanModifierBMeshFlag_BMesh_Separate = (1 << 0),
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index d9e151e5f73..1bf14f86189 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2863,6 +2863,11 @@ static void rna_def_modifier_boolean(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Solver", "Method for calculating booleans");
   RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
+  prop = RNA_def_property(srna, "use_self", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flag", eBooleanModifierFlag_Self);
+  RNA_def_property_ui_text(prop, "Self", "Allow self-intersection in 
operands");
+  RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
   /* BMesh debugging options, only used when G_DEBUG is set */
 
   /* BMesh intersection options */
diff --git a/source/blender/modifiers/intern/MOD_boolean.c 
b/source/blender/modifiers/intern/MOD_boolean.c
index 87489c90de3..bef7d5d8e4f 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -77,6 +77,7 @@ static void initData(ModifierData *md)
   bmd->double_threshold = 1e-6f;
   bmd->operation = eBooleanModifierOp_Difference;
   bmd->solver = eBooleanModifierSolver_Exact;
+  bmd->flag = 0;
 }
 
 static bool isDisabled(const struct Scene *UNUSED(scene),
@@ -319,15 +320,18 @@ static Mesh *modifyMesh(ModifierData *md, const 
ModifierEvalContext *ctx, Mesh *
 
 #ifdef WITH_GMP
 const bool use_exact = bmd->solver == eBooleanModifierSolver_Exact;
+const bool use_self = (bmd->flag & eBooleanModifierFlag_Self) != 0;
 #else
 if (bmd->solver == eBooleanModifierSolver_Exact) {
   BKE_modifier_set_error(md, "Compiled without GMP, using fast 

[Bf-blender-cvs] [19f56cfe6c5] master: Cleanup: GLBackend: Move buf_free and tex_free to GLContext

2020-09-07 Thread Clément Foucault
Commit: 19f56cfe6c59e3a54aaf7499fd9072a8790171b7
Author: Clément Foucault
Date:   Mon Sep 7 20:08:25 2020 +0200
Branches: master
https://developer.blender.org/rB19f56cfe6c59e3a54aaf7499fd9072a8790171b7

Cleanup: GLBackend: Move buf_free and tex_free to GLContext

This makes it easier to follow.

Also removes the GL related functions inside gpu_context.cc.

===

M   source/blender/gpu/intern/gpu_context.cc
M   source/blender/gpu/intern/gpu_context_private.hh
M   source/blender/gpu/opengl/gl_backend.hh
M   source/blender/gpu/opengl/gl_context.cc
M   source/blender/gpu/opengl/gl_context.hh
M   source/blender/gpu/opengl/gl_drawlist.cc
M   source/blender/gpu/opengl/gl_index_buffer.cc
M   source/blender/gpu/opengl/gl_texture.cc
M   source/blender/gpu/opengl/gl_uniform_buffer.cc
M   source/blender/gpu/opengl/gl_vertex_buffer.cc

===

diff --git a/source/blender/gpu/intern/gpu_context.cc 
b/source/blender/gpu/intern/gpu_context.cc
index 85e7dffe3e7..8ebd49a658e 100644
--- a/source/blender/gpu/intern/gpu_context.cc
+++ b/source/blender/gpu/intern/gpu_context.cc
@@ -126,58 +126,6 @@ GPUContext *GPU_context_active_get(void)
   return active_ctx;
 }
 
-GLuint GPU_vao_alloc(void)
-{
-  GLuint new_vao_id = 0;
-  glGenVertexArrays(1, _vao_id);
-  return new_vao_id;
-}
-
-GLuint GPU_fbo_alloc(void)
-{
-  GLuint new_fbo_id = 0;
-  glGenFramebuffers(1, _fbo_id);
-  return new_fbo_id;
-}
-
-GLuint GPU_buf_alloc(void)
-{
-  GLuint new_buffer_id = 0;
-  glGenBuffers(1, _buffer_id);
-  return new_buffer_id;
-}
-
-GLuint GPU_tex_alloc(void)
-{
-  GLuint new_texture_id = 0;
-  glGenTextures(1, _texture_id);
-  return new_texture_id;
-}
-
-void GPU_vao_free(GLuint vao_id, GPUContext *ctx)
-{
-  static_cast(ctx)->vao_free(vao_id);
-}
-
-void GPU_fbo_free(GLuint fbo_id, GPUContext *ctx)
-{
-  static_cast(ctx)->fbo_free(fbo_id);
-}
-
-void GPU_buf_free(GLuint buf_id)
-{
-  /* TODO avoid using backend */
-  GPUBackend *backend = GPUBackend::get();
-  static_cast(backend)->buf_free(buf_id);
-}
-
-void GPU_tex_free(GLuint tex_id)
-{
-  /* TODO avoid using backend */
-  GPUBackend *backend = GPUBackend::get();
-  static_cast(backend)->tex_free(tex_id);
-}
-
 struct GPUMatrixState *gpu_context_active_matrix_state_get()
 {
   BLI_assert(active_ctx);
diff --git a/source/blender/gpu/intern/gpu_context_private.hh 
b/source/blender/gpu/intern/gpu_context_private.hh
index 5643eec1aa6..3d92b4eb587 100644
--- a/source/blender/gpu/intern/gpu_context_private.hh
+++ b/source/blender/gpu/intern/gpu_context_private.hh
@@ -83,19 +83,6 @@ struct GPUContext {
   MEM_CXX_CLASS_ALLOC_FUNCS("GPUContext")
 };
 
-/* These require a OpenGL ctx bound. */
-GLuint GPU_buf_alloc(void);
-GLuint GPU_tex_alloc(void);
-GLuint GPU_vao_alloc(void);
-GLuint GPU_fbo_alloc(void);
-
-/* These can be called any threads even without OpenGL ctx. */
-void GPU_buf_free(GLuint buf_id);
-void GPU_tex_free(GLuint tex_id);
-/* These two need the ctx the id was created with. */
-void GPU_vao_free(GLuint vao_id, GPUContext *ctx);
-void GPU_fbo_free(GLuint fbo_id, GPUContext *ctx);
-
 void gpu_context_active_framebuffer_set(GPUContext *ctx, struct GPUFrameBuffer 
*fb);
 struct GPUFrameBuffer *gpu_context_active_framebuffer_get(GPUContext *ctx);
 
diff --git a/source/blender/gpu/opengl/gl_backend.hh 
b/source/blender/gpu/opengl/gl_backend.hh
index 25f3ff38d8b..0c759d2cd62 100644
--- a/source/blender/gpu/opengl/gl_backend.hh
+++ b/source/blender/gpu/opengl/gl_backend.hh
@@ -115,15 +115,10 @@ class GLBackend : public GPUBackend {
 return new GLVertBuf();
   };
 
-  /* TODO remove */
-  void buf_free(GLuint buf_id);
-  void tex_free(GLuint tex_id);
-  void orphans_add(Vector _list, std::mutex _mutex, 
unsigned int id)
+  GLSharedOrphanLists _orphan_list_get(void)
   {
-list_mutex.lock();
-orphan_list.append(id);
-list_mutex.unlock();
-  }
+return shared_orphan_list_;
+  };
 
  private:
   static void platform_init(void);
diff --git a/source/blender/gpu/opengl/gl_context.cc 
b/source/blender/gpu/opengl/gl_context.cc
index ecf74a1993d..5633d28023a 100644
--- a/source/blender/gpu/opengl/gl_context.cc
+++ b/source/blender/gpu/opengl/gl_context.cc
@@ -230,25 +230,27 @@ void GLContext::fbo_free(GLuint fbo_id)
   }
 }
 
-void GLBackend::buf_free(GLuint buf_id)
+void GLContext::buf_free(GLuint buf_id)
 {
   /* Any context can free. */
   if (GPU_context_active_get()) {
 glDeleteBuffers(1, _id);
   }
   else {
-orphans_add(shared_orphan_list_.buffers, shared_orphan_list_.lists_mutex, 
buf_id);
+GLSharedOrphanLists _list = 
GLBackend::get()->shared_orphan_list_get();
+orphans_add(orphan_list.buffers, orphan_list.lists_mutex, buf_id);
   }
 }
 
-void GLBackend::tex_free(GLuint tex_id)
+void GLContext::tex_free(GLuint tex_id)
 {
   /* Any context can free. */
   if (GPU_context_active_get()) {
 

[Bf-blender-cvs] [58353834f44] master: GPUCapabilities: Isolate GL memory statistics

2020-09-07 Thread Clément Foucault
Commit: 58353834f441b8b4ca91dcd4ec94ac49bbbf5ab0
Author: Clément Foucault
Date:   Mon Sep 7 19:53:48 2020 +0200
Branches: master
https://developer.blender.org/rB58353834f441b8b4ca91dcd4ec94ac49bbbf5ab0

GPUCapabilities: Isolate GL memory statistics

This is part of the Vulkan task T68990

This is a simple cleanup.

===

M   source/blender/gpu/intern/gpu_capabilities.cc
M   source/blender/gpu/intern/gpu_capabilities_private.hh
M   source/blender/gpu/intern/gpu_context_private.hh
M   source/blender/gpu/opengl/gl_backend.cc
M   source/blender/gpu/opengl/gl_context.cc
M   source/blender/gpu/opengl/gl_context.hh

===

diff --git a/source/blender/gpu/intern/gpu_capabilities.cc 
b/source/blender/gpu/intern/gpu_capabilities.cc
index 71bf479b4a8..0ee25ea2569 100644
--- a/source/blender/gpu/intern/gpu_capabilities.cc
+++ b/source/blender/gpu/intern/gpu_capabilities.cc
@@ -28,9 +28,9 @@
 
 #include "GPU_capabilities.h"
 
-#include "gpu_capabilities_private.hh"
+#include "gpu_context_private.hh"
 
-#include "gl_backend.hh" /* TODO remove */
+#include "gpu_capabilities_private.hh"
 
 namespace blender::gpu {
 
@@ -110,34 +110,12 @@ bool GPU_crappy_amd_driver(void)
 
 bool GPU_mem_stats_supported(void)
 {
-#ifndef GPU_STANDALONE
-  return (GLEW_NVX_gpu_memory_info || GLEW_ATI_meminfo);
-#else
-  return false;
-#endif
+  return GCaps.mem_stats_support;
 }
 
 void GPU_mem_stats_get(int *totalmem, int *freemem)
 {
-  /* TODO(merwin): use Apple's platform API to get this info */
-
-  if (GLEW_NVX_gpu_memory_info) {
-/* returned value in Kb */
-glGetIntegerv(GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, totalmem);
-
-glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, freemem);
-  }
-  else if (GLEW_ATI_meminfo) {
-int stats[4];
-
-glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, stats);
-*freemem = stats[0];
-*totalmem = 0;
-  }
-  else {
-*totalmem = 0;
-*freemem = 0;
-  }
+  GPU_context_active_get()->memory_statistics_get(totalmem, freemem);
 }
 
 /* Return support for the active context + window. */
diff --git a/source/blender/gpu/intern/gpu_capabilities_private.hh 
b/source/blender/gpu/intern/gpu_capabilities_private.hh
index ec387555bfe..a51525fa932 100644
--- a/source/blender/gpu/intern/gpu_capabilities_private.hh
+++ b/source/blender/gpu/intern/gpu_capabilities_private.hh
@@ -41,12 +41,13 @@ struct GPUCapabilities {
   int max_textures_vert = 0;
   int max_textures_geom = 0;
   int max_textures_frag = 0;
-
+  bool mem_stats_support = false;
   /* OpenGL related workarounds. */
   bool mip_render_workaround = false;
   bool depth_blitting_workaround = false;
   bool use_main_context_workaround = false;
   bool broken_amd_driver = false;
+  /* Vulkan related workarounds. */
 };
 
 extern GPUCapabilities GCaps;
diff --git a/source/blender/gpu/intern/gpu_context_private.hh 
b/source/blender/gpu/intern/gpu_context_private.hh
index 20e57c405ba..5643eec1aa6 100644
--- a/source/blender/gpu/intern/gpu_context_private.hh
+++ b/source/blender/gpu/intern/gpu_context_private.hh
@@ -76,6 +76,7 @@ struct GPUContext {
 
   virtual void activate(void) = 0;
   virtual void deactivate(void) = 0;
+  virtual void memory_statistics_get(int *total_mem, int *free_mem) = 0;
 
   bool is_active_on_thread(void);
 
diff --git a/source/blender/gpu/opengl/gl_backend.cc 
b/source/blender/gpu/opengl/gl_backend.cc
index fedc03f5787..3dfe0e1e412 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -339,6 +339,7 @@ void GLBackend::capabilities_init(void)
   glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, _textures_vert);
   glGetIntegerv(GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, _textures_geom);
   glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, _textures);
+  GCaps.mem_stats_support = GLEW_NVX_gpu_memory_info || GLEW_ATI_meminfo;
   /* GL specific capabilities. */
   glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, ::max_texture_3d_size);
   glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, ::max_cubemap_size);
diff --git a/source/blender/gpu/opengl/gl_context.cc 
b/source/blender/gpu/opengl/gl_context.cc
index ec6cc9e6159..ecf74a1993d 100644
--- a/source/blender/gpu/opengl/gl_context.cc
+++ b/source/blender/gpu/opengl/gl_context.cc
@@ -277,3 +277,30 @@ void GLContext::vao_cache_unregister(GLVaoCache *cache)
 }
 
 /** \} */
+
+/*  */
+/** \name Memory statistics
+ * \{ */
+
+void GLContext::memory_statistics_get(int *r_total_mem, int *r_free_mem)
+{
+  /* TODO(merwin): use Apple's platform API to get this info. */
+  if (GLEW_NVX_gpu_memory_info) {
+/* Teturned value in Kb. */
+glGetIntegerv(GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, r_total_mem);
+glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, r_free_mem);
+  }
+  else if 

[Bf-blender-cvs] [c5c6b5ddb31] master: GPUCapabilities: Isolate GL_STEREO to GLContext

2020-09-07 Thread Clément Foucault
Commit: c5c6b5ddb31c8a79667d6dcd689808efd3dadd8a
Author: Clément Foucault
Date:   Mon Sep 7 19:52:22 2020 +0200
Branches: master
https://developer.blender.org/rBc5c6b5ddb31c8a79667d6dcd689808efd3dadd8a

GPUCapabilities: Isolate GL_STEREO to GLContext

This is part of the Vulkan task T68990

This is a simple cleanup.

===

M   source/blender/gpu/intern/gpu_capabilities.cc
M   source/blender/gpu/opengl/gl_context.cc

===

diff --git a/source/blender/gpu/intern/gpu_capabilities.cc 
b/source/blender/gpu/intern/gpu_capabilities.cc
index 83b9597abbb..71bf479b4a8 100644
--- a/source/blender/gpu/intern/gpu_capabilities.cc
+++ b/source/blender/gpu/intern/gpu_capabilities.cc
@@ -143,9 +143,7 @@ void GPU_mem_stats_get(int *totalmem, int *freemem)
 /* Return support for the active context + window. */
 bool GPU_stereo_quadbuffer_support(void)
 {
-  GLboolean stereo = GL_FALSE;
-  glGetBooleanv(GL_STEREO, );
-  return stereo == GL_TRUE;
+  return GPU_context_active_get()->front_right != nullptr;
 }
 
 /** \} */
diff --git a/source/blender/gpu/opengl/gl_context.cc 
b/source/blender/gpu/opengl/gl_context.cc
index 1495e665aa8..ec6cc9e6159 100644
--- a/source/blender/gpu/opengl/gl_context.cc
+++ b/source/blender/gpu/opengl/gl_context.cc
@@ -80,8 +80,8 @@ GLContext::GLContext(void *ghost_window, GLSharedOrphanLists 
_orphan_list
   front_left = new GLFrameBuffer("front_left", this, GL_FRONT_LEFT, 0, w, 
h);
   back_left = new GLFrameBuffer("back_left", this, GL_BACK_LEFT, 0, w, h);
 }
-/* TODO(fclem) enable is supported. */
-const bool supports_stereo_quad_buffer = false;
+GLboolean supports_stereo_quad_buffer = GL_FALSE;
+glGetBooleanv(GL_STEREO, _stereo_quad_buffer);
 if (supports_stereo_quad_buffer) {
   front_right = new GLFrameBuffer("front_right", this, GL_FRONT_RIGHT, 0, 
w, h);
   back_right = new GLFrameBuffer("back_right", this, GL_BACK_RIGHT, 0, w, 
h);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d2911124f42] master: BLI: improve exception safety of VectorSet

2020-09-07 Thread Jacques Lucke
Commit: d2911124f42fd58d42b1b734c852980d5dbde401
Author: Jacques Lucke
Date:   Mon Sep 7 19:36:24 2020 +0200
Branches: master
https://developer.blender.org/rBd2911124f42fd58d42b1b734c852980d5dbde401

BLI: improve exception safety of VectorSet

For more information see rB2aff45146f1464ba8899368ad004522cb6a1a98c.

===

M   source/blender/blenlib/BLI_array.hh
M   source/blender/blenlib/BLI_vector_set.hh
M   source/blender/blenlib/BLI_vector_set_slots.hh
M   source/blender/blenlib/tests/BLI_vector_set_test.cc

===

diff --git a/source/blender/blenlib/BLI_array.hh 
b/source/blender/blenlib/BLI_array.hh
index dddf4f64ff5..8a7dcb7ffaa 100644
--- a/source/blender/blenlib/BLI_array.hh
+++ b/source/blender/blenlib/BLI_array.hh
@@ -353,6 +353,10 @@ class Array {
   {
 return allocator_;
   }
+  const Allocator () const
+  {
+return allocator_;
+  }
 
   /**
* Get the value of the InlineBufferCapacity template argument. This is the 
number of elements
diff --git a/source/blender/blenlib/BLI_vector_set.hh 
b/source/blender/blenlib/BLI_vector_set.hh
index 9d7c61f9e3b..c9773dc599d 100644
--- a/source/blender/blenlib/BLI_vector_set.hh
+++ b/source/blender/blenlib/BLI_vector_set.hh
@@ -143,7 +143,7 @@ class VectorSet {
* no keys are removed. The first set->size() elements in this array are 
initialized. The
* capacity of the array is usable_slots_.
*/
-  Key *keys_;
+  Key *keys_ = nullptr;
 
   /** Iterate over a slot index sequence for a given hash. */
 #define VECTOR_SET_SLOT_PROBING_BEGIN(HASH, R_SLOT) \
@@ -157,22 +157,31 @@ class VectorSet {
* necessary to avoid a high cost when no elements are added at all. An 
optimized grow operation
* is performed on the first insertion.
*/
-  VectorSet()
+  VectorSet(Allocator allocator = {}) noexcept
   : removed_slots_(0),
 occupied_and_removed_slots_(0),
 usable_slots_(0),
 slot_mask_(0),
-slots_(1),
+slots_(1, allocator),
 keys_(nullptr)
   {
   }
 
+  VectorSet(NoExceptConstructor, Allocator allocator = {}) : 
VectorSet(allocator)
+  {
+  }
+
+  VectorSet(Span keys, Allocator allocator = {}) : 
VectorSet(NoExceptConstructor(), allocator)
+  {
+this->add_multiple(keys);
+  }
+
   /**
* Construct a vector set that contains the given keys. Duplicates will be 
removed automatically.
*/
-  VectorSet(const std::initializer_list ) : VectorSet()
+  VectorSet(const std::initializer_list , Allocator allocator = {})
+  : VectorSet(Span(keys), allocator)
   {
-this->add_multiple(keys);
   }
 
   ~VectorSet()
@@ -183,15 +192,23 @@ class VectorSet {
 }
   }
 
-  VectorSet(const VectorSet )
-  : removed_slots_(other.removed_slots_),
-occupied_and_removed_slots_(other.occupied_and_removed_slots_),
-usable_slots_(other.usable_slots_),
-slot_mask_(other.slot_mask_),
-slots_(other.slots_)
+  VectorSet(const VectorSet ) : slots_(other.slots_)
   {
-keys_ = this->allocate_keys_array(usable_slots_);
-uninitialized_copy_n(other.keys_, other.size(), keys_);
+keys_ = this->allocate_keys_array(other.usable_slots_);
+try {
+  uninitialized_copy_n(other.keys_, other.size(), keys_);
+}
+catch (...) {
+  this->deallocate_keys_array(keys_);
+  throw;
+}
+
+removed_slots_ = other.removed_slots_;
+occupied_and_removed_slots_ = other.occupied_and_removed_slots_;
+usable_slots_ = other.usable_slots_;
+slot_mask_ = other.slot_mask_;
+hash_ = other.hash_;
+is_equal_ = other.is_equal_;
   }
 
   VectorSet(VectorSet &) noexcept
@@ -212,26 +229,12 @@ class VectorSet {
 
   VectorSet =(const VectorSet )
   {
-if (this == ) {
-  return *this;
-}
-
-this->~VectorSet();
-new (this) VectorSet(other);
-
-return *this;
+return copy_assign_container(*this, other);
   }
 
   VectorSet =(VectorSet &)
   {
-if (this == ) {
-  return *this;
-}
-
-this->~VectorSet();
-new (this) VectorSet(std::move(other));
-
-return *this;
+return move_assign_container(*this, std::move(other));
   }
 
   /**
@@ -490,32 +493,48 @@ class VectorSet {
 
 /* Optimize the case when the set was empty beforehand. We can avoid some 
copies here. */
 if (this->size() == 0) {
-  slots_.~Array();
-  new (_) SlotArray(total_slots);
+  try {
+slots_.reinitialize(total_slots);
+keys_ = this->allocate_keys_array(usable_slots);
+  }
+  catch (...) {
+this->noexcept_reset();
+throw;
+  }
   removed_slots_ = 0;
   occupied_and_removed_slots_ = 0;
   usable_slots_ = usable_slots;
   slot_mask_ = new_slot_mask;
-  keys_ = this->allocate_keys_array(usable_slots);
   return;
 }
 
 SlotArray new_slots(total_slots);
 
-for (Slot  : slots_) {
-  if 

[Bf-blender-cvs] [6b436b80a45] master: GPU: Rename gpu_extensions to gpu_capabilities

2020-09-07 Thread Clément Foucault
Commit: 6b436b80a45c947d49ab5fbda515fb02877eefd4
Author: Clément Foucault
Date:   Mon Sep 7 19:35:56 2020 +0200
Branches: master
https://developer.blender.org/rB6b436b80a45c947d49ab5fbda515fb02877eefd4

GPU: Rename gpu_extensions to gpu_capabilities

This makes more sense as this module has more to it than just
GL extensions.

===

M   source/blender/blenfont/intern/blf_glyph.c
M   source/blender/blenkernel/intern/image_gpu.c
M   source/blender/draw/engines/eevee/eevee_effects.c
M   source/blender/draw/engines/eevee/eevee_lightcache.c
M   source/blender/draw/engines/eevee/eevee_lightprobes.c
M   source/blender/draw/engines/eevee/eevee_occlusion.c
M   source/blender/draw/engines/eevee/eevee_render.c
M   source/blender/draw/engines/eevee/eevee_shaders.c
M   source/blender/draw/engines/eevee/eevee_subsurface.c
M   source/blender/draw/engines/eevee/eevee_volumes.c
M   source/blender/draw/engines/workbench/workbench_opaque.c
M   source/blender/draw/engines/workbench/workbench_transparent.c
M   source/blender/draw/intern/draw_cache_extract_mesh.c
M   source/blender/draw/intern/draw_cache_impl_displist.c
M   source/blender/draw/intern/draw_manager.c
M   source/blender/draw/intern/draw_manager_exec.c
M   source/blender/draw/intern/draw_manager_shader.c
M   source/blender/editors/screen/screen_ops.c
M   source/blender/editors/sculpt_paint/paint_image_proj.c
M   source/blender/editors/space_info/info_stats.c
M   source/blender/gpu/CMakeLists.txt
R084source/blender/gpu/GPU_extensions.h 
source/blender/gpu/GPU_capabilities.h
M   source/blender/gpu/intern/gpu_batch.cc
R097source/blender/gpu/intern/gpu_extensions.cc 
source/blender/gpu/intern/gpu_capabilities.cc
R100source/blender/gpu/intern/gpu_extensions_private.hh 
source/blender/gpu/intern/gpu_capabilities_private.hh
M   source/blender/gpu/intern/gpu_codegen.c
M   source/blender/gpu/intern/gpu_framebuffer.cc
M   source/blender/gpu/intern/gpu_shader.cc
M   source/blender/gpu/intern/gpu_shader_builtin.c
M   source/blender/gpu/intern/gpu_state.cc
M   source/blender/gpu/intern/gpu_uniform_buffer.cc
M   source/blender/gpu/opengl/gl_backend.cc
M   source/blender/gpu/opengl/gl_batch.cc
M   source/blender/gpu/opengl/gl_drawlist.cc
M   source/blender/gpu/opengl/gl_framebuffer.cc
M   source/blender/gpu/opengl/gl_shader.cc
M   source/blender/gpu/opengl/gl_state.cc
M   source/blender/gpu/opengl/gl_texture.cc
M   source/blender/gpu/opengl/gl_uniform_buffer.cc
M   source/blender/imbuf/intern/util_gpu.c
M   source/blender/makesrna/intern/rna_render.c
M   source/blender/makesrna/intern/rna_userdef.c
M   source/blender/windowmanager/intern/wm_stereo.c

===

diff --git a/source/blender/blenfont/intern/blf_glyph.c 
b/source/blender/blenfont/intern/blf_glyph.c
index 773d3409905..8e74d5bba7c 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -46,7 +46,7 @@
 
 #include "BLF_api.h"
 
-#include "GPU_extensions.h"
+#include "GPU_capabilities.h"
 #include "GPU_immediate.h"
 
 #include "blf_internal.h"
diff --git a/source/blender/blenkernel/intern/image_gpu.c 
b/source/blender/blenkernel/intern/image_gpu.c
index 083d6c1d973..8b6bd47a0db 100644
--- a/source/blender/blenkernel/intern/image_gpu.c
+++ b/source/blender/blenkernel/intern/image_gpu.c
@@ -39,7 +39,7 @@
 #include "BKE_image.h"
 #include "BKE_main.h"
 
-#include "GPU_extensions.h"
+#include "GPU_capabilities.h"
 #include "GPU_state.h"
 #include "GPU_texture.h"
 
diff --git a/source/blender/draw/engines/eevee/eevee_effects.c 
b/source/blender/draw/engines/eevee/eevee_effects.c
index 2bd1a875371..3b2a3cc7c01 100644
--- a/source/blender/draw/engines/eevee/eevee_effects.c
+++ b/source/blender/draw/engines/eevee/eevee_effects.c
@@ -26,7 +26,7 @@
 
 #include "BKE_global.h" /* for G.debug_value */
 
-#include "GPU_extensions.h"
+#include "GPU_capabilities.h"
 #include "GPU_platform.h"
 #include "GPU_state.h"
 #include "GPU_texture.h"
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c 
b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 5de161a646b..5a676bf4004 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -41,8 +41,8 @@
 #include "eevee_lightcache.h"
 #include "eevee_private.h"
 
+#include "GPU_capabilities.h"
 #include "GPU_context.h"
-#include "GPU_extensions.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c 
b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 9f86958cef8..89e61ab939a 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ 

[Bf-blender-cvs] [171b36683a7] master: GPUExtensions: GL backend isolation

2020-09-07 Thread Clément Foucault
Commit: 171b36683a774d70a8f25529858b9c002a2a317e
Author: Clément Foucault
Date:   Mon Sep 7 18:52:30 2020 +0200
Branches: master
https://developer.blender.org/rB171b36683a774d70a8f25529858b9c002a2a317e

GPUExtensions: GL backend isolation

This is part of the Vulkan task T68990.

This commits changes a few things:
- Rename extensions to capabilities (but left the file name untouched).
- Cubemap mip render workaround detection is rewritten using gl
  commands to avoid using the GPU API before initialization.
- Put all the capabilities that are only relevant for the GL backend
  inside GLContext as static variables.
- Cleanup the names of the limit variables.
- Separate all GL related workaround search inside the GL module.

===

M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/intern/draw_manager.c
M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/GPU_extensions.h
M   source/blender/gpu/intern/gpu_extensions.cc
A   source/blender/gpu/intern/gpu_extensions_private.hh
M   source/blender/gpu/intern/gpu_init_exit.c
M   source/blender/gpu/intern/gpu_private.h
M   source/blender/gpu/intern/gpu_uniform_buffer.cc
M   source/blender/gpu/opengl/gl_backend.cc
M   source/blender/gpu/opengl/gl_backend.hh
M   source/blender/gpu/opengl/gl_batch.cc
M   source/blender/gpu/opengl/gl_context.hh
M   source/blender/gpu/opengl/gl_drawlist.cc
M   source/blender/gpu/opengl/gl_framebuffer.cc
M   source/blender/gpu/opengl/gl_shader.cc
M   source/blender/gpu/opengl/gl_texture.cc
M   source/blender/gpu/opengl/gl_uniform_buffer.cc

===

diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index 680636f9e87..e154a52b32f 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -721,7 +721,6 @@ void DRW_state_lock(DRWState state);
 void DRW_select_load_id(uint id);
 
 /* Draw State */
-void DRW_state_dfdy_factors_get(float dfdyfac[2]);
 bool DRW_state_is_fbo(void);
 bool DRW_state_is_select(void);
 bool DRW_state_is_depth(void);
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 09ce16efcc2..49780f59db3 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2496,11 +2496,6 @@ void DRW_draw_depth_object(
 /** \name Draw Manager State (DRW_state)
  * \{ */
 
-void DRW_state_dfdy_factors_get(float dfdyfac[2])
-{
-  GPU_get_dfdy_factors(dfdyfac);
-}
-
 /**
  * When false, drawing doesn't output to a pixel buffer
  * eg: Occlusion queries, or when we have setup a context to draw in already.
diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 47ce113230b..358bd045c2f 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -137,6 +137,7 @@ set(SRC
   intern/gpu_codegen.h
   intern/gpu_context_private.hh
   intern/gpu_drawlist_private.hh
+  intern/gpu_extensions_private.hh
   intern/gpu_framebuffer_private.hh
   intern/gpu_immediate_private.hh
   intern/gpu_index_buffer_private.hh
diff --git a/source/blender/gpu/GPU_extensions.h 
b/source/blender/gpu/GPU_extensions.h
index 35967ac304f..dd0a2ec9f39 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -41,14 +41,10 @@ int GPU_max_color_texture_samples(void);
 int GPU_max_cube_map_size(void);
 int GPU_max_ubo_binds(void);
 int GPU_max_ubo_size(void);
-void GPU_get_dfdy_factors(float fac[2]);
-bool GPU_arb_base_instance_is_supported(void);
 bool GPU_arb_texture_cube_map_array_is_supported(void);
 bool GPU_mip_render_workaround(void);
 bool GPU_depth_blitting_workaround(void);
-bool GPU_unused_fb_slot_workaround(void);
 bool GPU_use_main_context_workaround(void);
-bool GPU_texture_copy_workaround(void);
 bool GPU_crappy_amd_driver(void);
 
 int GPU_texture_size_with_limit(int res);
diff --git a/source/blender/gpu/intern/gpu_extensions.cc 
b/source/blender/gpu/intern/gpu_extensions.cc
index ac7748e6430..168d2fb3fbb 100644
--- a/source/blender/gpu/intern/gpu_extensions.cc
+++ b/source/blender/gpu/intern/gpu_extensions.cc
@@ -24,381 +24,95 @@
  * with checks for drivers and GPU support.
  */
 
-#include "BLI_math_base.h"
-#include "BLI_math_vector.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_global.h"
-#include "MEM_guardedalloc.h"
-
 #include "DNA_userdef_types.h"
 
 #include "GPU_extensions.h"
-#include "GPU_framebuffer.h"
-#include "GPU_glew.h"
-#include "GPU_platform.h"
-#include "GPU_texture.h"
-
-#include "intern/gpu_private.h"
-
-#include 
-#include 
-#include 
-
-#ifdef WIN32
-#  include "BLI_winstuff.h"
-#endif
-
-/* Extensions support */
-
-/* -- extension: version of GL that absorbs it
- * EXT_gpu_shader4: 3.0
- * ARB_framebuffer object: 3.0
- * 

[Bf-blender-cvs] [360489c7516] master: GPUPlatform: GL backend isolation

2020-09-07 Thread Clément Foucault
Commit: 360489c75167d47653bc34ad9ba9a65076bf384c
Author: Clément Foucault
Date:   Mon Sep 7 15:39:47 2020 +0200
Branches: master
https://developer.blender.org/rB360489c75167d47653bc34ad9ba9a65076bf384c

GPUPlatform: GL backend isolation

Part of the vulkan implementation T68990.

Pretty straight forward. Just move the GL code inside the GLBackend and
make the GPUPlatformGlobal a class object.

===

M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/intern/gpu_init_exit.c
M   source/blender/gpu/intern/gpu_platform.cc
A   source/blender/gpu/intern/gpu_platform_private.hh
M   source/blender/gpu/intern/gpu_private.h
A   source/blender/gpu/opengl/gl_backend.cc
M   source/blender/gpu/opengl/gl_backend.hh

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 5cce4f84aea..47ce113230b 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -87,6 +87,7 @@ set(SRC
   intern/gpu_vertex_format.cc
   intern/gpu_viewport.c
 
+  opengl/gl_backend.cc
   opengl/gl_batch.cc
   opengl/gl_context.cc
   opengl/gl_drawlist.cc
@@ -143,6 +144,7 @@ set(SRC
   intern/gpu_matrix_private.h
   intern/gpu_node_graph.h
   intern/gpu_private.h
+  intern/gpu_platform_private.hh
   intern/gpu_select_private.h
   intern/gpu_shader_private.hh
   intern/gpu_shader_interface.hh
diff --git a/source/blender/gpu/intern/gpu_init_exit.c 
b/source/blender/gpu/intern/gpu_init_exit.c
index 4cb43db9bce..f265d841922 100644
--- a/source/blender/gpu/intern/gpu_init_exit.c
+++ b/source/blender/gpu/intern/gpu_init_exit.c
@@ -48,7 +48,6 @@ void GPU_init(void)
   }
 
   initialized = true;
-  gpu_platform_init();
   gpu_extensions_init(); /* must come first */
 
   gpu_codegen_init();
@@ -81,7 +80,6 @@ void GPU_exit(void)
   gpu_codegen_exit();
 
   gpu_extensions_exit();
-  gpu_platform_exit(); /* must come last */
 
   initialized = false;
 }
diff --git a/source/blender/gpu/intern/gpu_platform.cc 
b/source/blender/gpu/intern/gpu_platform.cc
index 5cabde61bc3..e4db8c93f1d 100644
--- a/source/blender/gpu/intern/gpu_platform.cc
+++ b/source/blender/gpu/intern/gpu_platform.cc
@@ -23,75 +23,31 @@
  * Wrap OpenGL features such as textures, shaders and GLSL
  * with checks for drivers and GPU support.
  */
-#include "GPU_platform.h"
-#include "GPU_glew.h"
-#include "gpu_private.h"
 
-#include 
+#include "MEM_guardedalloc.h"
 
 #include "BLI_dynstr.h"
 #include "BLI_string.h"
 
-#include "MEM_guardedalloc.h"
+#include "GPU_platform.h"
 
-static struct GPUPlatformGlobal {
-  bool initialized;
-  eGPUDeviceType device;
-  eGPUOSType os;
-  eGPUDriverType driver;
-  eGPUSupportLevel support_level;
-  char *support_key;
-  char *gpu_name;
-} GPG = {false};
-
-/* Remove this? */
-#if 0
-typedef struct GPUPlatformSupportTest {
-  eGPUSupportLevel support_level;
-  eGPUDeviceType device;
-  eGPUOSType os;
-  eGPUDriverType driver;
-  const char *vendor;
-  const char *renderer;
-  const char *version;
-} GPUPlatformSupportTest;
-#endif
+#include "gpu_platform_private.hh"
 
-eGPUSupportLevel GPU_platform_support_level(void)
-{
-  return GPG.support_level;
-}
+/*  */
+/** \name GPUPlatformGlobal
+ * \{ */
 
-const char *GPU_platform_support_level_key(void)
-{
-  return GPG.support_key;
-}
+namespace blender::gpu {
 
-const char *GPU_platform_gpu_name(void)
-{
-  return GPG.gpu_name;
-}
+GPUPlatformGlobal GPG;
 
-/* GPU Types */
-bool GPU_type_matches(eGPUDeviceType device, eGPUOSType os, eGPUDriverType 
driver)
-{
-  return (GPG.device & device) && (GPG.os & os) && (GPG.driver & driver);
-}
-
-static char *gpu_platform_create_key(eGPUSupportLevel support_level,
- const char *vendor,
- const char *renderer,
- const char *version)
+void GPUPlatformGlobal::create_key(eGPUSupportLevel support_level,
+   const char *vendor,
+   const char *renderer,
+   const char *version)
 {
   DynStr *ds = BLI_dynstr_new();
-  BLI_dynstr_append(ds, "{");
-  BLI_dynstr_append(ds, vendor);
-  BLI_dynstr_append(ds, "/");
-  BLI_dynstr_append(ds, renderer);
-  BLI_dynstr_append(ds, "/");
-  BLI_dynstr_append(ds, version);
-  BLI_dynstr_append(ds, "}");
-  BLI_dynstr_append(ds, "=");
+  BLI_dynstr_appendf(ds, "{%s/%s/%s}=", vendor, renderer, version);
   if (support_level == GPU_SUPPORT_LEVEL_SUPPORTED) {
 BLI_dynstr_append(ds, "SUPPORTED");
   }
@@ -102,132 +58,61 @@ static char *gpu_platform_create_key(eGPUSupportLevel 
support_level,
 BLI_dynstr_append(ds, "UNSUPPORTED");
   }
 
-  char *support_key = BLI_dynstr_get_cstring(ds);
+  support_key = BLI_dynstr_get_cstring(ds);
   

[Bf-blender-cvs] [a784e90be02] master: EEVEE: Try to allocate the lightcache and use fallback if failure

2020-09-07 Thread Clément Foucault
Commit: a784e90be02548aa38ba7c6d48087a819ea8693d
Author: Clément Foucault
Date:   Mon Sep 7 19:17:04 2020 +0200
Branches: master
https://developer.blender.org/rBa784e90be02548aa38ba7c6d48087a819ea8693d

EEVEE: Try to allocate the lightcache and use fallback if failure

This is to remove an explicit opengl dependence to GPU_extension.

===

M   source/blender/draw/engines/eevee/eevee_lightcache.c
M   source/blender/gpu/GPU_extensions.h
M   source/blender/gpu/intern/gpu_extensions.cc
M   source/blender/gpu/opengl/gl_shader.cc
M   source/blender/gpu/opengl/gl_texture.cc

===

diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c 
b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 49d68481045..5de161a646b 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -348,17 +348,14 @@ LightCache *EEVEE_lightcache_create(const int grid_len,
 
   int mips_len = log2_floor_u(cube_size) - MIN_CUBE_LOD_LEVEL;
 
-  if (GPU_arb_texture_cube_map_array_is_supported()) {
-light_cache->cube_tx.tex = DRW_texture_create_cube_array(
-cube_size, cube_len, GPU_R11F_G11F_B10F, DRW_TEX_FILTER | 
DRW_TEX_MIPMAP, NULL);
-  }
-  else {
-light_cache->cube_tx.tex = DRW_texture_create_2d_array(cube_size,
-   cube_size,
-   cube_len * 6,
-   GPU_R11F_G11F_B10F,
-   DRW_TEX_FILTER | 
DRW_TEX_MIPMAP,
-   NULL);
+  /* Try to create a cubemap array. */
+  DRWTextureFlag cube_texflag = DRW_TEX_FILTER | DRW_TEX_MIPMAP;
+  light_cache->cube_tx.tex = DRW_texture_create_cube_array(
+  cube_size, cube_len, GPU_R11F_G11F_B10F, cube_texflag, NULL);
+  if (light_cache->cube_tx.tex == NULL) {
+/* Try fallback to 2D array. */
+light_cache->cube_tx.tex = DRW_texture_create_2d_array(
+cube_size, cube_size, cube_len * 6, GPU_R11F_G11F_B10F, cube_texflag, 
NULL);
   }
 
   light_cache->cube_tx.tex_size[0] = cube_size;
@@ -414,15 +411,16 @@ static bool eevee_lightcache_static_load(LightCache 
*lcache)
   }
 
   if (lcache->cube_tx.tex == NULL) {
-if (GPU_arb_texture_cube_map_array_is_supported()) {
-  lcache->cube_tx.tex = 
GPU_texture_create_cube_array("lightcache_cubemaps",
-  
lcache->cube_tx.tex_size[0],
-  
lcache->cube_tx.tex_size[2] / 6,
-  lcache->mips_len + 1,
-  GPU_R11F_G11F_B10F,
-  NULL);
-}
-else {
+/* Try to create a cubemap array. */
+lcache->cube_tx.tex = GPU_texture_create_cube_array("lightcache_cubemaps",
+
lcache->cube_tx.tex_size[0],
+
lcache->cube_tx.tex_size[2] / 6,
+lcache->mips_len + 1,
+GPU_R11F_G11F_B10F,
+NULL);
+
+if (lcache->cube_tx.tex == NULL) {
+  /* Try fallback to 2D array. */
   lcache->cube_tx.tex = 
GPU_texture_create_2d_array("lightcache_cubemaps_fallback",
 
UNPACK3(lcache->cube_tx.tex_size),
 lcache->mips_len + 1,
diff --git a/source/blender/gpu/GPU_extensions.h 
b/source/blender/gpu/GPU_extensions.h
index dd0a2ec9f39..357e867775a 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -41,7 +41,6 @@ int GPU_max_color_texture_samples(void);
 int GPU_max_cube_map_size(void);
 int GPU_max_ubo_binds(void);
 int GPU_max_ubo_size(void);
-bool GPU_arb_texture_cube_map_array_is_supported(void);
 bool GPU_mip_render_workaround(void);
 bool GPU_depth_blitting_workaround(void);
 bool GPU_use_main_context_workaround(void);
diff --git a/source/blender/gpu/intern/gpu_extensions.cc 
b/source/blender/gpu/intern/gpu_extensions.cc
index 168d2fb3fbb..e06828bf994 100644
--- a/source/blender/gpu/intern/gpu_extensions.cc
+++ b/source/blender/gpu/intern/gpu_extensions.cc
@@ -81,12 +81,6 @@ int GPU_max_textures(void)
   return GCaps.max_textures;
 }
 
-bool GPU_arb_texture_cube_map_array_is_supported(void)
-{
-  /* FIXME bad level call. */
-  return GLContext::texture_cube_map_array_support;
-}
-
 bool GPU_mip_render_workaround(void)
 {
   return 

[Bf-blender-cvs] [5de4525e393] master: GPUTexture: Bump GPU_TEX_MAX_FBO_ATTACHED

2020-09-07 Thread Clément Foucault
Commit: 5de4525e3939514b339c9775541ff7d1bc8af908
Author: Clément Foucault
Date:   Mon Sep 7 19:19:06 2020 +0200
Branches: master
https://developer.blender.org/rB5de4525e3939514b339c9775541ff7d1bc8af908

GPUTexture: Bump GPU_TEX_MAX_FBO_ATTACHED

This was causing an assert when using `--debug-gpu-force-workarounds`

===

M   source/blender/gpu/intern/gpu_texture_private.hh

===

diff --git a/source/blender/gpu/intern/gpu_texture_private.hh 
b/source/blender/gpu/intern/gpu_texture_private.hh
index 8f01d28e65e..d237540f654 100644
--- a/source/blender/gpu/intern/gpu_texture_private.hh
+++ b/source/blender/gpu/intern/gpu_texture_private.hh
@@ -66,7 +66,7 @@ ENUM_OPERATORS(eGPUTextureType)
 #endif
 
 /* Maximum number of FBOs a texture can be attached to. */
-#define GPU_TEX_MAX_FBO_ATTACHED 13
+#define GPU_TEX_MAX_FBO_ATTACHED 14
 
 class Texture {
  public:

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9cac181fbea] master: Audaspace: port changes from upstream.

2020-09-07 Thread Joerg Mueller
Commit: 9cac181fbead28c0bf963bf2b9f82fddf3c2b7df
Author: Joerg Mueller
Date:   Mon Sep 7 18:11:56 2020 +0200
Branches: master
https://developer.blender.org/rB9cac181fbead28c0bf963bf2b9f82fddf3c2b7df

Audaspace: port changes from upstream.

Adds possibility to report progress during audio mixdown.

===

M   extern/audaspace/bindings/C/AUD_Special.cpp
M   extern/audaspace/bindings/C/AUD_Special.h
M   extern/audaspace/include/file/FileWriter.h
M   extern/audaspace/src/file/FileWriter.cpp
M   source/blender/editors/sound/sound_ops.c

===

diff --git a/extern/audaspace/bindings/C/AUD_Special.cpp 
b/extern/audaspace/bindings/C/AUD_Special.cpp
index c7155276a30..a83465620ab 100644
--- a/extern/audaspace/bindings/C/AUD_Special.cpp
+++ b/extern/audaspace/bindings/C/AUD_Special.cpp
@@ -270,7 +270,7 @@ AUD_API int AUD_readSound(AUD_Sound* sound, float* buffer, 
int length, int sampl
return length;
 }
 
-AUD_API const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned 
int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs 
specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate)
+AUD_API const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned 
int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs 
specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate, 
void(*callback)(float, void*), void* data)
 {
try
{
@@ -280,7 +280,7 @@ AUD_API const char* AUD_mixdown(AUD_Sound* sound, unsigned 
int start, unsigned i
std::shared_ptr reader = f->createQualityReader();
reader->seek(start);
std::shared_ptr writer = 
FileWriter::createWriter(filename, convCToDSpec(specs), 
static_cast(format), static_cast(codec), bitrate);
-   FileWriter::writeReader(reader, writer, length, buffersize);
+   FileWriter::writeReader(reader, writer, length, buffersize, 
callback, data);
 
return nullptr;
}
@@ -290,7 +290,7 @@ AUD_API const char* AUD_mixdown(AUD_Sound* sound, unsigned 
int start, unsigned i
}
 }
 
-AUD_API const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int 
start, unsigned int length, unsigned int buffersize, const char* filename, 
AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int 
bitrate)
+AUD_API const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int 
start, unsigned int length, unsigned int buffersize, const char* filename, 
AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int 
bitrate, void(*callback)(float, void*), void* data)
 {
try
{
@@ -326,7 +326,7 @@ AUD_API const char* AUD_mixdown_per_channel(AUD_Sound* 
sound, unsigned int start
 
std::shared_ptr reader = f->createQualityReader();
reader->seek(start);
-   FileWriter::writeReader(reader, writers, length, buffersize);
+   FileWriter::writeReader(reader, writers, length, buffersize, 
callback, data);
 
return nullptr;
}
diff --git a/extern/audaspace/bindings/C/AUD_Special.h 
b/extern/audaspace/bindings/C/AUD_Special.h
index 9faf9e4ee74..ce51fa2e04e 100644
--- a/extern/audaspace/bindings/C/AUD_Special.h
+++ b/extern/audaspace/bindings/C/AUD_Special.h
@@ -68,12 +68,15 @@ extern AUD_API int AUD_readSound(AUD_Sound* sound, float* 
buffer, int length, in
  * \param format The file's container format.
  * \param codec The codec used for encoding the audio data.
  * \param bitrate The bitrate for encoding.
+ * \param callback A callback function that is called periodically during 
mixdown, reporting progress if length > 0. Can be NULL.
+ * \param data Pass through parameter that is passed to the callback.
  * \return An error message or NULL in case of success.
  */
 extern AUD_API const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, 
unsigned int length,
   unsigned int 
buffersize, const char* filename,
   AUD_DeviceSpecs 
specs, AUD_Container format,
-  AUD_Codec codec, 
unsigned int bitrate);
+  AUD_Codec codec, 
unsigned int bitrate,
+  
void(*callback)(float, void*), void* data);
 
 /**
  * Mixes a sound down into multiple files.
@@ -86,12 +89,15 @@ extern AUD_API const char* AUD_mixdown(AUD_Sound* sound, 
unsigned int start, uns
  * \param format The file's container format.
  * \param codec The codec used for encoding the audio data.
  * \param bitrate The bitrate for encoding.
+ * \param callback A callback function that is called periodically during 
mixdown, 

[Bf-blender-cvs] [1291c7add61] master: Cleanup: Refactor object.parent_set operator

2020-09-07 Thread Sybren A. Stüvel
Commit: 1291c7add619d5e5f3cf4a6ad2c14827ce74afb6
Author: Sybren A. Stüvel
Date:   Mon Sep 7 16:30:34 2020 +0200
Branches: master
https://developer.blender.org/rB1291c7add619d5e5f3cf4a6ad2c14827ce74afb6

Cleanup: Refactor object.parent_set operator

Refactor the operator exec function into a few smaller functions. The exec
function was mixing up vertex-parent and non-vertex-parent code, including
incorrect comments.

No functional changes.

===

M   source/blender/editors/object/object_relations.c

===

diff --git a/source/blender/editors/object/object_relations.c 
b/source/blender/editors/object/object_relations.c
index d9196425098..fd4a7ae1d4a 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -954,58 +954,104 @@ static void parent_set_vert_find(KDTree_3d *tree, Object 
*child, int vert_par[3]
   }
 }
 
-static int parent_set_exec(bContext *C, wmOperator *op)
-{
-  Main *bmain = CTX_data_main(C);
-  Scene *scene = CTX_data_scene(C);
-  Object *par = ED_object_active_context(C);
-  int partype = RNA_enum_get(op->ptr, "type");
-  const bool xmirror = RNA_boolean_get(op->ptr, "xmirror");
-  const bool keep_transform = RNA_boolean_get(op->ptr, "keep_transform");
-  bool ok = true;
-
-  /* vertex parent (kdtree) */
-  const bool is_vert_par = ELEM(partype, PAR_VERTEX, PAR_VERTEX_TRI);
-  const bool is_tri = partype == PAR_VERTEX_TRI;
-  int tree_tot;
-  struct KDTree_3d *tree = NULL;
-  int vert_par[3] = {0, 0, 0};
-  const int *vert_par_p = is_vert_par ? vert_par : NULL;
-
-  if (is_vert_par) {
-tree = BKE_object_as_kdtree(par, _tot);
-BLI_assert(tree != NULL);
+struct ParentingContext {
+  ReportList *reports;
+  Scene *scene;
+  Object *par;
+  int partype;
+  bool is_vertex_tri;
+  bool xmirror;
+  bool keep_transform;
+};
 
-if (tree_tot < (is_tri ? 3 : 1)) {
-  BKE_report(op->reports, RPT_ERROR, "Not enough vertices for 
vertex-parent");
-  ok = false;
+static bool parent_set_nonvertex_parent(bContext *C, struct ParentingContext 
*parenting_context)
+{
+  CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
+if (!ED_object_parent_set(parenting_context->reports,
+  C,
+  parenting_context->scene,
+  ob,
+  parenting_context->par,
+  parenting_context->partype,
+  parenting_context->xmirror,
+  parenting_context->keep_transform,
+  NULL)) {
+  return false;
 }
   }
+  CTX_DATA_END;
 
-  if (ok) {
-/* Non vertex-parent */
-CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
-  if (is_vert_par) {
-parent_set_vert_find(tree, ob, vert_par, is_tri);
-  }
+  return true;
+}
 
-  if (!ED_object_parent_set(
-  op->reports, C, scene, ob, par, partype, xmirror, 
keep_transform, vert_par_p)) {
-ok = false;
-break;
-  }
+static bool parent_set_vertex_parent_with_kdtree(bContext *C,
+ struct ParentingContext 
*parenting_context,
+ struct KDTree_3d *tree)
+{
+  int vert_par[3] = {0, 0, 0};
+
+  CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
+parent_set_vert_find(tree, ob, vert_par, parenting_context->is_vertex_tri);
+if (!ED_object_parent_set(parenting_context->reports,
+  C,
+  parenting_context->scene,
+  ob,
+  parenting_context->par,
+  parenting_context->partype,
+  parenting_context->xmirror,
+  parenting_context->keep_transform,
+  vert_par)) {
+  return false;
 }
-CTX_DATA_END;
   }
+  CTX_DATA_END;
+  return true;
+}
+
+static bool parent_set_vertex_parent(bContext *C, struct ParentingContext 
*parenting_context)
+{
+  struct KDTree_3d *tree = NULL;
+  int tree_tot;
+
+  tree = BKE_object_as_kdtree(parenting_context->par, _tot);
+  BLI_assert(tree != NULL);
 
-  if (is_vert_par) {
+  if (tree_tot < (parenting_context->is_vertex_tri ? 3 : 1)) {
+BKE_report(parenting_context->reports, RPT_ERROR, "Not enough vertices for 
vertex-parent");
 BLI_kdtree_3d_free(tree);
+return false;
   }
 
+  const bool ok = parent_set_vertex_parent_with_kdtree(C, parenting_context, 
tree);
+  BLI_kdtree_3d_free(tree);
+  return ok;
+}
+
+static int parent_set_exec(bContext *C, wmOperator *op)
+{
+  const int partype = RNA_enum_get(op->ptr, "type");
+  struct ParentingContext parenting_context = {
+  .reports = op->reports,
+  .scene = 

[Bf-blender-cvs] [53ca638f2b7] master: Cleanup: Clang Tidy, readability-inconsistent-declaration-parameter-name

2020-09-07 Thread Sybren A. Stüvel
Commit: 53ca638f2b738af644661bd4fabcf7e3fdf6e73b
Author: Sybren A. Stüvel
Date:   Mon Sep 7 18:09:09 2020 +0200
Branches: master
https://developer.blender.org/rB53ca638f2b738af644661bd4fabcf7e3fdf6e73b

Cleanup: Clang Tidy, readability-inconsistent-declaration-parameter-name

No functional changes.

===

M   source/blender/python/intern/bpy_rna.c

===

diff --git a/source/blender/python/intern/bpy_rna.c 
b/source/blender/python/intern/bpy_rna.c
index cc981c7c2e1..0980d9df762 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -219,10 +219,10 @@ static void value_id_set(void *id)
 }
 
 static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash);
-static PyObject *id_free_weakref_cb(PyObject *weakinfo_capsule, PyObject 
*weakref)
+static PyObject *id_free_weakref_cb(PyObject *weakinfo_pair, PyObject *weakref)
 {
   /* Important to search backwards. */
-  GHash *weakinfo_hash = PyCapsule_GetPointer(weakinfo_capsule, NULL);
+  GHash *weakinfo_hash = PyCapsule_GetPointer(weakinfo_pair, NULL);
 
   if (BLI_ghash_len(weakinfo_hash) > 1) {
 BLI_ghash_remove(weakinfo_hash, weakref, NULL, NULL);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [66a8a2584f2] soc-2020-fluid-tools: Replaced `coba_*` with `color_ramp_*` in the Python API for fluid.

2020-09-07 Thread Sriharsha Kotcharlakot
Commit: 66a8a2584f28f73a045d5bc8db0c68ff1e2f3dbd
Author: Sriharsha Kotcharlakot
Date:   Mon Sep 7 20:59:31 2020 +0530
Branches: soc-2020-fluid-tools
https://developer.blender.org/rB66a8a2584f28f73a045d5bc8db0c68ff1e2f3dbd

Replaced `coba_*` with `color_ramp_*` in the Python API for fluid.

===

M   release/scripts/startup/bl_ui/properties_physics_fluid.py
M   source/blender/makesrna/intern/rna_fluid.c

===

diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py 
b/release/scripts/startup/bl_ui/properties_physics_fluid.py
index df50311c8e2..95a3d509f23 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fluid.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py
@@ -1268,7 +1268,7 @@ class PHYSICS_PT_viewport_display(PhysicButtonsPanel, 
Panel):
 sub = col.column()
 sub.prop(domain, "display_interpolation")
 
-if domain.use_color_ramp and domain.coba_field == 'FLAGS':
+if domain.use_color_ramp and domain.color_ramp_field == 'FLAGS':
 sub.enabled = False
 
 col.prop(domain, "axis_slice_method")
@@ -1276,7 +1276,7 @@ class PHYSICS_PT_viewport_display(PhysicButtonsPanel, 
Panel):
 if not do_full_slicing:
 col.prop(domain, "slice_axis")
 col.prop(domain, "slice_depth")
-if domain.display_interpolation == 'CLOSEST' or domain.coba_field 
== 'FLAGS':
+if domain.display_interpolation == 'CLOSEST' or 
domain.color_ramp_field == 'FLAGS':
 col.prop(domain, "show_gridlines")
 
 col = col.column()
@@ -1305,14 +1305,14 @@ class 
PHYSICS_PT_viewport_display_color(PhysicButtonsPanel, Panel):
 domain = context.fluid.domain_settings
 col = layout.column()
 col.active = domain.use_color_ramp
-col.prop(domain, "coba_field")
+col.prop(domain, "color_ramp_field")
 
-if not domain.coba_field == 'FLAGS':
-col.prop(domain, "coba_field_scale")
+if not domain.color_ramp_field == 'FLAGS':
+col.prop(domain, "color_ramp_field_scale")
 
 col.use_property_split = False
 
-if domain.coba_field[:3] != 'PHI' and domain.coba_field not in 
{'FLAGS', 'PRESSURE'}:
+if domain.color_ramp_field[:3] != 'PHI' and domain.color_ramp_field 
not in {'FLAGS', 'PRESSURE'}:
 col = col.column()
 col.template_color_ramp(domain, "color_ramp", expand=True)
 
@@ -1376,7 +1376,7 @@ class 
PHYSICS_PT_viewport_display_advanced(PhysicButtonsPanel, Panel):
 col.prop(domain, "gridlines_color_field", text="Color Gridlines")
 
 if domain.gridlines_color_field == 'RANGE':
-if domain.use_color_ramp and domain.coba_field != 'FLAGS':
+if domain.use_color_ramp and domain.color_ramp_field != 'FLAGS':
 col.prop(domain, "gridlines_lower_bound")
 col.prop(domain, "gridlines_upper_bound")
 col.prop(domain, "gridlines_range_color")
diff --git a/source/blender/makesrna/intern/rna_fluid.c 
b/source/blender/makesrna/intern/rna_fluid.c
index f468ee815a1..dc15652c753 100644
--- a/source/blender/makesrna/intern/rna_fluid.c
+++ b/source/blender/makesrna/intern/rna_fluid.c
@@ -2555,14 +2555,14 @@ static void rna_def_fluid_domain_settings(BlenderRNA 
*brna)
   {0, NULL, 0, NULL, NULL},
   };
 
-  prop = RNA_def_property(srna, "coba_field", PROP_ENUM, PROP_NONE);
+  prop = RNA_def_property(srna, "color_ramp_field", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_sdna(prop, NULL, "coba_field");
   RNA_def_property_enum_items(prop, coba_field_items);
   RNA_def_property_enum_funcs(prop, NULL, "rna_Fluid_cobafield_set", 
"rna_Fluid_cobafield_itemf");
   RNA_def_property_ui_text(prop, "Field", "Simulation field to color map");
   RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
 
-  prop = RNA_def_property(srna, "coba_field_scale", PROP_FLOAT, PROP_NONE);
+  prop = RNA_def_property(srna, "color_ramp_field_scale", PROP_FLOAT, 
PROP_NONE);
   RNA_def_property_float_sdna(prop, NULL, "grid_scale");
   RNA_def_property_range(prop, 0.001, 10.0);
   RNA_def_property_ui_range(prop, 0.001, 1000.0, 0.1, 3);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [675c9644420] master: Sculpt: Sculpt Trimming gestures tools

2020-09-07 Thread Pablo Dobarro
Commit: 675c9644420eba96751e1cadedd2656a8bc39191
Author: Pablo Dobarro
Date:   Sat Sep 5 20:06:27 2020 +0200
Branches: master
https://developer.blender.org/rB675c9644420eba96751e1cadedd2656a8bc39191

Sculpt: Sculpt Trimming gestures tools

This implements Box Trim as a boolean based trimming too gesture in sculpt
mode. This is the intended way to remove parts of the sculpt instead of
using box mask and mask slice. It also creates new face sets for the new
faces created after the boolean operation.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8766

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M   source/blender/editors/sculpt_paint/paint_mask.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/windowmanager/intern/wm_operators.c

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index acb2e731e12..53b45ed6c90 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -6332,7 +6332,6 @@ def km_3d_view_tool_sculpt_box_face_set(params):
 ]},
 )
 
-
 def km_3d_view_tool_sculpt_lasso_face_set(params):
 return (
 "3D View Tool: Sculpt, Lasso Face Set",
@@ -6342,6 +6341,26 @@ def km_3d_view_tool_sculpt_lasso_face_set(params):
  None),
 ]},
 )
+
+def km_3d_view_tool_sculpt_box_trim(params):
+return (
+"3D View Tool: Sculpt, Box Trim",
+{"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
+{"items": [
+("sculpt.trim_box_gesture", {"type": params.tool_tweak, "value": 
'ANY'},
+ None),
+]},
+)
+
+def km_3d_view_tool_sculpt_lasso_trim(params):
+return (
+"3D View Tool: Sculpt, Lasso Trim",
+{"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
+{"items": [
+("sculpt.trim_lasso_gesture", {"type": params.tool_tweak, "value": 
'ANY'},
+ None),
+]},
+)
 
 def km_3d_view_tool_sculpt_mesh_filter(params):
 return (
@@ -6938,6 +6957,8 @@ def generate_keymaps(params=None):
 km_3d_view_tool_sculpt_lasso_mask(params),
 km_3d_view_tool_sculpt_box_face_set(params),
 km_3d_view_tool_sculpt_lasso_face_set(params),
+km_3d_view_tool_sculpt_box_trim(params),
+km_3d_view_tool_sculpt_lasso_trim(params),
 km_3d_view_tool_sculpt_mesh_filter(params),
 km_3d_view_tool_sculpt_cloth_filter(params),
 km_3d_view_tool_sculpt_color_filter(params),
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index c17b981a6b8..ab7ac007257 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1284,6 +1284,26 @@ class _defs_sculpt:
 draw_settings=draw_settings,
 )
 
+@ToolDef.from_fn
+def trim_box():
+return dict(
+idname="builtin.box_trim",
+label="Box Trim",
+icon="ops.sculpt.box_trim",
+widget=None,
+keymap=(),
+)
+
+@ToolDef.from_fn
+def trim_lasso():
+return dict(
+idname="builtin.lasso_trim",
+label="Lasso Trim",
+icon="ops.sculpt.lasso_trim",
+widget=None,
+keymap=(),
+)
+
 
 @ToolDef.from_fn
 def mesh_filter():
@@ -2632,6 +2652,10 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, 
Panel):
 _defs_sculpt.face_set_lasso,
 ),
 _defs_sculpt.hide_border,
+(
+_defs_sculpt.trim_box,
+_defs_sculpt.trim_lasso,
+),
 None,
 _defs_sculpt.mesh_filter,
 _defs_sculpt.cloth_filter,
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c 
b/source/blender/editors/sculpt_paint/paint_mask.c
index fd17793b6de..70f8ef89e9a 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -23,14 +23,18 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
+#include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
 #include "DNA_vec_types.h"
 
+#include "BLI_alloca.h"
 #include "BLI_bitmap_draw_2d.h"
 #include "BLI_lasso_2d.h"
 #include "BLI_math_geom.h"
 #include "BLI_math_matrix.h"
+#include "BLI_polyfill_2d.h"
 #include "BLI_rect.h"
 #include "BLI_task.h"
 #include "BLI_utildefines.h"
@@ -56,6 +60,8 

[Bf-blender-cvs] [1dc11d15a60] master: Fix T79914: Grab active vertex using wrong coordinates

2020-09-07 Thread Pablo Dobarro
Commit: 1dc11d15a60b1fdb21f72c9bd39ba27e3acdb80f
Author: Pablo Dobarro
Date:   Mon Sep 7 17:24:52 2020 +0200
Branches: master
https://developer.blender.org/rB1dc11d15a60b1fdb21f72c9bd39ba27e3acdb80f

Fix T79914: Grab active vertex using wrong coordinates

This was introduced in the first commit of the cloth brush. In order to
support the cloth brush deformations with subsurf modifiers, the sculpt
API was changed to return the deformed coordinates from the PBVH instead
of the mesh coordinates. When using grab active vertex and rendering the
original mesh wireframe it should render the undeformed mesh coordinates
when available.

Reviewed By: sergey

Maniphest Tasks: T79914

Differential Revision: https://developer.blender.org/D8630

===

M   source/blender/editors/sculpt_paint/paint_cursor.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h

===

diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c 
b/source/blender/editors/sculpt_paint/paint_cursor.c
index 08733a26187..f4d7869e40a 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -1154,7 +1154,8 @@ static void sculpt_geometry_preview_lines_draw(const uint 
gpuattr,
   if (ss->preview_vert_index_count > 0) {
 immBegin(GPU_PRIM_LINES, ss->preview_vert_index_count);
 for (int i = 0; i < ss->preview_vert_index_count; i++) {
-  immVertex3fv(gpuattr, SCULPT_vertex_co_get(ss, 
ss->preview_vert_index_list[i]));
+  immVertex3fv(gpuattr,
+   SCULPT_vertex_co_for_grab_active_get(ss, 
ss->preview_vert_index_list[i]));
 }
 immEnd();
   }
@@ -1572,7 +1573,14 @@ static void 
paint_cursor_draw_3d_view_brush_cursor_inactive(PaintCursorContext *
 
   /* Cursor location symmetry points. */
 
-  const float *active_vertex_co = SCULPT_active_vertex_co_get(pcontext->ss);
+  const float *active_vertex_co;
+  if (brush->sculpt_tool == SCULPT_TOOL_GRAB && brush->flag & 
BRUSH_GRAB_ACTIVE_VERTEX) {
+active_vertex_co = SCULPT_vertex_co_for_grab_active_get(
+pcontext->ss, SCULPT_active_vertex_get(pcontext->ss));
+  }
+  else {
+active_vertex_co = SCULPT_active_vertex_co_get(pcontext->ss);
+  }
   if (len_v3v3(active_vertex_co, pcontext->location) < pcontext->radius) {
 immUniformColor3fvAlpha(pcontext->outline_col, pcontext->outline_alpha);
 cursor_draw_point_with_symmetry(pcontext->pos,
diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index f2eb1359af7..c8ee4a75b1d 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -204,6 +204,14 @@ const float *SCULPT_vertex_persistent_co_get(SculptSession 
*ss, int index)
   return SCULPT_vertex_co_get(ss, index);
 }
 
+const float *SCULPT_vertex_co_for_grab_active_get(SculptSession *ss, int index)
+{
+  if (ss->mvert) {
+return ss->mvert[index].co;
+  }
+  return SCULPT_vertex_co_get(ss, index);
+}
+
 void SCULPT_vertex_limit_surface_get(SculptSession *ss, int index, float 
r_co[3])
 {
   switch (BKE_pbvh_type(ss->pbvh)) {
@@ -6694,7 +6702,8 @@ static void 
sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru
 
 if (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache)) {
   if (tool == SCULPT_TOOL_GRAB && brush->flag & BRUSH_GRAB_ACTIVE_VERTEX) {
-copy_v3_v3(cache->orig_grab_location, SCULPT_active_vertex_co_get(ss));
+copy_v3_v3(cache->orig_grab_location,
+   SCULPT_vertex_co_for_grab_active_get(ss, 
SCULPT_active_vertex_get(ss)));
   }
   else {
 copy_v3_v3(cache->orig_grab_location, cache->true_location);
@@ -8366,7 +8375,7 @@ void SCULPT_geometry_preview_lines_update(bContext *C, 
SculptSession *ss, float
 totpoints++;
 if (!BLI_BITMAP_TEST(visited_vertices, to_v)) {
   BLI_BITMAP_ENABLE(visited_vertices, to_v);
-  const float *co = SCULPT_vertex_co_get(ss, to_v);
+  const float *co = SCULPT_vertex_co_for_grab_active_get(ss, to_v);
   if (len_squared_v3v3(brush_co, co) < radius * radius) {
 BLI_gsqueue_push(not_visited_vertices, _v);
   }
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h 
b/source/blender/editors/sculpt_paint/sculpt_intern.h
index d7497a6cd4c..9f28bd59d87 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -100,6 +100,9 @@ const float *SCULPT_vertex_color_get(SculptSession *ss, int 
index);
 const float *SCULPT_vertex_persistent_co_get(SculptSession *ss, int index);
 void SCULPT_vertex_persistent_normal_get(SculptSession *ss, int index, float 
no[3]);
 
+/* Coordinates used for manipulating the base mesh when Grab Active Vertex is 

[Bf-blender-cvs] [0c4b732ef2c] master: Fix T78225: Vertex Colors not showing in edit mode

2020-09-07 Thread Pablo Dobarro
Commit: 0c4b732ef2cd5d3b4d6d7dbaa27801d1bfff04ae
Author: Pablo Dobarro
Date:   Sun Sep 6 18:56:40 2020 +0200
Branches: master
https://developer.blender.org/rB0c4b732ef2cd5d3b4d6d7dbaa27801d1bfff04ae

Fix T78225: Vertex Colors not showing in edit mode

This should be using the mesh_cd_ldata_get_from_mesh function in
order to get ldata from BMesh in edit mode.

Reviewed By: sergey

Maniphest Tasks: T78225

Differential Revision: https://developer.blender.org/D8818

===

M   source/blender/draw/intern/draw_cache_impl_mesh.c

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index e8a712b6881..c7ba707d403 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -169,7 +169,7 @@ static void mesh_cd_calc_active_vcol_layer(const Mesh *me, 
DRW_MeshCDMask *cd_us
 static void mesh_cd_calc_active_mloopcol_layer(const Mesh *me, DRW_MeshCDMask 
*cd_used)
 {
   const Mesh *me_final = editmesh_final_or_this(me);
-  const CustomData *cd_ldata = _final->ldata;
+  const CustomData *cd_ldata = mesh_cd_ldata_get_from_mesh(me_final);
 
   int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPCOL);
   if (layer != -1) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bbbfd7130ae] master: Fix Boundary Brush not working with partially hidden meshes

2020-09-07 Thread Pablo Dobarro
Commit: bbbfd7130ae36b9ba1652b919ef6ae426107acd8
Author: Pablo Dobarro
Date:   Sun Sep 6 19:38:37 2020 +0200
Branches: master
https://developer.blender.org/rBbbbfd7130ae36b9ba1652b919ef6ae426107acd8

Fix Boundary Brush not working with partially hidden meshes

Now when a mesh is partially hidden using Face Sets, the open boundary
the hidden geometry produces is also detected by the brush.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8819

===

M   source/blender/editors/sculpt_paint/sculpt_boundary.c

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_boundary.c 
b/source/blender/editors/sculpt_paint/sculpt_boundary.c
index 5e01e034715..3051413a405 100644
--- a/source/blender/editors/sculpt_paint/sculpt_boundary.c
+++ b/source/blender/editors/sculpt_paint/sculpt_boundary.c
@@ -74,6 +74,10 @@ static bool boundary_initial_vertex_floodfill_cb(
 {
   BoundaryInitialVertexFloodFillData *data = userdata;
 
+  if (!SCULPT_vertex_visible_get(ss, to_v)) {
+return false;
+  }
+
   if (!is_duplicate) {
 data->floodfill_steps[to_v] = data->floodfill_steps[from_v] + 1;
   }
@@ -174,13 +178,19 @@ static bool 
sculpt_boundary_is_vertex_in_editable_boundary(SculptSession *ss,
const int 
initial_vertex)
 {
 
+  if (!SCULPT_vertex_visible_get(ss, initial_vertex)) {
+return false;
+  }
+
   int neighbor_count = 0;
   int boundary_vertex_count = 0;
   SculptVertexNeighborIter ni;
   SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, initial_vertex, ni) {
-neighbor_count++;
-if (SCULPT_vertex_is_boundary(ss, ni.index)) {
-  boundary_vertex_count++;
+if (SCULPT_vertex_visible_get(ss, ni.index)) {
+  neighbor_count++;
+  if (SCULPT_vertex_is_boundary(ss, ni.index)) {
+boundary_vertex_count++;
+  }
 }
   }
   SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
@@ -349,7 +359,9 @@ static void sculpt_boundary_edit_data_init(SculptSession 
*ss,
 
   SculptVertexNeighborIter ni;
   SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, from_v, ni) {
-if (boundary->edit_info[ni.index].num_propagation_steps == 
BOUNDARY_STEPS_NONE) {
+const bool is_visible = SCULPT_vertex_visible_get(ss, ni.index);
+if (is_visible &&
+boundary->edit_info[ni.index].num_propagation_steps == 
BOUNDARY_STEPS_NONE) {
   boundary->edit_info[ni.index].original_vertex =
   boundary->edit_info[from_v].original_vertex;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [179bd1ea7d4] master: Fix T77763: Wrong highlight of active grab vertex

2020-09-07 Thread Sergey Sharybin
Commit: 179bd1ea7d4d1b31ce22ac1d5d0c0b32b843aa6f
Author: Sergey Sharybin
Date:   Mon Sep 7 16:56:41 2020 +0200
Branches: master
https://developer.blender.org/rB179bd1ea7d4d1b31ce22ac1d5d0c0b32b843aa6f

Fix T77763: Wrong highlight of active grab vertex

The "Grab Active Vertex" in sculpt mode highlights the vertex and
the neighbor vertices. This was working wrong in the case when mesh
has multires modifier at sculpt level 0 and has shape keys.

The issue was caused by the wrong crazy space calculation, which was
ignoring subdivision level. This is an oversight from the initial
implementation: the modifier has no effect if the subdivision level
is 0.

===

M   source/blender/modifiers/intern/MOD_multires.c

===

diff --git a/source/blender/modifiers/intern/MOD_multires.c 
b/source/blender/modifiers/intern/MOD_multires.c
index 03e7f0a235b..9c7ab50cb61 100644
--- a/source/blender/modifiers/intern/MOD_multires.c
+++ b/source/blender/modifiers/intern/MOD_multires.c
@@ -296,7 +296,7 @@ static Mesh *modifyMesh(ModifierData *md, const 
ModifierEvalContext *ctx, Mesh *
 }
 
 static void deformMatrices(ModifierData *md,
-   const ModifierEvalContext *UNUSED(ctx),
+   const ModifierEvalContext *ctx,
Mesh *mesh,
float (*vertex_cos)[3],
float (*deform_matrices)[3][3],
@@ -312,11 +312,19 @@ static void deformMatrices(ModifierData *md,
   (void)deform_matrices;
 
   MultiresModifierData *mmd = (MultiresModifierData *)md;
+
   SubdivSettings subdiv_settings;
   BKE_multires_subdiv_settings_init(_settings, mmd);
   if (subdiv_settings.level == 0) {
 return;
   }
+
+  SubdivToCCGSettings ccg_settings;
+  multires_ccg_settings_init(_settings, mmd, ctx, mesh);
+  if (ccg_settings.resolution < 3) {
+return;
+  }
+
   BKE_subdiv_settings_validate_for_mesh(_settings, mesh);
   MultiresRuntimeData *runtime_data = multires_ensure_runtime(mmd);
   Subdiv *subdiv = subdiv_descriptor_ensure(mmd, _settings, mesh);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [231d08cbb11] master: Multires: Fix memory leak when multires is at level 0

2020-09-07 Thread Sergey Sharybin
Commit: 231d08cbb11277ebfe1c1700124ced9ef50229d8
Author: Sergey Sharybin
Date:   Mon Sep 7 16:43:34 2020 +0200
Branches: master
https://developer.blender.org/rB231d08cbb11277ebfe1c1700124ced9ef50229d8

Multires: Fix memory leak when multires is at level 0

There is no SubdivCCG created in this case, meaning ownership of the Subdiv
was not altered.

===

M   source/blender/modifiers/intern/MOD_multires.c

===

diff --git a/source/blender/modifiers/intern/MOD_multires.c 
b/source/blender/modifiers/intern/MOD_multires.c
index 7bdc1da33c2..03e7f0a235b 100644
--- a/source/blender/modifiers/intern/MOD_multires.c
+++ b/source/blender/modifiers/intern/MOD_multires.c
@@ -205,6 +205,13 @@ static Mesh *multires_as_ccg(MultiresModifierData *mmd,
   }
   BKE_subdiv_displacement_attach_from_multires(subdiv, mesh, mmd);
   result = BKE_subdiv_to_ccg_mesh(subdiv, _settings, mesh);
+
+  /* NOTE: CCG becomes an owner of Subdiv descriptor, so can not share
+   * this pointer. Not sure if it's needed, but might have a second look
+   * on the ownership model here. */
+  MultiresRuntimeData *runtime_data = mmd->modifier.runtime;
+  runtime_data->subdiv = NULL;
+
   return result;
 }
 
@@ -261,10 +268,6 @@ static Mesh *modifyMesh(ModifierData *md, const 
ModifierEvalContext *ctx, Mesh *
   sculpt_session->mpoly = NULL;
   sculpt_session->mloop = NULL;
 }
-/* NOTE: CCG becomes an owner of Subdiv descriptor, so can not share
- * this pointer. Not sure if it's needed, but might have a second look
- * on the ownership model here. */
-runtime_data->subdiv = NULL;
 // BKE_subdiv_stats_print(>stats);
   }
   else {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9681708c1cf] master: Fix T80561: Crash when multi-mesh editing UVs with proportional editing

2020-09-07 Thread Julian Eisel
Commit: 9681708c1cf12026095b3a8a52cd0b3fa046ba1f
Author: Julian Eisel
Date:   Mon Sep 7 16:14:58 2020 +0200
Branches: master
https://developer.blender.org/rB9681708c1cf12026095b3a8a52cd0b3fa046ba1f

Fix T80561: Crash when multi-mesh editing UVs with proportional editing

Because of a `goto` we would free a variable before it was declared.
Declare it before the `goto` and `NULL`-check the value before freeing.

===

M   source/blender/editors/transform/transform_convert_mesh_uv.c

===

diff --git a/source/blender/editors/transform/transform_convert_mesh_uv.c 
b/source/blender/editors/transform/transform_convert_mesh_uv.c
index 632769c167e..92447c257da 100644
--- a/source/blender/editors/transform/transform_convert_mesh_uv.c
+++ b/source/blender/editors/transform/transform_convert_mesh_uv.c
@@ -322,6 +322,8 @@ void createTransUVs(bContext *C, TransInfo *t)
   }
 }
 
+float *prop_dists = NULL;
+
 /* Support other objects using PET to adjust these, unless connected is 
enabled. */
 if (((is_prop_edit && !is_prop_connected) ? count : countsel) == 0) {
   goto finally;
@@ -349,8 +351,6 @@ void createTransUVs(bContext *C, TransInfo *t)
 td = tc->data;
 td2d = tc->data_2d;
 
-float *prop_dists = NULL;
-
 if (is_prop_connected) {
   prop_dists = MEM_callocN(em->bm->totloop * sizeof(float), 
"TransObPropDists(UV Editing)");
 
@@ -397,7 +397,7 @@ void createTransUVs(bContext *C, TransInfo *t)
 
   finally:
 if (is_prop_connected) {
-  MEM_freeN(prop_dists);
+  MEM_SAFE_FREE(prop_dists);
 }
 if (is_island_center) {
   BM_uv_element_map_free(elementmap);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d71458d9196] master: BLI: add comparison operators for StringRef

2020-09-07 Thread Jacques Lucke
Commit: d71458d91963b56a02bc05d617344fd2871951dd
Author: Jacques Lucke
Date:   Mon Sep 7 16:09:48 2020 +0200
Branches: master
https://developer.blender.org/rBd71458d91963b56a02bc05d617344fd2871951dd

BLI: add comparison operators for StringRef

The semantic of those is the same as for std::string_view.

===

M   source/blender/blenlib/BLI_string_ref.hh

===

diff --git a/source/blender/blenlib/BLI_string_ref.hh 
b/source/blender/blenlib/BLI_string_ref.hh
index be18848fbf4..8e3e3be99e2 100644
--- a/source/blender/blenlib/BLI_string_ref.hh
+++ b/source/blender/blenlib/BLI_string_ref.hh
@@ -404,6 +404,26 @@ inline bool operator!=(StringRef a, StringRef b)
   return !(a == b);
 }
 
+inline bool operator<(StringRef a, StringRef b)
+{
+  return std::string_view(a) < std::string_view(b);
+}
+
+inline bool operator>(StringRef a, StringRef b)
+{
+  return std::string_view(a) > std::string_view(b);
+}
+
+inline bool operator<=(StringRef a, StringRef b)
+{
+  return std::string_view(a) <= std::string_view(b);
+}
+
+inline bool operator>=(StringRef a, StringRef b)
+{
+  return std::string_view(a) >= std::string_view(b);
+}
+
 /**
  * Return true when the string starts with the given prefix.
  */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [34063250aef] soc-2020-greasepencil-curve: GPencil: Fix view_selected

2020-09-07 Thread Falk David
Commit: 34063250aef35c2e4e03664da9ade24ca151f683
Author: Falk David
Date:   Mon Sep 7 15:44:54 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB34063250aef35c2e4e03664da9ade24ca151f683

GPencil: Fix view_selected

===

M   source/blender/editors/space_view3d/view3d_edit.c

===

diff --git a/source/blender/editors/space_view3d/view3d_edit.c 
b/source/blender/editors/space_view3d/view3d_edit.c
index e78f4e94614..63bcdb9c1ff 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -46,6 +46,7 @@
 #include "BKE_camera.h"
 #include "BKE_context.h"
 #include "BKE_font.h"
+#include "BKE_gpencil_curve.h"
 #include "BKE_gpencil_geom.h"
 #include "BKE_layer.h"
 #include "BKE_lib_id.h"
@@ -3054,8 +3055,11 @@ static int viewselected_exec(bContext *C, wmOperator *op)
 const bool is_curve_edit = GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd_eval);
 CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) {
   /* we're only interested in selected points here... */
-  if (((gps->flag & GP_STROKE_SELECT) && (gps->flag & GP_STROKE_3DSPACE)) 
||
-  (is_curve_edit && gps->editcurve != NULL && gps->editcurve->flag & 
GP_CURVE_SELECT)) {
+  if (is_curve_edit && gps->editcurve != NULL && gps->editcurve->flag & 
GP_CURVE_SELECT) {
+BKE_gpencil_stroke_editcurve_sync_selection(gps, gps->editcurve);
+ok |= BKE_gpencil_stroke_minmax(gps, true, min, max);
+  }
+  else if ((gps->flag & GP_STROKE_SELECT) && (gps->flag & 
GP_STROKE_3DSPACE)) {
 ok |= BKE_gpencil_stroke_minmax(gps, true, min, max);
   }
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b00cd419f50] soc-2020-greasepencil-curve: Merge branch 'greasepencil-edit-curve' into soc-2020-greasepencil-curve

2020-09-07 Thread Falk David
Commit: b00cd419f50e5e9900b66815f45e07300850a8b1
Author: Falk David
Date:   Mon Sep 7 15:30:04 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rBb00cd419f50e5e9900b66815f45e07300850a8b1

Merge branch 'greasepencil-edit-curve' into soc-2020-greasepencil-curve

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [cc19fe75626] greasepencil-object: Merge branch 'master' into greasepencil-object

2020-09-07 Thread Antonio Vazquez
Commit: cc19fe75626181dbc0af9896f91d277379ef85ee
Author: Antonio Vazquez
Date:   Mon Sep 7 15:46:38 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rBcc19fe75626181dbc0af9896f91d277379ef85ee

Merge branch 'master' into greasepencil-object

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [453451e5705] soc-2020-greasepencil-curve: GPencil: Support view_selected in curve edit mode

2020-09-07 Thread Falk David
Commit: 453451e5705672972559e9631e02b576e4c4eba1
Author: Falk David
Date:   Mon Sep 7 15:29:36 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB453451e5705672972559e9631e02b576e4c4eba1

GPencil: Support view_selected in curve edit mode

===

M   source/blender/editors/space_view3d/view3d_edit.c

===

diff --git a/source/blender/editors/space_view3d/view3d_edit.c 
b/source/blender/editors/space_view3d/view3d_edit.c
index ab08c9a804a..e78f4e94614 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -3051,9 +3051,11 @@ static int viewselected_exec(bContext *C, wmOperator *op)
   }
 
   if (is_gp_edit) {
+const bool is_curve_edit = GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd_eval);
 CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) {
   /* we're only interested in selected points here... */
-  if ((gps->flag & GP_STROKE_SELECT) && (gps->flag & GP_STROKE_3DSPACE)) {
+  if (((gps->flag & GP_STROKE_SELECT) && (gps->flag & GP_STROKE_3DSPACE)) 
||
+  (is_curve_edit && gps->editcurve != NULL && gps->editcurve->flag & 
GP_CURVE_SELECT)) {
 ok |= BKE_gpencil_stroke_minmax(gps, true, min, max);
   }
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2db8d319bc0] greasepencil-edit-curve: GPencil: Fix compiler errors and warnings

2020-09-07 Thread Antonio Vazquez
Commit: 2db8d319bc0e87f69f06dd3d4496b80e68d93f8b
Author: Antonio Vazquez
Date:   Mon Sep 7 15:28:27 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rB2db8d319bc0e87f69f06dd3d4496b80e68d93f8b

GPencil: Fix compiler errors and warnings

The error was related to the draw manager refactor.

===

M   source/blender/blenkernel/BKE_gpencil_curve.h
M   source/blender/draw/intern/draw_cache_impl_gpencil.c
M   source/blender/makesrna/intern/rna_gpencil.c

===

diff --git a/source/blender/blenkernel/BKE_gpencil_curve.h 
b/source/blender/blenkernel/BKE_gpencil_curve.h
index e8c4139384f..1821972469c 100644
--- a/source/blender/blenkernel/BKE_gpencil_curve.h
+++ b/source/blender/blenkernel/BKE_gpencil_curve.h
@@ -31,6 +31,7 @@ struct Main;
 struct Object;
 struct Scene;
 struct bGPdata;
+struct bGPDlayer;
 struct bGPDstroke;
 struct bGPDcurve;
 
diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c 
b/source/blender/draw/intern/draw_cache_impl_gpencil.c
index 0c6c2120466..655130fa4c1 100644
--- a/source/blender/draw/intern/draw_cache_impl_gpencil.c
+++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c
@@ -877,7 +877,7 @@ static void gpencil_edit_batches_ensure(Object *ob, 
GpencilBatchCache *cache, in
 if (vert_len > 0) {
 
   GPU_vertbuf_data_alloc(cache->edit_curve_vbo, vert_len);
-  iter.verts = (gpEditCurveVert *)cache->edit_curve_vbo->data;
+  iter.verts = (gpEditCurveVert 
*)GPU_vertbuf_get_data(cache->edit_curve_vbo);
 
   /* Fill buffers with data. */
   BKE_gpencil_visible_stroke_iter(
diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index 480e01f8eb6..ca8631a61f5 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -2399,7 +2399,7 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
   RNA_def_property_float_sdna(prop, NULL, "curve_edit_corner_angle");
   RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
   RNA_def_property_float_default(prop, DEG2RADF(90.0f));
-  RNA_def_property_ui_text(prop, "Corner Angle", "Angle threshold to be 
treated as corners.");
+  RNA_def_property_ui_text(prop, "Corner Angle", "Angle threshold to be 
treated as corners");
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
   prop = RNA_def_property(srna, "use_multiedit", PROP_BOOLEAN, PROP_NONE);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8deb0d84ebb] greasepencil-edit-curve: Merge branch 'master' into greasepencil-edit-curve

2020-09-07 Thread Antonio Vazquez
Commit: 8deb0d84ebbe92ce0cc1b550123b69de6ceda05c
Author: Antonio Vazquez
Date:   Mon Sep 7 15:23:02 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rB8deb0d84ebbe92ce0cc1b550123b69de6ceda05c

Merge branch 'master' into greasepencil-edit-curve

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0e5aa49e1d0] master: Cleanup: include missing header files in CMake

2020-09-07 Thread Campbell Barton
Commit: 0e5aa49e1d0edab553a3054b298a8c2f5ecaa16f
Author: Campbell Barton
Date:   Mon Sep 7 23:10:17 2020 +1000
Branches: master
https://developer.blender.org/rB0e5aa49e1d0edab553a3054b298a8c2f5ecaa16f

Cleanup: include missing header files in CMake

===

M   source/blender/CMakeLists.txt
M   source/blender/blenlib/CMakeLists.txt
M   source/blender/blenloader/CMakeLists.txt
M   source/blender/draw/CMakeLists.txt
M   source/blender/python/intern/CMakeLists.txt

===

diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index e178b0f7935..d4f71c5b423 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -78,6 +78,7 @@ set(SRC_DNA_INC
   ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_screen_types.h
   ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_sdna_types.h
   ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_sequence_types.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_session_uuid_types.h
   ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_shader_fx_types.h
   ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_simulation_types.h
   ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_sound_types.h
diff --git a/source/blender/blenlib/CMakeLists.txt 
b/source/blender/blenlib/CMakeLists.txt
index 1db45cff09a..a0569ad3dd4 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -243,6 +243,7 @@ set(SRC
   BLI_mesh_intersect.hh
   BLI_mpq2.hh
   BLI_mpq3.hh
+  BLI_multi_value_map.hh
   BLI_noise.h
   BLI_path_util.h
   BLI_polyfill_2d.h
diff --git a/source/blender/blenloader/CMakeLists.txt 
b/source/blender/blenloader/CMakeLists.txt
index f5c7223a37c..992870daeb4 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -103,6 +103,8 @@ if(WITH_GTESTS)
   set(TEST_SRC
 tests/blendfile_load_test.cc
 tests/blendfile_loading_base_test.cc
+
+tests/blendfile_loading_base_test.h
   )
   set(TEST_INC
   )
diff --git a/source/blender/draw/CMakeLists.txt 
b/source/blender/draw/CMakeLists.txt
index 83d39b606fe..b299df50852 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -163,6 +163,7 @@ set(SRC
   intern/draw_instance_data.h
   intern/draw_manager.h
   intern/draw_manager_profiling.h
+  intern/draw_manager_testing.h
   intern/draw_manager_text.h
   intern/draw_view.h
   intern/smaa_textures.h
@@ -443,4 +444,4 @@ if(WITH_GTESTS)
 include(GTestTesting)
 blender_add_test_lib(bf_draw_tests "${TEST_SRC}" "${INC};${TEST_INC}" 
"${INC_SYS}" "${LIB};${TEST_LIB}")
   endif()
-endif()
\ No newline at end of file
+endif()
diff --git a/source/blender/python/intern/CMakeLists.txt 
b/source/blender/python/intern/CMakeLists.txt
index b50aee73a13..6c3f422d3f0 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -123,6 +123,8 @@ set(SRC
   bpy_utils_units.h
   ../BPY_extern.h
   ../BPY_extern_clog.h
+  ../BPY_extern_python.h
+  ../BPY_extern_run.h
 )
 
 set(LIB

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0774fdbeb67] master: Cleanup: tabs in CMake files

2020-09-07 Thread Campbell Barton
Commit: 0774fdbeb67dc3acdf90b2dabd920dc9cd1ca521
Author: Campbell Barton
Date:   Mon Sep 7 23:12:34 2020 +1000
Branches: master
https://developer.blender.org/rB0774fdbeb67dc3acdf90b2dabd920dc9cd1ca521

Cleanup: tabs in CMake files

===

M   intern/cycles/cmake/external_libs.cmake
M   intern/cycles/cmake/macros.cmake

===

diff --git a/intern/cycles/cmake/external_libs.cmake 
b/intern/cycles/cmake/external_libs.cmake
index e84dc7a1fca..b29f392a754 100644
--- a/intern/cycles/cmake/external_libs.cmake
+++ b/intern/cycles/cmake/external_libs.cmake
@@ -18,9 +18,9 @@
 ###
 
 macro(_set_default variable value)
-   if(NOT ${variable})
-   set(${variable} ${value})
-   endif()
+  if(NOT ${variable})
+set(${variable} ${value})
+  endif()
 endmacro()
 
 ###
@@ -233,14 +233,14 @@ if(WITH_CYCLES_OSL)
   unset(_llvm_libs_release)
 
   set(OSL_LIBRARIES
-   optimized ${OSL_ROOT_DIR}/lib/oslcomp.lib
-   optimized ${OSL_ROOT_DIR}/lib/oslexec.lib
-   optimized ${OSL_ROOT_DIR}/lib/oslquery.lib
-   optimized ${OSL_ROOT_DIR}/lib/pugixml.lib
-   debug ${OSL_ROOT_DIR}/lib/oslcomp_d.lib
-   debug ${OSL_ROOT_DIR}/lib/oslexec_d.lib
-   debug ${OSL_ROOT_DIR}/lib/oslquery_d.lib
-   debug ${OSL_ROOT_DIR}/lib/pugixml_d.lib
+optimized ${OSL_ROOT_DIR}/lib/oslcomp.lib
+optimized ${OSL_ROOT_DIR}/lib/oslexec.lib
+optimized ${OSL_ROOT_DIR}/lib/oslquery.lib
+optimized ${OSL_ROOT_DIR}/lib/pugixml.lib
+debug ${OSL_ROOT_DIR}/lib/oslcomp_d.lib
+debug ${OSL_ROOT_DIR}/lib/oslexec_d.lib
+debug ${OSL_ROOT_DIR}/lib/oslquery_d.lib
+debug ${OSL_ROOT_DIR}/lib/pugixml_d.lib
   )
 endif()
   endif()
diff --git a/intern/cycles/cmake/macros.cmake b/intern/cycles/cmake/macros.cmake
index ad20916d471..c5fe5f672c0 100644
--- a/intern/cycles/cmake/macros.cmake
+++ b/intern/cycles/cmake/macros.cmake
@@ -182,15 +182,15 @@ macro(cycles_install_libraries target)
 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
   install(
 FILES
-   ${TBB_ROOT_DIR}/lib/debug/tbb_debug${CMAKE_SHARED_LIBRARY_SUFFIX}
+${TBB_ROOT_DIR}/lib/debug/tbb_debug${CMAKE_SHARED_LIBRARY_SUFFIX}
 ${OPENVDB_ROOT_DIR}/bin/openvdb_d${CMAKE_SHARED_LIBRARY_SUFFIX}
-   DESTINATION $)
+DESTINATION $)
 else()
   install(
 FILES
-   ${TBB_ROOT_DIR}/lib/tbb${CMAKE_SHARED_LIBRARY_SUFFIX}
+${TBB_ROOT_DIR}/lib/tbb${CMAKE_SHARED_LIBRARY_SUFFIX}
 ${OPENVDB_ROOT_DIR}/bin/openvdb${CMAKE_SHARED_LIBRARY_SUFFIX}
-   DESTINATION $)
+DESTINATION $)
 endif()
   endif()
 endmacro()

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [870fcb3857b] master: Cleanup: change Python version checks to include newer versions

2020-09-07 Thread Campbell Barton
Commit: 870fcb3857ba36986d1d44ab4ac519897f8fb264
Author: Campbell Barton
Date:   Mon Sep 7 22:58:16 2020 +1000
Branches: master
https://developer.blender.org/rB870fcb3857ba36986d1d44ab4ac519897f8fb264

Cleanup: change Python version checks to include newer versions

===

M   build_files/cmake/cmake_consistency_check.py
M   build_files/cmake/project_source_info.py
M   source/blender/makesrna/rna_cleanup/rna_cleaner.py

===

diff --git a/build_files/cmake/cmake_consistency_check.py 
b/build_files/cmake/cmake_consistency_check.py
index b4c91e6ba4f..cdf4058d394 100755
--- a/build_files/cmake/cmake_consistency_check.py
+++ b/build_files/cmake/cmake_consistency_check.py
@@ -21,7 +21,7 @@
 # 
 
 import sys
-if not sys.version.startswith("3"):
+if sys.version_info.major < 3:
 print("\nPython3.x needed, found %s.\nAborting!\n" %
   sys.version.partition(" ")[0])
 sys.exit(1)
diff --git a/build_files/cmake/project_source_info.py 
b/build_files/cmake/project_source_info.py
index 6649f4620c8..f8067c216fd 100644
--- a/build_files/cmake/project_source_info.py
+++ b/build_files/cmake/project_source_info.py
@@ -25,8 +25,8 @@ __all__ = (
 
 
 import sys
-if not sys.version.startswith("3"):
-print("\nPython3.x needed, found %s.\nAborting!\n" %
+if not sys.version_info.major < 3:
+print("\nPython3.x or newer needed, found %s.\nAborting!\n" %
   sys.version.partition(" ")[0])
 sys.exit(1)
 
diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner.py 
b/source/blender/makesrna/rna_cleanup/rna_cleaner.py
index a936e6499bc..f107b5aee63 100755
--- a/source/blender/makesrna/rna_cleanup/rna_cleaner.py
+++ b/source/blender/makesrna/rna_cleanup/rna_cleaner.py
@@ -321,7 +321,7 @@ def main():
 
 if __name__ == '__main__':
 import sys
-if not sys.version.startswith("3"):
-print("Incorrect python version, use python 3!")
+if sys.version_info.major < 3:
+print("Incorrect python version, use Python 3 or newer!")
 else:
 main()

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [272c53f8f01] master: datatoc_icon: remove Python 2.x support

2020-09-07 Thread Campbell Barton
Commit: 272c53f8f01fef7190ac378fd32279054657f99b
Author: Campbell Barton
Date:   Mon Sep 7 22:55:55 2020 +1000
Branches: master
https://developer.blender.org/rB272c53f8f01fef7190ac378fd32279054657f99b

datatoc_icon: remove Python 2.x support

This was originally included in case the system Python was v2.x,
remove support since Python 2.x is no longer being maintained.

===

M   source/blender/datatoc/datatoc_icon.py

===

diff --git a/source/blender/datatoc/datatoc_icon.py 
b/source/blender/datatoc/datatoc_icon.py
index 16092431195..6d8b24924f1 100755
--- a/source/blender/datatoc/datatoc_icon.py
+++ b/source/blender/datatoc/datatoc_icon.py
@@ -1,5 +1,4 @@
 #!/usr/bin/env python3
-
 # # BEGIN GPL LICENSE BLOCK #
 #
 #  This program is free software; you can redistribute it and/or
@@ -136,13 +135,7 @@ def icondir_to_png(path_src, file_dst):
 
 # write pixels
 with open(file_dst, 'wb') as f_dst:
-import sys
-# py2/3 compat
-if sys.version.startswith("2"):
-pixels_data = pixels_canvas.tostring()
-else:
-pixels_data = pixels_canvas.tobytes()
-
+pixels_data = pixels_canvas.tobytes()
 image_data = write_png(pixels_data, canvas_w, canvas_h)
 f_dst.write(image_data)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5ccdc6ad861] master: Cleanup: Fix clang-tidy warning in the new boolean code

2020-09-07 Thread Sebastian Parborg
Commit: 5ccdc6ad8611bdefb19e9c1085e20e21892311bc
Author: Sebastian Parborg
Date:   Mon Sep 7 14:26:10 2020 +0200
Branches: master
https://developer.blender.org/rB5ccdc6ad8611bdefb19e9c1085e20e21892311bc

Cleanup: Fix clang-tidy warning in the new boolean code

No functional changes.

===

M   source/blender/blenlib/intern/mesh_boolean.cc

===

diff --git a/source/blender/blenlib/intern/mesh_boolean.cc 
b/source/blender/blenlib/intern/mesh_boolean.cc
index 3b128aba102..e92751efe72 100644
--- a/source/blender/blenlib/intern/mesh_boolean.cc
+++ b/source/blender/blenlib/intern/mesh_boolean.cc
@@ -2375,9 +2375,8 @@ static bool point_is_inside_shape(const IMesh ,
   if (high_confidence) {
 return (gwn > 0.9);
   }
-  else {
-return (gwn > 0.01);
-  }
+
+  return (gwn > 0.01);
 }
 
 /**

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bb2aeb45049] master: GPUVertBuf: Rename GPUVertBuf to VertBuf and add some getters

2020-09-07 Thread Clément Foucault
Commit: bb2aeb4504907cab1cf8c4afc4dd1d6495c940e4
Author: Clément Foucault
Date:   Sun Sep 6 23:45:51 2020 +0200
Branches: master
https://developer.blender.org/rBbb2aeb4504907cab1cf8c4afc4dd1d6495c940e4

GPUVertBuf: Rename GPUVertBuf to VertBuf and add some getters

to avoid more typecasts.

===

M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/GPU_vertex_buffer.h
M   source/blender/gpu/intern/gpu_backend.hh
M   source/blender/gpu/intern/gpu_batch.cc
M   source/blender/gpu/intern/gpu_batch_private.hh
M   source/blender/gpu/intern/gpu_immediate.cc
M   source/blender/gpu/intern/gpu_texture.cc
M   source/blender/gpu/intern/gpu_vertex_buffer.cc
M   source/blender/gpu/intern/gpu_vertex_buffer_private.hh
M   source/blender/gpu/intern/gpu_vertex_format.cc
M   source/blender/gpu/intern/gpu_vertex_format_private.h
M   source/blender/gpu/opengl/gl_backend.hh
M   source/blender/gpu/opengl/gl_batch.cc
M   source/blender/gpu/opengl/gl_batch.hh
M   source/blender/gpu/opengl/gl_drawlist.cc
M   source/blender/gpu/opengl/gl_shader.cc
M   source/blender/gpu/opengl/gl_texture.cc
M   source/blender/gpu/opengl/gl_vertex_array.cc
A   source/blender/gpu/opengl/gl_vertex_buffer.cc
A   source/blender/gpu/opengl/gl_vertex_buffer.hh

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 799e146183a..5cce4f84aea 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -100,6 +100,7 @@ set(SRC
   opengl/gl_texture.cc
   opengl/gl_uniform_buffer.cc
   opengl/gl_vertex_array.cc
+  opengl/gl_vertex_buffer.cc
 
   GPU_batch.h
   GPU_batch_presets.h
@@ -166,6 +167,7 @@ set(SRC
   opengl/gl_texture.hh
   opengl/gl_uniform_buffer.hh
   opengl/gl_vertex_array.hh
+  opengl/gl_vertex_buffer.hh
 )
 
 set(LIB
diff --git a/source/blender/gpu/GPU_vertex_buffer.h 
b/source/blender/gpu/GPU_vertex_buffer.h
index efed2725e27..e42d6c47b58 100644
--- a/source/blender/gpu/GPU_vertex_buffer.h
+++ b/source/blender/gpu/GPU_vertex_buffer.h
@@ -46,7 +46,6 @@ ENUM_OPERATORS(GPUVertBufStatus)
 extern "C" {
 #endif
 
-#define VRAM_USAGE 1
 /**
  * How to create a #GPUVertBuf:
  * 1) verts = GPU_vertbuf_calloc()
@@ -64,9 +63,7 @@ typedef enum {
 
 typedef struct GPUVertBuf GPUVertBuf;
 
-#define GPU_vertbuf_calloc() GPU_vertbuf_create(GPU_USAGE_STATIC);
-
-GPUVertBuf *GPU_vertbuf_create(GPUUsageType);
+GPUVertBuf *GPU_vertbuf_calloc(void);
 GPUVertBuf *GPU_vertbuf_create_with_format_ex(const GPUVertFormat *, 
GPUUsageType);
 
 #define GPU_vertbuf_create_with_format(format) \
@@ -79,7 +76,6 @@ void GPU_vertbuf_discard(GPUVertBuf *);
 void GPU_vertbuf_handle_ref_add(GPUVertBuf *verts);
 void GPU_vertbuf_handle_ref_remove(GPUVertBuf *verts);
 
-void GPU_vertbuf_init(GPUVertBuf *, GPUUsageType);
 void GPU_vertbuf_init_with_format_ex(GPUVertBuf *, const GPUVertFormat *, 
GPUUsageType);
 
 #define GPU_vertbuf_init_with_format(verts, format) \
@@ -87,7 +83,6 @@ void GPU_vertbuf_init_with_format_ex(GPUVertBuf *, const 
GPUVertFormat *, GPUUsa
 
 GPUVertBuf *GPU_vertbuf_duplicate(GPUVertBuf *verts);
 
-uint GPU_vertbuf_size_get(const GPUVertBuf *);
 void GPU_vertbuf_data_alloc(GPUVertBuf *, uint v_len);
 void GPU_vertbuf_data_resize(GPUVertBuf *, uint v_len);
 void GPU_vertbuf_data_len_set(GPUVertBuf *, uint v_len);
diff --git a/source/blender/gpu/intern/gpu_backend.hh 
b/source/blender/gpu/intern/gpu_backend.hh
index b5162fd820f..d074350e8d0 100644
--- a/source/blender/gpu/intern/gpu_backend.hh
+++ b/source/blender/gpu/intern/gpu_backend.hh
@@ -37,6 +37,7 @@ class IndexBuf;
 class Shader;
 class Texture;
 class UniformBuf;
+class VertBuf;
 
 class GPUBackend {
  public:
@@ -55,6 +56,7 @@ class GPUBackend {
   virtual Shader *shader_alloc(const char *name) = 0;
   virtual Texture *texture_alloc(const char *name) = 0;
   virtual UniformBuf *uniformbuf_alloc(int size, const char *name) = 0;
+  virtual VertBuf *vertbuf_alloc(void) = 0;
 };
 
 }  // namespace gpu
diff --git a/source/blender/gpu/intern/gpu_batch.cc 
b/source/blender/gpu/intern/gpu_batch.cc
index 864843a6d01..34655c48ca4 100644
--- a/source/blender/gpu/intern/gpu_batch.cc
+++ b/source/blender/gpu/intern/gpu_batch.cc
@@ -267,14 +267,14 @@ void GPU_batch_draw_advanced(
   v_count = batch->elem_()->index_len_get();
 }
 else {
-  v_count = batch->verts[0]->vertex_len;
+  v_count = batch->verts_(0)->vertex_len;
 }
   }
   if (i_count == 0) {
-i_count = (batch->inst[0]) ? batch->inst[0]->vertex_len : 1;
+i_count = (batch->inst[0]) ? batch->inst_(0)->vertex_len : 1;
 /* Meh. This is to be able to use different numbers of verts in instance 
vbos. */
 if (batch->inst[1] != NULL) {
-  i_count = min_ii(i_count, batch->inst[1]->vertex_len);
+  i_count = min_ii(i_count, 

[Bf-blender-cvs] [c38debd39fa] master: GPUVertBuf: GL Backend Isolation

2020-09-07 Thread Clément Foucault
Commit: c38debd39fac1e3d44b84e8092419da34f0b613d
Author: Clément Foucault
Date:   Mon Sep 7 01:20:55 2020 +0200
Branches: master
https://developer.blender.org/rBc38debd39fac1e3d44b84e8092419da34f0b613d

GPUVertBuf: GL Backend Isolation

Part of the Vulkan port T68990

This makes a few changes in how the data is being handled by the
backend to allow more flexibility in the future.

The overall code logic is left unchanged.

===

M   source/blender/gpu/intern/gpu_vertex_buffer.cc
M   source/blender/gpu/intern/gpu_vertex_buffer_private.hh
M   source/blender/gpu/opengl/gl_shader.cc
M   source/blender/gpu/opengl/gl_texture.cc
M   source/blender/gpu/opengl/gl_vertex_array.cc
M   source/blender/gpu/opengl/gl_vertex_buffer.cc
M   source/blender/gpu/opengl/gl_vertex_buffer.hh

===

diff --git a/source/blender/gpu/intern/gpu_vertex_buffer.cc 
b/source/blender/gpu/intern/gpu_vertex_buffer.cc
index 44c5c9deb37..62c07761b4c 100644
--- a/source/blender/gpu/intern/gpu_vertex_buffer.cc
+++ b/source/blender/gpu/intern/gpu_vertex_buffer.cc
@@ -35,8 +35,6 @@
 
 #include 
 
-#define VRAM_USAGE 1
-
 /*  */
 /** \name VertBuf
  * \{ */
@@ -45,6 +43,75 @@ namespace blender::gpu {
 
 size_t VertBuf::memory_usage = 0;
 
+VertBuf::VertBuf()
+{
+  /* Needed by some code check. */
+  format.attr_len = 0;
+}
+
+VertBuf::~VertBuf()
+{
+  /* Should already have been cleared. */
+  BLI_assert(flag == GPU_VERTBUF_INVALID);
+}
+
+void VertBuf::init(const GPUVertFormat *format, GPUUsageType usage)
+{
+  usage_ = usage;
+  flag = GPU_VERTBUF_DATA_DIRTY;
+  GPU_vertformat_copy(>format, format);
+  if (!format->packed) {
+VertexFormat_pack(>format);
+  }
+  flag |= GPU_VERTBUF_INIT;
+}
+
+void VertBuf::clear(void)
+{
+  this->release_data();
+  flag = GPU_VERTBUF_INVALID;
+}
+
+VertBuf *VertBuf::duplicate(void)
+{
+  VertBuf *dst = GPUBackend::get()->vertbuf_alloc();
+  /* Full copy. */
+  *dst = *this;
+  /* Almost full copy... */
+  dst->handle_refcount_ = 1;
+  /* Duplicate all needed implementation specifics data. */
+  this->duplicate_data(dst);
+  return dst;
+}
+
+void VertBuf::allocate(uint vert_len)
+{
+  BLI_assert(format.packed);
+  /* Catch any unnecessary usage. */
+  BLI_assert(vertex_alloc != vert_len || data == nullptr);
+  vertex_len = vertex_alloc = vert_len;
+
+  this->acquire_data();
+
+  flag |= GPU_VERTBUF_DATA_DIRTY;
+}
+
+void VertBuf::resize(uint vert_len)
+{
+  /* Catch any unnecessary usage. */
+  BLI_assert(vertex_alloc != vert_len);
+  vertex_len = vertex_alloc = vert_len;
+
+  this->resize_data();
+
+  flag |= GPU_VERTBUF_DATA_DIRTY;
+}
+
+void VertBuf::upload(void)
+{
+  this->upload_data();
+}
+
 }  // namespace blender::gpu
 
 /** \} */
@@ -56,8 +123,6 @@ size_t VertBuf::memory_usage = 0;
 using namespace blender;
 using namespace blender::gpu;
 
-static uint GPU_vertbuf_size_get(const VertBuf *verts);
-
 /*  Creation & deletion  */
 
 GPUVertBuf *GPU_vertbuf_calloc(void)
@@ -68,7 +133,7 @@ GPUVertBuf *GPU_vertbuf_calloc(void)
 GPUVertBuf *GPU_vertbuf_create_with_format_ex(const GPUVertFormat *format, 
GPUUsageType usage)
 {
   GPUVertBuf *verts = GPU_vertbuf_calloc();
-  GPU_vertbuf_init_with_format_ex(verts, format, usage);
+  unwrap(verts)->init(format, usage);
   return verts;
 }
 
@@ -76,133 +141,48 @@ void GPU_vertbuf_init_with_format_ex(GPUVertBuf *verts_,
  const GPUVertFormat *format,
  GPUUsageType usage)
 {
-  VertBuf *verts = unwrap(verts_);
-  verts->usage = usage;
-  verts->flag = GPU_VERTBUF_DATA_DIRTY;
-  verts->handle_refcount = 1;
-  GPU_vertformat_copy(>format, format);
-  if (!format->packed) {
-VertexFormat_pack(>format);
-  }
-  verts->flag |= GPU_VERTBUF_INIT;
+  unwrap(verts_)->init(format, usage);
 }
 
 GPUVertBuf *GPU_vertbuf_duplicate(GPUVertBuf *verts_)
 {
-  VertBuf *verts = unwrap(verts_);
-  VertBuf *verts_dst = unwrap(GPU_vertbuf_calloc());
-  /* Full copy. */
-  *verts_dst = *verts;
-  verts_dst->handle_refcount = 1;
-  GPU_vertformat_copy(_dst->format, >format);
-
-  if (verts->vbo_id) {
-uint buffer_sz = GPU_vertbuf_size_get(verts);
-
-verts_dst->vbo_id = GPU_buf_alloc();
-
-glBindBuffer(GL_COPY_READ_BUFFER, verts->vbo_id);
-glBindBuffer(GL_COPY_WRITE_BUFFER, verts_dst->vbo_id);
-
-glBufferData(GL_COPY_WRITE_BUFFER, buffer_sz, NULL, to_gl(verts->usage));
-
-glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 
buffer_sz);
-
-VertBuf::memory_usage += GPU_vertbuf_size_get(verts);
-  }
-
-  if (verts->data) {
-verts_dst->data = (uchar *)MEM_dupallocN(verts->data);
-  }
-  return wrap(verts_dst);
+  return wrap(unwrap(verts_)->duplicate());
 }
 
 /** Same as discard but does not free. */
-void 

[Bf-blender-cvs] [6b91c641e81] master: GPU: Fix clang tidy warnings

2020-09-07 Thread Clément Foucault
Commit: 6b91c641e81ec2256b63e3dc8c0fe9d4e5dcf411
Author: Clément Foucault
Date:   Mon Sep 7 13:59:22 2020 +0200
Branches: master
https://developer.blender.org/rB6b91c641e81ec2256b63e3dc8c0fe9d4e5dcf411

GPU: Fix clang tidy warnings

===

M   source/blender/gpu/GPU_index_buffer.h
M   source/blender/gpu/GPU_texture.h
M   source/blender/gpu/intern/gpu_texture.cc
M   source/blender/gpu/opengl/gl_debug.cc
M   source/blender/gpu/opengl/gl_texture.hh

===

diff --git a/source/blender/gpu/GPU_index_buffer.h 
b/source/blender/gpu/GPU_index_buffer.h
index 09c12c6e177..df24e07caef 100644
--- a/source/blender/gpu/GPU_index_buffer.h
+++ b/source/blender/gpu/GPU_index_buffer.h
@@ -81,9 +81,9 @@ void GPU_indexbuf_create_subrange_in_place(GPUIndexBuf *elem,
uint start,
uint length);
 
-void GPU_indexbuf_discard(GPUIndexBuf *);
+void GPU_indexbuf_discard(GPUIndexBuf *elem);
 
-bool GPU_indexbuf_is_init(GPUIndexBuf *ibo);
+bool GPU_indexbuf_is_init(GPUIndexBuf *elem);
 
 int GPU_indexbuf_primitive_len(GPUPrimType prim_type);
 
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index 78a4c9d0ac9..bae5bfbaae8 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -218,9 +218,9 @@ void GPU_texture_update_mipmap(GPUTexture *tex,
eGPUDataFormat gpu_data_format,
const void *pixels);
 
-void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const 
void *pixels);
+void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const 
void *data);
 void GPU_texture_update_sub(GPUTexture *tex,
-eGPUDataFormat gpu_data_format,
+eGPUDataFormat data_format,
 const void *pixels,
 int offset_x,
 int offset_y,
@@ -229,8 +229,8 @@ void GPU_texture_update_sub(GPUTexture *tex,
 int height,
 int depth);
 
-void *GPU_texture_read(GPUTexture *tex, eGPUDataFormat gpu_data_format, int 
miplvl);
-void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat gpu_data_format, const 
void *color);
+void *GPU_texture_read(GPUTexture *tex, eGPUDataFormat data_format, int 
miplvl);
+void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat data_format, const void 
*data);
 
 void GPU_invalid_tex_init(void);
 void GPU_invalid_tex_bind(int mode);
diff --git a/source/blender/gpu/intern/gpu_texture.cc 
b/source/blender/gpu/intern/gpu_texture.cc
index a4d0d039c8f..ad9b690683c 100644
--- a/source/blender/gpu/intern/gpu_texture.cc
+++ b/source/blender/gpu/intern/gpu_texture.cc
@@ -331,17 +331,17 @@ GPUTexture *GPU_texture_create_error(int dimension, bool 
is_array)
 
 void GPU_texture_update_mipmap(GPUTexture *tex_,
int miplvl,
-   eGPUDataFormat gpu_data_format,
+   eGPUDataFormat data_format,
const void *pixels)
 {
   Texture *tex = reinterpret_cast(tex_);
   int extent[3] = {1, 1, 1}, offset[3] = {0, 0, 0};
   tex->mip_size_get(miplvl, extent);
-  reinterpret_cast(tex)->update_sub(miplvl, offset, extent, 
gpu_data_format, pixels);
+  reinterpret_cast(tex)->update_sub(miplvl, offset, extent, 
data_format, pixels);
 }
 
 void GPU_texture_update_sub(GPUTexture *tex,
-eGPUDataFormat gpu_data_format,
+eGPUDataFormat data_format,
 const void *pixels,
 int offset_x,
 int offset_y,
@@ -352,7 +352,7 @@ void GPU_texture_update_sub(GPUTexture *tex,
 {
   int offset[3] = {offset_x, offset_y, offset_z};
   int extent[3] = {width, height, depth};
-  reinterpret_cast(tex)->update_sub(0, offset, extent, 
gpu_data_format, pixels);
+  reinterpret_cast(tex)->update_sub(0, offset, extent, data_format, 
pixels);
 }
 
 void *GPU_texture_read(GPUTexture *tex_, eGPUDataFormat data_format, int 
miplvl)
diff --git a/source/blender/gpu/opengl/gl_debug.cc 
b/source/blender/gpu/opengl/gl_debug.cc
index 5915b3ea226..d54ea0919b6 100644
--- a/source/blender/gpu/opengl/gl_debug.cc
+++ b/source/blender/gpu/opengl/gl_debug.cc
@@ -207,7 +207,7 @@ void check_gl_resources(const char *info)
   /* NOTE: This only check binding. To be valid, the bound texture needs to
* be the same format/target the shader expects. */
   uint64_t tex_needed = interface->enabled_tex_mask_;
-  tex_needed &= ~ctx->state_manager_active_get()->bound_texture_slots();
+  tex_needed &= ~GLContext::state_manager_active_get()->bound_texture_slots();
 
   if (ubo_needed == 0 && tex_needed == 0) {
 return;

[Bf-blender-cvs] [aa32e7a2f31] master: Cleanup: GPUVertBuf: Replace TRUST_NO_ONE by BLI_asserts and ifdef DEBUG

2020-09-07 Thread Clément Foucault
Commit: aa32e7a2f31486503edb430b15ce31a819e02702
Author: Clément Foucault
Date:   Mon Sep 7 02:12:59 2020 +0200
Branches: master
https://developer.blender.org/rBaa32e7a2f31486503edb430b15ce31a819e02702

Cleanup: GPUVertBuf: Replace TRUST_NO_ONE by BLI_asserts and ifdef DEBUG

===

M   source/blender/gpu/GPU_vertex_buffer.h
M   source/blender/gpu/intern/gpu_vertex_buffer.cc

===

diff --git a/source/blender/gpu/GPU_vertex_buffer.h 
b/source/blender/gpu/GPU_vertex_buffer.h
index e42d6c47b58..80f0501edc0 100644
--- a/source/blender/gpu/GPU_vertex_buffer.h
+++ b/source/blender/gpu/GPU_vertex_buffer.h
@@ -107,7 +107,7 @@ typedef struct GPUVertBufRaw {
   uint stride;
   unsigned char *data;
   unsigned char *data_init;
-#if TRUST_NO_ONE
+#ifdef DEBUG
   /* Only for overflow check */
   unsigned char *_data_end;
 #endif
@@ -117,9 +117,7 @@ GPU_INLINE void *GPU_vertbuf_raw_step(GPUVertBufRaw *a)
 {
   unsigned char *data = a->data;
   a->data += a->stride;
-#if TRUST_NO_ONE
-  assert(data < a->_data_end);
-#endif
+  BLI_assert(data < a->_data_end);
   return (void *)data;
 }
 
diff --git a/source/blender/gpu/intern/gpu_vertex_buffer.cc 
b/source/blender/gpu/intern/gpu_vertex_buffer.cc
index 62c07761b4c..4cc2af889e6 100644
--- a/source/blender/gpu/intern/gpu_vertex_buffer.cc
+++ b/source/blender/gpu/intern/gpu_vertex_buffer.cc
@@ -193,7 +193,6 @@ void GPU_vertbuf_data_len_set(GPUVertBuf *verts_, uint 
v_len)
   VertBuf *verts = unwrap(verts_);
   BLI_assert(verts->data != NULL); /* Only for dynamic data. */
   BLI_assert(v_len <= verts->vertex_alloc);
-
   verts->vertex_len = v_len;
 }
 
@@ -202,28 +201,21 @@ void GPU_vertbuf_attr_set(GPUVertBuf *verts_, uint a_idx, 
uint v_idx, const void
   VertBuf *verts = unwrap(verts_);
   const GPUVertFormat *format = >format;
   const GPUVertAttr *a = >attrs[a_idx];
-
-#if TRUST_NO_ONE
-  assert(a_idx < format->attr_len);
-  assert(v_idx < verts->vertex_alloc);
-  assert(verts->data != NULL);
-#endif
+  BLI_assert(v_idx < verts->vertex_alloc);
+  BLI_assert(a_idx < format->attr_len);
+  BLI_assert(verts->data != NULL);
   verts->flag |= GPU_VERTBUF_DATA_DIRTY;
-  memcpy((uchar *)verts->data + a->offset + v_idx * format->stride, data, 
a->sz);
+  memcpy(verts->data + a->offset + v_idx * format->stride, data, a->sz);
 }
 
 void GPU_vertbuf_attr_fill(GPUVertBuf *verts_, uint a_idx, const void *data)
 {
   VertBuf *verts = unwrap(verts_);
   const GPUVertFormat *format = >format;
+  BLI_assert(a_idx < format->attr_len);
   const GPUVertAttr *a = >attrs[a_idx];
-
-#if TRUST_NO_ONE
-  assert(a_idx < format->attr_len);
-#endif
   const uint stride = a->sz; /* tightly packed input data */
   verts->flag |= GPU_VERTBUF_DATA_DIRTY;
-
   GPU_vertbuf_attr_fill_stride(verts_, a_idx, stride, data);
 }
 
@@ -232,13 +224,10 @@ void GPU_vertbuf_vert_set(GPUVertBuf *verts_, uint v_idx, 
const void *data)
 {
   VertBuf *verts = unwrap(verts_);
   const GPUVertFormat *format = >format;
-
-#if TRUST_NO_ONE
-  assert(v_idx < verts->vertex_alloc);
-  assert(verts->data != NULL);
-#endif
+  BLI_assert(v_idx < verts->vertex_alloc);
+  BLI_assert(verts->data != NULL);
   verts->flag |= GPU_VERTBUF_DATA_DIRTY;
-  memcpy((uchar *)verts->data + v_idx * format->stride, data, format->stride);
+  memcpy(verts->data + v_idx * format->stride, data, format->stride);
 }
 
 void GPU_vertbuf_attr_fill_stride(GPUVertBuf *verts_, uint a_idx, uint stride, 
const void *data)
@@ -246,11 +235,8 @@ void GPU_vertbuf_attr_fill_stride(GPUVertBuf *verts_, uint 
a_idx, uint stride, c
   VertBuf *verts = unwrap(verts_);
   const GPUVertFormat *format = >format;
   const GPUVertAttr *a = >attrs[a_idx];
-
-#if TRUST_NO_ONE
-  assert(a_idx < format->attr_len);
-  assert(verts->data != NULL);
-#endif
+  BLI_assert(a_idx < format->attr_len);
+  BLI_assert(verts->data != NULL);
   verts->flag |= GPU_VERTBUF_DATA_DIRTY;
   const uint vertex_len = verts->vertex_len;
 
@@ -261,9 +247,8 @@ void GPU_vertbuf_attr_fill_stride(GPUVertBuf *verts_, uint 
a_idx, uint stride, c
   else {
 /* we must copy it per vertex */
 for (uint v = 0; v < vertex_len; v++) {
-  memcpy((uchar *)verts->data + a->offset + v * format->stride,
- (const uchar *)data + v * stride,
- a->sz);
+  memcpy(
+  verts->data + a->offset + v * format->stride, (const uchar *)data + 
v * stride, a->sz);
 }
   }
 }
@@ -273,11 +258,8 @@ void GPU_vertbuf_attr_get_raw_data(GPUVertBuf *verts_, 
uint a_idx, GPUVertBufRaw
   VertBuf *verts = unwrap(verts_);
   const GPUVertFormat *format = >format;
   const GPUVertAttr *a = >attrs[a_idx];
-
-#if TRUST_NO_ONE
-  assert(a_idx < format->attr_len);
-  assert(verts->data != NULL);
-#endif
+  BLI_assert(a_idx < format->attr_len);
+  BLI_assert(verts->data != NULL);
 
   verts->flag |= GPU_VERTBUF_DATA_DIRTY;
   verts->flag &= 

[Bf-blender-cvs] [99e3541d3b1] master: Docs: add note on updating startup defaults to dna_defaults

2020-09-07 Thread Campbell Barton
Commit: 99e3541d3b1a1fc62fcd24e9f0d12a631e4caead
Author: Campbell Barton
Date:   Mon Sep 7 20:49:50 2020 +1000
Branches: master
https://developer.blender.org/rB99e3541d3b1a1fc62fcd24e9f0d12a631e4caead

Docs: add note on updating startup defaults to dna_defaults

Without this it's not clear which defaults these values are used for.

===

M   source/blender/makesdna/intern/dna_defaults.c

===

diff --git a/source/blender/makesdna/intern/dna_defaults.c 
b/source/blender/makesdna/intern/dna_defaults.c
index 2d86e97debf..50794d1d2e5 100644
--- a/source/blender/makesdna/intern/dna_defaults.c
+++ b/source/blender/makesdna/intern/dna_defaults.c
@@ -19,6 +19,9 @@
 /** \file
  * \ingroup DNA
  *
+ * DNA Defaults
+ * 
+ *
  * This API provides direct access to DNA default structs
  * to avoid duplicating values for initialization, versioning and RNA.
  * This allows DNA default definitions to be defined in a single header along 
side the types.
@@ -26,11 +29,20 @@
  *
  * Defining the defaults is optional since it doesn't make sense for some 
structs to have defaults.
  *
+ * Adding Defaults
+ * ---
+ *
+ * Adding/removing defaults for existing structs can be done by hand.
+ * When adding new defaults for larger structs you may want to write-out the 
in-memory data.
+ *
  * To create these defaults there is a GDB script which can be handy to get 
started:
  * `./source/tools/utils/gdb_struct_repr_c99.py`
  *
  * Magic numbers should be replaced with flags before committing.
  *
+ * Public API
+ * --
+ *
  * The main functions to access these are:
  * - #DNA_struct_default_get
  * - #DNA_struct_default_alloc
@@ -38,6 +50,22 @@
  * These access the struct table #DNA_default_table using the struct number.
  *
  * \note Struct members only define their members (pointers are left as NULL 
set).
+ *
+ * Typical Usage
+ * -
+ *
+ * While there is no restriction for using these defaults,
+ * it's worth noting where these functions are typically used:
+ *
+ * - When creating/allocating new data.
+ * - RNA property defaults, used for "Set Default Value" in the buttons 
right-click context menu.
+ *
+ * These defaults are not used:
+ *
+ * - When loading old files that don't contain newly added struct members 
(these will be zeroed)
+ *   to set their values use `versioning_{BLENDER_VERSION}.c` source files.
+ * - For startup file data, to update these defaults use
+ *   #BLO_update_defaults_startup_blend & #BLO_version_defaults_userpref_blend.
  */
 
 #include 

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a2921067994] master: Fix T80531: Dope Sheet Shape Key Editor search/filter not working

2020-09-07 Thread Philipp Oeser
Commit: a2921067994bdec012a5b9edc7168d10b1b0627c
Author: Philipp Oeser
Date:   Mon Sep 7 11:45:10 2020 +0200
Branches: master
https://developer.blender.org/rBa2921067994bdec012a5b9edc7168d10b1b0627c

Fix T80531: Dope Sheet Shape Key Editor search/filter not working

Looks like this has just not been implemented before.
Use the name matching method used in other Dope Sheet UI modes.

Maniphest Tasks: T80531

Differential Revision: https://developer.blender.org/D8824

===

M   source/blender/editors/animation/anim_filter.c

===

diff --git a/source/blender/editors/animation/anim_filter.c 
b/source/blender/editors/animation/anim_filter.c
index b75437fff45..3416d72c021 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1715,6 +1715,7 @@ static size_t animdata_filter_shapekey(bAnimContext *ac,
   /* check if channels or only F-Curves */
   if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
 KeyBlock *kb;
+bDopeSheet *ads = ac->ads;
 
 /* loop through the channels adding ShapeKeys as appropriate */
 for (kb = key->block.first; kb; kb = kb->next) {
@@ -1723,6 +1724,12 @@ static size_t animdata_filter_shapekey(bAnimContext *ac,
 continue;
   }
 
+  /* Skip shapekey if the name doesn't match the filter string. */
+  if (ads != NULL && ads->searchstr[0] != '\0' &&
+  name_matches_dopesheet_filter(ads, kb->name) == false) {
+continue;
+  }
+
   /* only work with this channel and its subchannels if it is editable */
   if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_SHAPEKEY(kb)) {
 /* Only include this track if selected in a way consistent

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bc0855d319c] soc-2020-greasepencil-curve: Merge branch 'greasepencil-edit-curve' into soc-2020-greasepencil-curve

2020-09-07 Thread Falk David
Commit: bc0855d319cd11ef7b358ae4c017bb802137770f
Author: Falk David
Date:   Mon Sep 7 11:40:07 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rBbc0855d319cd11ef7b358ae4c017bb802137770f

Merge branch 'greasepencil-edit-curve' into soc-2020-greasepencil-curve

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [10cfa388479] soc-2020-fluid-tools: Included `world_block` UBO in the shading groups for volume in Workbench when slicing is used to avoid 'Missing UBO bind' error as in P1616.

2020-09-07 Thread Sriharsha Kotcharlakot
Commit: 10cfa388479cb21f2906328d943eab174acfcbde
Author: Sriharsha Kotcharlakot
Date:   Mon Sep 7 14:51:36 2020 +0530
Branches: soc-2020-fluid-tools
https://developer.blender.org/rB10cfa388479cb21f2906328d943eab174acfcbde

Included `world_block` UBO in the shading groups for volume in Workbench when 
slicing is used to avoid 'Missing UBO bind' error as in P1616.

===

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

===

diff --git a/source/blender/draw/engines/workbench/workbench_volume.c 
b/source/blender/draw/engines/workbench/workbench_volume.c
index 4a9fb05b586..148760e3750 100644
--- a/source/blender/draw/engines/workbench/workbench_volume.c
+++ b/source/blender/draw/engines/workbench/workbench_volume.c
@@ -127,6 +127,7 @@ static void 
workbench_volume_modifier_cache_populate(WORKBENCH_Data *vedata,
 float step_length = max_ff(1e-16f, dim[axis] * 0.05f);
 
 grp = DRW_shgroup_create(sh, vedata->psl->volume_ps);
+DRW_shgroup_uniform_block(grp, "world_block", wpd->world_ubo);
 DRW_shgroup_uniform_float_copy(grp, "slicePosition", fds->slice_depth);
 DRW_shgroup_uniform_int_copy(grp, "sliceAxis", axis);
 DRW_shgroup_uniform_float_copy(grp, "stepLength", step_length);
@@ -269,6 +270,7 @@ static void 
workbench_volume_object_cache_populate(WORKBENCH_Data *vedata,
 const float slice_position = volume->display.slice_depth;
 
 grp = DRW_shgroup_create(sh, vedata->psl->volume_ps);
+DRW_shgroup_uniform_block(grp, "world_block", wpd->world_ubo);
 DRW_shgroup_uniform_float_copy(grp, "slicePosition", slice_position);
 DRW_shgroup_uniform_int_copy(grp, "sliceAxis", axis);
 DRW_shgroup_uniform_float_copy(grp, "stepLength", step_length);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b351607996e] master: Cleanup: update comment after Clang-Tidy bugprone-incorrect-roundings fixes

2020-09-07 Thread Sybren A. Stüvel
Commit: b351607996e467f89ce841630a84244fab6fe3f5
Author: Sybren A. Stüvel
Date:   Mon Sep 7 10:12:12 2020 +0200
Branches: master
https://developer.blender.org/rBb351607996e467f89ce841630a84244fab6fe3f5

Cleanup: update comment after Clang-Tidy bugprone-incorrect-roundings fixes

Remove the comment about adding `0.5`, as this is no longer done (since
fb5e2f56109e).

No functional changes.

===

M   source/blender/imbuf/intern/imageprocess.c

===

diff --git a/source/blender/imbuf/intern/imageprocess.c 
b/source/blender/imbuf/intern/imageprocess.c
index 79382e3be76..bcac140f036 100644
--- a/source/blender/imbuf/intern/imageprocess.c
+++ b/source/blender/imbuf/intern/imageprocess.c
@@ -201,8 +201,7 @@ void bilinear_interpolation_color_wrap(
 row3I = (unsigned char *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x2;
 row4I = (unsigned char *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x2;
 
-/* need to add 0.5 to avoid rounding down (causes darken with the smear 
brush)
- * tested with white images and this should not wrap back to zero */
+/* Tested with white images and this should not wrap back to zero. */
 outI[0] = roundf(ma_mb * row1I[0] + a_mb * row3I[0] + ma_b * row2I[0] + 
a_b * row4I[0]);
 outI[1] = roundf(ma_mb * row1I[1] + a_mb * row3I[1] + ma_b * row2I[1] + 
a_b * row4I[1]);
 outI[2] = roundf(ma_mb * row1I[2] + a_mb * row3I[2] + ma_b * row2I[2] + 
a_b * row4I[2]);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d122911d109] master: Fix mistake in Clang-Tidy bugprone-incorrect-roundings fix

2020-09-07 Thread Sybren A. Stüvel
Commit: d122911d109305dc4768538fdd6e9b9ce5bc130e
Author: Sybren A. Stüvel
Date:   Mon Sep 7 10:09:02 2020 +0200
Branches: master
https://developer.blender.org/rBd122911d109305dc4768538fdd6e9b9ce5bc130e

Fix mistake in Clang-Tidy bugprone-incorrect-roundings fix

Remove a `+ 0.5` that I overlooked in fb5e2f56109e.

===

M   source/blender/imbuf/intern/bmp.c

===

diff --git a/source/blender/imbuf/intern/bmp.c 
b/source/blender/imbuf/intern/bmp.c
index 0b185f3442a..ab818d451d6 100644
--- a/source/blender/imbuf/intern/bmp.c
+++ b/source/blender/imbuf/intern/bmp.c
@@ -329,8 +329,8 @@ int imb_savebmp(ImBuf *ibuf, const char *filepath, int 
UNUSED(flags))
   putShortLSB(is_grayscale ? 8 : 24, ofile);
   putIntLSB(0, ofile);
   putIntLSB(bytesize, ofile);
-  putIntLSB(round(ibuf->ppm[0] + 0.5), ofile);
-  putIntLSB(round(ibuf->ppm[1] + 0.5), ofile);
+  putIntLSB(round(ibuf->ppm[0]), ofile);
+  putIntLSB(round(ibuf->ppm[1]), ofile);
   putIntLSB(0, ofile);
   putIntLSB(0, ofile);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [08ab3fa7eae] greasepencil-object: Merge branch 'master' into greasepencil-object

2020-09-07 Thread Antonio Vazquez
Commit: 08ab3fa7eae11cc3f3091eaba078441f7274ff45
Author: Antonio Vazquez
Date:   Mon Sep 7 10:13:56 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rB08ab3fa7eae11cc3f3091eaba078441f7274ff45

Merge branch 'master' into greasepencil-object

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b25a87ea493] greasepencil-edit-curve: Merge branch 'master' into greasepencil-edit-curve

2020-09-07 Thread Antonio Vazquez
Commit: b25a87ea49399c8a1363ac6aee65e74e4fe9d7f3
Author: Antonio Vazquez
Date:   Mon Sep 7 10:13:41 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rBb25a87ea49399c8a1363ac6aee65e74e4fe9d7f3

Merge branch 'master' into greasepencil-edit-curve

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7170f7a0414] master: EEVEE: Shaders tests

2020-09-07 Thread Jeroen Bakker
Commit: 7170f7a0414ecded72fba3ef69e28be2be148291
Author: Jeroen Bakker
Date:   Mon Sep 7 08:19:09 2020 +0200
Branches: master
https://developer.blender.org/rB7170f7a0414ecded72fba3ef69e28be2be148291

EEVEE: Shaders tests

This will add the remaining static shaders to the eevee shader test suite.

- Downsampling
- GGX LUT generation
- Mist
- Motion Blur
- Ambient Occlusion
- Render Passes
- Screen Raytracing
- Shadows
- Subsurface
- Volumes

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8779

===

M   source/blender/draw/engines/eevee/eevee_effects.c
M   source/blender/draw/engines/eevee/eevee_engine.c
M   source/blender/draw/engines/eevee/eevee_lut_gen.c
M   source/blender/draw/engines/eevee/eevee_mist.c
M   source/blender/draw/engines/eevee/eevee_motion_blur.c
M   source/blender/draw/engines/eevee/eevee_occlusion.c
M   source/blender/draw/engines/eevee/eevee_private.h
M   source/blender/draw/engines/eevee/eevee_renderpasses.c
M   source/blender/draw/engines/eevee/eevee_screen_raytrace.c
M   source/blender/draw/engines/eevee/eevee_shaders.c
M   source/blender/draw/engines/eevee/eevee_shadows.c
M   source/blender/draw/engines/eevee/eevee_subsurface.c
M   source/blender/draw/engines/eevee/eevee_temporal_sampling.c
M   source/blender/draw/engines/eevee/eevee_volumes.c
M   source/blender/draw/engines/eevee/shaders/bsdf_lut_frag.glsl
M   source/blender/draw/tests/shaders_test.cc

===

diff --git a/source/blender/draw/engines/eevee/eevee_effects.c 
b/source/blender/draw/engines/eevee/eevee_effects.c
index a7b067c99d6..2bd1a875371 100644
--- a/source/blender/draw/engines/eevee/eevee_effects.c
+++ b/source/blender/draw/engines/eevee/eevee_effects.c
@@ -33,21 +33,6 @@
 #include "eevee_private.h"
 
 static struct {
-  /* Downsample Depth */
-  struct GPUShader *minz_downlevel_sh;
-  struct GPUShader *maxz_downlevel_sh;
-  struct GPUShader *minz_downdepth_sh;
-  struct GPUShader *maxz_downdepth_sh;
-  struct GPUShader *minz_downdepth_layer_sh;
-  struct GPUShader *maxz_downdepth_layer_sh;
-  struct GPUShader *maxz_copydepth_layer_sh;
-  struct GPUShader *minz_copydepth_sh;
-  struct GPUShader *maxz_copydepth_sh;
-
-  /* Simple Downsample */
-  struct GPUShader *downsample_sh;
-  struct GPUShader *downsample_cube_sh;
-
   /* These are just references, not actually allocated */
   struct GPUTexture *depth_src;
   struct GPUTexture *color_src;
@@ -56,49 +41,6 @@ static struct {
   float cube_texel_size;
 } e_data = {NULL}; /* Engine data */
 
-extern char datatoc_common_uniforms_lib_glsl[];
-extern char datatoc_common_view_lib_glsl[];
-extern char datatoc_bsdf_common_lib_glsl[];
-extern char datatoc_effect_minmaxz_frag_glsl[];
-extern char datatoc_effect_downsample_frag_glsl[];
-extern char datatoc_effect_downsample_cube_frag_glsl[];
-extern char datatoc_lightprobe_vert_glsl[];
-extern char datatoc_lightprobe_geom_glsl[];
-
-static void eevee_create_shader_downsample(void)
-{
-  e_data.downsample_sh = 
DRW_shader_create_fullscreen(datatoc_effect_downsample_frag_glsl, NULL);
-  e_data.downsample_cube_sh = DRW_shader_create(datatoc_lightprobe_vert_glsl,
-datatoc_lightprobe_geom_glsl,
-
datatoc_effect_downsample_cube_frag_glsl,
-NULL);
-
-  e_data.minz_downlevel_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-  "#define 
MIN_PASS\n");
-  e_data.maxz_downlevel_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-  "#define 
MAX_PASS\n");
-  e_data.minz_downdepth_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-  "#define 
MIN_PASS\n");
-  e_data.maxz_downdepth_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-  "#define 
MAX_PASS\n");
-  e_data.minz_downdepth_layer_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-"#define 
MIN_PASS\n"
-"#define 
LAYERED\n");
-  e_data.maxz_downdepth_layer_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-"#define 
MAX_PASS\n"
-"#define 
LAYERED\n");
-  e_data.maxz_copydepth_layer_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-"#define 
MAX_PASS\n"

[Bf-blender-cvs] [267b8e1a5c3] master: Cleanup: spelling

2020-09-07 Thread Campbell Barton
Commit: 267b8e1a5c322c87d9684638cc29c984c6d33e58
Author: Campbell Barton
Date:   Mon Sep 7 15:57:12 2020 +1000
Branches: master
https://developer.blender.org/rB267b8e1a5c322c87d9684638cc29c984c6d33e58

Cleanup: spelling

Also correct wrapped lines of example code in threads.cc.

===

M   intern/ghost/intern/GHOST_DropTargetX11.h
M   intern/ghost/intern/GHOST_SystemCocoa.mm
M   intern/ghost/intern/GHOST_SystemX11.cpp
M   source/blender/blenkernel/BKE_DerivedMesh.h
M   source/blender/blenkernel/BKE_object.h
M   source/blender/blenlib/intern/listbase.c
M   source/blender/blenlib/intern/mesh_boolean.cc
M   source/blender/blenlib/intern/threads.cc
M   source/blender/draw/engines/gpencil/gpencil_render.c
M   source/blender/draw/intern/draw_instance_data.c
M   source/blender/draw/intern/draw_manager_data.c
M   source/blender/editors/animation/anim_channels_edit.c
M   source/blender/editors/screen/screen_edit.c
M   source/blender/gpu/intern/gpu_material.c
M   source/blender/makesrna/intern/rna_object.c

===

diff --git a/intern/ghost/intern/GHOST_DropTargetX11.h 
b/intern/ghost/intern/GHOST_DropTargetX11.h
index 066f2f6bba2..a96852da7bb 100644
--- a/intern/ghost/intern/GHOST_DropTargetX11.h
+++ b/intern/ghost/intern/GHOST_DropTargetX11.h
@@ -91,7 +91,7 @@ class GHOST_DropTargetX11 {
   /**
* Fully decode file URL (i.e. converts "file:///a%20b/test" to "/a b/test")
* \param fileUrl - file path URL to be fully decoded
-   * \return decoded file path (resutl should be free-d)
+   * \return decoded file path (result should be free-d)
*/
   char *FileUrlDecode(char *fileUrl);
 
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm 
b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 467f59defea..8e9be626684 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1249,7 +1249,7 @@ GHOST_TSuccess 
GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
 [bitmapImage setSize:imgSize];
 
 /* Convert the image in a RGBA 32bit format */
-/* As Core Graphics does not support contextes with non 
premutliplied alpha,
+/* As Core Graphics does not support contexts with non 
premutliplied alpha,
  we need to get alpha key values in a separate batch */
 
 /* First get RGB values w/o Alpha to avoid pre-multiplication,
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp 
b/intern/ghost/intern/GHOST_SystemX11.cpp
index 2a07e02706b..1c8267fa482 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -1043,7 +1043,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
*   is unmodified (or anyone swapping the keys with xmodmap).
*
* - XLookupKeysym seems to always use first defined keymap (see 
T47228), which generates
-   *   keycodes unusable by ghost_key_from_keysym for 
non-latin-compatible keymaps.
+   *   keycodes unusable by ghost_key_from_keysym for 
non-Latin-compatible keymaps.
*
* To address this, we:
*
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h 
b/source/blender/blenkernel/BKE_DerivedMesh.h
index 42ce7e06c26..c824ed03ee6 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -215,7 +215,7 @@ struct DerivedMesh {
   void *(*getPolyDataArray)(DerivedMesh *dm, int type);
 
   /** Retrieves the base CustomData structures for
-   * verts/edges/tessfaces/loops/facdes*/
+   * verts/edges/tessfaces/loops/faces. */
   CustomData *(*getVertDataLayout)(DerivedMesh *dm);
   CustomData *(*getEdgeDataLayout)(DerivedMesh *dm);
   CustomData *(*getTessFaceDataLayout)(DerivedMesh *dm);
diff --git a/source/blender/blenkernel/BKE_object.h 
b/source/blender/blenkernel/BKE_object.h
index 143955e4930..387d3dfc806 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -200,7 +200,7 @@ void BKE_object_where_is_calc_time(struct Depsgraph 
*depsgraph,
float ctime);
 void BKE_object_where_is_calc_mat4(struct Object *ob, float r_obmat[4][4]);
 
-/* possibly belong in own moduke? */
+/* Possibly belong in own module? */
 struct BoundBox *BKE_boundbox_alloc_unit(void);
 void BKE_boundbox_init_from_minmax(struct BoundBox *bb, const float min[3], 
const float max[3]);
 void BKE_boundbox_calc_center_aabb(const struct BoundBox *bb, float r_cent[3]);
diff --git a/source/blender/blenlib/intern/listbase.c 
b/source/blender/blenlib/intern/listbase.c
index 5e88f8f3e44..acb18d0e53e 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -224,7 +224,7 @@ void BLI_listbase_swaplinks(ListBase *listbase, void 
*vlinka, void *vlinkb)