Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/device/device_multi.cpp
| Show First 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | void const_copy_to(const char *name, void *host, size_t size) | ||||
| foreach(SubDevice& sub, devices) | foreach(SubDevice& sub, devices) | ||||
| sub.device->const_copy_to(name, host, size); | sub.device->const_copy_to(name, host, size); | ||||
| } | } | ||||
| void tex_alloc(const char *name, | void tex_alloc(const char *name, | ||||
| device_memory& mem, | device_memory& mem, | ||||
| InterpolationType | InterpolationType | ||||
| interpolation, | interpolation, | ||||
| ExtensionType extension) | ExtensionType extension, | ||||
| uint *bindless_slot) | |||||
| { | { | ||||
| VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes."; | VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes."; | ||||
| foreach(SubDevice& sub, devices) { | foreach(SubDevice& sub, devices) { | ||||
| mem.device_pointer = 0; | mem.device_pointer = 0; | ||||
| sub.device->tex_alloc(name, mem, interpolation, extension); | sub.device->tex_alloc(name, mem, interpolation, extension, bindless_slot); | ||||
| sub.ptr_map[unique_ptr] = mem.device_pointer; | sub.ptr_map[unique_ptr] = mem.device_pointer; | ||||
| } | } | ||||
| mem.device_pointer = unique_ptr++; | mem.device_pointer = unique_ptr++; | ||||
| } | } | ||||
| void tex_free(device_memory& mem) | void tex_free(device_memory& mem) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | static bool device_multi_add(vector<DeviceInfo>& devices, DeviceType type, bool with_display, bool with_advanced_shading, const char *id_fmt, int num) | ||||
| /* create map to find duplicate descriptions */ | /* create map to find duplicate descriptions */ | ||||
| map<string, int> dupli_map; | map<string, int> dupli_map; | ||||
| map<string, int>::iterator dt; | map<string, int>::iterator dt; | ||||
| int num_added = 0, num_display = 0; | int num_added = 0, num_display = 0; | ||||
| info.advanced_shading = with_advanced_shading; | info.advanced_shading = with_advanced_shading; | ||||
| info.pack_images = false; | info.pack_images = false; | ||||
| info.extended_images = true; | info.bindless_textures = true; | ||||
| foreach(DeviceInfo& subinfo, devices) { | foreach(DeviceInfo& subinfo, devices) { | ||||
| if(subinfo.type == type) { | if(subinfo.type == type) { | ||||
| if(subinfo.advanced_shading != info.advanced_shading) | if(subinfo.advanced_shading != info.advanced_shading) | ||||
| continue; | continue; | ||||
| if(subinfo.display_device) { | if(subinfo.display_device) { | ||||
| if(with_display) | if(with_display) | ||||
| num_display++; | num_display++; | ||||
| else | else | ||||
| continue; | continue; | ||||
| } | } | ||||
| string key = subinfo.description; | string key = subinfo.description; | ||||
| if(dupli_map.find(key) == dupli_map.end()) | if(dupli_map.find(key) == dupli_map.end()) | ||||
| dupli_map[key] = 1; | dupli_map[key] = 1; | ||||
| else | else | ||||
| dupli_map[key]++; | dupli_map[key]++; | ||||
| info.multi_devices.push_back(subinfo); | info.multi_devices.push_back(subinfo); | ||||
| if(subinfo.display_device) | if(subinfo.display_device) | ||||
| info.display_device = true; | info.display_device = true; | ||||
| info.pack_images = info.pack_images || subinfo.pack_images; | info.pack_images = info.pack_images || subinfo.pack_images; | ||||
| info.extended_images = info.extended_images && subinfo.extended_images; | info.bindless_textures = info.bindless_textures && subinfo.bindless_textures; | ||||
| num_added++; | num_added++; | ||||
| } | } | ||||
| } | } | ||||
| if(num_added <= 1 || (with_display && num_display == 0)) | if(num_added <= 1 || (with_display && num_display == 0)) | ||||
| return false; | return false; | ||||
| /* generate string */ | /* generate string */ | ||||
| ▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines | |||||