Fix #29528: crash adding subsurf modifier in a particular scene with viewport render.
This commit is contained in:
@@ -269,7 +269,7 @@ SessionParams BlenderSync::get_session_params(BL::Scene b_scene, bool background
|
||||
if(!experimental || RNA_enum_get(&cscene, "gpu_type") == 0)
|
||||
dtype = DEVICE_CUDA;
|
||||
else
|
||||
dtype = DEVICE_CUDA;
|
||||
dtype = DEVICE_OPENCL;
|
||||
|
||||
if(device_type_available(types, dtype))
|
||||
params.device_type = dtype;
|
||||
|
@@ -270,15 +270,19 @@ void Mesh::compute_bvh(SceneParams *params, Progress& progress)
|
||||
void Mesh::tag_update(Scene *scene, bool rebuild)
|
||||
{
|
||||
need_update = true;
|
||||
if(rebuild)
|
||||
|
||||
if(rebuild) {
|
||||
need_update_rebuild = true;
|
||||
scene->light_manager->need_update = true;
|
||||
}
|
||||
else {
|
||||
foreach(uint sindex, used_shaders)
|
||||
if(scene->shaders[sindex]->has_surface_emission)
|
||||
scene->light_manager->need_update = true;
|
||||
}
|
||||
|
||||
scene->mesh_manager->need_update = true;
|
||||
scene->object_manager->need_update = true;
|
||||
|
||||
foreach(uint sindex, used_shaders)
|
||||
if(scene->shaders[sindex]->has_surface_emission)
|
||||
scene->light_manager->need_update = true;
|
||||
}
|
||||
|
||||
/* Mesh Manager */
|
||||
@@ -685,9 +689,9 @@ void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scen
|
||||
if(!mesh->transform_applied) {
|
||||
string msg = "Updating Mesh BVH ";
|
||||
if(mesh->name == "")
|
||||
msg += string_printf("%lu/%lu", (unsigned long)(i+1), (unsigned long)num_instance_bvh);
|
||||
msg += string_printf("%u/%u", (uint)(i+1), (uint)num_instance_bvh);
|
||||
else
|
||||
msg += string_printf("%s %lu/%lu", mesh->name.c_str(), (unsigned long)(i+1), (unsigned long)num_instance_bvh);
|
||||
msg += string_printf("%s %u/%u", mesh->name.c_str(), (uint)(i+1), (uint)num_instance_bvh);
|
||||
progress.set_status(msg, "Building BVH");
|
||||
|
||||
mesh->compute_bvh(&scene->params, progress);
|
||||
|
@@ -47,6 +47,7 @@
|
||||
*/
|
||||
|
||||
#include "util_debug.h"
|
||||
#include "util_types.h"
|
||||
|
||||
#include "sobol.h"
|
||||
|
||||
@@ -55,8 +56,8 @@ CCL_NAMESPACE_BEGIN
|
||||
#define SOBOL_MAX_NUMBER 32
|
||||
|
||||
typedef struct SobolDirectionNumbers {
|
||||
unsigned int d, s, a;
|
||||
unsigned int m[SOBOL_MAX_NUMBER];
|
||||
uint d, s, a;
|
||||
uint m[SOBOL_MAX_NUMBER];
|
||||
} SobolDirectionNumbers;
|
||||
|
||||
static SobolDirectionNumbers SOBOL_NUMBERS[SOBOL_MAX_DIMENSIONS-1] = {
|
||||
@@ -21262,38 +21263,38 @@ static SobolDirectionNumbers SOBOL_NUMBERS[SOBOL_MAX_DIMENSIONS-1] = {
|
||||
{21201, 18, 131059, {1, 1, 7, 11, 15, 7, 37, 239, 337, 245, 1557, 3681, 7357, 9639, 27367, 26869, 114603, 86317}}
|
||||
};
|
||||
|
||||
void sobol_generate_direction_vectors(unsigned int vectors[][SOBOL_BITS], int dimensions)
|
||||
void sobol_generate_direction_vectors(uint vectors[][SOBOL_BITS], int dimensions)
|
||||
{
|
||||
assert(dimensions <= SOBOL_MAX_DIMENSIONS);
|
||||
|
||||
const unsigned int L = SOBOL_BITS;
|
||||
const uint L = SOBOL_BITS;
|
||||
|
||||
/* first dimension is exception */
|
||||
unsigned int *v = vectors[0];
|
||||
uint *v = vectors[0];
|
||||
|
||||
for(unsigned int i = 0; i < L; i++)
|
||||
for(uint i = 0; i < L; i++)
|
||||
v[i] = 1 << (31-i); // all m's = 1
|
||||
|
||||
for(int dim = 1; dim < dimensions; dim++) {
|
||||
SobolDirectionNumbers *numbers = &SOBOL_NUMBERS[dim-1];
|
||||
unsigned int s = numbers->s;
|
||||
unsigned int a = numbers->a;
|
||||
unsigned int *m = numbers->m;
|
||||
uint s = numbers->s;
|
||||
uint a = numbers->a;
|
||||
uint *m = numbers->m;
|
||||
|
||||
v = vectors[dim];
|
||||
|
||||
if(L <= s) {
|
||||
for(unsigned int i = 0; i < L; i++)
|
||||
for(uint i = 0; i < L; i++)
|
||||
v[i] = m[i] << (31-i);
|
||||
}
|
||||
else {
|
||||
for(unsigned int i = 0; i < s; i++)
|
||||
for(uint i = 0; i < s; i++)
|
||||
v[i] = m[i] << (31-i);
|
||||
|
||||
for(unsigned int i = s; i < L; i++) {
|
||||
for(uint i = s; i < L; i++) {
|
||||
v[i] = v[i-s] ^ (v[i-s] >> s);
|
||||
|
||||
for(unsigned int k = 1; k < s; k++)
|
||||
for(uint k = 1; k < s; k++)
|
||||
v[i] ^= (((a >> (s-1-k)) & 1) * v[i-k]);
|
||||
}
|
||||
}
|
||||
|
@@ -19,12 +19,14 @@
|
||||
#ifndef __SOBOL_H__
|
||||
#define __SOBOL_H__
|
||||
|
||||
#include "util_types.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#define SOBOL_BITS 32
|
||||
#define SOBOL_MAX_DIMENSIONS 21201
|
||||
|
||||
void sobol_generate_direction_vectors(unsigned int vectors[][SOBOL_BITS], int dimensions);
|
||||
void sobol_generate_direction_vectors(uint vectors[][SOBOL_BITS], int dimensions);
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
Reference in New Issue
Block a user