Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/device/device_opencl.cpp
| Show First 20 Lines • Show All 875 Lines • ▼ Show 20 Lines | void const_copy_to(const char *name, void *host, size_t size) | ||||
| else { | else { | ||||
| device_vector<uchar> *data = i->second; | device_vector<uchar> *data = i->second; | ||||
| data->copy((uchar*)host, size); | data->copy((uchar*)host, size); | ||||
| } | } | ||||
| mem_copy_to(*i->second); | mem_copy_to(*i->second); | ||||
| } | } | ||||
| void tex_alloc(const char *name, device_memory& mem, bool interpolation, bool periodic) | void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic) | ||||
| { | { | ||||
| MemMap::iterator it = mem_map.find(name); | |||||
| device_ptr old_tex; | |||||
| if(it != mem_map.end()){ | |||||
| old_tex = it->second; | |||||
| ciErr = clReleaseMemObject(CL_MEM_PTR(old_tex)); | |||||
| //TODO do stats on the free | |||||
| opencl_assert(ciErr); | |||||
| mem_map.erase(it); | |||||
| } | |||||
brecht: Why is this needed? Is it when you have a texture with the same name but different… | |||||
Not Done Inline ActionsChanging the interpolation changes the texture map and that reallocates the texture that holds all the image textures. But the map we keep is not designed for that and that will hit the assert and fail. I think it can be done better juicyfruit: Changing the interpolation changes the texture map and that reallocates the texture that holds… | |||||
| mem_alloc(mem, MEM_READ_ONLY); | mem_alloc(mem, MEM_READ_ONLY); | ||||
| mem_copy_to(mem); | mem_copy_to(mem); | ||||
| assert(mem_map.find(name) == mem_map.end()); | |||||
| mem_map.insert(MemMap::value_type(name, mem.device_pointer)); | mem_map.insert(MemMap::value_type(name, mem.device_pointer)); | ||||
| } | } | ||||
Not Done Inline ActionsNewline not needed. dingto: Newline not needed. | |||||
| void tex_free(device_memory& mem) | void tex_free(device_memory& mem) | ||||
| { | { | ||||
| if(mem.device_pointer) { | if(mem.device_pointer) { | ||||
| foreach(const MemMap::value_type& value, mem_map) { | foreach(const MemMap::value_type& value, mem_map) { | ||||
| if(value.second == mem.device_pointer) { | if(value.second == mem.device_pointer) { | ||||
| mem_map.erase(value.first); | mem_map.erase(value.first); | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 296 Lines • Show Last 20 Lines | |||||
Why is this needed? Is it when you have a texture with the same name but different interpolation? We should be able to handle that case correctly.