[Bf-blender-cvs] [101b248174a] cycles_texture_cache: Merge branch 'master' of git.blender.org:blender into cycles_texture_cache
Stefan Werner
noreply at git.blender.org
Tue Jun 19 13:35:36 CEST 2018
Commit: 101b248174a63965e83e03bd0afa6a5f97004b44
Author: Stefan Werner
Date: Tue Mar 6 14:49:05 2018 +0100
Branches: cycles_texture_cache
https://developer.blender.org/rB101b248174a63965e83e03bd0afa6a5f97004b44
Merge branch 'master' of git.blender.org:blender into cycles_texture_cache
===================================================================
===================================================================
diff --cc intern/cycles/blender/blender_sync.cpp
index b25a0a3005d,283aa5600fd..e47b64b99f2
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@@ -666,16 -662,8 +662,16 @@@ SceneParams BlenderSync::get_scene_para
params.texture_limit = 0;
}
- params.use_qbvh = DebugFlags().cpu.qbvh;
+ params.bvh_layout = DebugFlags().cpu.bvh_layout;
+ params.texture_cache_size = RNA_int_get(&cscene, "texture_cache_size");
+ params.texture_auto_convert = RNA_boolean_get(&cscene, "texture_auto_convert");
+ params.texture_accept_unmipped = RNA_boolean_get(&cscene, "texture_accept_unmipped");
+ params.texture_accept_untiled = RNA_boolean_get(&cscene, "texture_accept_untiled");
+ params.texture_tile_size = RNA_int_get(&cscene, "texture_tile_size");
+ params.texture_auto_mip = RNA_int_get(&cscene, "texture_auto_mip");
+ params.texture_auto_tile = RNA_int_get(&cscene, "texture_auto_tile");
+
return params;
}
diff --cc intern/cycles/render/image.cpp
index 3424d1dc405,9c5e32e8219..521b33794f2
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@@ -131,85 -131,74 +140,95 @@@ bool ImageManager::get_image_metadata(c
ImageInput *in = ImageInput::create(filename);
- if(in) {
- ImageSpec spec;
-
- if(in->open(filename, spec)) {
- /* check the main format, and channel formats;
- * if any take up more than one byte, we'll need a float texture slot */
- if(spec.format.basesize() > 1) {
- is_float = true;
- is_linear = true;
- }
+ if(!in) {
+ return false;
+ }
- for(size_t channel = 0; channel < spec.channelformats.size(); channel++) {
- if(spec.channelformats[channel].basesize() > 1) {
- is_float = true;
- is_linear = true;
- }
- }
+ ImageSpec spec;
+ if(!in->open(filename, spec)) {
+ delete in;
+ return false;
+ }
- /* check if it's half float */
- if(spec.format == TypeDesc::HALF)
- is_half = true;
+ metadata.width = spec.width;
+ metadata.height = spec.height;
+ metadata.depth = spec.depth;
- channels = spec.nchannels;
+ /* check the main format, and channel formats;
+ * if any take up more than one byte, we'll need a float texture slot */
+ if(spec.format.basesize() > 1) {
+ metadata.is_float = true;
+ metadata.is_linear = true;
+ }
- /* basic color space detection, not great but better than nothing
- * before we do OpenColorIO integration */
- if(is_float) {
- string colorspace = spec.get_string_attribute("oiio:ColorSpace");
+ for(size_t channel = 0; channel < spec.channelformats.size(); channel++) {
+ if(spec.channelformats[channel].basesize() > 1) {
+ metadata.is_float = true;
+ metadata.is_linear = true;
+ }
+ }
- is_linear = !(colorspace == "sRGB" ||
- colorspace == "GammaCorrected" ||
- (colorspace == "" &&
- (strcmp(in->format_name(), "png") == 0 ||
- strcmp(in->format_name(), "tiff") == 0 ||
- strcmp(in->format_name(), "dpx") == 0 ||
- strcmp(in->format_name(), "jpeg2000") == 0)));
- }
- else {
- is_linear = false;
- }
+ /* check if it's half float */
+ if(spec.format == TypeDesc::HALF)
+ metadata.is_half = true;
- in->close();
- }
+ /* basic color space detection, not great but better than nothing
+ * before we do OpenColorIO integration */
+ if(metadata.is_float) {
+ string colorspace = spec.get_string_attribute("oiio:ColorSpace");
- delete in;
+ metadata.is_linear = !(colorspace == "sRGB" ||
+ colorspace == "GammaCorrected" ||
+ (colorspace == "" &&
+ (strcmp(in->format_name(), "png") == 0 ||
+ strcmp(in->format_name(), "tiff") == 0 ||
+ strcmp(in->format_name(), "dpx") == 0 ||
+ strcmp(in->format_name(), "jpeg2000") == 0)));
+ }
+ else {
+ metadata.is_linear = false;
}
- if(is_half) {
- return (channels > 1) ? IMAGE_DATA_TYPE_HALF4 : IMAGE_DATA_TYPE_HALF;
+ /* set type and channels */
+ metadata.channels = spec.nchannels;
+
+ if(metadata.is_half) {
+ metadata.type = (metadata.channels > 1) ? IMAGE_DATA_TYPE_HALF4 : IMAGE_DATA_TYPE_HALF;
}
- else if(is_float) {
- return (channels > 1) ? IMAGE_DATA_TYPE_FLOAT4 : IMAGE_DATA_TYPE_FLOAT;
+ else if(metadata.is_float) {
+ metadata.type = (metadata.channels > 1) ? IMAGE_DATA_TYPE_FLOAT4 : IMAGE_DATA_TYPE_FLOAT;
}
else {
- return (channels > 1) ? IMAGE_DATA_TYPE_BYTE4 : IMAGE_DATA_TYPE_BYTE;
+ metadata.type = (metadata.channels > 1) ? IMAGE_DATA_TYPE_BYTE4 : IMAGE_DATA_TYPE_BYTE;
}
+
+ in->close();
+ delete in;
+
+ return true;
}
+const string ImageManager::get_mip_map_path(const string& filename)
+{
+ if(!path_exists(filename)) {
+ return "";
+ }
+
+ string::size_type idx = filename.rfind('.');
+ if(idx != string::npos) {
+ std::string extension = filename.substr(idx+1);
+ if(extension == "tx") {
+ return filename;
+ }
+ }
+
+ string tx_name = filename + ".tx";
+ if(path_exists(tx_name)) {
+ return tx_name;
+ }
+ return "";
+}
+
int ImageManager::max_flattened_slot(ImageDataType type)
{
if(tex_num_images[type] == 0) {
diff --cc intern/cycles/render/image.h
index 3972baf433c,5391490d993..b61c3578ddb
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@@ -71,11 -82,11 +82,13 @@@ public
void device_free(Device *device);
void device_free_builtin(Device *device);
- void set_osl_texture_system(void *texture_system);
+ void set_oiio_texture_system(void *texture_system);
+ const string get_mip_map_path(const string& filename);
+ void set_pack_images(bool pack_images_);
bool set_animation_frame_update(int frame);
+ device_memory *image_memory(int flat_slot);
+
bool need_update;
/* NOTE: Here pixels_size is a size of storage, which equals to
diff --cc intern/cycles/render/scene.h
index eee01ecdf2a,ea9485ff230..dd15a94544c
--- a/intern/cycles/render/scene.h
+++ b/intern/cycles/render/scene.h
@@@ -132,16 -158,9 +158,16 @@@ public
bool use_bvh_spatial_split;
bool use_bvh_unaligned_nodes;
int num_bvh_time_steps;
- bool use_qbvh;
+
bool persistent_data;
int texture_limit;
+ int texture_cache_size;
+ bool texture_auto_convert;
+ bool texture_accept_unmipped;
+ bool texture_accept_untiled;
+ bool texture_auto_tile;
+ bool texture_auto_mip;
+ int texture_tile_size;
SceneParams()
{
@@@ -150,16 -170,8 +177,15 @@@
use_bvh_spatial_split = false;
use_bvh_unaligned_nodes = true;
num_bvh_time_steps = 0;
- use_qbvh = true;
persistent_data = false;
texture_limit = 0;
+ texture_cache_size = 1024;
+ texture_auto_convert = true;
+ texture_accept_unmipped = true;
+ texture_accept_untiled = true;
+ texture_auto_tile = true;
+ texture_auto_mip = true;
+ texture_tile_size = 64;
}
bool modified(const SceneParams& params)
@@@ -168,16 -181,8 +195,15 @@@
&& use_bvh_spatial_split == params.use_bvh_spatial_split
&& use_bvh_unaligned_nodes == params.use_bvh_unaligned_nodes
&& num_bvh_time_steps == params.num_bvh_time_steps
- && use_qbvh == params.use_qbvh
&& persistent_data == params.persistent_data
- && texture_limit == params.texture_limit); }
+ && texture_limit == params.texture_limit)
+ && texture_cache_size == params.texture_cache_size
+ && texture_auto_convert == params.texture_auto_convert
+ && texture_accept_unmipped == params.texture_accept_unmipped
+ && texture_accept_untiled == params.texture_accept_untiled
+ && texture_auto_tile == params.texture_auto_tile
+ && texture_auto_mip == params.texture_auto_mip
+ && texture_tile_size == params.texture_tile_size; }
};
/* Scene */
More information about the Bf-blender-cvs
mailing list