diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-19 12:59:58 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-22 19:19:20 +0300 |
commit | 2f79d1c0584f4d72984e56db1f5878be3360e044 (patch) | |
tree | f2385b9834d7a9e0c15be92ca5356f4bc91aa247 /intern/cycles/device | |
parent | 0f69026b1c3c07b203aeba658048f1129e41b116 (diff) |
Cycles: Replace use_qbvh boolean flag with an enum-based property
This was we can introduce other types of BVH, for example, wider ones, without
causing too much mess around boolean flags.
Thoughs:
- Ideally device info should probably return bitflag of what BVH types it
supports.
It is possible to implement based on simple logic in device/ and mesh.cpp,
rest of the changes will stay the same.
- Not happy with workarounds in util_debug and duplicated enum in kernel.
Maybe enbum should be stores in kernel, but then it's kind of weird to include
kernel types from utils. Soudns some cyclkic dependency.
Reviewers: brecht, maxim_d33
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D3011
Diffstat (limited to 'intern/cycles/device')
-rw-r--r-- | intern/cycles/device/device.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/device/device.h | 20 | ||||
-rw-r--r-- | intern/cycles/device/device_cpu.cpp | 5 | ||||
-rw-r--r-- | intern/cycles/device/device_cuda.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/device/device_network.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/device/device_opencl.cpp | 2 |
6 files changed, 20 insertions, 15 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index d55a999c454..1ec0bc3e1c6 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -362,7 +362,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo>& subdevices, int th info.has_fermi_limits = false; info.has_half_images = true; info.has_volume_decoupled = true; - info.has_qbvh = true; + info.bvh_layout_mask = BVH_LAYOUT_ALL; info.has_osl = true; foreach(const DeviceInfo &device, subdevices) { @@ -399,7 +399,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo>& subdevices, int th device.has_fermi_limits; info.has_half_images &= device.has_half_images; info.has_volume_decoupled &= device.has_volume_decoupled; - info.has_qbvh &= device.has_qbvh; + 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 528a6dc10f6..99e80d10424 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -19,6 +19,8 @@ #include <stdlib.h> +#include "bvh/bvh_params.h" + #include "device/device_memory.h" #include "device/device_task.h" @@ -52,14 +54,14 @@ public: string description; string id; /* used for user preferences, should stay fixed with changing hardware config */ int num; - bool display_device; /* GPU is used as a display device. */ - bool advanced_shading; /* Supports full shading system. */ - bool has_fermi_limits; /* Fixed number of textures limit. */ - bool has_half_images; /* Support half-float textures. */ - bool has_volume_decoupled; /* Decoupled volume shading. */ - bool has_qbvh; /* Supports both BVH2 and BVH4 raytracing. */ - bool has_osl; /* Support Open Shading Language. */ - bool use_split_kernel; /* Use split or mega kernel. */ + bool display_device; /* GPU is used as a display device. */ + bool advanced_shading; /* Supports full shading system. */ + bool has_fermi_limits; /* Fixed number of textures limit. */ + 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; vector<DeviceInfo> multi_devices; @@ -74,7 +76,7 @@ public: has_fermi_limits = false; has_half_images = false; has_volume_decoupled = false; - has_qbvh = false; + bvh_layout_mask = BVH_LAYOUT_NONE; has_osl = false; use_split_kernel = false; } diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index 6b6b3432446..fd55ec3687a 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -1046,7 +1046,10 @@ void device_cpu_info(vector<DeviceInfo>& devices) info.id = "CPU"; info.num = 0; info.advanced_shading = true; - info.has_qbvh = system_cpu_support_sse2(); + info.bvh_layout_mask = BVH_LAYOUT_BVH2; + if (system_cpu_support_sse2()) { + info.bvh_layout_mask |= BVH_LAYOUT_BVH4; + } 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 116f4e2a452..f3548640679 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -2551,7 +2551,7 @@ void device_cuda_info(vector<DeviceInfo>& devices) info.has_fermi_limits = !(major >= 3); info.has_half_images = (major >= 3); info.has_volume_decoupled = false; - info.has_qbvh = 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_network.cpp b/intern/cycles/device/device_network.cpp index 536d5ee08c0..5ad4405366e 100644 --- a/intern/cycles/device/device_network.cpp +++ b/intern/cycles/device/device_network.cpp @@ -306,7 +306,7 @@ void device_network_info(vector<DeviceInfo>& devices) /* todo: get this info from device */ info.advanced_shading = true; info.has_volume_decoupled = false; - info.has_qbvh = 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 d3eebb10028..9d61bbdae5d 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -135,7 +135,7 @@ 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.has_qbvh = false; + info.bvh_layout_mask = BVH_LAYOUT_BVH2; info.id = id; devices.push_back(info); num_devices++; |