Merge branch 'master' into blender2.8
This commit is contained in:
@@ -777,6 +777,15 @@ static void create_mesh(Scene *scene,
|
||||
int shader = clamp(f->material_index(), 0, used_shaders.size()-1);
|
||||
bool smooth = f->use_smooth() || use_loop_normals;
|
||||
|
||||
if(use_loop_normals) {
|
||||
BL::Array<float, 12> loop_normals = f->split_normals();
|
||||
for(int i = 0; i < n; i++) {
|
||||
N[vi[i]] = make_float3(loop_normals[i * 3],
|
||||
loop_normals[i * 3 + 1],
|
||||
loop_normals[i * 3 + 2]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Create triangles.
|
||||
*
|
||||
* NOTE: Autosmooth is already taken care about.
|
||||
|
@@ -79,8 +79,7 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data,
|
||||
me.calc_normals_split();
|
||||
}
|
||||
else {
|
||||
me.split_faces();
|
||||
me.calc_normals_split();
|
||||
me.split_faces(false);
|
||||
}
|
||||
}
|
||||
if(subdivision_type == Mesh::SUBDIVISION_NONE) {
|
||||
|
@@ -162,6 +162,7 @@ public:
|
||||
void mem_free(device_memory& mem)
|
||||
{
|
||||
device_ptr tmp = mem.device_pointer;
|
||||
stats.mem_free(mem.device_size);
|
||||
|
||||
foreach(SubDevice& sub, devices) {
|
||||
mem.device_pointer = sub.ptr_map[tmp];
|
||||
@@ -170,7 +171,6 @@ public:
|
||||
}
|
||||
|
||||
mem.device_pointer = 0;
|
||||
stats.mem_free(mem.device_size);
|
||||
}
|
||||
|
||||
void const_copy_to(const char *name, void *host, size_t size)
|
||||
@@ -202,6 +202,7 @@ public:
|
||||
void tex_free(device_memory& mem)
|
||||
{
|
||||
device_ptr tmp = mem.device_pointer;
|
||||
stats.mem_free(mem.device_size);
|
||||
|
||||
foreach(SubDevice& sub, devices) {
|
||||
mem.device_pointer = sub.ptr_map[tmp];
|
||||
@@ -210,7 +211,6 @@ public:
|
||||
}
|
||||
|
||||
mem.device_pointer = 0;
|
||||
stats.mem_free(mem.device_size);
|
||||
}
|
||||
|
||||
void pixels_alloc(device_memory& mem)
|
||||
|
@@ -309,6 +309,8 @@ bool OpenCLDeviceBase::OpenCLProgram::build_kernel(const string *debug_src)
|
||||
string build_options;
|
||||
build_options = device->kernel_build_options(debug_src) + kernel_build_options;
|
||||
|
||||
VLOG(1) << "Build options passed to clBuildProgram: '"
|
||||
<< build_options << "'.";
|
||||
cl_int ciErr = clBuildProgram(program, 0, NULL, build_options.c_str(), NULL, NULL);
|
||||
|
||||
/* show warnings even if build is successful */
|
||||
|
@@ -18,8 +18,19 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Noise */
|
||||
|
||||
ccl_device_inline void svm_noise(float3 p, float detail, float distortion, float *fac, float3 *color)
|
||||
ccl_device void svm_node_tex_noise(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
|
||||
{
|
||||
uint co_offset, scale_offset, detail_offset, distortion_offset, fac_offset, color_offset;
|
||||
|
||||
decode_node_uchar4(node.y, &co_offset, &scale_offset, &detail_offset, &distortion_offset);
|
||||
decode_node_uchar4(node.z, &color_offset, &fac_offset, NULL, NULL);
|
||||
|
||||
uint4 node2 = read_node(kg, offset);
|
||||
|
||||
float scale = stack_load_float_default(stack, scale_offset, node2.x);
|
||||
float detail = stack_load_float_default(stack, detail_offset, node2.y);
|
||||
float distortion = stack_load_float_default(stack, distortion_offset, node2.z);
|
||||
float3 p = stack_load_float3(stack, co_offset) * scale;
|
||||
int hard = 0;
|
||||
|
||||
if(distortion != 0.0f) {
|
||||
@@ -32,36 +43,17 @@ ccl_device_inline void svm_noise(float3 p, float detail, float distortion, float
|
||||
p += r;
|
||||
}
|
||||
|
||||
*fac = noise_turbulence(p, detail, hard);
|
||||
*color = make_float3(*fac,
|
||||
noise_turbulence(make_float3(p.y, p.x, p.z), detail, hard),
|
||||
noise_turbulence(make_float3(p.y, p.z, p.x), detail, hard));
|
||||
}
|
||||
float f = noise_turbulence(p, detail, hard);
|
||||
|
||||
ccl_device void svm_node_tex_noise(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
|
||||
{
|
||||
uint co_offset, scale_offset, detail_offset, distortion_offset, fac_offset, color_offset;
|
||||
|
||||
decode_node_uchar4(node.y, &co_offset, &scale_offset, &detail_offset, &distortion_offset);
|
||||
|
||||
uint4 node2 = read_node(kg, offset);
|
||||
|
||||
float scale = stack_load_float_default(stack, scale_offset, node2.x);
|
||||
float detail = stack_load_float_default(stack, detail_offset, node2.y);
|
||||
float distortion = stack_load_float_default(stack, distortion_offset, node2.z);
|
||||
float3 co = stack_load_float3(stack, co_offset);
|
||||
|
||||
float3 color;
|
||||
float f;
|
||||
|
||||
svm_noise(co*scale, detail, distortion, &f, &color);
|
||||
|
||||
decode_node_uchar4(node.z, &color_offset, &fac_offset, NULL, NULL);
|
||||
|
||||
if(stack_valid(fac_offset))
|
||||
if(stack_valid(fac_offset)) {
|
||||
stack_store_float(stack, fac_offset, f);
|
||||
if(stack_valid(color_offset))
|
||||
}
|
||||
if(stack_valid(color_offset)) {
|
||||
float3 color = make_float3(f,
|
||||
noise_turbulence(make_float3(p.y, p.x, p.z), detail, hard),
|
||||
noise_turbulence(make_float3(p.y, p.z, p.x), detail, hard));
|
||||
stack_store_float3(stack, color_offset, color);
|
||||
}
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -36,7 +36,7 @@
|
||||
#if !defined(__MINGW64__)
|
||||
# if defined(_WIN32) || defined(__APPLE__) || \
|
||||
defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
static void sincos(double x, double *sinx, double *cosx) {
|
||||
inline void sincos(double x, double *sinx, double *cosx) {
|
||||
*sinx = sin(x);
|
||||
*cosx = cos(x);
|
||||
}
|
||||
|
Reference in New Issue
Block a user