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:
authorPhilipp Oeser <info@graphics-engineer.com>2020-10-26 15:07:00 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2020-10-26 15:07:00 +0300
commit4d5e0a852060fbac1a56eb04511c08b5409c8d3d (patch)
tree779f7c63c7bd7f2c5733d0df8ef20d67d2b19bc8
parent57fc44de6ca085178b3834db2b8a842e96f31eac (diff)
parentf76f48c3d3eb3ac518fed158a0f17c7507604ca8 (diff)
Merge branch 'blender-v2.91-release'
-rw-r--r--intern/cycles/blender/blender_geometry.cpp2
-rw-r--r--intern/cycles/blender/blender_id_map.h7
-rw-r--r--intern/cycles/render/camera.cpp32
-rw-r--r--intern/cycles/render/camera.h2
-rw-r--r--source/blender/blenkernel/intern/lattice_deform_test.cc14
-rw-r--r--source/blender/gpu/intern/gpu_shader.cc4
-rw-r--r--source/blender/gpu/opengl/gl_debug.cc2
7 files changed, 36 insertions, 27 deletions
diff --git a/intern/cycles/blender/blender_geometry.cpp b/intern/cycles/blender/blender_geometry.cpp
index 14da8075903..c7637fe8608 100644
--- a/intern/cycles/blender/blender_geometry.cpp
+++ b/intern/cycles/blender/blender_geometry.cpp
@@ -52,11 +52,11 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
/* Test if we can instance or if the object is modified. */
BL::ID b_ob_data = b_ob.data();
BL::ID b_key_id = (BKE_object_is_modified(b_ob)) ? b_ob_instance : b_ob_data;
- GeometryKey key(b_key_id.ptr.data, use_particle_hair);
BL::Material material_override = view_layer.material_override;
Shader *default_shader = (b_ob.type() == BL::Object::type_VOLUME) ? scene->default_volume :
scene->default_surface;
Geometry::Type geom_type = determine_geom_type(b_ob, use_particle_hair);
+ GeometryKey key(b_key_id.ptr.data, geom_type);
/* Find shader indices. */
vector<Shader *> used_shaders;
diff --git a/intern/cycles/blender/blender_id_map.h b/intern/cycles/blender/blender_id_map.h
index f9f201c2e4e..8ce1d23665d 100644
--- a/intern/cycles/blender/blender_id_map.h
+++ b/intern/cycles/blender/blender_id_map.h
@@ -19,6 +19,7 @@
#include <string.h>
+#include "render/geometry.h"
#include "render/scene.h"
#include "util/util_map.h"
@@ -230,9 +231,9 @@ struct ObjectKey {
struct GeometryKey {
void *id;
- bool use_particle_hair;
+ Geometry::Type geometry_type;
- GeometryKey(void *id, bool use_particle_hair) : id(id), use_particle_hair(use_particle_hair)
+ GeometryKey(void *id, Geometry::Type geometry_type) : id(id), geometry_type(geometry_type)
{
}
@@ -242,7 +243,7 @@ struct GeometryKey {
return true;
}
else if (id == k.id) {
- if (use_particle_hair < k.use_particle_hair) {
+ if (geometry_type < k.geometry_type) {
return true;
}
}
diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp
index ee68c9ede22..0f2befae320 100644
--- a/intern/cycles/render/camera.cpp
+++ b/intern/cycles/render/camera.cpp
@@ -313,9 +313,12 @@ void Camera::update(Scene *scene)
if (type == CAMERA_PERSPECTIVE) {
float3 v = transform_perspective(&full_rastertocamera,
make_float3(full_width, full_height, 1.0f));
-
frustum_right_normal = normalize(make_float3(v.z, 0.0f, -v.x));
frustum_top_normal = normalize(make_float3(0.0f, v.z, -v.y));
+
+ v = transform_perspective(&full_rastertocamera, make_float3(0.0f, 0.0f, 1.0f));
+ frustum_left_normal = normalize(make_float3(-v.z, 0.0f, v.x));
+ frustum_bottom_normal = normalize(make_float3(0.0f, -v.z, v.y));
}
/* Compute kernel camera data. */
@@ -644,17 +647,22 @@ float Camera::world_to_raster_size(float3 P)
if (offscreen_dicing_scale > 1.0f) {
float3 p = transform_point(&worldtocamera, P);
- float3 v = transform_perspective(&full_rastertocamera,
- make_float3(full_width, full_height, 0.0f));
+ float3 v1 = transform_perspective(&full_rastertocamera,
+ make_float3(full_width, full_height, 0.0f));
+ float3 v2 = transform_perspective(&full_rastertocamera, make_float3(0.0f, 0.0f, 0.0f));
/* Create point clamped to frustum */
float3 c;
- c.x = max(-v.x, min(v.x, p.x));
- c.y = max(-v.y, min(v.y, p.y));
+ c.x = max(v2.x, min(v1.x, p.x));
+ c.y = max(v2.y, min(v1.y, p.y));
c.z = max(0.0f, p.z);
- float f_dist = len(p - c) / sqrtf((v.x * v.x + v.y * v.y) * 0.5f);
-
+ /* Check right side */
+ float f_dist = len(p - c) / sqrtf((v1.x * v1.x + v1.y * v1.y) * 0.5f);
+ if (f_dist < 0.0f) {
+ /* Check left side */
+ f_dist = len(p - c) / sqrtf((v2.x * v2.x + v2.y * v2.y) * 0.5f);
+ }
if (f_dist > 0.0f) {
res += res * f_dist * (offscreen_dicing_scale - 1.0f);
}
@@ -685,10 +693,8 @@ float Camera::world_to_raster_size(float3 P)
/* Distance from the four planes */
float r = dot(p, frustum_right_normal);
float t = dot(p, frustum_top_normal);
- p = make_float3(-p.x, -p.y, p.z);
- float l = dot(p, frustum_right_normal);
- float b = dot(p, frustum_top_normal);
- p = make_float3(-p.x, -p.y, p.z);
+ float l = dot(p, frustum_left_normal);
+ float b = dot(p, frustum_bottom_normal);
if (r <= 0.0f && l <= 0.0f && t <= 0.0f && b <= 0.0f) {
/* Point is inside frustum */
@@ -701,9 +707,9 @@ float Camera::world_to_raster_size(float3 P)
else {
/* Point may be behind or off to the side, need to check */
float3 along_right = make_float3(-frustum_right_normal.z, 0.0f, frustum_right_normal.x);
- float3 along_left = make_float3(frustum_right_normal.z, 0.0f, frustum_right_normal.x);
+ float3 along_left = make_float3(frustum_left_normal.z, 0.0f, -frustum_left_normal.x);
float3 along_top = make_float3(0.0f, -frustum_top_normal.z, frustum_top_normal.y);
- float3 along_bottom = make_float3(0.0f, frustum_top_normal.z, frustum_top_normal.y);
+ float3 along_bottom = make_float3(0.0f, frustum_bottom_normal.z, -frustum_bottom_normal.y);
float dist[] = {r, l, t, b};
float3 along[] = {along_right, along_left, along_top, along_bottom};
diff --git a/intern/cycles/render/camera.h b/intern/cycles/render/camera.h
index 0e91fa44a5b..21dad5eea3b 100644
--- a/intern/cycles/render/camera.h
+++ b/intern/cycles/render/camera.h
@@ -170,6 +170,8 @@ class Camera : public Node {
float3 frustum_right_normal;
float3 frustum_top_normal;
+ float3 frustum_left_normal;
+ float3 frustum_bottom_normal;
/* update */
bool need_update;
diff --git a/source/blender/blenkernel/intern/lattice_deform_test.cc b/source/blender/blenkernel/intern/lattice_deform_test.cc
index 33a4cc1d871..7db9d941458 100644
--- a/source/blender/blenkernel/intern/lattice_deform_test.cc
+++ b/source/blender/blenkernel/intern/lattice_deform_test.cc
@@ -83,7 +83,7 @@ static void test_lattice_deform_free(LatticeDeformTestContext *ctx)
TEST(lattice_deform_performance, performance_no_dvert_1)
{
const int32_t num_items = 1;
- LatticeDeformTestContext ctx = {0};
+ LatticeDeformTestContext ctx = {{{0}}};
RandomNumberGenerator rng;
test_lattice_deform_init(&ctx, &rng, num_items);
test_lattice_deform(&ctx, num_items);
@@ -92,7 +92,7 @@ TEST(lattice_deform_performance, performance_no_dvert_1)
TEST(lattice_deform_performance, performance_no_dvert_1000)
{
const int32_t num_items = 1000;
- LatticeDeformTestContext ctx = {0};
+ LatticeDeformTestContext ctx = {{{0}}};
RandomNumberGenerator rng;
test_lattice_deform_init(&ctx, &rng, num_items);
test_lattice_deform(&ctx, num_items);
@@ -101,7 +101,7 @@ TEST(lattice_deform_performance, performance_no_dvert_1000)
TEST(lattice_deform_performance, performance_no_dvert_10000)
{
const int32_t num_items = 10000;
- LatticeDeformTestContext ctx = {0};
+ LatticeDeformTestContext ctx = {{{0}}};
RandomNumberGenerator rng;
test_lattice_deform_init(&ctx, &rng, num_items);
test_lattice_deform(&ctx, num_items);
@@ -110,7 +110,7 @@ TEST(lattice_deform_performance, performance_no_dvert_10000)
TEST(lattice_deform_performance, performance_no_dvert_100000)
{
const int32_t num_items = 100000;
- LatticeDeformTestContext ctx = {0};
+ LatticeDeformTestContext ctx = {{{0}}};
RandomNumberGenerator rng;
test_lattice_deform_init(&ctx, &rng, num_items);
test_lattice_deform(&ctx, num_items);
@@ -119,7 +119,7 @@ TEST(lattice_deform_performance, performance_no_dvert_100000)
TEST(lattice_deform_performance, performance_no_dvert_1000000)
{
const int32_t num_items = 1000000;
- LatticeDeformTestContext ctx = {0};
+ LatticeDeformTestContext ctx = {{{0}}};
RandomNumberGenerator rng;
test_lattice_deform_init(&ctx, &rng, num_items);
test_lattice_deform(&ctx, num_items);
@@ -128,11 +128,11 @@ TEST(lattice_deform_performance, performance_no_dvert_1000000)
TEST(lattice_deform_performance, performance_no_dvert_10000000)
{
const int32_t num_items = 10000000;
- LatticeDeformTestContext ctx = {0};
+ LatticeDeformTestContext ctx = {{{0}}};
RandomNumberGenerator rng;
test_lattice_deform_init(&ctx, &rng, num_items);
test_lattice_deform(&ctx, num_items);
test_lattice_deform_free(&ctx);
}
-} // namespace blender::bke::tests \ No newline at end of file
+} // namespace blender::bke::tests
diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc
index 5f46f57c09a..c13321ed205 100644
--- a/source/blender/gpu/intern/gpu_shader.cc
+++ b/source/blender/gpu/intern/gpu_shader.cc
@@ -211,9 +211,9 @@ void Shader::print_log(Span<const char *> sources, char *log, const char *stage,
BLI_dynstr_appendf(dynstr, "%s%s%s: ", warn_col, "Warning", info_col);
}
/* Print the error itself. */
- BLI_dynstr_appendf(dynstr, info_col);
+ BLI_dynstr_append(dynstr, info_col);
BLI_dynstr_nappend(dynstr, log_line, (line_end + 1) - log_line);
- BLI_dynstr_appendf(dynstr, reset_col);
+ BLI_dynstr_append(dynstr, reset_col);
/* Continue to next line. */
log_line = line_end + 1;
last_error_line = error_line;
diff --git a/source/blender/gpu/opengl/gl_debug.cc b/source/blender/gpu/opengl/gl_debug.cc
index 69289d7602e..5564cbbabae 100644
--- a/source/blender/gpu/opengl/gl_debug.cc
+++ b/source/blender/gpu/opengl/gl_debug.cc
@@ -122,7 +122,7 @@ static void APIENTRY debug_callback(GLenum UNUSED(source),
}
if (((LOG.type->flag & CLG_FLAG_USE) && (LOG.type->level >= clog_severity))) {
- CLG_logf(LOG.type, clog_severity, debug_groups, "", message);
+ CLG_logf(LOG.type, clog_severity, debug_groups, "", "%s", message);
if (severity == GL_DEBUG_SEVERITY_HIGH) {
/* Focus on error message. */
if (use_color) {