Cycles: Increase number of textures allowed for OpenCL render
authorSergey Sharybin <sergey.vfx@gmail.com>
Sun, 11 Oct 2015 13:15:02 +0000 (18:15 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sun, 11 Oct 2015 13:22:01 +0000 (18:22 +0500)
Currently OpenCL devices are packing images into a single texture,
which means technically number of textures is not limited here.

Now OpenCL will use same number of textures as CPU. If we want
to bump number of textures further, this values are to be modified
in sync.

NOTE OpenCL still does not support float textures.

Original patch from a guy called bliblubli in the tracker with
some own modifications.

Reviewers: brecht, dingto, sergey

Differential Revision: https://developer.blender.org/D1530

intern/cycles/render/image.cpp
intern/cycles/render/image.h

index 7bceb8a8bfa0eec2a593049b552f8843de3ccd51..7a846e1dd4633f4452500abf0a6c3d3d2a3cfe52 100644 (file)
@@ -69,6 +69,9 @@ void ImageManager::set_extended_image_limits(const DeviceInfo& info)
        else if((info.type == DEVICE_CUDA || info.type == DEVICE_MULTI) && info.extended_images) {
                tex_num_images = TEX_EXTENDED_NUM_IMAGES_GPU;
        }
+       else if(info.pack_images) {
+               tex_num_images = TEX_PACKED_NUM_IMAGES;
+       }
 }
 
 bool ImageManager::set_animation_frame_update(int frame)
index bcc58ae951bf0c3dbaa6143897dced446d8fc9b2..c79c152afdee9e5a6841555c3989584932347bde 100644 (file)
@@ -40,6 +40,13 @@ CCL_NAMESPACE_BEGIN
 #define TEX_EXTENDED_NUM_IMAGES_CPU            1024
 #define TEX_EXTENDED_IMAGE_BYTE_START  TEX_EXTENDED_NUM_FLOAT_IMAGES
 
+/* Limitations for packed images.
+ *
+ * Technically number of textures is unlimited, but it should in
+ * fact be in sync with CPU limitations.
+ */
+#define TEX_PACKED_NUM_IMAGES                  1024
+
 /* color to use when textures are not found */
 #define TEX_IMAGE_MISSING_R 1
 #define TEX_IMAGE_MISSING_G 0