diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-10-31 13:49:04 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-10-31 13:49:04 +0300 |
commit | fc12a736bbd10e488b701ad18fb70934ea8de01b (patch) | |
tree | 13532ffffbd7fac27474c01c00702041c45d273f /intern | |
parent | 14e1dfda4e145fb4d6975fd1531fad149b761bbb (diff) | |
parent | e0cc3e980999ed97e72b430f0d654b30f60f9313 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/device/device.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/device/device.h | 3 | ||||
-rw-r--r-- | intern/cycles/device/device_cpu.cpp | 18 | ||||
-rw-r--r-- | intern/cycles/device/device_cuda.cpp | 5 | ||||
-rw-r--r-- | intern/cycles/device/device_multi.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/device/device_network.cpp | 5 | ||||
-rw-r--r-- | intern/cycles/device/device_opencl.cpp | 1 | ||||
-rw-r--r-- | intern/cycles/device/opencl/opencl_mega.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/device/opencl/opencl_split.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/render/mesh.cpp | 4 |
10 files changed, 38 insertions, 16 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index 906c01c619d..428cd4158bc 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -504,7 +504,6 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo>& subdevices, int th info.has_half_images = true; info.has_volume_decoupled = true; - info.bvh_layout_mask = BVH_LAYOUT_ALL; info.has_osl = true; foreach(const DeviceInfo &device, subdevices) { @@ -539,7 +538,6 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo>& subdevices, int th /* Accumulate device info. */ info.has_half_images &= device.has_half_images; info.has_volume_decoupled &= device.has_volume_decoupled; - info.bvh_layout_mask = device.bvh_layout_mask & info.bvh_layout_mask; info.has_osl &= device.has_osl; } diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index 585d9802279..b09843e9f12 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -58,7 +58,6 @@ public: bool advanced_shading; /* Supports full shading system. */ bool has_half_images; /* Support half-float textures. */ bool has_volume_decoupled; /* Decoupled volume shading. */ - BVHLayoutMask bvh_layout_mask; /* Bitmask of supported BVH layouts. */ bool has_osl; /* Support Open Shading Language. */ bool use_split_kernel; /* Use split or mega kernel. */ int cpu_threads; @@ -74,7 +73,6 @@ public: advanced_shading = true; has_half_images = false; has_volume_decoupled = false; - bvh_layout_mask = BVH_LAYOUT_NONE; has_osl = false; use_split_kernel = false; } @@ -294,6 +292,7 @@ public: fflush(stderr); } virtual bool show_samples() const { return false; } + virtual BVHLayoutMask get_bvh_layout_mask() const = 0; /* statistics */ Stats &stats; diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index eb816e1fdd0..731d6c0d631 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -278,6 +278,17 @@ public: return (info.cpu_threads == 1); } + virtual BVHLayoutMask get_bvh_layout_mask() const { + BVHLayoutMask bvh_layout_mask = BVH_LAYOUT_BVH2; + if(DebugFlags().cpu.has_sse2() && system_cpu_support_sse2()) { + bvh_layout_mask |= BVH_LAYOUT_BVH4; + } + if(DebugFlags().cpu.has_avx2() && system_cpu_support_avx2()) { + bvh_layout_mask |= BVH_LAYOUT_BVH8; + } + return bvh_layout_mask; + } + void load_texture_info() { if(need_texture_info) { @@ -1041,13 +1052,6 @@ void device_cpu_info(vector<DeviceInfo>& devices) info.id = "CPU"; info.num = 0; info.advanced_shading = true; - info.bvh_layout_mask = BVH_LAYOUT_BVH2; - if(system_cpu_support_sse2()) { - info.bvh_layout_mask |= BVH_LAYOUT_BVH4; - } - if(system_cpu_support_avx2()) { - info.bvh_layout_mask |= BVH_LAYOUT_BVH8; - } info.has_volume_decoupled = true; info.has_osl = true; info.has_half_images = true; diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 22b1bc493c8..1c2d35061cc 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -181,6 +181,10 @@ public: return true; } + virtual BVHLayoutMask get_bvh_layout_mask() const { + return BVH_LAYOUT_BVH2; + } + /*#ifdef NDEBUG #define cuda_abort() #else @@ -2477,7 +2481,6 @@ void device_cuda_info(vector<DeviceInfo>& devices) info.advanced_shading = (major >= 3); info.has_half_images = (major >= 3); info.has_volume_decoupled = false; - info.bvh_layout_mask = BVH_LAYOUT_BVH2; int pci_location[3] = {0, 0, 0}; cuDeviceGetAttribute(&pci_location[0], CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, num); diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp index 587840e551f..67f0f880287 100644 --- a/intern/cycles/device/device_multi.cpp +++ b/intern/cycles/device/device_multi.cpp @@ -103,6 +103,14 @@ public: return devices.front().device->show_samples(); } + virtual BVHLayoutMask get_bvh_layout_mask() const { + BVHLayoutMask bvh_layout_mask = BVH_LAYOUT_ALL; + foreach(const SubDevice& sub_device, devices) { + bvh_layout_mask &= sub_device.device->get_bvh_layout_mask(); + } + return bvh_layout_mask; + } + bool load_kernels(const DeviceRequestedFeatures& requested_features) { foreach(SubDevice& sub, devices) diff --git a/intern/cycles/device/device_network.cpp b/intern/cycles/device/device_network.cpp index 204e405421d..b6e18621f12 100644 --- a/intern/cycles/device/device_network.cpp +++ b/intern/cycles/device/device_network.cpp @@ -87,6 +87,10 @@ public: snd.write(); } + virtual BVHLayoutMask get_bvh_layout_mask() const { + return BVH_LAYOUT_BVH2; + } + void mem_alloc(device_memory& mem) { if(mem.name) { @@ -306,7 +310,6 @@ void device_network_info(vector<DeviceInfo>& devices) /* todo: get this info from device */ info.advanced_shading = true; info.has_volume_decoupled = false; - info.bvh_layout_mask = BVH_LAYOUT_BVH2; info.has_osl = false; devices.push_back(info); diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index be0f8f45399..0f622430abb 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -136,7 +136,6 @@ void device_opencl_info(vector<DeviceInfo>& devices) info.use_split_kernel = OpenCLInfo::kernel_use_split(platform_name, device_type); info.has_volume_decoupled = false; - info.bvh_layout_mask = BVH_LAYOUT_BVH2; info.id = id; /* Check OpenCL extensions */ diff --git a/intern/cycles/device/opencl/opencl_mega.cpp b/intern/cycles/device/opencl/opencl_mega.cpp index e004c0b44f4..89001366d9d 100644 --- a/intern/cycles/device/opencl/opencl_mega.cpp +++ b/intern/cycles/device/opencl/opencl_mega.cpp @@ -43,6 +43,10 @@ public: return true; } + virtual BVHLayoutMask get_bvh_layout_mask() const { + return BVH_LAYOUT_BVH2; + } + virtual bool load_kernels(const DeviceRequestedFeatures& /*requested_features*/, vector<OpenCLProgram*> &programs) { diff --git a/intern/cycles/device/opencl/opencl_split.cpp b/intern/cycles/device/opencl/opencl_split.cpp index 66a4aa7e891..83389ef7cc8 100644 --- a/intern/cycles/device/opencl/opencl_split.cpp +++ b/intern/cycles/device/opencl/opencl_split.cpp @@ -95,6 +95,10 @@ public: return true; } + virtual BVHLayoutMask get_bvh_layout_mask() const { + return BVH_LAYOUT_BVH2; + } + virtual bool load_kernels(const DeviceRequestedFeatures& requested_features, vector<OpenCLDeviceBase::OpenCLProgram*> &programs) { diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index 8a00b88af12..6f619380988 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -1068,7 +1068,7 @@ void Mesh::compute_bvh(Device *device, bparams.use_spatial_split = params->use_bvh_spatial_split; bparams.bvh_layout = BVHParams::best_bvh_layout( params->bvh_layout, - device->info.bvh_layout_mask); + device->get_bvh_layout_mask()); bparams.use_unaligned_nodes = dscene->data.bvh.have_curves && params->use_bvh_unaligned_nodes; bparams.num_motion_triangle_steps = params->num_bvh_time_steps; @@ -1855,7 +1855,7 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene * bparams.top_level = true; bparams.bvh_layout = BVHParams::best_bvh_layout( scene->params.bvh_layout, - device->info.bvh_layout_mask); + device->get_bvh_layout_mask()); bparams.use_spatial_split = scene->params.use_bvh_spatial_split; bparams.use_unaligned_nodes = dscene->data.bvh.have_curves && scene->params.use_bvh_unaligned_nodes; |