diff options
Diffstat (limited to 'intern/cycles/device')
-rw-r--r-- | intern/cycles/device/cuda/device_cuda_impl.cpp | 11 | ||||
-rw-r--r-- | intern/cycles/device/device_cpu.cpp | 11 | ||||
-rw-r--r-- | intern/cycles/device/device_memory.cpp | 1 | ||||
-rw-r--r-- | intern/cycles/device/device_memory.h | 1 | ||||
-rw-r--r-- | intern/cycles/device/opencl/device_opencl_impl.cpp | 2 |
5 files changed, 16 insertions, 10 deletions
diff --git a/intern/cycles/device/cuda/device_cuda_impl.cpp b/intern/cycles/device/cuda/device_cuda_impl.cpp index 4e8d8b7ca7c..4df1ca2097a 100644 --- a/intern/cycles/device/cuda/device_cuda_impl.cpp +++ b/intern/cycles/device/cuda/device_cuda_impl.cpp @@ -1169,10 +1169,10 @@ void CUDADevice::tex_alloc(device_memory &mem) } /* Kepler+, bindless textures. */ - int flat_slot = 0; + int slot = 0; if (string_startswith(mem.name, "__tex_image")) { int pos = string(mem.name).rfind("_"); - flat_slot = atoi(mem.name + pos + 1); + slot = atoi(mem.name + pos + 1); } else { assert(0); @@ -1214,15 +1214,16 @@ void CUDADevice::tex_alloc(device_memory &mem) cuda_assert(cuTexObjectCreate(&cmem->texobject, &resDesc, &texDesc, NULL)); /* Resize once */ - if (flat_slot >= texture_info.size()) { + if (slot >= texture_info.size()) { /* Allocate some slots in advance, to reduce amount * of re-allocations. */ - texture_info.resize(flat_slot + 128); + texture_info.resize(slot + 128); } /* Set Mapping and tag that we need to (re-)upload to device */ - TextureInfo &info = texture_info[flat_slot]; + TextureInfo &info = texture_info[slot]; info.data = (uint64_t)cmem->texobject; + info.data_type = mem.image_data_type; info.cl_buffer = 0; info.interpolation = mem.interpolation; info.extension = mem.extension; diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index d11918ccbbf..56569a5ee3d 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -465,23 +465,24 @@ class CPUDevice : public Device { } else { /* Image Texture. */ - int flat_slot = 0; + int slot = 0; if (string_startswith(mem.name, "__tex_image")) { int pos = string(mem.name).rfind("_"); - flat_slot = atoi(mem.name + pos + 1); + slot = atoi(mem.name + pos + 1); } else { assert(0); } - if (flat_slot >= texture_info.size()) { + if (slot >= texture_info.size()) { /* Allocate some slots in advance, to reduce amount * of re-allocations. */ - texture_info.resize(flat_slot + 128); + texture_info.resize(slot + 128); } - TextureInfo &info = texture_info[flat_slot]; + TextureInfo &info = texture_info[slot]; info.data = (uint64_t)mem.host_pointer; + info.data_type = mem.image_data_type; info.cl_buffer = 0; info.interpolation = mem.interpolation; info.extension = mem.extension; diff --git a/intern/cycles/device/device_memory.cpp b/intern/cycles/device/device_memory.cpp index 3a99a49dffc..f22b91f3fa1 100644 --- a/intern/cycles/device/device_memory.cpp +++ b/intern/cycles/device/device_memory.cpp @@ -31,6 +31,7 @@ device_memory::device_memory(Device *device, const char *name, MemoryType type) data_depth(0), type(type), name(name), + image_data_type(IMAGE_DATA_NUM_TYPES), interpolation(INTERPOLATION_NONE), extension(EXTENSION_REPEAT), device(device), diff --git a/intern/cycles/device/device_memory.h b/intern/cycles/device/device_memory.h index 2949773ef0c..617cc0c4342 100644 --- a/intern/cycles/device/device_memory.h +++ b/intern/cycles/device/device_memory.h @@ -208,6 +208,7 @@ class device_memory { size_t data_depth; MemoryType type; const char *name; + ImageDataType image_data_type; InterpolationType interpolation; ExtensionType extension; diff --git a/intern/cycles/device/opencl/device_opencl_impl.cpp b/intern/cycles/device/opencl/device_opencl_impl.cpp index 3dbe54b38aa..09d3b78dd28 100644 --- a/intern/cycles/device/opencl/device_opencl_impl.cpp +++ b/intern/cycles/device/opencl/device_opencl_impl.cpp @@ -1298,6 +1298,8 @@ void OpenCLDevice::flush_texture_buffers() if (string_startswith(slot.name, "__tex_image")) { device_memory *mem = textures[slot.name]; + info.data_type = mem->image_data_type; + info.width = mem->data_width; info.height = mem->data_height; info.depth = mem->data_depth; |