[Bf-blender-cvs] [ead469c] soc-2016-pbvh-painting: Merge branch 'soc-2016-pbvh-painting' of git.blender.org:blender into soc-2016-pbvh-painting

2016-09-13 Thread Nathan Vollmer
Commit: ead469c83b6203734fbede1c9eab1de45d7dde3b
Author: Nathan Vollmer
Date:   Tue Sep 13 17:47:31 2016 -0600
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rBead469c83b6203734fbede1c9eab1de45d7dde3b

Merge branch 'soc-2016-pbvh-painting' of git.blender.org:blender into 
soc-2016-pbvh-painting

===



===



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


[Bf-blender-cvs] [0fac021] soc-2016-pbvh-painting: Refactoring

2016-09-13 Thread Nathan Vollmer
Commit: 0fac021c2165ef4b7bf975bfbe7f41f9583276e0
Author: Nathan Vollmer
Date:   Tue Sep 13 17:47:09 2016 -0600
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rB0fac021c2165ef4b7bf975bfbe7f41f9583276e0

Refactoring

===

M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/blenkernel/BKE_paint.h
M   source/blender/blenkernel/intern/paint.c
M   source/blender/blenlib/BLI_math_base.h
M   source/blender/blenlib/intern/math_base_inline.c
M   source/blender/blenloader/intern/versioning_defaults.c
M   source/blender/editors/sculpt_paint/paint_vertex.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index ee9b7e5..7df4d59 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1702,7 +1702,6 @@ class VIEW3D_PT_tools_brush_appearance(Panel, 
View3DPaintPanel):
 class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
 bl_category = "Tools"
 bl_context = "weightpaint"
-bl_options = {'DEFAULT_CLOSED'}
 bl_label = "Weight Tools"
 
 def draw(self, context):
diff --git a/source/blender/blenkernel/BKE_paint.h 
b/source/blender/blenkernel/BKE_paint.h
index eb47cd8..9be9f64 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -204,16 +204,16 @@ typedef struct SculptSession {
struct SculptStroke *stroke;
struct StrokeCache *cache;
 
-   int *map_mem;
-   MeshElemMap* vert_to_loop;
+   int *vert_map_mem;
+   MeshElemMap *vert_to_loop;
int *poly_map_mem;
-   MeshElemMap* vert_to_poly;
+   MeshElemMap *vert_to_poly;
 
-   unsigned long* totalColor;
-   double* totalWeight;
-   unsigned int *totloopsHit;
-   float *maxWeight;
-   unsigned int *previousColor;
+   unsigned int *total_color;
+   double *total_weight;
+   unsigned int *tot_loops_hit;
+   float *max_weight;
+   unsigned int *previous_color;
 } SculptSession;
 
 void BKE_sculptsession_free(struct Object *ob);
diff --git a/source/blender/blenkernel/intern/paint.c 
b/source/blender/blenkernel/intern/paint.c
index 734d2bf..08a4308 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -750,26 +750,24 @@ void BKE_sculptsession_free(Object *ob)
/* Free maps */
if (ss->vert_to_loop)
MEM_freeN(ss->vert_to_loop);
-   if (ss->map_mem)
-   MEM_freeN(ss->map_mem);
+   if (ss->vert_map_mem)
+   MEM_freeN(ss->vert_map_mem);
if (ss->vert_to_poly)
MEM_freeN(ss->vert_to_poly);
if (ss->poly_map_mem)
MEM_freeN(ss->poly_map_mem);
 
-   /* Free average brush arrays */
-   if (ob->sculpt->totloopsHit)
-   MEM_freeN(ob->sculpt->totloopsHit);
-
-   if (ob->sculpt->totalColor)
-   MEM_freeN(ob->sculpt->totalColor);
-
-   MEM_freeN(ob->sculpt->totalWeight);
-
-   if (ob->sculpt->maxWeight)
-   MEM_freeN(ob->sculpt->maxWeight);
-   if (ob->sculpt->previousColor)
-   MEM_freeN(ob->sculpt->previousColor);
+   /* Free average, blur, and spray brush arrays */
+   if (ob->sculpt->tot_loops_hit)
+   MEM_freeN(ob->sculpt->tot_loops_hit);
+   if (ob->sculpt->total_color)
+   MEM_freeN(ob->sculpt->total_color);
+   if (ob->sculpt->total_weight)
+ MEM_freeN(ob->sculpt->total_weight);
+   if (ob->sculpt->max_weight)
+   MEM_freeN(ob->sculpt->max_weight);
+   if (ob->sculpt->previous_color)
+   MEM_freeN(ob->sculpt->previous_color);
 
MEM_freeN(ss);
 
diff --git a/source/blender/blenlib/BLI_math_base.h 
b/source/blender/blenlib/BLI_math_base.h
index 5751aee..e97a250 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -205,7 +205,6 @@ MINLINE unsigned int power_of_2_min_u(unsigned int x);
 
 MINLINE int iroundf(float a);
 MINLINE int divide_round_i(int a, int b);
-MINLINE unsigned long divide_round_ul(unsigned long a, unsigned long b);
 MINLINE int mod_i(int i, int n);
 
 int pow_i(int base, int exp);
diff --git a/source/blender/blenlib/intern/math_base_inline.c 
b/source/blender/blenlib/intern/math_base_inline.c
index e7362ed..8d2d80c 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -193,11 +193,6 @@ MINLINE int 

[Bf-blender-cvs] [a267710] master: FileBrowser: Always do full cache refresh while we are still listing...

2016-09-13 Thread Bastien Montagne
Commit: a2677100fef06afdbede1985028520be6646efc2
Author: Bastien Montagne
Date:   Tue Sep 13 19:02:27 2016 +0200
Branches: master
https://developer.blender.org/rBa2677100fef06afdbede1985028520be6646efc2

FileBrowser: Always do full cache refresh while we are still listing...

Does not seem to be a problem with embeded filelisting code, but was breaking 
with some experimental asset engines.

===

M   source/blender/editors/space_file/filelist.c

===

diff --git a/source/blender/editors/space_file/filelist.c 
b/source/blender/editors/space_file/filelist.c
index 1471932..b60487a 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1651,6 +1651,7 @@ bool filelist_file_cache_block(struct FileList *filelist, 
const int index)
int start_index = max_ii(0, index - (cache_size / 2));
int end_index = min_ii(nbr_entries, index + (cache_size / 2));
int i;
+   const bool full_refresh = (filelist->flags & FL_IS_READY) != 0;
 
if ((index < 0) || (index >= nbr_entries)) {
 // printf("Wrong index %d ([%d:%d])", index, 0, nbr_entries);
@@ -1673,8 +1674,8 @@ bool filelist_file_cache_block(struct FileList *filelist, 
const int index)
 //start_index, end_index, index, cache->block_start_index, 
cache->block_end_index);
 
/* If we have something to (re)cache... */
-   if ((start_index != cache->block_start_index) || (end_index != 
cache->block_end_index)) {
-   if ((start_index >= cache->block_end_index) || (end_index <= 
cache->block_start_index)) {
+   if (full_refresh || (start_index != cache->block_start_index) || 
(end_index != cache->block_end_index)) {
+   if (full_refresh || (start_index >= cache->block_end_index) || 
(end_index <= cache->block_start_index)) {
int size1 = cache->block_end_index - 
cache->block_start_index;
int size2 = 0;
int idx1 = cache->block_cursor, idx2 = 0;

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


[Bf-blender-cvs] [ddb0a27] temp_manipulators_core: Cleanup: Line length, indentation, etc

2016-09-13 Thread Julian Eisel
Commit: ddb0a27e0e99bd06a50c971e410845bcb0a84d5a
Author: Julian Eisel
Date:   Tue Sep 13 15:30:13 2016 +0200
Branches: temp_manipulators_core
https://developer.blender.org/rBddb0a27e0e99bd06a50c971e410845bcb0a84d5a

Cleanup: Line length, indentation, etc

===

M   source/blender/windowmanager/manipulators/WM_manipulator_api.h
M   source/blender/windowmanager/manipulators/WM_manipulator_library.h
M   
source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c
M   
source/blender/windowmanager/manipulators/intern/manipulator_library/cage_manipulator.c
M   
source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_utils.c
M   
source/blender/windowmanager/manipulators/intern/manipulator_library/primitive_manipulator.c
M   source/blender/windowmanager/manipulators/intern/wm_manipulatorgroup.c
M   source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
M   source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h

===

diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_api.h 
b/source/blender/windowmanager/manipulators/WM_manipulator_api.h
index 6109141..3b4eace 100644
--- a/source/blender/windowmanager/manipulators/WM_manipulator_api.h
+++ b/source/blender/windowmanager/manipulators/WM_manipulator_api.h
@@ -52,7 +52,9 @@ struct wmManipulator *WM_manipulator_new(
 void (*render_3d_intersection)(const struct bContext *, struct 
wmManipulator *, int),
 int  (*intersect)(struct bContext *, const struct wmEvent *, struct 
wmManipulator *),
 int  (*handler)(struct bContext *, const struct wmEvent *, struct 
wmManipulator *, const int));
-void WM_manipulator_delete(ListBase *manipulatorlist, struct wmManipulatorMap 
*mmap, struct wmManipulator *manipulator, struct bContext *C);
+void WM_manipulator_delete(
+ListBase *manipulatorlist, struct wmManipulatorMap *mmap, struct 
wmManipulator *manipulator,
+struct bContext *C);
 
 void WM_manipulator_set_property(struct wmManipulator *, int slot, struct 
PointerRNA *ptr, const char *propname);
 struct PointerRNA *WM_manipulator_set_operator(struct wmManipulator *, const 
char *opname);
@@ -79,7 +81,8 @@ struct wmManipulatorGroupType 
*WM_manipulatorgrouptype_append_runtime(
 void WM_manipulatorgrouptype_init_runtime(
 const struct Main *bmain, struct wmManipulatorMapType *mmaptype,
 struct wmManipulatorGroupType *mgrouptype);
-void WM_manipulatorgrouptype_unregister(struct bContext *C, struct Main 
*bmain, struct wmManipulatorGroupType *mgroup);
+void WM_manipulatorgrouptype_unregister(
+struct bContext *C, struct Main *bmain, struct wmManipulatorGroupType 
*mgroup);
 
 struct wmKeyMap *WM_manipulatorgroup_keymap_common(
 const struct wmManipulatorGroupType *mgrouptype, struct wmKeyConfig 
*config);
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_library.h 
b/source/blender/windowmanager/manipulators/WM_manipulator_library.h
index 947ca94..1e71069 100644
--- a/source/blender/windowmanager/manipulators/WM_manipulator_library.h
+++ b/source/blender/windowmanager/manipulators/WM_manipulator_library.h
@@ -85,8 +85,10 @@ enum {
RECT_TRANSFORM_SLOT_SCALE = 1
 };
 
-struct wmManipulator *MANIPULATOR_rect_transform_new(struct wmManipulatorGroup 
*mgroup, const char *name, const int style);
-void MANIPULATOR_rect_transform_set_dimensions(struct wmManipulator 
*manipulator, const float width, const float height);
+struct wmManipulator *MANIPULATOR_rect_transform_new(
+struct wmManipulatorGroup *mgroup, const char *name, const int style);
+void MANIPULATOR_rect_transform_set_dimensions(
+struct wmManipulator *manipulator, const float width, const float 
height);
 
 
 /*  */
diff --git 
a/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c
 
b/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c
index d80c36a..7afaa66 100644
--- 
a/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c
+++ 
b/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c
@@ -247,7 +247,9 @@ static void arrow_draw_intern(ArrowManipulator *arrow, 
const bool select, const
}
 }
 
-static void manipulator_arrow_render_3d_intersect(const bContext *UNUSED(C), 
wmManipulator *manipulator, int selectionbase)
+static void manipulator_arrow_render_3d_intersect(
+const bContext *UNUSED(C), wmManipulator *manipulator,
+int selectionbase)
 {
GPU_select_load_id(selectionbase);
arrow_draw_intern((ArrowManipulator *)manipulator, true, false);
@@ -531,7 +533,8 @@ void 

[Bf-blender-cvs] [b67957a] soc-2016-pbvh-painting: Merge branch 'master' into soc-2016-pbvh-painting

2016-09-13 Thread Bastien Montagne
Commit: b67957a9f3a2766f233e8e1985c7c9f9e6a60d60
Author: Bastien Montagne
Date:   Tue Sep 13 14:05:37 2016 +0200
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rBb67957a9f3a2766f233e8e1985c7c9f9e6a60d60

Merge branch 'master' into soc-2016-pbvh-painting

===



===



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


[Bf-blender-cvs] [81a1595] soc-2016-pbvh-painting: Merge branch 'master' into soc-2016-pbvh-painting

2016-09-13 Thread Bastien Montagne
Commit: 81a15951f45b9a221a5977cbe7f181dcca560a85
Author: Bastien Montagne
Date:   Tue Sep 13 08:49:03 2016 +0200
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rB81a15951f45b9a221a5977cbe7f181dcca560a85

Merge branch 'master' into soc-2016-pbvh-painting

===



===



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


[Bf-blender-cvs] [88ddf29] soc-2016-pbvh-painting: Cleanup: Reduce diff from master (mostly emty lines...).

2016-09-13 Thread Bastien Montagne
Commit: 88ddf296bbc994f29bdaa4638fcfffaeda106997
Author: Bastien Montagne
Date:   Tue Sep 13 14:13:40 2016 +0200
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rB88ddf296bbc994f29bdaa4638fcfffaeda106997

Cleanup: Reduce diff from master (mostly emty lines...).

===

M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/editors/sculpt_paint/paint_vertex.c
M   source/blender/editors/sculpt_paint/sculpt.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index ee9b7e5..4fd87da 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1788,6 +1788,7 @@ class VIEW3D_PT_tools_vertexpaint(Panel, 
View3DPaintPanel):
 col.prop(vpaint, "use_spray")
 
 self.unified_paint_settings(col, context)
+
 # Commented out because the Apply button isn't an operator yet, making these 
settings useless
 #~ col.label(text="Gamma:")
 #~ col.prop(vpaint, "gamma", text="")
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c 
b/source/blender/editors/sculpt_paint/paint_vertex.c
index c2ce7be..0904cdf 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -798,6 +798,7 @@ static unsigned int vpaint_blend(VPaint *vp, unsigned int 
col, unsigned int colo
 {
Brush *brush = BKE_paint_brush(>paint);
const int tool = brush->vertexpaint_tool;
+
col = vpaint_blend_tool(tool, col, paintcol, alpha_i);
 
/* if no spray, clip color adding with colorig & orig alpha */
@@ -1560,6 +1561,7 @@ static void do_weight_paint_vertex_single(
{
dw->weight = wpaint_blend(wp, dw->weight, alpha, paintweight,
  wpi->brush_alpha_value, wpi->do_flip);
+
/* WATCH IT: take care of the ordering of applying mirror -> 
normalize,
 * can give wrong results [#26193], least confusing if 
normalize is done last */
 
@@ -1764,6 +1766,7 @@ static int wpaint_mode_toggle_exec(bContext *C, 
wmOperator *op)
Scene *scene = CTX_data_scene(C);
VPaint *wp = scene->toolsettings->wpaint;
Mesh *me;
+
if (!is_mode_set) {
if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) {
return OPERATOR_CANCELLED;
@@ -1786,7 +1789,6 @@ static int wpaint_mode_toggle_exec(bContext *C, 
wmOperator *op)
ED_mesh_mirror_spatial_table(NULL, NULL, NULL, NULL, 'e');
ED_mesh_mirror_topo_table(NULL, NULL, 'e');
 
-
/* If the cache is not released by a cancel or a done, free it 
now. */
if (ob->sculpt->cache){
sculpt_cache_free(ob->sculpt->cache);
@@ -1802,6 +1804,7 @@ static int wpaint_mode_toggle_exec(bContext *C, 
wmOperator *op)
 
if (wp == NULL)
wp = scene->toolsettings->wpaint = new_vpaint(1);
+
paint_cursor_start(C, weight_paint_poll);
 
BKE_paint_init(scene, ePaintWeight, PAINT_CURSOR_WEIGHT_PAINT);
@@ -2057,7 +2060,6 @@ static void vwpaint_update_cache_variants(bContext *C, 
VPaint *vd, Object *ob, P
cache->radius_squared = cache->radius * cache->radius;
 }
 
-
 static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float 
mouse[2])
 {
Scene *scene = CTX_data_scene(C);
@@ -2071,7 +2073,7 @@ static bool wpaint_stroke_test_start(bContext *C, 
wmOperator *op, const float mo
bool *defbase_sel;
SculptSession *ss = ob->sculpt;
VPaint *vd = CTX_data_tool_settings(C)->wpaint;
-   
+
float mat[4][4], imat[4][4];
 
if (wpaint_ensure_data(C, op, WPAINT_ENSURE_MIRROR, _index) == 
false) {
@@ -3010,7 +3012,7 @@ static int vpaint_mode_toggle_exec(bContext *C, 
wmOperator *op)
 
if (vp == NULL)
vp = scene->toolsettings->vpaint = new_vpaint(0);
-
+   
paint_cursor_start(C, vertex_paint_poll);
 
BKE_paint_init(scene, ePaintVertex, PAINT_CURSOR_VERTEX_PAINT);
@@ -3166,6 +3168,7 @@ static void UNUSED_FUNCTION(Nvpaint_paint_poly)(VPaint 
*vp, VPaintData *vpd, Mes
float alpha;
int i, j;
int totloop = mpoly->totloop;
+
int brush_alpha_pressure_i = (int)(brush_alpha_pressure * 255.0f);
 
if (brush->vertexpaint_tool == PAINT_BLEND_BLUR) {
@@ -3660,7 +3663,6 @@ static void vpaint_stroke_update_step(bContext *C, struct 
PaintStroke *stroke, P
/* If using new VBO drawing, mark mcol as dirty to force colors 
gpu buffer refresh! */
ob->derivedFinal->dirty |= DM_DIRTY_MCOL_UPDATE_DRAW;
}
-
 }

[Bf-blender-cvs] [0de69e5] master: Cycles: Implement threaded SVM nodes compilation

2016-09-13 Thread Sergey Sharybin
Commit: 0de69e56b43f194d3d79ad28c3cd6e49e88aa8d2
Author: Sergey Sharybin
Date:   Fri Sep 9 12:27:51 2016 +0200
Branches: master
https://developer.blender.org/rB0de69e56b43f194d3d79ad28c3cd6e49e88aa8d2

Cycles: Implement threaded SVM nodes compilation

The title says it all actually. From tests with barber shop scene here
gives 2-3x speedup for shader compilation on my oldie i7 machine. The
gain is mainly due to textures metadata query from jpeg files (which
seems to requite de-compression before metadata can be read). But in
theory could give nice improvements for scenes with huge node trees
as well (i'm talking about node trees of complexity of fractal which
we had reports about in the past).

Reviewers: juicyfruit, dingto, lukasstockner97, brecht

Reviewed By: brecht

Subscribers: monio, Blendify

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

===

M   intern/cycles/render/image.cpp
M   intern/cycles/render/svm.cpp
M   intern/cycles/render/svm.h

===

diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index 2454360..b387c2c 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -280,6 +280,8 @@ int ImageManager::add_image(const string& filename,
 
ImageDataType type = get_image_metadata(filename, builtin_data, 
is_linear);
 
+   thread_scoped_lock device_lock(device_mutex);
+
/* Do we have a float? */
if(type == IMAGE_DATA_TYPE_FLOAT || type == IMAGE_DATA_TYPE_FLOAT4)
is_float = true;
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index 8b3affb..9d3f49a 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -27,6 +27,7 @@
 #include "util_logging.h"
 #include "util_foreach.h"
 #include "util_progress.h"
+#include "util_task.h"
 
 CCL_NAMESPACE_BEGIN
 
@@ -44,6 +45,51 @@ void SVMShaderManager::reset(Scene * /*scene*/)
 {
 }
 
+void SVMShaderManager::device_update_shader(Scene *scene,
+Shader *shader,
+Progress *progress,
+vector *global_svm_nodes)
+{
+   if(progress->get_cancel()) {
+   return;
+   }
+   assert(shader->graph);
+
+   vector svm_nodes;
+   svm_nodes.push_back(make_int4(NODE_SHADER_JUMP, 0, 0, 0));
+
+   SVMCompiler::Summary summary;
+   SVMCompiler compiler(scene->shader_manager, scene->image_manager);
+   compiler.background = (shader == scene->default_background);
+   compiler.compile(scene, shader, svm_nodes, 0, );
+
+   VLOG(2) << "Compilation summary:\n"
+   << "Shader name: " << shader->name << "\n"
+   << summary.full_report();
+
+   if(shader->use_mis && shader->has_surface_emission) {
+   scene->light_manager->need_update = true;
+   }
+
+   /* We only calculate offset and do re-allocation from the locked block,
+* actual copy we do after the lock is releases to hopefully gain some
+* percent of performance.
+*/
+   nodes_lock_.lock();
+   size_t global_nodes_size = global_svm_nodes->size();
+   global_svm_nodes->resize(global_nodes_size + svm_nodes.size());
+   nodes_lock_.unlock();
+   /* Offset local SVM nodes to a global address space. */
+   int4& jump_node = global_svm_nodes->at(shader->id);
+   jump_node.y = svm_nodes[0].y + global_nodes_size - 1;
+   jump_node.z = svm_nodes[0].z + global_nodes_size - 1;
+   jump_node.w = svm_nodes[0].w + global_nodes_size - 1;
+   /* Copy new nodes to global storage. */
+   memcpy(_svm_nodes->at(global_nodes_size),
+  _nodes[1],
+  sizeof(int4) * (svm_nodes.size() - 1));
+}
+
 void SVMShaderManager::device_update(Device *device, DeviceScene *dscene, 
Scene *scene, Progress& progress)
 {
if(!need_update)
@@ -67,23 +113,20 @@ void SVMShaderManager::device_update(Device *device, 
DeviceScene *dscene, Scene
svm_nodes.push_back(make_int4(NODE_SHADER_JUMP, 0, 0, 0));
}
 
+   TaskPool task_pool;
foreach(Shader *shader, scene->shaders) {
-   if(progress.get_cancel()) return;
-
-   assert(shader->graph);
-
-   SVMCompiler::Summary summary;
-   SVMCompiler compiler(scene->shader_manager, 
scene->image_manager);
-   compiler.background = (shader == scene->default_background);
-   compiler.compile(scene, shader, svm_nodes, shader->id, 
);
-
-   if(shader->use_mis && shader->has_surface_emission) {
-   scene->light_manager->need_update = true;
-   }
+   
task_pool.push(function_bind(::device_update_shader,
+this,
+ 

[Bf-blender-cvs] [f38f787] master: Fix bpy.data.user_map() ignoring unused datablocks.

2016-09-13 Thread Bastien Montagne
Commit: f38f7874488de876410e1bb4acf67a4629ba2b82
Author: Bastien Montagne
Date:   Tue Sep 13 13:22:03 2016 +0200
Branches: master
https://developer.blender.org/rBf38f7874488de876410e1bb4acf67a4629ba2b82

Fix bpy.data.user_map() ignoring unused datablocks.

Should be backported to 2.78.
Found by Sybren here in studio, thanks!

===

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

===

diff --git a/source/blender/python/intern/bpy_rna_id_collection.c 
b/source/blender/python/intern/bpy_rna_id_collection.c
index 31189ba..3e50e79 100644
--- a/source/blender/python/intern/bpy_rna_id_collection.c
+++ b/source/blender/python/intern/bpy_rna_id_collection.c
@@ -233,8 +233,26 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), 
PyObject *args, PyObject *
data_cb.py_id_key_lookup_only = 
pyrna_id_CreatePyObject(id);
}
 
+   if (!data_cb.is_subset) {
+   PyObject *key = data_cb.py_id_key_lookup_only;
+   PyObject *set;
+
+   RNA_id_pointer_create(id, &((BPy_StructRNA 
*)key)->ptr);
+
+   /* We have to insert the key now, otherwise ID 
unused would be missing from final dict... */
+   if ((set = PyDict_GetItem(data_cb.user_map, 
key)) == NULL) {
+   /* Cannot use our placeholder key here! 
*/
+   key = pyrna_id_CreatePyObject(id);
+   set = PySet_New(NULL);
+   PyDict_SetItem(data_cb.user_map, key, 
set);
+   Py_DECREF(set);
+   Py_DECREF(key);
+   }
+   }
+
data_cb.id_curr = id;
BKE_library_foreach_ID_link(id, 
foreach_libblock_id_user_map_callback, _cb, IDWALK_NOP);
+
if (data_cb.py_id_curr) {
Py_DECREF(data_cb.py_id_curr);
data_cb.py_id_curr = NULL;

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


[Bf-blender-cvs] [d82710c] master: Outliner: Report linked datablock edit failure when trying to rename linked data in outliner

2016-09-13 Thread Philipp Oeser
Commit: d82710cc02f9a6c82b8a738c0a5d493b97533b93
Author: Philipp Oeser
Date:   Tue Sep 13 13:12:44 2016 +0200
Branches: master
https://developer.blender.org/rBd82710cc02f9a6c82b8a738c0a5d493b97533b93

Outliner: Report linked datablock edit failure when trying to rename linked 
data in outliner

===

M   source/blender/editors/space_outliner/outliner_edit.c

===

diff --git a/source/blender/editors/space_outliner/outliner_edit.c 
b/source/blender/editors/space_outliner/outliner_edit.c
index f2a0ddc..65608c8 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -245,18 +245,15 @@ static void do_item_rename(ARegion *ar, TreeElement *te, 
TreeStoreElem *tselem,
 }
 
 void item_rename_cb(
-bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), 
TreeElement *te,
+bContext *C, ReportList *reports, Scene *UNUSED(scene), TreeElement 
*te,
 TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void 
*UNUSED(user_data))
 {
ARegion *ar = CTX_wm_region(C);
-   ReportList *reports = CTX_wm_reports(C); // XXX
do_item_rename(ar, te, tselem, reports);
 }
 
-static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, 
TreeElement *te, const float mval[2])
-{  
-   ReportList *reports = CTX_wm_reports(C); // XXX
-   
+static int do_outliner_item_rename(ReportList *reports, ARegion *ar, SpaceOops 
*soops, TreeElement *te, const float mval[2])
+{
if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) {
TreeStoreElem *tselem = TREESTORE(te);

@@ -269,12 +266,12 @@ static int do_outliner_item_rename(bContext *C, ARegion 
*ar, SpaceOops *soops, T
}

for (te = te->subtree.first; te; te = te->next) {
-   if (do_outliner_item_rename(C, ar, soops, te, mval)) return 1;
+   if (do_outliner_item_rename(reports, ar, soops, te, mval)) 
return 1;
}
return 0;
 }
 
-static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), const 
wmEvent *event)
+static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent 
*event)
 {
ARegion *ar = CTX_wm_region(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
@@ -285,7 +282,7 @@ static int outliner_item_rename(bContext *C, wmOperator 
*UNUSED(op), const wmEve
UI_view2d_region_to_view(>v2d, event->mval[0], event->mval[1], 
[0], [1]);

for (te = soops->tree.first; te; te = te->next) {
-   if (do_outliner_item_rename(C, ar, soops, te, fmval)) {
+   if (do_outliner_item_rename(op->reports, ar, soops, te, fmval)) 
{
changed = true;
break;
}

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


[Bf-blender-cvs] [49fe9a9] soc-2016-multiview: Merge branch 'master' into soc-2016-multiview

2016-09-13 Thread Tianwei Shen
Commit: 49fe9a94d286b9dfc046453de0a6eb2c24cd2aa3
Author: Tianwei Shen
Date:   Tue Sep 13 14:24:04 2016 +0800
Branches: soc-2016-multiview
https://developer.blender.org/rB49fe9a94d286b9dfc046453de0a6eb2c24cd2aa3

Merge branch 'master' into soc-2016-multiview

===



===



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


[Bf-blender-cvs] [7f67885] master: Fix T49323: Ineffective bone roll calculation with low rig scale

2016-09-13 Thread Sergey Sharybin
Commit: 7f67885526ee925dafd7ff5c0813b404cebd8a5d
Author: Sergey Sharybin
Date:   Tue Sep 13 12:38:47 2016 +0200
Branches: master
https://developer.blender.org/rB7f67885526ee925dafd7ff5c0813b404cebd8a5d

Fix T49323: Ineffective bone roll calculation with low rig scale

The code was expecting vector to be normalized, however after
applying inverted object matrix it was possible to have scale
applied to it.

===

M   source/blender/editors/armature/armature_edit.c

===

diff --git a/source/blender/editors/armature/armature_edit.c 
b/source/blender/editors/armature/armature_edit.c
index 354b748..ece0f18 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -410,6 +410,7 @@ static int armature_calc_roll_exec(bContext *C, wmOperator 
*op)
if (type < 3) vec[type] = 1.0f;
else vec[type - 2] = -1.0f;
mul_m3_v3(imat, vec);
+   normalize_v3(vec);
}

if (axis_flip) negate_v3(vec);

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


[Bf-blender-cvs] [0307369] master: Fix T49336: Outliner allows to edit restrict flags for linked objects

2016-09-13 Thread Sergey Sharybin
Commit: 0307369211825afe1a5ae79a84b32a90da37868a
Author: Sergey Sharybin
Date:   Tue Sep 13 11:33:55 2016 +0200
Branches: master
https://developer.blender.org/rB0307369211825afe1a5ae79a84b32a90da37868a

Fix T49336: Outliner allows to edit restrict flags for linked objects

===

M   source/blender/editors/space_outliner/outliner_edit.c

===

diff --git a/source/blender/editors/space_outliner/outliner_edit.c 
b/source/blender/editors/space_outliner/outliner_edit.c
index 3c47f54..f2a0ddc 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -788,12 +788,17 @@ int common_restrict_check(bContext *C, Object *ob)
 /* Toggle Visibility  */
 
 void object_toggle_visibility_cb(
-bContext *C, ReportList *UNUSED(reports), Scene *scene, TreeElement 
*te,
+bContext *C, ReportList *reports, Scene *scene, TreeElement *te,
 TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void 
*UNUSED(user_data))
 {
Base *base = (Base *)te->directdata;
Object *ob = (Object *)tselem->id;
-   
+
+   if (ID_IS_LINKED_DATABLOCK(tselem->id)) {
+   BKE_report(reports, RPT_WARNING, "Cannot edit external 
libdata");
+   return;
+   }
+
/* add check for edit mode */
if (!common_restrict_check(C, ob)) return;

@@ -845,11 +850,16 @@ void OUTLINER_OT_visibility_toggle(wmOperatorType *ot)
 /* Toggle Selectability  */
 
 void object_toggle_selectability_cb(
-bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *scene, 
TreeElement *te,
+bContext *UNUSED(C), ReportList *reports, Scene *scene, TreeElement 
*te,
 TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void 
*UNUSED(user_data))
 {
Base *base = (Base *)te->directdata;
-   
+
+   if (ID_IS_LINKED_DATABLOCK(tselem->id)) {
+   BKE_report(reports, RPT_WARNING, "Cannot edit external 
libdata");
+   return;
+   }
+
if (base == NULL) base = BKE_scene_base_find(scene, (Object 
*)tselem->id);
if (base) {
base->object->restrictflag ^= OB_RESTRICT_SELECT;
@@ -895,11 +905,16 @@ void OUTLINER_OT_selectability_toggle(wmOperatorType *ot)
 /* Toggle Renderability  */
 
 void object_toggle_renderability_cb(
-bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *scene, 
TreeElement *te,
+bContext *UNUSED(C), ReportList *reports, Scene *scene, TreeElement 
*te,
 TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void 
*UNUSED(user_data))
 {
Base *base = (Base *)te->directdata;
-   
+
+   if (ID_IS_LINKED_DATABLOCK(tselem->id)) {
+   BKE_report(reports, RPT_WARNING, "Cannot edit external 
libdata");
+   return;
+   }
+
if (base == NULL) base = BKE_scene_base_find(scene, (Object 
*)tselem->id);
if (base) {
base->object->restrictflag ^= OB_RESTRICT_RENDER;

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


[Bf-blender-cvs] [52038fd] master: Fix T49290: Specific .blend with hair crashes in MacOS 2.78 RC1 on render

2016-09-13 Thread Sergey Sharybin
Commit: 52038fd8c7dd7cece0cccd50cf09274abbdb14ba
Author: Sergey Sharybin
Date:   Tue Sep 13 10:59:48 2016 +0200
Branches: master
https://developer.blender.org/rB52038fd8c7dd7cece0cccd50cf09274abbdb14ba

Fix T49290: Specific .blend with hair crashes in MacOS 2.78 RC1 on render

The issue was caused by some false-positive empty non-AABB intersection.
Tried to tweak it a bit so it does not record intersection anymore.

Hopefully will work for all platforms. Tested here on iMac and Debian.

===

M   intern/cycles/bvh/bvh.cpp

===

diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index 4f97abd..39b2a0c 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -951,9 +951,23 @@ void QBVH::pack_unaligned_node(int idx,
/* We store BB which would never be recorded as intersection
 * so kernel might safely assume there are always 4 child nodes.
 */
-   for(int j = 1; j < 13; ++j) {
-   data[j][i] = 0.0f;
-   }
+
+   data[1][i] = 1.0f;
+   data[2][i] = 0.0f;
+   data[3][i] = 0.0f;
+
+   data[4][i] = 0.0f;
+   data[5][i] = 0.0f;
+   data[6][i] = 0.0f;
+
+   data[7][i] = 0.0f;
+   data[8][i] = 0.0f;
+   data[9][i] = 0.0f;
+
+   data[10][i] = -FLT_MAX;
+   data[11][i] = -FLT_MAX;
+   data[12][i] = -FLT_MAX;
+
data[13][i] = __int_as_float(0);
}

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


[Bf-blender-cvs] [ecbfa31] master: Cycles: Tweak empty boundbox children

2016-09-13 Thread Sergey Sharybin
Commit: ecbfa31caaadb03c53c0fe1459718b99613c8804
Author: Sergey Sharybin
Date:   Tue Sep 13 11:05:11 2016 +0200
Branches: master
https://developer.blender.org/rBecbfa31caaadb03c53c0fe1459718b99613c8804

Cycles: Tweak empty boundbox children

The idea here is to make assert failure to fail sooner on an incorrect
node address rather than later with stack overflow.

===

M   intern/cycles/bvh/bvh.cpp

===

diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index 39b2a0c..bb326d4 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -885,7 +885,7 @@ void QBVH::pack_aligned_node(int idx,
data[5][i] = FLT_MAX;
data[6][i] = -FLT_MAX;
 
-   data[7][i] = __int_as_float(0);
+   data[7][i] = __int_as_float(INT_MAX);
}
 
memcpy([idx], data, sizeof(float4)*BVH_QNODE_SIZE);
@@ -968,7 +968,7 @@ void QBVH::pack_unaligned_node(int idx,
data[11][i] = -FLT_MAX;
data[12][i] = -FLT_MAX;
 
-   data[13][i] = __int_as_float(0);
+   data[13][i] = __int_as_float(INT_MAX);
}
 
memcpy([idx], data, sizeof(float4)*BVH_UNALIGNED_QNODE_SIZE);

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


[Bf-blender-cvs] [54b0065] blender2.8: Gawain: fix Windows compile error

2016-09-13 Thread Mike Erwin
Commit: 54b00657cada1cf25c2793c1842f6c8f408a3151
Author: Mike Erwin
Date:   Tue Sep 13 03:21:16 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB54b00657cada1cf25c2793c1842f6c8f408a3151

Gawain: fix Windows compile error

MSVC was NOT happy about uint64_t, now it is.

===

M   source/blender/gpu/gawain/common.h

===

diff --git a/source/blender/gpu/gawain/common.h 
b/source/blender/gpu/gawain/common.h
index 77b953b..184c907 100644
--- a/source/blender/gpu/gawain/common.h
+++ b/source/blender/gpu/gawain/common.h
@@ -15,6 +15,7 @@
 
 #include 
 #include 
+#include 
 
 #if TRUST_NO_ONE
   #include 

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


[Bf-blender-cvs] [b6bd299] blender2.8: Gawain: reorganize source code

2016-09-13 Thread Mike Erwin
Commit: b6bd2993598712240bd354e4400d057732cda459
Author: Mike Erwin
Date:   Tue Sep 13 02:18:33 2016 -0400
Branches: blender2.8
https://developer.blender.org/rBb6bd2993598712240bd354e4400d057732cda459

Gawain: reorganize source code

Put Gawain source code in a subfolder to make the boundary between the
library and the rest of Blender clear.

Changed Gawain’s license from Apache to Mozilla Public License. Has
more essence of copyleft — closer to GPL but not as restrictive.

Split immediate.c into several files so parts can be reused (adding
more files soon…)

===

M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/GPU_immediate.h
A   source/blender/gpu/gawain/attrib_binding.c
A   source/blender/gpu/gawain/attrib_binding.h
A   source/blender/gpu/gawain/common.h
R072source/blender/gpu/intern/gpu_immediate.c   
source/blender/gpu/gawain/immediate.c
A   source/blender/gpu/gawain/immediate.h
A   source/blender/gpu/gawain/vertex_format.c
A   source/blender/gpu/gawain/vertex_format.h

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 4071004..33ebb92 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -54,13 +54,20 @@ set(SRC
intern/gpu_draw.c
intern/gpu_extensions.c
intern/gpu_framebuffer.c
-   intern/gpu_immediate.c
intern/gpu_init_exit.c
intern/gpu_material.c
intern/gpu_select.c
intern/gpu_shader.c
intern/gpu_texture.c
 
+   gawain/attrib_binding.c
+   gawain/attrib_binding.h
+   gawain/common.h
+   gawain/immediate.c
+   gawain/immediate.h
+   gawain/vertex_format.c
+   gawain/vertex_format.h
+
shaders/gpu_shader_fx_lib.glsl
shaders/gpu_shader_fx_ssao_frag.glsl
shaders/gpu_shader_fx_dof_frag.glsl
@@ -97,6 +104,7 @@ set(SRC
GPU_select.h
GPU_shader.h
GPU_texture.h
+
intern/gpu_codegen.h
intern/gpu_private.h
 )
diff --git a/source/blender/gpu/GPU_immediate.h 
b/source/blender/gpu/GPU_immediate.h
index ffd0a6d..8b88275 100644
--- a/source/blender/gpu/GPU_immediate.h
+++ b/source/blender/gpu/GPU_immediate.h
@@ -1,99 +1,33 @@
-
-// Gawain immediate mode work-alike, take 2
-//
-// This code is part of the Gawain library, with modifications
-// specific to integration with Blender.
-//
-// Copyright 2016 Mike Erwin
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * 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) 2016 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Mike Erwin
+ *
+ * * END GPL LICENSE BLOCK *
+ */
+
+/* Immediate mode rendering is powered by the Gawain library.
+ * This file contains any additions or modifications specific to Blender.
+ */
 
 #pragma once
 
-#include "GPU_glew.h"
-#include 
-
-#define PER_THREAD
-// #define PER_THREAD __thread
-// MSVC uses __declspec(thread) for C code
-
-#define MAX_VERTEX_ATTRIBS 16
-
-#define TRUST_NO_ONE 1
-
-typedef enum {
-   KEEP_FLOAT,
-   KEEP_INT,
-   NORMALIZE_INT_TO_FLOAT, // 127 (ubyte) -> 0.5 (and so on for other int 
types)
-   CONVERT_INT_TO_FLOAT // 127 (any int type) -> 127.0
-} VertexFetchMode;
-
-typedef struct {
-   GLenum comp_type;
-   unsigned comp_ct; // 1 to 4
-   unsigned sz; // size in bytes, 1 to 16
-   unsigned offset; // from beginning of vertex, in bytes
-   VertexFetchMode fetch_mode;
-   char* name; // TODO: shared allocation of all names within a 
VertexFormat
-} Attrib;
-
-typedef struct {
-   unsigned attrib_ct; // 0 to 16 (MAX_VERTEX_ATTRIBS)
-   unsigned stride; // stride in bytes, 1 to 256
-   bool packed;
-   Attrib attribs[MAX_VERTEX_ATTRIBS]; // TODO: variable-size attribs array
-} VertexFormat;
-
-void clear_VertexFormat(VertexFormat*);
-unsigned add_attrib(VertexFormat*, const char* 

[Bf-blender-cvs] [ddb1d56] blender2.8: Gawain: geometry batches (unfinished)

2016-09-13 Thread Mike Erwin
Commit: ddb1d5648dbd6d5be8b7fd9df4d122e6df5b5ce3
Author: Mike Erwin
Date:   Tue Sep 13 02:41:43 2016 -0400
Branches: blender2.8
https://developer.blender.org/rBddb1d5648dbd6d5be8b7fd9df4d122e6df5b5ce3

Gawain: geometry batches (unfinished)

Vertex Buffer to store vertex attribute data.
Element List (AKA Index Buffer) to select which vertices to use.
Batch combines these into an object that can be built once then drawn
many times.

Porting over from the C++ version… Most of this C code is compiled but
unused. Some of it is not even compiled. Committing now in case I’m
lost at sea.

===

M   source/blender/gpu/CMakeLists.txt
A   source/blender/gpu/GPU_batch.h
A   source/blender/gpu/gawain/batch.c
A   source/blender/gpu/gawain/batch.h
A   source/blender/gpu/gawain/element.c
A   source/blender/gpu/gawain/element.h
A   source/blender/gpu/gawain/vertex_buffer.c
A   source/blender/gpu/gawain/vertex_buffer.h

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 33ebb92..99ce3eb 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -63,8 +63,12 @@ set(SRC
gawain/attrib_binding.c
gawain/attrib_binding.h
gawain/common.h
+   gawain/element.c
+   gawain/element.h
gawain/immediate.c
gawain/immediate.h
+   gawain/vertex_buffer.c
+   gawain/vertex_buffer.h
gawain/vertex_format.c
gawain/vertex_format.h
 
diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h
new file mode 100644
index 000..10b00c3
--- /dev/null
+++ b/source/blender/gpu/GPU_batch.h
@@ -0,0 +1,33 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * 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) 2016 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Mike Erwin
+ *
+ * * END GPL LICENSE BLOCK *
+ */
+
+/* Batched geometry rendering is powered by the Gawain library.
+ * This file contains any additions or modifications specific to Blender.
+ */
+
+#pragma once
+
+#include "gawain/batch.h"
diff --git a/source/blender/gpu/gawain/batch.c 
b/source/blender/gpu/gawain/batch.c
new file mode 100644
index 000..3934d35
--- /dev/null
+++ b/source/blender/gpu/gawain/batch.c
@@ -0,0 +1,18 @@
+
+// Gawain geometry batch
+//
+// This code is part of the Gawain library, with modifications
+// specific to integration with Blender.
+//
+// Copyright 2016 Mike Erwin
+//
+// This Source Code Form is subject to the terms of the Mozilla Public 
License, v. 2.0. If a copy of
+// the MPL was not distributed with this file, You can obtain one at 
https://mozilla.org/MPL/2.0/.
+
+#include "batch.h"
+
+// BasicBatches
+// Vertex buffer with 3D pos only
+// Index buffer for edges (lines)
+// Index buffer for surface (triangles)
+// glGenBuffers(3,xxx)
diff --git a/source/blender/gpu/gawain/batch.h 
b/source/blender/gpu/gawain/batch.h
new file mode 100644
index 000..9625d66
--- /dev/null
+++ b/source/blender/gpu/gawain/batch.h
@@ -0,0 +1,135 @@
+
+// Gawain geometry batch
+//
+// This code is part of the Gawain library, with modifications
+// specific to integration with Blender.
+//
+// Copyright 2016 Mike Erwin
+//
+// This Source Code Form is subject to the terms of the Mozilla Public 
License, v. 2.0. If a copy of
+// the MPL was not distributed with this file, You can obtain one at 
https://mozilla.org/MPL/2.0/.
+
+#pragma once
+
+#include "vertex_buffer.h"
+#include "element.h"
+#include "attrib_binding.h"
+
+// How will this API be used?
+// create batch
+// ...
+// profit!
+
+// TODO: finalize Batch struct design & usage, pare down this file
+
+typedef struct {
+   VertexBuffer; // format is fixed at "vec3 pos"
+   ElementList line_elem;
+   ElementList triangle_elem;
+   GLuint vao_id;
+   GLenum prev_prim; // did most recent draw use GL_POINTS, GL_LINES or 
GL_TRIANGLES?
+} BasicBatch;
+
+// How to do this without replicating code?
+
+typedef struct {
+   VertexBuffer* verts;
+   ElementList* elem; // <-- NULL if element list not needed
+   GLenum prim_type;
+   

[Bf-blender-cvs] [1b5b899] blender2.8: OpenGL: add built-in GPU_SHADER_3D_DEPTH_ONLY

2016-09-13 Thread Mike Erwin
Commit: 1b5b899228bd63e34dd1c35ada8e0408983b8f38
Author: Mike Erwin
Date:   Tue Sep 13 02:51:38 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB1b5b899228bd63e34dd1c35ada8e0408983b8f38

OpenGL: add built-in GPU_SHADER_3D_DEPTH_ONLY

We’re discussing several techniques that require a depth pre-pass.

===

M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/intern/gpu_shader.c
R100source/blender/gpu/shaders/gpu_shader_2D_uniform_color_vert.glsl
source/blender/gpu/shaders/gpu_shader_2D_no_color_vert.glsl
R100source/blender/gpu/shaders/gpu_shader_3D_uniform_color_vert.glsl
source/blender/gpu/shaders/gpu_shader_3D_no_color_vert.glsl
A   source/blender/gpu/shaders/gpu_shader_depth_only_frag.glsl

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 99ce3eb..50c2db2 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -113,13 +113,14 @@ set(SRC
intern/gpu_private.h
 )
 
+data_to_c_simple(shaders/gpu_shader_depth_only_frag.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_uniform_color_frag.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_flat_color_frag.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_2D_uniform_color_vert.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_2D_no_color_vert.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_2D_flat_color_vert.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_2D_smooth_color_vert.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_2D_smooth_color_frag.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_3D_uniform_color_vert.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_3D_no_color_vert.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_3D_flat_color_vert.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_3D_smooth_color_vert.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_3D_smooth_color_frag.glsl SRC)
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index 367e134..2a1c5e0 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -98,6 +98,7 @@ typedef enum GPUBuiltinShader {
GPU_SHADER_3D_UNIFORM_COLOR,
GPU_SHADER_3D_FLAT_COLOR,
GPU_SHADER_3D_SMOOTH_COLOR,
+   GPU_SHADER_3D_DEPTH_ONLY,
 } GPUBuiltinShader;
 
 GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader);
diff --git a/source/blender/gpu/intern/gpu_shader.c 
b/source/blender/gpu/intern/gpu_shader.c
index c95c427..9fe3c3a 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -46,13 +46,14 @@
 #define MAX_EXT_DEFINE_LENGTH 1024
 
 /* Non-generated shaders */
+extern char datatoc_gpu_shader_depth_only_frag_glsl[];
 extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
 extern char datatoc_gpu_shader_flat_color_frag_glsl[];
-extern char datatoc_gpu_shader_2D_uniform_color_vert_glsl[];
+extern char datatoc_gpu_shader_2D_no_color_vert_glsl[];
 extern char datatoc_gpu_shader_2D_flat_color_vert_glsl[];
 extern char datatoc_gpu_shader_2D_smooth_color_vert_glsl[];
 extern char datatoc_gpu_shader_2D_smooth_color_frag_glsl[];
-extern char datatoc_gpu_shader_3D_uniform_color_vert_glsl[];
+extern char datatoc_gpu_shader_3D_no_color_vert_glsl[];
 extern char datatoc_gpu_shader_3D_flat_color_vert_glsl[];
 extern char datatoc_gpu_shader_3D_smooth_color_vert_glsl[];
 extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[];
@@ -90,6 +91,7 @@ static struct GPUShadersGlobal {
GPUShader *uniform_color_3D;
GPUShader *flat_color_3D;
GPUShader *smooth_color_3D;
+   GPUShader *depth_only_3D;
} shaders;
 } GG = {{NULL}};
 
@@ -625,7 +627,7 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader 
shader)
case GPU_SHADER_2D_UNIFORM_COLOR:
if (!GG.shaders.uniform_color_2D)
GG.shaders.uniform_color_2D = GPU_shader_create(
-   
datatoc_gpu_shader_2D_uniform_color_vert_glsl,
+   
datatoc_gpu_shader_2D_no_color_vert_glsl,

datatoc_gpu_shader_uniform_color_frag_glsl,
NULL, NULL, NULL, 0, 0, 0);
retval = GG.shaders.uniform_color_2D;
@@ -649,7 +651,7 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader 
shader)
case GPU_SHADER_3D_UNIFORM_COLOR:
if (!GG.shaders.uniform_color_3D)
GG.shaders.uniform_color_3D = GPU_shader_create(
-   
datatoc_gpu_shader_3D_uniform_color_vert_glsl,
+   
datatoc_gpu_shader_3D_no_color_vert_glsl,
  

[Bf-blender-cvs] [56c798e] master: API doc update script: Fix generated zipfile name, was broken in 'release' case...

2016-09-13 Thread Bastien Montagne
Commit: 56c798ee620719750dd38917cb8ce191e02913ad
Author: Bastien Montagne
Date:   Tue Sep 13 08:38:10 2016 +0200
Branches: master
https://developer.blender.org/rB56c798ee620719750dd38917cb8ce191e02913ad

API doc update script: Fix generated zipfile name, was broken in 'release' 
case...

===

M   doc/python_api/sphinx_doc_update.py

===

diff --git a/doc/python_api/sphinx_doc_update.py 
b/doc/python_api/sphinx_doc_update.py
index c93f167..5301f39 100755
--- a/doc/python_api/sphinx_doc_update.py
+++ b/doc/python_api/sphinx_doc_update.py
@@ -108,18 +108,19 @@ def main():
 subprocess.run(doc_gen_cmd)
 
 # III) Get Blender version info.
-blenver = ""
+blenver = blenver_zip = ""
 getver_file = os.path.join(tmp_dir, "blendver.txt")
 getver_script = (""
 "import sys, bpy\n"
 "with open(sys.argv[-1], 'w') as f:\n"
-"f.write('%d_%d%s_release' % (bpy.app.version[0], 
bpy.app.version[1], bpy.app.version_char)\n"
-"if bpy.app.version_cycle in {'rc', 'release'} else 
'%d_%d_%d' % bpy.app.version)\n")
+"f.write('%d_%d%s_release\\n' % (bpy.app.version[0], 
bpy.app.version[1], bpy.app.version_char)\n"
+"if bpy.app.version_cycle in {'rc', 'release'} else 
'%d_%d_%d\\n' % bpy.app.version)\n"
+"f.write('%d_%d_%d' % bpy.app.version)\n")
 get_ver_cmd = (args.blender, "--background", "-noaudio", 
"--factory-startup", "--python-exit-code", "1",
"--python-expr", getver_script, "--", getver_file)
 subprocess.run(get_ver_cmd)
 with open(getver_file) as f:
-blenver = f.read()
+blenver, blenver_zip = f.read().split("\n")
 os.remove(getver_file)
 
 # IV) Build doc.
@@ -138,7 +139,7 @@ def main():
 os.rename(os.path.join(tmp_dir, "sphinx-out"), api_dir)
 
 # VI) Create zip archive.
-zip_name = "blender_python_reference_%s" % blenver
+zip_name = "blender_python_reference_%s" % blenver_zip  # We can't use 
'release' postfix here...
 zip_path = os.path.join(args.mirror_dir, zip_name)
 with zipfile.ZipFile(zip_path, 'w') as zf:
 for de in os.scandir(api_dir):

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


[Bf-blender-cvs] [ccaca71] soc-2016-pbvh-painting: Fixed pen sensitivity bug.

2016-09-13 Thread Nathan Vollmer
Commit: ccaca716aef7243b70e4bae7d47725fb7b12539e
Author: Nathan Vollmer
Date:   Tue Sep 13 00:04:49 2016 -0600
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rBccaca716aef7243b70e4bae7d47725fb7b12539e

Fixed pen sensitivity bug.

===

M   release/datafiles/locale
M   release/scripts/addons
M   source/blender/editors/sculpt_paint/paint_vertex.c

===

diff --git a/release/datafiles/locale b/release/datafiles/locale
index dc16605..ee35b90 16
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit dc166057192ea882b5cc70484d4c8bacd7cb41b4
+Subproject commit ee35b906abbd72c1a36e61027b15e9af970f5f2b
diff --git a/release/scripts/addons b/release/scripts/addons
index 06dad53..d5d095f 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 06dad53c80801e0e0919f086040e3d9c31bbd0a1
+Subproject commit d5d095f2bc3ea279b3a52003d2496d9d52a754d9
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c 
b/source/blender/editors/sculpt_paint/paint_vertex.c
index 7c2e2cd..c2ce7be 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -3324,8 +3324,8 @@ static void do_vpaint_brush_draw_task_cb_ex(
   }
 
   //Mix the new color with the original based on the brush strength 
and the curve.
-  lcol[loopIndex] = vpaint_blend(data->vp, lcol[loopIndex], 
ss->previousColor[loopIndex], actualColor,
- 255 * fade * bstrength * dot * alpha, 
brush_alpha_pressure * 255);
+ lcol[loopIndex] = vpaint_blend(data->vp, lcol[loopIndex], 
ss->previousColor[loopIndex], actualColor,
+ 255 * fade * bstrength * dot * alpha * 
brush_alpha_pressure, 255.0*bstrength);
 }
 }
 BKE_pbvh_vertex_iter_end;

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


[Bf-blender-cvs] [dad3e97] soc-2016-pbvh-painting: Merge branch 'master' into soc-2016-pbvh-painting

2016-09-13 Thread Nathan Vollmer
Commit: dad3e97829e30fad32fd23b7fac78d3bb48bb3d1
Author: Nathan Vollmer
Date:   Sat Sep 3 12:55:56 2016 -0600
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rBdad3e97829e30fad32fd23b7fac78d3bb48bb3d1

Merge branch 'master' into soc-2016-pbvh-painting

===



===



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