diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-04-28 15:56:22 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-04-28 15:56:22 +0300 |
commit | 0f339a748eff50317589b45e9b4f3c286ca18f91 (patch) | |
tree | c16ff56db4e8db95c836c9989319b7f07f72dbd3 | |
parent | 1ec59c8e067f4af213d61e114de97334ce9f3e77 (diff) |
Cycles: Quick (real) fix for broken textures on OpenCL
Previous fix did not work for mixed textures. This one will over-allocate
information array, but it's better than not being able to render at all.
Some more cleanup and improvement is coming.
-rw-r--r-- | intern/cycles/render/image.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 5ce3b75a226..22fe14d1dd2 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -1045,8 +1045,17 @@ void ImageManager::device_pack_images(Device *device, size_t size = 0, offset = 0; ImageDataType type; - int info_size = tex_num_images[IMAGE_DATA_TYPE_FLOAT4] + tex_num_images[IMAGE_DATA_TYPE_BYTE4] - + tex_num_images[IMAGE_DATA_TYPE_FLOAT] + tex_num_images[IMAGE_DATA_TYPE_BYTE]; + /* TODO(sergey): This will over-allocate a bit, but this is constant memory + * so should be fine for a short term. + */ + size_t info_size = max4(type_index_to_flattened_slot(tex_num_images[IMAGE_DATA_TYPE_FLOAT4], + IMAGE_DATA_TYPE_FLOAT4), + type_index_to_flattened_slot(tex_num_images[IMAGE_DATA_TYPE_BYTE4], + IMAGE_DATA_TYPE_BYTE4), + type_index_to_flattened_slot(tex_num_images[IMAGE_DATA_TYPE_FLOAT], + IMAGE_DATA_TYPE_FLOAT), + type_index_to_flattened_slot(tex_num_images[IMAGE_DATA_TYPE_BYTE], + IMAGE_DATA_TYPE_BYTE)); uint4 *info = dscene->tex_image_packed_info.resize(info_size*2); /* Byte4 Textures*/ |