Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/device/device_memory.h
| Show First 20 Lines • Show All 264 Lines • ▼ Show 20 Lines | |||||
| /* Device Only Memory | /* Device Only Memory | ||||
| * | * | ||||
| * Working memory only needed by the device, with no corresponding allocation | * Working memory only needed by the device, with no corresponding allocation | ||||
| * on the host. Only used internally in the device implementations. */ | * on the host. Only used internally in the device implementations. */ | ||||
| template<typename T> class device_only_memory : public device_memory { | template<typename T> class device_only_memory : public device_memory { | ||||
| public: | public: | ||||
| device_only_memory(Device *device, const char *name) | device_only_memory(Device *device, const char *name, MemoryType type = MEM_DEVICE_ONLY) | ||||
| : device_memory(device, name, MEM_DEVICE_ONLY) | : device_memory(device, name, type) | ||||
brecht: I think it would be more clear to add a `bool allow_host_memory_fallback = false` parameter… | |||||
| { | { | ||||
| data_type = device_type_traits<T>::data_type; | data_type = device_type_traits<T>::data_type; | ||||
| data_elements = max(device_type_traits<T>::num_elements, 1); | data_elements = max(device_type_traits<T>::num_elements, 1); | ||||
| } | } | ||||
| virtual ~device_only_memory() | virtual ~device_only_memory() | ||||
| { | { | ||||
| free(); | free(); | ||||
| ▲ Show 20 Lines • Show All 334 Lines • Show Last 20 Lines | |||||
I think it would be more clear to add a bool allow_host_memory_fallback = false parameter here, which then uses MEM_DEVICE_ONLY or MEM_READ_WRITE depending on the value.
Otherwise it's not obvious why you'd use one or the other in code.