コード例 #1
0
ファイル: image.cpp プロジェクト: nttputus/blensor
void ImageManager::device_free(Device *device, DeviceScene *dscene)
{
	for(size_t slot = 0; slot < images.size(); slot++)
		device_free_image(device, dscene, slot);
	for(size_t slot = 0; slot < float_images.size(); slot++)
		device_free_image(device, dscene, slot + TEX_IMAGE_FLOAT_START);

	images.clear();
	float_images.clear();
}
コード例 #2
0
ファイル: image.cpp プロジェクト: mgschwan/blensor
void ImageManager::device_update(Device *device,
                                 Scene *scene,
                                 Progress& progress)
{
	if(!need_update) {
		return;
	}

	TaskPool pool;
	for(int type = 0; type < IMAGE_DATA_NUM_TYPES; type++) {
		for(size_t slot = 0; slot < images[type].size(); slot++) {
			if(!images[type][slot])
				continue;

			if(images[type][slot]->users == 0) {
				device_free_image(device, (ImageDataType)type, slot);
			}
			else if(images[type][slot]->need_load) {
				if(!osl_texture_system || images[type][slot]->builtin_data)
					pool.push(function_bind(&ImageManager::device_load_image,
					                        this,
					                        device,
					                        scene,
					                        (ImageDataType)type,
					                        slot,
					                        &progress));
			}
		}
	}

	pool.wait_work();

	need_update = false;
}
コード例 #3
0
ファイル: image.cpp プロジェクト: dreamsxin/blender
void ImageManager::device_update_slot(Device *device,
                                      DeviceScene *dscene,
                                      Scene *scene,
                                      int flat_slot,
                                      Progress *progress)
{
	ImageDataType type;
	int slot = flattened_slot_to_type_index(flat_slot, &type);

	Image *image = images[type][slot];
	assert(image != NULL);

	if(image->users == 0) {
		device_free_image(device, dscene, type, slot);
	}
	else if(image->need_load) {
		if(!osl_texture_system || image->builtin_data)
			device_load_image(device,
			                  dscene,
			                  scene,
			                  type,
			                  slot,
			                  progress);
	}
}
コード例 #4
0
ファイル: image.cpp プロジェクト: mgschwan/blensor
void ImageManager::device_free(Device *device)
{
	for(int type = 0; type < IMAGE_DATA_NUM_TYPES; type++) {
		for(size_t slot = 0; slot < images[type].size(); slot++) {
			device_free_image(device, (ImageDataType)type, slot);
		}
		images[type].clear();
	}
}
コード例 #5
0
ファイル: image.cpp プロジェクト: mgschwan/blensor
void ImageManager::device_free_builtin(Device *device)
{
	for(int type = 0; type < IMAGE_DATA_NUM_TYPES; type++) {
		for(size_t slot = 0; slot < images[type].size(); slot++) {
			if(images[type][slot] && images[type][slot]->builtin_data)
				device_free_image(device, (ImageDataType)type, slot);
		}
	}
}
コード例 #6
0
ファイル: image.cpp プロジェクト: vanangamudi/blender-main
void ImageManager::device_update(Device *device, DeviceScene *dscene, Progress& progress)
{
	if(!need_update)
		return;
	
	TaskPool pool;

	for(size_t slot = 0; slot < images.size(); slot++) {
		if(!images[slot])
			continue;

		if(images[slot]->users == 0) {
			device_free_image(device, dscene, slot);
		}
		else if(images[slot]->need_load) {
			if(!osl_texture_system) 
				pool.push(function_bind(&ImageManager::device_load_image, this, device, dscene, slot, &progress));
		}
	}

	for(size_t slot = 0; slot < float_images.size(); slot++) {
		if(!float_images[slot])
			continue;

		if(float_images[slot]->users == 0) {
			device_free_image(device, dscene, slot + TEX_IMAGE_FLOAT_START);
		}
		else if(float_images[slot]->need_load) {
			if(!osl_texture_system) 
				pool.push(function_bind(&ImageManager::device_load_image, this, device, dscene, slot + TEX_IMAGE_FLOAT_START, &progress));
		}
	}

	pool.wait_work();

	if(pack_images)
		device_pack_images(device, dscene, progress);

	need_update = false;
}
コード例 #7
0
ファイル: image.cpp プロジェクト: paulfitz/cycles_hack
void ImageManager::device_update(Device *device, DeviceScene *dscene, Progress& progress)
{
	if(!need_update)
		return;

	for(size_t slot = 0; slot < images.size(); slot++) {
		if(images[slot]) {
			if(images[slot]->users == 0) {
				device_free_image(device, dscene, slot);
			}
			else if(images[slot]->need_load) {
				string name = path_filename(images[slot]->filename);
				progress.set_status("Updating Images", "Loading " + name);
				device_load_image(device, dscene, slot);
				images[slot]->need_load = false;
			}

			if(progress.get_cancel()) return;
		}
	}

	for(size_t slot = 0; slot < float_images.size(); slot++) {
		if(float_images[slot]) {
			if(float_images[slot]->users == 0) {
				device_free_image(device, dscene, slot + TEX_IMAGE_FLOAT_START);
			}
			else if(float_images[slot]->need_load) {
				string name = path_filename(float_images[slot]->filename);
				progress.set_status("Updating Images", "Loading " + name);
				device_load_image(device, dscene, slot + TEX_IMAGE_FLOAT_START);
				float_images[slot]->need_load = false;
			}

			if(progress.get_cancel()) return;
		}
	}

	need_update = false;
}
コード例 #8
0
ファイル: image.cpp プロジェクト: dreamsxin/blender
void ImageManager::device_free(Device *device, DeviceScene *dscene)
{
	for(int type = 0; type < IMAGE_DATA_NUM_TYPES; type++) {
		for(size_t slot = 0; slot < images[type].size(); slot++) {
			device_free_image(device, dscene, (ImageDataType)type, slot);
		}
		images[type].clear();
	}

	dscene->tex_float4_image.clear();
	dscene->tex_byte4_image.clear();
	dscene->tex_half4_image.clear();
	dscene->tex_float_image.clear();
	dscene->tex_byte_image.clear();
	dscene->tex_half_image.clear();
}