Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-10-31 13:46:52 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-10-31 13:46:52 +0300
commite0cc3e980999ed97e72b430f0d654b30f60f9313 (patch)
tree08097b2302697f5b8634a451be726453bfadb001
parent5490708c399ba450ec1551d226467287b5b184ea (diff)
Cycles: Fix wrong BVH used when disabling AVX2 in debug settings
Mainly useful for debugging. Previously, when AVX2 was disabled in the debug panel but BVH layout was kept on BVH8 nothing was rendered. Needed to make it so supported BVH layout mask for devices is queried in "dynamic", so it is possible to use DebugFlags there.
-rw-r--r--intern/cycles/device/device.cpp2
-rw-r--r--intern/cycles/device/device.h3
-rw-r--r--intern/cycles/device/device_cpu.cpp18
-rw-r--r--intern/cycles/device/device_cuda.cpp5
-rw-r--r--intern/cycles/device/device_multi.cpp8
-rw-r--r--intern/cycles/device/device_network.cpp5
-rw-r--r--intern/cycles/device/device_opencl.cpp1
-rw-r--r--intern/cycles/device/opencl/opencl_mega.cpp4
-rw-r--r--intern/cycles/device/opencl/opencl_split.cpp4
-rw-r--r--intern/cycles/render/mesh.cpp4
10 files changed, 38 insertions, 16 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 6959dd73c32..7e20bb449c3 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -361,7 +361,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) {
@@ -396,7 +395,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 2400788c833..54a3ae1fe9f 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;
}
@@ -281,6 +279,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 5b46d5a507d..f0e58f22ad4 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
@@ -2459,7 +2463,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 f1bd3fd13e1..490ee3951c9 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;