Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2020-01-23 18:56:26 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-01-23 18:56:26 +0300
commitfb671035be082a67e6ffc58fb098c0d5140ba6b0 (patch)
treed8befc157c786d22c4ae66aa490b990adc7958ef /source/blender
parent8482ba6d2e1a97e038175a7fb693ed40c03ca5d9 (diff)
parentd9d11e2faf0502eab215f8f13661972f9b459d3a (diff)
Merge branch 'blender-v2.82-release'
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide_edgering.c5
-rw-r--r--source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl14
-rw-r--r--source/blender/draw/engines/overlay/overlay_extra.c5
-rw-r--r--source/blender/draw/intern/draw_cache.c28
-rw-r--r--source/blender/editors/gpencil/gpencil_brush.c9
5 files changed, 39 insertions, 22 deletions
diff --git a/source/blender/bmesh/operators/bmo_subdivide_edgering.c b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
index f93d33bb05f..b9d5548f5d4 100644
--- a/source/blender/bmesh/operators/bmo_subdivide_edgering.c
+++ b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
@@ -828,6 +828,11 @@ static void bm_face_slice(BMesh *bm, BMLoop *l, const int cuts)
for (i = 0; i < cuts; i++) {
/* no chance of double */
BM_face_split(bm, l_new->f, l_new->prev, l_new->next->next, &l_new, NULL, false);
+ if (l_new == NULL) {
+ /* This happens when l_new->prev and l_new->next->next are adjacent. Since
+ * this sets l_new to NULL, we cannot continue this for-loop. */
+ break;
+ }
if (l_new->f->len < l_new->radial_next->f->len) {
l_new = l_new->radial_next;
}
diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl
index ca4940ceffb..5277bfa32bb 100644
--- a/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl
@@ -41,6 +41,12 @@ float max_v4(vec4 v)
return max(max(v.x, v.y), max(v.z, v.w));
}
+vec4 safe_color(vec4 c)
+{
+ /* Clamp to avoid black square artifacts if a pixel goes NaN. */
+ return clamp(c, vec4(0.0), vec4(1e20)); /* 1e20 arbitrary. */
+}
+
#define THRESHOLD 1.0
#ifdef STEP_DOWNSAMPLE
@@ -57,10 +63,10 @@ void main(void)
ivec4 uvs = ivec4(gl_FragCoord.xyxy) * 2 + ivec4(0, 0, 1, 1);
/* custom downsampling */
- vec4 color1 = texelFetch(colorBuffer, uvs.xy, 0);
- vec4 color2 = texelFetch(colorBuffer, uvs.zw, 0);
- vec4 color3 = texelFetch(colorBuffer, uvs.zy, 0);
- vec4 color4 = texelFetch(colorBuffer, uvs.xw, 0);
+ vec4 color1 = safe_color(texelFetch(colorBuffer, uvs.xy, 0));
+ vec4 color2 = safe_color(texelFetch(colorBuffer, uvs.zw, 0));
+ vec4 color3 = safe_color(texelFetch(colorBuffer, uvs.zy, 0));
+ vec4 color4 = safe_color(texelFetch(colorBuffer, uvs.xw, 0));
/* Leverage SIMD by combining 4 depth samples into a vec4 */
vec4 depth;
diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c
index c5dc6860ac2..fc52efb0174 100644
--- a/source/blender/draw/engines/overlay/overlay_extra.c
+++ b/source/blender/draw/engines/overlay/overlay_extra.c
@@ -623,8 +623,9 @@ void OVERLAY_light_cache_populate(OVERLAY_Data *vedata, Object *ob)
copy_m4_m4(instdata.mat, ob->obmat);
/* FIXME / TODO: clipend has no meaning nowadays.
* In EEVEE, Only clipsta is used shadowmaping.
- * Clip end is computed automatically based on light power. */
- instdata.clip_end = la->clipend;
+ * Clip end is computed automatically based on light power.
+ * For now, always use the custom distance as clipend. */
+ instdata.clip_end = la->att_dist;
instdata.clip_sta = la->clipsta;
DRW_buffer_add_entry(cb->groundline, instdata.pos);
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index a0e4af8fc8d..bfb74a9576f 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -1208,10 +1208,11 @@ GPUBatch *DRW_cache_field_curve_get(void)
GPUBatch *DRW_cache_field_tube_limit_get(void)
{
#define CIRCLE_RESOL 32
+#define SIDE_STIPPLE 32
if (!SHC.drw_field_tube_limit) {
GPUVertFormat format = extra_vert_format();
- int v_len = 2 * (CIRCLE_RESOL * 2 + 4);
+ int v_len = 2 * (CIRCLE_RESOL * 2 + 4 * SIDE_STIPPLE / 2);
GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format);
GPU_vertbuf_data_alloc(vbo, v_len);
@@ -1219,14 +1220,14 @@ GPUBatch *DRW_cache_field_tube_limit_get(void)
int flag = VCLASS_EMPTY_SIZE;
/* Caps */
for (int i = 0; i < 2; i++) {
- float z = (float)i * 2.0f - 1.0f;
- circle_verts(vbo, &v, CIRCLE_RESOL, 1.0f, z, flag);
+ float z = i * 2.0f - 1.0f;
+ circle_dashed_verts(vbo, &v, CIRCLE_RESOL, 1.0f, z, flag);
}
/* Side Edges */
for (int a = 0; a < 4; a++) {
- for (int i = 0; i < 2; i++) {
- float z = (float)i * 2.0f - 1.0f;
- float angle = (2.0f * M_PI * a) / 4.0f;
+ float angle = (2.0f * M_PI * a) / 4.0f;
+ for (int i = 0; i < SIDE_STIPPLE; i++) {
+ float z = (i / (float)SIDE_STIPPLE) * 2.0f - 1.0f;
GPU_vertbuf_vert_set(vbo, v++, &(Vert){{sinf(angle), cosf(angle), z}, flag});
}
}
@@ -1234,16 +1235,18 @@ GPUBatch *DRW_cache_field_tube_limit_get(void)
SHC.drw_field_tube_limit = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
return SHC.drw_field_tube_limit;
+#undef SIDE_STIPPLE
#undef CIRCLE_RESOL
}
GPUBatch *DRW_cache_field_cone_limit_get(void)
{
#define CIRCLE_RESOL 32
+#define SIDE_STIPPLE 32
if (!SHC.drw_field_cone_limit) {
GPUVertFormat format = extra_vert_format();
- int v_len = 2 * (CIRCLE_RESOL * 2 + 4);
+ int v_len = 2 * (CIRCLE_RESOL * 2 + 4 * SIDE_STIPPLE / 2);
GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format);
GPU_vertbuf_data_alloc(vbo, v_len);
@@ -1251,14 +1254,14 @@ GPUBatch *DRW_cache_field_cone_limit_get(void)
int flag = VCLASS_EMPTY_SIZE;
/* Caps */
for (int i = 0; i < 2; i++) {
- float z = (float)i * 2.0f - 1.0f;
- circle_verts(vbo, &v, CIRCLE_RESOL, 1.0f, z, flag);
+ float z = i * 2.0f - 1.0f;
+ circle_dashed_verts(vbo, &v, CIRCLE_RESOL, 1.0f, z, flag);
}
/* Side Edges */
for (int a = 0; a < 4; a++) {
- for (int i = 0; i < 2; i++) {
- float z = (float)i * 2.0f - 1.0f;
- float angle = (2.0f * M_PI * a) / 4.0f;
+ float angle = (2.0f * M_PI * a) / 4.0f;
+ for (int i = 0; i < SIDE_STIPPLE; i++) {
+ float z = (i / (float)SIDE_STIPPLE) * 2.0f - 1.0f;
GPU_vertbuf_vert_set(vbo, v++, &(Vert){{sinf(angle) * z, cosf(angle) * z, z}, flag});
}
}
@@ -1266,6 +1269,7 @@ GPUBatch *DRW_cache_field_cone_limit_get(void)
SHC.drw_field_cone_limit = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
return SHC.drw_field_cone_limit;
+#undef SIDE_STIPPLE
#undef CIRCLE_RESOL
}
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 690fee61005..c2f1e9f091a 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -424,7 +424,8 @@ static bool gp_brush_strength_apply(tGP_BrushEditData *gso,
* - We divide the strength, so that users can set "sane" values.
* Otherwise, good default values are in the range of 0.093
*/
- inf = gp_brush_influence_calc(gso, radius, co) / 20.0f;
+ inf = gp_brush_influence_calc(gso, radius, co) / 2.0f;
+ CLAMP_MIN(inf, 0.01f);
/* apply */
if (gp_brush_invert_check(gso)) {
@@ -435,12 +436,12 @@ static bool gp_brush_strength_apply(tGP_BrushEditData *gso,
/* make line more opaque - increase stroke strength */
pt->strength += inf;
}
- /* smooth the strength */
- BKE_gpencil_smooth_stroke_strength(gps, pt_index, inf);
-
/* Strength should stay within [0.0, 1.0] */
CLAMP(pt->strength, 0.0f, 1.0f);
+ /* smooth the strength */
+ BKE_gpencil_smooth_stroke_strength(gps, pt_index, inf);
+
return true;
}