Exemplo n.º 1
0
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);
	}
}
Exemplo n.º 2
0
device_memory *ImageManager::image_memory(int flat_slot)
{
	   ImageDataType type;
	   int slot = flattened_slot_to_type_index(flat_slot, &type);

	   Image *img = images[type][slot];

	   return img->mem;
}
Exemplo n.º 3
0
void ImageManager::remove_image(int flat_slot)
{
	ImageDataType type;
	int slot = flattened_slot_to_type_index(flat_slot, &type);

	Image *image = images[type][slot];
	assert(image && image->users >= 1);

	/* decrement user count */
	image->users--;

	/* don't remove immediately, rather do it all together later on. one of
	 * the reasons for this is that on shader changes we add and remove nodes
	 * that use them, but we do not want to reload the image all the time. */
	if(image->users == 0)
		need_update = true;
}