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.
This commit is contained in:
Sergey Sharybin 2017-04-28 14:56:22 +02:00
parent 1ec59c8e06
commit 0f339a748e
Notes: blender-bot 2023-02-14 07:01:31 +01:00
Referenced by issue #51341, cycles OpenCL corruption in todays buildbot (wasn't there 2 days ago)
1 changed files with 11 additions and 2 deletions

View File

@ -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*/