From 803286dde8dd9594a6a8c9e1ed154863934da295 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 26 Jan 2012 19:07:01 +0000 Subject: Cycles: render passes for CUDA cards with compute model >= 2.x. --- intern/cycles/blender/blender_session.cpp | 2 +- intern/cycles/device/device.cpp | 3 ++ intern/cycles/device/device.h | 6 ++-- intern/cycles/device/device_cpu.cpp | 8 ++---- intern/cycles/device/device_cuda.cpp | 24 +++------------- intern/cycles/device/device_multi.cpp | 46 +++---------------------------- intern/cycles/device/device_network.cpp | 18 ------------ intern/cycles/device/device_opencl.cpp | 15 +--------- intern/cycles/kernel/kernel_passes.h | 4 +-- intern/cycles/kernel/kernel_types.h | 6 ++-- intern/cycles/render/buffers.cpp | 2 +- intern/cycles/render/svm.cpp | 2 +- 12 files changed, 25 insertions(+), 111 deletions(-) diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 5e3102fd7c7..d9adc5480dc 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -206,7 +206,7 @@ void BlenderSession::render() vector passes; Pass::add(PASS_COMBINED, passes); - if(session_params.device.type == DEVICE_CPU) { /* todo */ + if(session_params.device.advanced_shading) { BL::RenderLayer::passes_iterator b_pass_iter; for(b_rlay.passes.begin(b_pass_iter); b_pass_iter != b_rlay.passes.end(); ++b_pass_iter) { diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index e4beb4d7d8c..cceec8b8e5c 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -183,6 +183,9 @@ Device *Device::create(DeviceInfo& info, bool background, int threads) return NULL; } + if(device) + device->info = info; + return device; } diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index b8fea4c4c69..af2567498d9 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -51,6 +51,7 @@ public: string id; int num; bool display_device; + bool advanced_shading; vector multi_devices; DeviceInfo() @@ -59,6 +60,7 @@ public: id = "CPU"; num = 0; display_device = false; + advanced_shading = true; } }; @@ -101,10 +103,8 @@ protected: public: virtual ~Device() {} - virtual bool support_full_kernel() = 0; - /* info */ - virtual string description() = 0; + DeviceInfo info; virtual const string& error_message() { return error_msg; } /* regular memory */ diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index 2ca599f6c67..da977ed8472 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -72,16 +72,11 @@ public: kernel_globals_free(kg); } - bool support_full_kernel() + bool support_advanced_shading() { return true; } - string description() - { - return system_cpu_brand_string(); - } - void mem_alloc(device_memory& mem, MemoryType type) { mem.device_pointer = mem.data_pointer; @@ -271,6 +266,7 @@ void device_cpu_info(vector& devices) info.description = system_cpu_brand_string(); info.id = "CPU"; info.num = 0; + info.advanced_shading = true; devices.insert(devices.begin(), info); } diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 55b467fc856..14bcaa94130 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -194,26 +194,6 @@ public: cuda_assert(cuCtxDetach(cuContext)) } - bool support_full_kernel() - { - int major, minor; - cuDeviceComputeCapability(&major, &minor, cuDevId); - - return (major >= 2); - } - - string description() - { - /* print device information */ - char deviceName[256]; - - cuda_push_context(); - cuDeviceGetName(deviceName, 256, cuDevId); - cuda_pop_context(); - - return string("CUDA ") + deviceName; - } - bool support_device(bool experimental) { if(!experimental) { @@ -881,6 +861,10 @@ void device_cuda_info(vector& devices) info.id = string_printf("CUDA_%d", num); info.num = num; + int major, minor; + cuDeviceComputeCapability(&major, &minor, num); + info.advanced_shading = (major >= 2); + /* if device has a kernel timeout, assume it is used for display */ if(cuDeviceGetAttribute(&attr, CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, num) == CUDA_SUCCESS && attr == 1) { info.display_device = true; diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp index 41d0e268526..375719133b8 100644 --- a/intern/cycles/device/device_multi.cpp +++ b/intern/cycles/device/device_multi.cpp @@ -76,16 +76,6 @@ public: delete sub.device; } - bool support_full_kernel() - { - foreach(SubDevice& sub, devices) { - if(!sub.device->support_full_kernel()) - return false; - } - - return true; - } - const string& error_message() { foreach(SubDevice& sub, devices) { @@ -99,38 +89,6 @@ public: return error_msg; } - string description() - { - /* create map to find duplicate descriptions */ - map dupli_map; - map::iterator dt; - - foreach(SubDevice& sub, devices) { - string key = sub.device->description(); - - if(dupli_map.find(key) == dupli_map.end()) - dupli_map[key] = 1; - else - dupli_map[key]++; - } - - /* generate string */ - stringstream desc; - bool first = true; - - for(dt = dupli_map.begin(); dt != dupli_map.end(); dt++) { - if(!first) desc << ", "; - first = false; - - if(dt->second > 1) - desc << dt->second << "x " << dt->first; - else - desc << dt->first; - } - - return desc.str(); - } - bool load_kernels(bool experimental) { foreach(SubDevice& sub, devices) @@ -344,6 +302,8 @@ static void device_multi_add(vector& devices, DeviceType type, bool map::iterator dt; int num_added = 0, num_display = 0; + info.advanced_shading = true; + foreach(DeviceInfo& subinfo, devices) { if(subinfo.type == type) { if(subinfo.display_device) { @@ -363,6 +323,8 @@ static void device_multi_add(vector& devices, DeviceType type, bool info.multi_devices.push_back(subinfo); if(subinfo.display_device) info.display_device = true; + if(!subinfo.advanced_shading) + info.advanced_shading = false; num_added++; } } diff --git a/intern/cycles/device/device_network.cpp b/intern/cycles/device/device_network.cpp index 14518b1507e..931890b5859 100644 --- a/intern/cycles/device/device_network.cpp +++ b/intern/cycles/device/device_network.cpp @@ -57,24 +57,6 @@ public: { } - bool support_full_kernel() - { - return false; - } - - string description() - { - RPCSend snd(socket, "description"); - snd.write(); - - RPCReceive rcv(socket); - string desc_string; - - *rcv.archive & desc_string; - - return desc_string + " (remote)"; - } - void mem_alloc(device_memory& mem, MemoryType type) { #if 0 diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index ccfd8544362..9a55f957895 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -453,20 +453,6 @@ public: clReleaseContext(cxContext); } - bool support_full_kernel() - { - return false; - } - - string description() - { - char name[1024]; - - clGetDeviceInfo(cdDevice, CL_DEVICE_NAME, sizeof(name), &name, NULL); - - return string("OpenCL ") + name; - } - void mem_alloc(device_memory& mem, MemoryType type) { size_t size = mem.memory_size(); @@ -750,6 +736,7 @@ void device_opencl_info(vector& devices) info.num = num; /* we don't know if it's used for display, but assume it is */ info.display_device = true; + info.advanced_shading = false; devices.push_back(info); } diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h index cfd73c98bad..a1b3b0e9038 100644 --- a/intern/cycles/kernel/kernel_passes.h +++ b/intern/cycles/kernel/kernel_passes.h @@ -36,7 +36,7 @@ __device_inline void kernel_write_pass_float4(__global float *buffer, int sample *buf = (sample == 0)? value: *buf + value; } -__device void kernel_write_data_passes(KernelGlobals *kg, __global float *buffer, PathRadiance *L, +__device_inline void kernel_write_data_passes(KernelGlobals *kg, __global float *buffer, PathRadiance *L, ShaderData *sd, int sample, int path_flag, float3 throughput) { #ifdef __PASSES__ @@ -86,7 +86,7 @@ __device void kernel_write_data_passes(KernelGlobals *kg, __global float *buffer #endif } -__device void kernel_write_light_passes(KernelGlobals *kg, __global float *buffer, PathRadiance *L, int sample) +__device_inline void kernel_write_light_passes(KernelGlobals *kg, __global float *buffer, PathRadiance *L, int sample) { #ifdef __PASSES__ int flag = kernel_data.film.pass_flag; diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index b4b1da83162..9ebe4120e36 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -185,6 +185,9 @@ typedef float3 PathThroughput; struct PathRadiance { int use_light_pass; + float3 emission; + float3 background; + float3 indirect; float3 direct_throughput; float3 direct_emission; @@ -200,9 +203,6 @@ struct PathRadiance { float3 indirect_diffuse; float3 indirect_glossy; float3 indirect_transmission; - - float3 emission; - float3 background; }; struct BsdfEval { diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp index 56219482ef0..361ead3cd24 100644 --- a/intern/cycles/render/buffers.cpp +++ b/intern/cycles/render/buffers.cpp @@ -130,7 +130,7 @@ bool RenderBuffers::copy_from_device() if(!buffer.device_pointer) return false; - device->mem_copy_from(buffer, 0, params.width, params.height, sizeof(float4)); + device->mem_copy_from(buffer, 0, params.width, params.height, params.get_passes_size()*sizeof(float)); return true; } diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp index f088a8143cc..ae666ddfe68 100644 --- a/intern/cycles/render/svm.cpp +++ b/intern/cycles/render/svm.cpp @@ -58,7 +58,7 @@ void SVMShaderManager::device_update(Device *device, DeviceScene *dscene, Scene } bool sunsky_done = false; - bool use_multi_closure = device->support_full_kernel(); + bool use_multi_closure = device->info.advanced_shading; for(i = 0; i < scene->shaders.size(); i++) { Shader *shader = scene->shaders[i]; -- cgit v1.2.3 From 4fe00cd4f9ca5b0521c60c70b55032472700b0c5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 26 Jan 2012 19:45:59 +0000 Subject: Cycles: disable environment importance sampling code for CUDA cards with compute model < 2.x, to avoid running out of memory in the compiler. --- intern/cycles/kernel/kernel_emission.h | 7 ++++++- intern/cycles/kernel/kernel_light.h | 2 ++ intern/cycles/kernel/kernel_shader.h | 1 - intern/cycles/kernel/kernel_types.h | 3 +-- intern/cycles/render/light.cpp | 10 ++++++++++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h index b3a5b2bfcb4..513a453b585 100644 --- a/intern/cycles/kernel/kernel_emission.h +++ b/intern/cycles/kernel/kernel_emission.h @@ -27,6 +27,7 @@ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando, ShaderData sd; float3 eval; +#ifdef __BACKGROUND_MIS__ if(ls->type == LIGHT_BACKGROUND) { Ray ray; ray.D = ls->D; @@ -36,7 +37,9 @@ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando, shader_setup_from_background(kg, &sd, &ray); eval = shader_eval_background(kg, &sd, 0); } - else { + else +#endif + { shader_setup_from_sample(kg, &sd, ls->P, ls->Ng, I, ls->shader, ls->object, ls->prim, u, v); ls->Ng = sd.Ng; @@ -164,6 +167,7 @@ __device float3 indirect_background(KernelGlobals *kg, Ray *ray, int path_flag, float3 L = shader_eval_background(kg, &sd, path_flag); shader_release(kg, &sd); +#ifdef __BACKGROUND_MIS__ /* check if background light exists or if we should skip pdf */ int res = kernel_data.integrator.pdf_background_res; @@ -175,6 +179,7 @@ __device float3 indirect_background(KernelGlobals *kg, Ray *ray, int path_flag, return L*mis_weight; } +#endif return L; #else diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h index 4c2b69c2716..aa125180a94 100644 --- a/intern/cycles/kernel/kernel_light.h +++ b/intern/cycles/kernel/kernel_light.h @@ -192,6 +192,7 @@ __device void regular_light_sample(KernelGlobals *kg, int point, ls->D = -D; ls->t = FLT_MAX; } +#ifdef __BACKGROUND_MIS__ else if(type == LIGHT_BACKGROUND) { /* infinite area light (e.g. light dome or env light) */ float3 D = background_light_sample(kg, randu, randv, pdf); @@ -201,6 +202,7 @@ __device void regular_light_sample(KernelGlobals *kg, int point, ls->D = -D; ls->t = FLT_MAX; } +#endif else { ls->P = make_float3(data0.y, data0.z, data0.w); diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index 1d2cf46aa56..0f04af1275d 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -26,7 +26,6 @@ * */ - #ifdef __OSL__ #include "osl_shader.h" diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 9ebe4120e36..477b08f2f87 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -70,9 +70,8 @@ CCL_NAMESPACE_BEGIN #ifdef __KERNEL_ADV_SHADING__ #define __MULTI_CLOSURE__ #define __TRANSPARENT_SHADOWS__ -#ifdef __KERNEL_CPU__ #define __PASSES__ -#endif +#define __BACKGROUND_MIS__ #endif //#define __MULTI_LIGHT__ diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 777e764558f..405aa800457 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -402,6 +402,16 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce float4 *light_data = dscene->light_data.resize(scene->lights.size()*LIGHT_SIZE); + if(!device->info.advanced_shading) { + /* remove unsupported light */ + foreach(Light *light, scene->lights) { + if(light->type == LIGHT_BACKGROUND) { + scene->lights.erase(std::remove(scene->lights.begin(), scene->lights.end(), light), scene->lights.end()); + break; + } + } + } + for(size_t i = 0; i < scene->lights.size(); i++) { Light *light = scene->lights[i]; float3 co = light->co; -- cgit v1.2.3 From 0c7a455c074304c7882ea6aca63dee22ef620dec Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 27 Jan 2012 01:30:58 +0000 Subject: Action Constraint GUI - Refinements and Clarification While looking at a bug report, I found that the current GUI for the Action Constraint actually didn't make sense, mixing up settings so that it wasn't clear which settings corresponded to which others. This commit cleans up the layout into a clearer two-column design to have a "from" -> "to" layout, making all the relationships between things clear. For more details see http://aligorith.blogspot.com/2012/01/action-constraint- gui-revised.html --- .../startup/bl_ui/properties_object_constraint.py | 31 ++++++++++++---------- source/blender/makesrna/intern/rna_constraint.c | 22 +++++++-------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py index 57adfa1fa20..dff23e6238f 100644 --- a/release/scripts/startup/bl_ui/properties_object_constraint.py +++ b/release/scripts/startup/bl_ui/properties_object_constraint.py @@ -434,25 +434,28 @@ class ConstraintButtonsPanel(): def ACTION(self, context, layout, con): self.target_template(layout, con) - layout.prop(con, "action") - - layout.prop(con, "transform_channel") - split = layout.split() - - col = split.column(align=True) - col.label(text="Action Length:") - col.prop(con, "frame_start", text="Start") - col.prop(con, "frame_end", text="End") - + + col = split.column() + col.label(text="From Target:") + col.prop(con, "transform_channel", text="") + col.prop(con, "target_space", text="") + + col = split.column() + col.label(text="To Action:") + col.prop(con, "action", text="") + + split = layout.split() + col = split.column(align=True) col.label(text="Target Range:") col.prop(con, "min", text="Min") col.prop(con, "max", text="Max") - - row = layout.row() - row.label(text="Convert:") - row.prop(con, "target_space", text="") + + col = split.column(align=True) + col.label(text="Action Range:") + col.prop(con, "frame_start", text="Start") + col.prop(con, "frame_end", text="End") def LOCKED_TRACK(self, context, layout, con): self.target_template(layout, con) diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 3258b8c3dcb..e12f411f81f 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -1026,15 +1026,15 @@ static void rna_def_constraint_action(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem transform_channel_items[] = { - {20, "LOCATION_X", 0, "Location X", ""}, - {21, "LOCATION_Y", 0, "Location Y", ""}, - {22, "LOCATION_Z", 0, "Location Z", ""}, - {00, "ROTATION_X", 0, "Rotation X", ""}, - {01, "ROTATION_Y", 0, "Rotation Y", ""}, - {02, "ROTATION_Z", 0, "Rotation Z", ""}, - {10, "SCALE_X", 0, "Scale X", ""}, - {11, "SCALE_Y", 0, "Scale Y", ""}, - {12, "SCALE_Z", 0, "Scale Z", ""}, + {20, "LOCATION_X", 0, "X Location", ""}, + {21, "LOCATION_Y", 0, "Y Location", ""}, + {22, "LOCATION_Z", 0, "Z Location", ""}, + {00, "ROTATION_X", 0, "X Rotation", ""}, + {01, "ROTATION_Y", 0, "Y Rotation", ""}, + {02, "ROTATION_Z", 0, "Z Rotation", ""}, + {10, "SCALE_X", 0, "Z Scale", ""}, + {11, "SCALE_Y", 0, "Y Scale", ""}, + {12, "SCALE_Z", 0, "Z Scale", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "ActionConstraint", "Constraint"); @@ -2011,12 +2011,12 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "chainlen"); RNA_def_property_range(prop, 1, 255); // TODO: this should really check the max length of the chain the constraint is attached to RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the chain"); - RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); // XXX: this update goes wrong... needs extra flush? /* direct access to bindings */ // NOTE: only to be used by experienced users prop= RNA_def_property(srna, "joint_bindings", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_array(prop, 32); // XXX this is the maximum value allowed + RNA_def_property_array(prop, 32); // XXX this is the maximum value allowed - why? RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_dynamic_array_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get_length"); RNA_def_property_float_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get", "rna_SplineIKConstraint_joint_bindings_set", NULL); -- cgit v1.2.3 From 959f2624ca58839ae8cc5ac6e13162759e5dc759 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Fri, 27 Jan 2012 07:35:57 +0000 Subject: Fix [#29884] Splash screen only displays "r43" Based on patch by perfection cat Removed the unnecessary char * juggling. --- source/blender/windowmanager/intern/wm_operators.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index faf2d3fd352..4052c221935 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1277,22 +1277,17 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar #ifdef WITH_BUILDINFO int ver_width, rev_width; - char *version_str = NULL; - char *revision_str = NULL; char version_buf[128]; char revision_buf[128]; extern char build_rev[]; - version_str = &version_buf[0]; - revision_str = &revision_buf[0]; - - BLI_snprintf(version_str, sizeof(version_str), + BLI_snprintf(version_buf, sizeof(version_buf), "%d.%02d.%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION); - BLI_snprintf(revision_str, sizeof(revision_str), "r%s", build_rev); + BLI_snprintf(revision_buf, sizeof(revision_buf), "r%s", build_rev); BLF_size(style->widgetlabel.uifont_id, style->widgetlabel.points, U.dpi); - ver_width = (int)BLF_width(style->widgetlabel.uifont_id, version_str) + 5; - rev_width = (int)BLF_width(style->widgetlabel.uifont_id, revision_str) + 5; + ver_width = (int)BLF_width(style->widgetlabel.uifont_id, version_buf) + 5; + rev_width = (int)BLF_width(style->widgetlabel.uifont_id, revision_buf) + 5; #endif //WITH_BUILDINFO block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS); @@ -1303,8 +1298,8 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar uiBlockSetFunc(block, wm_block_splash_refreshmenu, block, NULL); #ifdef WITH_BUILDINFO - uiDefBut(block, LABEL, 0, version_str, 494-ver_width, 282-24, ver_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); - uiDefBut(block, LABEL, 0, revision_str, 494-rev_width, 282-36, rev_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, LABEL, 0, version_buf, 494-ver_width, 282-24, ver_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, LABEL, 0, revision_buf, 494-rev_width, 282-36, rev_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); #endif //WITH_BUILDINFO layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, 480, 110, style); -- cgit v1.2.3 From b35446c3fa84ec0b817be1aaf356c3e3a5071285 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 27 Jan 2012 08:04:03 +0000 Subject: Fix #30000: Boolean modifier messing up multi material Issue was caused by resetting face's mat_nr to zero if there's no material map sent to ConvertCSGDescriptorsToDerivedMesh. In case of boolean modifier we can't use such map because we can't affect on materials present in object. So the only way which can give reasonable result is: - Dot change mat_nr for faces from left operand (they should be fine, because materials aren't deleting by modifier) - For faces from right operand check if needed material exists in left operand and if so, use it's index as new mat_nr. - If there are materials in right operand which doesn't exist in left operand, they'll be changed to first material from left operand. --- source/blender/modifiers/intern/MOD_boolean_util.c | 32 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index f6a2e4451b2..4b380efa95b 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -374,10 +374,10 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( } // a hash table to remap materials to indices - if (mat) { - material_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "CSG_mat gh"); + material_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "CSG_mat gh"); + + if (mat) *totmat = 0; - } origindex_layer = result->getFaceDataArray(result, CD_ORIGINDEX); @@ -422,6 +422,32 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( else mface->mat_nr = GET_INT_FROM_POINTER(BLI_ghash_lookup(material_hash, orig_mat)); } + else if(orig_mat) { + if(orig_ob == ob1) { + // No need to change materian index for faces from left operand + } + else { + // for faces from right operand checn if there's needed material in left operand and if it is, + // use index of that material, otherwise fallback to first material (material with index=0) + if (!BLI_ghash_haskey(material_hash, orig_mat)) { + int a; + + mat_nr = 0; + for(a = 0; a < ob1->totcol; a++) { + if(give_current_material(ob1, a+1) == orig_mat) { + mat_nr = a; + break; + } + } + + BLI_ghash_insert(material_hash, orig_mat, SET_INT_IN_POINTER(mat_nr)); + + mface->mat_nr = mat_nr; + } + else + mface->mat_nr = GET_INT_FROM_POINTER(BLI_ghash_lookup(material_hash, orig_mat)); + } + } else mface->mat_nr = 0; -- cgit v1.2.3 From 82300fabb9cc0d55c3044fc1cf039025bd39129a Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Fri, 27 Jan 2012 08:15:30 +0000 Subject: Minor fix for CD_TYPE_AS_MASK macro: shift operator uses the left operand's type for the result, so cast 1 to CustomDataMask. --- source/blender/blenkernel/BKE_customdata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 1af2f014ef4..7ad25ac7e79 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -67,7 +67,7 @@ extern const CustomDataMask CD_MASK_FACECORNERS; #define CD_DUPLICATE 4 /* do a full copy of all layers, only allowed if source has same number of elements */ -#define CD_TYPE_AS_MASK(_type) (CustomDataMask)(1 << (CustomDataMask)(_type)) +#define CD_TYPE_AS_MASK(_type) (CustomDataMask)((CustomDataMask)1 << (CustomDataMask)(_type)) /* initialises a CustomData object with the same layer setup as source. * mask is a bitfield where (mask & (1 << (layer type))) indicates -- cgit v1.2.3 From 3062798de3a34d461578da4bd9d8d4f700f70ddb Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 27 Jan 2012 08:17:53 +0000 Subject: Fixed some possible issues and access non-initialized variable in Carve BOP interface. Discovered when was investigating some crashes caused by Carve's triangulator. --- intern/boolop/intern/BOP_CarveInterface.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/intern/boolop/intern/BOP_CarveInterface.cpp b/intern/boolop/intern/BOP_CarveInterface.cpp index 274d9cac0cf..5a847ff26d4 100644 --- a/intern/boolop/intern/BOP_CarveInterface.cpp +++ b/intern/boolop/intern/BOP_CarveInterface.cpp @@ -150,12 +150,19 @@ static MeshSet<3> *Carve_unionIntersectingMeshes(MeshSet<3> *poly, MeshSet<3> *right = Carve_getIntersectedOperand(orig_meshes, precomputedAABB, otherAABB); try { - MeshSet<3> *result = csg.compute(left, right, carve::csg::CSG::UNION, NULL, carve::csg::CSG::CLASSIFY_EDGE); + if(left->meshes.size()==0) { + delete left; - delete left; - delete right; + left = right; + } + else { + MeshSet<3> *result = csg.compute(left, right, carve::csg::CSG::UNION, NULL, carve::csg::CSG::CLASSIFY_EDGE); - left = result; + delete left; + delete right; + + left = result; + } } catch(carve::exception e) { std::cerr << "CSG failed, exception " << e.str() << std::endl; @@ -492,7 +499,7 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType, CSG_VertexIteratorDescriptor obBVertices) { carve::csg::CSG::OP op; - MeshSet<3> *left, *right, *output; + MeshSet<3> *left, *right, *output = NULL; carve::csg::CSG csg; carve::geom3d::Vector min, max; carve::interpolate::FaceAttr oface_num; @@ -517,6 +524,17 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType, Carve_prepareOperands(&left, &right, oface_num); + if(left->meshes.size() == 0 || right->meshes.size()==0) { + // normally sohuldn't happen (zero-faces objects are handled by modifier itself), but + // unioning intersecting meshes which doesn't have consistent normals might lead to + // empty result which wouldn't work here + + delete left; + delete right; + + return BOP_ERROR; + } + min.x = max.x = left->vertex_storage[0].v.x; min.y = max.y = left->vertex_storage[0].v.y; min.z = max.z = left->vertex_storage[0].v.z; -- cgit v1.2.3 From b023665551d2059d34ffa45d4234abb3d1c92736 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 27 Jan 2012 13:58:32 +0000 Subject: Cycles: another fix for CUDA render passes, needed to align float4 passes. --- intern/cycles/device/device_cuda.cpp | 11 +++-------- intern/cycles/render/buffers.cpp | 2 +- intern/cycles/render/film.cpp | 14 ++++++++++++++ intern/cycles/util/util_types.h | 5 +++++ 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 14bcaa94130..0c08baae3ff 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -106,11 +106,6 @@ public: } } - static int cuda_align_up(int& offset, int alignment) - { - return (offset + alignment - 1) & ~(alignment - 1); - } - #ifdef NDEBUG #define cuda_abort() #else @@ -485,7 +480,7 @@ public: offset += sizeof(d_rng_state); int sample = task.sample; - offset = cuda_align_up(offset, __alignof(sample)); + offset = align_up(offset, __alignof(sample)); cuda_assert(cuParamSeti(cuPathTrace, offset, task.sample)) offset += sizeof(task.sample); @@ -549,7 +544,7 @@ public: offset += sizeof(d_buffer); int sample = task.sample; - offset = cuda_align_up(offset, __alignof(sample)); + offset = align_up(offset, __alignof(sample)); cuda_assert(cuParamSeti(cuFilmConvert, offset, task.sample)) offset += sizeof(task.sample); @@ -618,7 +613,7 @@ public: offset += sizeof(d_offset); int shader_eval_type = task.shader_eval_type; - offset = cuda_align_up(offset, __alignof(shader_eval_type)); + offset = align_up(offset, __alignof(shader_eval_type)); cuda_assert(cuParamSeti(cuDisplace, offset, task.shader_eval_type)) offset += sizeof(task.shader_eval_type); diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp index 361ead3cd24..dd0ebf7195c 100644 --- a/intern/cycles/render/buffers.cpp +++ b/intern/cycles/render/buffers.cpp @@ -71,7 +71,7 @@ int BufferParams::get_passes_size() foreach(Pass& pass, passes) size += pass.components; - return size; + return align_up(size, 4); } /* Render Buffers */ diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp index bc51384b873..376e9d6d0ca 100644 --- a/intern/cycles/render/film.cpp +++ b/intern/cycles/render/film.cpp @@ -21,12 +21,20 @@ #include "film.h" #include "scene.h" +#include "util_algorithm.h" #include "util_foreach.h" CCL_NAMESPACE_BEGIN /* Pass */ +static bool compare_pass_order(const Pass& a, const Pass& b) +{ + if(a.components == b.components) + return (a.type < b.type); + return (a.components > b.components); +} + void Pass::add(PassType type, vector& passes) { Pass pass; @@ -106,6 +114,10 @@ void Pass::add(PassType type, vector& passes) } passes.push_back(pass); + + /* order from by components, to ensure alignment so passes with size 4 + come first and then passes with size 1 */ + sort(passes.begin(), passes.end(), compare_pass_order); } bool Pass::equals(const vector& A, const vector& B) @@ -219,6 +231,8 @@ void Film::device_update(Device *device, DeviceScene *dscene) kfilm->pass_stride += pass.components; } + kfilm->pass_stride = align_up(kfilm->pass_stride, 4); + need_update = false; } diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h index 2c0ae13ad2a..efdda98571a 100644 --- a/intern/cycles/util/util_types.h +++ b/intern/cycles/util/util_types.h @@ -277,6 +277,11 @@ __device float4 make_float4(float x, float y, float z, float w) return a; } +__device int align_up(int offset, int alignment) +{ + return (offset + alignment - 1) & ~(alignment - 1); +} + #endif CCL_NAMESPACE_END -- cgit v1.2.3 From 6da44f9042afcdb13f0c2b4bb99139629fc40907 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 27 Jan 2012 14:17:59 +0000 Subject: Always assume isFinalCals is truth when applying constructive modifiers on curves for viewport display. It saves plenty of memory when using subsurf modifier which result is getting converted from CCGDM to CDDM without any benefit. It also syncs behavior of modifiers with mesh. Need to keep an eye on constructive modifiers when in edit mode. Discovered this when was looking into #29973. --- source/blender/blenkernel/intern/displist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 17936a44a73..e0f76917368 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -833,6 +833,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba int editmode = (!forRender && cu->editnurb); DerivedMesh *dm= NULL, *ndm; float (*vertCos)[3] = NULL; + int useCache = !forRender; if(forRender) required_mode = eModifierMode_Render; else required_mode = eModifierMode_Realtime; @@ -911,7 +912,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba vertCos= NULL; } - ndm = mti->applyModifier(md, ob, dm, forRender, editmode); + ndm = mti->applyModifier(md, ob, dm, forRender, useCache); if (ndm) { /* Modifier returned a new derived mesh */ -- cgit v1.2.3 From d7b9fdc2f6090696390e3f991090ba3ab60f2ce3 Mon Sep 17 00:00:00 2001 From: Miika Hamalainen Date: Fri, 27 Jan 2012 17:44:56 +0000 Subject: Dynamic Paint: * Fix: Brush didn't paint particles that were hidden by the display percentage setting. --- source/blender/blenkernel/intern/dynamicpaint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 501b97bd9be..cdfd5d3562b 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -3552,7 +3552,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, /* Proceed only if particle is active */ if(pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN)==0) continue; else if(pa->alive == PARS_DEAD && (part->flag & PART_DIED)==0) continue; - else if(pa->flag & PARS_NO_DISP || pa->flag & PARS_UNEXIST) continue; + else if(pa->flag & PARS_UNEXIST) continue; /* for debug purposes check if any NAN particle proceeds * For some reason they get past activity check, this should rule most of them out */ -- cgit v1.2.3 From 8369706c153cf1fde48de795d519617382ed7e67 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 28 Jan 2012 08:45:51 +0000 Subject: Fixed typo in a tooltip --- source/blender/makesrna/intern/rna_space.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 571fe05238d..799366a5234 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2902,7 +2902,7 @@ static void rna_def_space_clip(BlenderRNA *brna) /* lock to time cursor */ prop= RNA_def_property(srna, "lock_time_cursor", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Lock to Time Cursor", "Lock curves view to time cursos during playback and tracking"); + RNA_def_property_ui_text(prop, "Lock to Time Cursor", "Lock curves view to time cursor during playback and tracking"); RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_LOCK_TIMECURSOR); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); -- cgit v1.2.3 From b86c6f65a43a2ef1597b29467ba61bbed4ff6ec5 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sat, 28 Jan 2012 13:53:17 +0000 Subject: Release cycle: * Moving on to BCon3: Beta. --- source/blender/blenkernel/BKE_blender.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 42d9ae73b9a..50fef032b75 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -51,7 +51,7 @@ extern "C" { /* can be left blank, otherwise a,b,c... etc with no quotes */ #define BLENDER_VERSION_CHAR /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE alpha +#define BLENDER_VERSION_CYCLE beta extern char versionstr[]; /* from blender.c */ -- cgit v1.2.3 From d4584dfd23ab4880cc6e2f7f6d699ea3c9687d22 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 29 Jan 2012 10:21:28 +0000 Subject: Fix for [#30015] Keyframed Resolution Unpredictable * Disabled possibility to keyframe render resolution, percentage and border render properties. Animating them does not makes much sense. Discussed with Sergey in IRC. --- source/blender/makesrna/intern/rna_scene.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index c1df493eea5..68b9ce4e956 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3154,18 +3154,21 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "xsch"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 4, 10000); RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the rendered image"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update"); prop= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ysch"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 4, 10000); RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the rendered image"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update"); prop= RNA_def_property(srna, "resolution_percentage", PROP_INT, PROP_PERCENTAGE); RNA_def_property_int_sdna(prop, NULL, "size"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1, SHRT_MAX); RNA_def_property_ui_range(prop, 1, 100, 10, 1); RNA_def_property_ui_text(prop, "Resolution %", "Percentage scale for render resolution"); @@ -3185,12 +3188,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "pixel_aspect_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xasp"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1.0f, 200.0f); RNA_def_property_ui_text(prop, "Pixel Aspect X", "Horizontal aspect ratio - for anamorphic or non-square pixel output"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update"); prop= RNA_def_property(srna, "pixel_aspect_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "yasp"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1.0f, 200.0f); RNA_def_property_ui_text(prop, "Pixel Aspect Y", "Vertical aspect ratio - for anamorphic or non-square pixel output"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update"); @@ -3404,6 +3409,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) /* border */ prop= RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Border", "Render a user-defined border region, within the frame size " "(note that this disables save_buffers and full_sample)"); @@ -3435,6 +3441,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_crop_to_border", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_CROP); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Crop to Border", "Crop the rendered frame to the defined border size"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); -- cgit v1.2.3 From b820ec4ae4a62a05fc9ac6ca9c93a17128675407 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 29 Jan 2012 16:55:57 +0000 Subject: Fixed for cloth modifier when it's applied after deformation modifier. --- source/blender/modifiers/intern/MOD_cloth.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 7e46d3f0fe3..fdb584ec592 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -84,6 +84,10 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, } dm = get_dm(ob, NULL, derivedData, NULL, 0); + if(dm == derivedData) + dm = CDDM_copy(dm); + + CDDM_apply_vert_coords(dm, vertexCos); clothModifier_do(clmd, md->scene, ob, dm, vertexCos); @@ -92,8 +96,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, result->release(result); } - if(dm != derivedData) - dm->release(dm); + dm->release(dm); } static void updateDepgraph( -- cgit v1.2.3