diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/device/device.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/device/device.h | 6 | ||||
-rw-r--r-- | intern/cycles/device/device_cpu.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/device/device_cuda.cpp | 24 | ||||
-rw-r--r-- | intern/cycles/device/device_multi.cpp | 46 | ||||
-rw-r--r-- | intern/cycles/device/device_network.cpp | 18 | ||||
-rw-r--r-- | intern/cycles/device/device_opencl.cpp | 15 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_passes.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 6 | ||||
-rw-r--r-- | intern/cycles/render/buffers.cpp | 2 | ||||
-rw-r--r-- | 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<Pass> 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<DeviceInfo> 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<DeviceInfo>& 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<DeviceInfo>& 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<string, int> dupli_map; - map<string, int>::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<DeviceInfo>& devices, DeviceType type, bool map<string, int>::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<DeviceInfo>& 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<DeviceInfo>& 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]; |