diff options
Diffstat (limited to 'intern/cycles/render')
-rw-r--r-- | intern/cycles/render/image.cpp | 57 | ||||
-rw-r--r-- | intern/cycles/render/image.h | 5 | ||||
-rw-r--r-- | intern/cycles/render/scene.cpp | 5 | ||||
-rw-r--r-- | intern/cycles/render/scene.h | 4 |
4 files changed, 41 insertions, 30 deletions
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 3bf3cae2b85..c0cbf0af968 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -30,16 +30,46 @@ CCL_NAMESPACE_BEGIN -ImageManager::ImageManager() +ImageManager::ImageManager(const DeviceInfo& info) { need_update = true; pack_images = false; osl_texture_system = NULL; animation_frame = 0; - tex_num_images = TEX_NUM_IMAGES; - tex_num_float_images = TEX_NUM_FLOAT_IMAGES; - tex_image_byte_start = TEX_IMAGE_BYTE_START; + /* Set image limits */ + + /* CPU */ + if(info.type == DEVICE_CPU) { + tex_num_byte_images = TEX_NUM_BYTE_IMAGES_CPU; + tex_num_float_images = TEX_NUM_FLOAT_IMAGES_CPU; + tex_image_byte_start = TEX_IMAGE_BYTE_START_CPU; + } + /* CUDA (Fermi) */ + else if((info.type == DEVICE_CUDA || info.type == DEVICE_MULTI) && !info.extended_images) { + tex_num_byte_images = TEX_NUM_BYTE_IMAGES_CUDA; + tex_num_float_images = TEX_NUM_FLOAT_IMAGES_CUDA; + tex_image_byte_start = TEX_IMAGE_BYTE_START_CUDA; + } + /* CUDA (Kepler and above) */ + else if((info.type == DEVICE_CUDA || info.type == DEVICE_MULTI) && info.extended_images) { + tex_num_byte_images = TEX_NUM_BYTE_IMAGES_CUDA_KEPLER; + tex_num_float_images = TEX_NUM_FLOAT_IMAGES_CUDA_KEPLER; + tex_image_byte_start = TEX_IMAGE_BYTE_START_CUDA_KELPER; + } + /* OpenCL */ + else if(info.pack_images) { + tex_num_byte_images = TEX_NUM_BYTE_IMAGES_OPENCL; + tex_num_float_images = TEX_NUM_FLOAT_IMAGES_OPENCL; + tex_image_byte_start = TEX_IMAGE_BYTE_START_OPENCL; + } + /* Should never happen */ + else { + tex_num_byte_images = 0; + tex_num_float_images = 0; + tex_image_byte_start = 0; + assert(0); + } } ImageManager::~ImageManager() @@ -60,21 +90,6 @@ void ImageManager::set_osl_texture_system(void *texture_system) osl_texture_system = texture_system; } -void ImageManager::set_extended_image_limits(const DeviceInfo& info) -{ - if(info.type == DEVICE_CPU) { - tex_num_images = TEX_EXTENDED_NUM_IMAGES_CPU; - tex_num_float_images = TEX_EXTENDED_NUM_FLOAT_IMAGES; - tex_image_byte_start = TEX_EXTENDED_IMAGE_BYTE_START; - } - 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) { if(frame != animation_frame) { @@ -267,9 +282,9 @@ int ImageManager::add_image(const string& filename, if(slot == images.size()) { /* max images limit reached */ - if(images.size() == tex_num_images) { + if(images.size() == tex_num_byte_images) { printf("ImageManager::add_image: byte image limit reached %d, skipping '%s'\n", - tex_num_images, filename.c_str()); + tex_num_byte_images, filename.c_str()); return -1; } diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index e4fb8001b78..64798d75638 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -32,7 +32,7 @@ class Progress; class ImageManager { public: - ImageManager(); + ImageManager(const DeviceInfo& info); ~ImageManager(); int add_image(const string& filename, @@ -62,7 +62,6 @@ public: void set_osl_texture_system(void *texture_system); void set_pack_images(bool pack_images_); - void set_extended_image_limits(const DeviceInfo& info); bool set_animation_frame_update(int frame); bool need_update; @@ -86,7 +85,7 @@ public: }; private: - int tex_num_images; + int tex_num_byte_images; int tex_num_float_images; int tex_image_byte_start; thread_mutex device_mutex; diff --git a/intern/cycles/render/scene.cpp b/intern/cycles/render/scene.cpp index ece4919dedb..29163c53109 100644 --- a/intern/cycles/render/scene.cpp +++ b/intern/cycles/render/scene.cpp @@ -54,7 +54,7 @@ Scene::Scene(const SceneParams& params_, const DeviceInfo& device_info_) mesh_manager = new MeshManager(); object_manager = new ObjectManager(); integrator = new Integrator(); - image_manager = new ImageManager(); + image_manager = new ImageManager(device_info_); particle_system_manager = new ParticleSystemManager(); curve_system_manager = new CurveSystemManager(); bake_manager = new BakeManager(); @@ -64,9 +64,6 @@ Scene::Scene(const SceneParams& params_, const DeviceInfo& device_info_) shader_manager = ShaderManager::create(this, params.shadingsystem); else shader_manager = ShaderManager::create(this, SHADINGSYSTEM_SVM); - - /* Extended image limits for CPU and GPUs */ - image_manager->set_extended_image_limits(device_info_); } Scene::~Scene() diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h index db70ae3c176..d30a0cb45fe 100644 --- a/intern/cycles/render/scene.h +++ b/intern/cycles/render/scene.h @@ -109,8 +109,8 @@ public: device_vector<uint> sobol_directions; /* cpu images */ - device_vector<uchar4> tex_image[TEX_EXTENDED_NUM_IMAGES_CPU]; - device_vector<float4> tex_float_image[TEX_EXTENDED_NUM_FLOAT_IMAGES]; + device_vector<uchar4> tex_image[TEX_NUM_BYTE_IMAGES_CPU]; + device_vector<float4> tex_float_image[TEX_NUM_FLOAT_IMAGES_CPU]; /* opencl images */ device_vector<uchar4> tex_image_packed; |