Merge branch 'master' into blender2.8

This commit is contained in:
Sergey Sharybin
2018-10-31 11:49:04 +01:00
10 changed files with 38 additions and 16 deletions

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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)

View File

@@ -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);

View File

@@ -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 */

View File

@@ -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)
{

View File

@@ -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)
{

View File

@@ -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;