Cycles / GPU Image Textures:

* On nvidia Kepler GPUs (sm_30 and above), there are now 145 byte images available, instead of 95. 
We could extend this to about 200 if needed. 

Could not test this, as I don't have a Kepler GPU, so feedback on this would be appreciated.

Thanks to Brecht for review and some fixes. :)
This commit is contained in:
Thomas Dinges
2013-06-20 15:14:14 +00:00
parent 370ebad2f9
commit 230f4e7ca2
10 changed files with 134 additions and 10 deletions

View File

@@ -61,11 +61,16 @@ void ImageManager::set_osl_texture_system(void *texture_system)
osl_texture_system = texture_system;
}
void ImageManager::set_extended_image_limits(void)
void ImageManager::set_extended_image_limits(const DeviceInfo& info)
{
tex_num_images = TEX_EXTENDED_NUM_IMAGES;
tex_num_float_images = TEX_EXTENDED_NUM_FLOAT_IMAGES;
tex_image_byte_start = TEX_EXTENDED_IMAGE_BYTE_START;
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;
}
}
bool ImageManager::set_animation_frame_update(int frame)

View File

@@ -19,6 +19,7 @@
#ifndef __IMAGE_H__
#define __IMAGE_H__
#include "device.h"
#include "device_memory.h"
#include "util_string.h"
@@ -29,12 +30,15 @@
CCL_NAMESPACE_BEGIN
/* Normal Image amount */
#define TEX_NUM_IMAGES 95
#define TEX_IMAGE_BYTE_START TEX_NUM_FLOAT_IMAGES
/* Extended Image amount*/
#define TEX_EXTENDED_NUM_FLOAT_IMAGES 5
#define TEX_EXTENDED_NUM_IMAGES 512
#define TEX_EXTENDED_IMAGE_BYTE_START TEX_EXTENDED_NUM_FLOAT_IMAGES
#define TEX_EXTENDED_NUM_IMAGES_CPU 512
#define TEX_EXTENDED_NUM_IMAGES_GPU 145
/* color to use when textures are not found */
#define TEX_IMAGE_MISSING_R 1
@@ -60,7 +64,7 @@ public:
void set_osl_texture_system(void *texture_system);
void set_pack_images(bool pack_images_);
void set_extended_image_limits(void);
void set_extended_image_limits(const DeviceInfo& info);
bool set_animation_frame_update(int frame);
bool need_update;

View File

@@ -63,8 +63,8 @@ Scene::Scene(const SceneParams& params_, const DeviceInfo& device_info_)
else
shader_manager = ShaderManager::create(this, SceneParams::SVM);
if (device_info_.type == DEVICE_CPU)
image_manager->set_extended_image_limits();
/* Extended Image limits for CPU and Kepler GPUs */
image_manager->set_extended_image_limits(device_info_);
}
Scene::~Scene()

View File

@@ -105,8 +105,8 @@ public:
/* integrator */
device_vector<uint> sobol_directions;
/* images */
device_vector<uchar4> tex_image[TEX_EXTENDED_NUM_IMAGES];
/* CPU images */
device_vector<uchar4> tex_image[TEX_EXTENDED_NUM_IMAGES_CPU];
device_vector<float4> tex_float_image[TEX_EXTENDED_NUM_FLOAT_IMAGES];
/* opencl images */