Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/device/device_optix.cpp
| Show First 20 Lines • Show All 1,164 Lines • ▼ Show 20 Lines | void mem_alloc(device_memory &mem) override | ||||
| mem.device_size = mem.memory_size(); | mem.device_size = mem.memory_size(); | ||||
| if (mem.type == MEM_TEXTURE && mem.interpolation != INTERPOLATION_NONE) { | if (mem.type == MEM_TEXTURE && mem.interpolation != INTERPOLATION_NONE) { | ||||
| CUDAMem &cmem = cuda_mem_map[&mem]; // Lock and get associated memory information | CUDAMem &cmem = cuda_mem_map[&mem]; // Lock and get associated memory information | ||||
| CUDA_TEXTURE_DESC tex_desc = {}; | CUDA_TEXTURE_DESC tex_desc = {}; | ||||
| tex_desc.flags = CU_TRSF_NORMALIZED_COORDINATES; | tex_desc.flags = CU_TRSF_NORMALIZED_COORDINATES; | ||||
| if (mem.compress_as_srgb) { | |||||
| tex_desc.flags |= CU_TRSF_SRGB; | |||||
| } | |||||
| CUDA_RESOURCE_DESC res_desc = {}; | CUDA_RESOURCE_DESC res_desc = {}; | ||||
| switch (mem.extension) { | switch (mem.extension) { | ||||
| default: | default: | ||||
| assert(0); | assert(0); | ||||
| case EXTENSION_REPEAT: | case EXTENSION_REPEAT: | ||||
| tex_desc.addressMode[0] = tex_desc.addressMode[1] = tex_desc.addressMode[2] = | tex_desc.addressMode[0] = tex_desc.addressMode[1] = tex_desc.addressMode[2] = | ||||
| CU_TR_ADDRESS_MODE_WRAP; | CU_TR_ADDRESS_MODE_WRAP; | ||||
| ▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | if (mem.type == MEM_TEXTURE && mem.interpolation != INTERPOLATION_NONE) { | ||||
| if (flat_slot >= texture_info.size()) | if (flat_slot >= texture_info.size()) | ||||
| texture_info.resize(flat_slot + 128); | texture_info.resize(flat_slot + 128); | ||||
| TextureInfo &info = texture_info[flat_slot]; | TextureInfo &info = texture_info[flat_slot]; | ||||
| info.data = (uint64_t)cmem.texobject; | info.data = (uint64_t)cmem.texobject; | ||||
| info.cl_buffer = 0; | info.cl_buffer = 0; | ||||
| info.interpolation = mem.interpolation; | info.interpolation = mem.interpolation; | ||||
| info.extension = mem.extension; | info.extension = mem.extension; | ||||
| info.compress_as_srgb = mem.compress_as_srgb; | |||||
| info.width = mem.data_width; | info.width = mem.data_width; | ||||
| info.height = mem.data_height; | info.height = mem.data_height; | ||||
| info.depth = mem.data_depth; | info.depth = mem.data_depth; | ||||
| // Texture information has changed and needs an update, delay this to next launch | // Texture information has changed and needs an update, delay this to next launch | ||||
| need_texture_info = true; | need_texture_info = true; | ||||
| } | } | ||||
| else { | else { | ||||
| ▲ Show 20 Lines • Show All 683 Lines • Show Last 20 Lines | |||||