Fix a few issues reported by coverity scan.
This commit is contained in:
@@ -458,7 +458,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
|
||||
params.tile_size = make_int2(tile_x, tile_y);
|
||||
}
|
||||
|
||||
params.tile_order = RNA_enum_get(&cscene, "tile_order");
|
||||
params.tile_order = (TileOrder)RNA_enum_get(&cscene, "tile_order");
|
||||
|
||||
params.start_resolution = get_int(cscene, "preview_start_resolution");
|
||||
|
||||
|
@@ -97,6 +97,7 @@ ustring OSLRenderServices::u_empty;
|
||||
OSLRenderServices::OSLRenderServices()
|
||||
{
|
||||
kernel_globals = NULL;
|
||||
osl_ts = NULL;
|
||||
}
|
||||
|
||||
OSLRenderServices::~OSLRenderServices()
|
||||
@@ -701,7 +702,7 @@ bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustri
|
||||
int object, prim, segment;
|
||||
|
||||
/* lookup of attribute on another object */
|
||||
if (object_name != u_empty || sd == NULL) {
|
||||
if (object_name != u_empty) {
|
||||
OSLGlobals::ObjectNameMap::iterator it = kg->osl->object_name_map.find(object_name);
|
||||
|
||||
if (it == kg->osl->object_name_map.end())
|
||||
|
@@ -388,6 +388,8 @@ static void flatten_volume_closure_tree(ShaderData *sd,
|
||||
|
||||
sc.sample_weight = sample_weight;
|
||||
sc.type = CLOSURE_VOLUME_ID;
|
||||
sc.data0 = 0.0f;
|
||||
sc.data1 = 0.0f;
|
||||
sc.prim = NULL;
|
||||
|
||||
/* add */
|
||||
|
@@ -52,6 +52,7 @@ Camera::Camera()
|
||||
|
||||
width = 1024;
|
||||
height = 512;
|
||||
resolution = 1;
|
||||
|
||||
viewplane.left = -((float)width/(float)height);
|
||||
viewplane.right = (float)width/(float)height;
|
||||
|
@@ -39,6 +39,7 @@ CCL_NAMESPACE_BEGIN
|
||||
Mesh::Mesh()
|
||||
{
|
||||
need_update = true;
|
||||
need_update_rebuild = false;
|
||||
transform_applied = false;
|
||||
transform_negative_scaled = false;
|
||||
transform_normal = transform_identity();
|
||||
@@ -467,6 +468,7 @@ void MeshManager::update_osl_attributes(Device *device, Scene *scene, vector<Att
|
||||
osl_attr.type = attr.type();
|
||||
osl_attr.elem = ATTR_ELEMENT_VALUE;
|
||||
osl_attr.value = attr;
|
||||
osl_attr.offset = 0;
|
||||
|
||||
og->attribute_map[i*ATTR_PRIM_TYPES][attr.name()] = osl_attr;
|
||||
og->attribute_map[i*ATTR_PRIM_TYPES + ATTR_PRIM_CURVE][attr.name()] = osl_attr;
|
||||
|
@@ -452,6 +452,13 @@ static void sky_texture_precompute_old(SunSky *sunsky, float3 dir, float turbidi
|
||||
sunsky->config_z[3] = (-0.0441f * T - 1.6537f);
|
||||
sunsky->config_z[4] = (-0.0109f * T + 0.0529f);
|
||||
|
||||
/* unused for old sky model */
|
||||
for(int i = 5; i < 9; i++) {
|
||||
sunsky->config_x[i] = 0.0f;
|
||||
sunsky->config_y[i] = 0.0f;
|
||||
sunsky->config_z[i] = 0.0f;
|
||||
}
|
||||
|
||||
sunsky->radiance_x /= sky_perez_function(sunsky->config_x, 0, theta);
|
||||
sunsky->radiance_y /= sky_perez_function(sunsky->config_y, 0, theta);
|
||||
sunsky->radiance_z /= sky_perez_function(sunsky->config_z, 0, theta);
|
||||
@@ -558,6 +565,7 @@ void SkyTextureNode::compile(OSLCompiler& compiler)
|
||||
tex_mapping.compile(compiler);
|
||||
|
||||
SunSky sunsky;
|
||||
|
||||
if(type_enum[type] == NODE_SKY_OLD)
|
||||
sky_texture_precompute_old(&sunsky, sun_direction, turbidity);
|
||||
else if(type_enum[type] == NODE_SKY_NEW)
|
||||
|
@@ -41,10 +41,13 @@ Object::Object()
|
||||
particle_id = 0;
|
||||
bounds = BoundBox::empty;
|
||||
motion.pre = transform_identity();
|
||||
motion.mid = transform_identity();
|
||||
motion.post = transform_identity();
|
||||
use_motion = false;
|
||||
use_holdout = false;
|
||||
curverender = false;
|
||||
dupli_generated = make_float3(0.0f, 0.0f, 0.0f);
|
||||
dupli_uv = make_float2(0.0f, 0.0f);
|
||||
}
|
||||
|
||||
Object::~Object()
|
||||
|
@@ -136,6 +136,7 @@ public:
|
||||
#else
|
||||
use_qbvh = false;
|
||||
#endif
|
||||
persistent_data = false;
|
||||
}
|
||||
|
||||
bool modified(const SceneParams& params)
|
||||
|
@@ -66,6 +66,7 @@ Session::Session(const SessionParams& params_)
|
||||
reset_time = 0.0;
|
||||
preview_time = 0.0;
|
||||
paused_time = 0.0;
|
||||
last_update_time = 0.0;
|
||||
|
||||
delayed_reset.do_reset = false;
|
||||
delayed_reset.samples = 0;
|
||||
|
@@ -49,7 +49,7 @@ public:
|
||||
bool experimental;
|
||||
int samples;
|
||||
int2 tile_size;
|
||||
int tile_order;
|
||||
TileOrder tile_order;
|
||||
int start_resolution;
|
||||
int threads;
|
||||
|
||||
@@ -81,6 +81,7 @@ public:
|
||||
text_timeout = 1.0;
|
||||
|
||||
shadingsystem = SVM;
|
||||
tile_order = TILE_CENTER;
|
||||
}
|
||||
|
||||
bool modified(const SessionParams& params)
|
||||
@@ -99,6 +100,7 @@ public:
|
||||
&& cancel_timeout == params.cancel_timeout
|
||||
&& reset_timeout == params.reset_timeout
|
||||
&& text_timeout == params.text_timeout
|
||||
&& tile_order == params.tile_order
|
||||
&& shadingsystem == params.shadingsystem); }
|
||||
|
||||
};
|
||||
|
@@ -110,6 +110,7 @@ SVMCompiler::SVMCompiler(ShaderManager *shader_manager_, ImageManager *image_man
|
||||
max_stack_use = 0;
|
||||
current_type = SHADER_TYPE_SURFACE;
|
||||
current_shader = NULL;
|
||||
current_graph = NULL;
|
||||
background = false;
|
||||
mix_weight_offset = SVM_STACK_INVALID;
|
||||
use_multi_closure = use_multi_closure_;
|
||||
|
@@ -22,7 +22,7 @@
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
TileManager::TileManager(bool progressive_, int num_samples_, int2 tile_size_, int start_resolution_,
|
||||
bool preserve_tile_device_, bool background_, int tile_order_, int num_devices_)
|
||||
bool preserve_tile_device_, bool background_, TileOrder tile_order_, int num_devices_)
|
||||
{
|
||||
progressive = progressive_;
|
||||
tile_size = tile_size_;
|
||||
@@ -178,7 +178,7 @@ list<Tile>::iterator TileManager::next_viewport_tile(int device)
|
||||
return state.tiles.end();
|
||||
}
|
||||
|
||||
list<Tile>::iterator TileManager::next_background_tile(int device, int tile_order)
|
||||
list<Tile>::iterator TileManager::next_background_tile(int device, TileOrder tile_order)
|
||||
{
|
||||
list<Tile>::iterator iter, best = state.tiles.end();
|
||||
|
||||
@@ -199,21 +199,21 @@ list<Tile>::iterator TileManager::next_background_tile(int device, int tile_orde
|
||||
int64_t disty = cordy;
|
||||
|
||||
switch (tile_order) {
|
||||
case TileManager::CENTER:
|
||||
case TILE_CENTER:
|
||||
distx = centx - (cur_tile.x + cur_tile.w);
|
||||
disty = centy - (cur_tile.y + cur_tile.h);
|
||||
distx = (int64_t) sqrt((double)distx * distx + disty * disty);
|
||||
break;
|
||||
case TileManager::RIGHT_TO_LEFT:
|
||||
case TILE_RIGHT_TO_LEFT:
|
||||
distx = cordx - cur_tile.x;
|
||||
break;
|
||||
case TileManager::LEFT_TO_RIGHT:
|
||||
case TILE_LEFT_TO_RIGHT:
|
||||
distx = cordx + cur_tile.x;
|
||||
break;
|
||||
case TileManager::TOP_TO_BOTTOM:
|
||||
case TILE_TOP_TO_BOTTOM:
|
||||
distx = cordx - cur_tile.y;
|
||||
break;
|
||||
case TileManager::BOTTOM_TO_TOP:
|
||||
case TILE_BOTTOM_TO_TOP:
|
||||
distx = cordx + cur_tile.y;
|
||||
break;
|
||||
default:
|
||||
|
@@ -40,6 +40,17 @@ public:
|
||||
: index(index_), x(x_), y(y_), w(w_), h(h_), device(device_), rendering(false) {}
|
||||
};
|
||||
|
||||
/* Tile order */
|
||||
|
||||
/* Note: this should match enum_tile_order in properties.py */
|
||||
enum TileOrder {
|
||||
TILE_CENTER = 0,
|
||||
TILE_RIGHT_TO_LEFT = 1,
|
||||
TILE_LEFT_TO_RIGHT = 2,
|
||||
TILE_TOP_TO_BOTTOM = 3,
|
||||
TILE_BOTTOM_TO_TOP = 4
|
||||
};
|
||||
|
||||
/* Tile Manager */
|
||||
|
||||
class TileManager {
|
||||
@@ -59,7 +70,7 @@ public:
|
||||
int num_samples;
|
||||
|
||||
TileManager(bool progressive, int num_samples, int2 tile_size, int start_resolution,
|
||||
bool preserve_tile_device, bool background, int tile_order, int num_devices = 1);
|
||||
bool preserve_tile_device, bool background, TileOrder tile_order, int num_devices = 1);
|
||||
~TileManager();
|
||||
|
||||
void reset(BufferParams& params, int num_samples);
|
||||
@@ -67,23 +78,15 @@ public:
|
||||
bool next();
|
||||
bool next_tile(Tile& tile, int device = 0);
|
||||
bool done();
|
||||
|
||||
void set_tile_order(int tile_order_) { tile_order = tile_order_; }
|
||||
protected:
|
||||
/* Note: this should match enum_tile_order in properties.py */
|
||||
enum {
|
||||
CENTER = 0,
|
||||
RIGHT_TO_LEFT = 1,
|
||||
LEFT_TO_RIGHT = 2,
|
||||
TOP_TO_BOTTOM = 3,
|
||||
BOTTOM_TO_TOP = 4
|
||||
} TileOrder;
|
||||
|
||||
void set_tile_order(TileOrder tile_order_) { tile_order = tile_order_; }
|
||||
protected:
|
||||
|
||||
void set_tiles();
|
||||
|
||||
bool progressive;
|
||||
int2 tile_size;
|
||||
int tile_order;
|
||||
TileOrder tile_order;
|
||||
int start_resolution;
|
||||
int num_devices;
|
||||
|
||||
@@ -113,7 +116,7 @@ protected:
|
||||
void gen_tiles_sliced();
|
||||
|
||||
/* returns tiles for background render */
|
||||
list<Tile>::iterator next_background_tile(int device, int tile_order);
|
||||
list<Tile>::iterator next_background_tile(int device, TileOrder tile_order);
|
||||
|
||||
/* returns first unhandled tile for viewport render */
|
||||
list<Tile>::iterator next_viewport_tile(int device);
|
||||
|
@@ -373,14 +373,12 @@ bool DedicatedTaskPool::cancelled()
|
||||
|
||||
void DedicatedTaskPool::num_decrease(int done)
|
||||
{
|
||||
num_mutex.lock();
|
||||
thread_scoped_lock num_lock(num_mutex);
|
||||
num -= done;
|
||||
|
||||
assert(num >= 0);
|
||||
if(num == 0)
|
||||
num_cond.notify_all();
|
||||
|
||||
num_mutex.unlock();
|
||||
}
|
||||
|
||||
void DedicatedTaskPool::num_increase()
|
||||
|
@@ -502,7 +502,8 @@ static void render_endjob(void *rjv)
|
||||
* engine API, so lets use simple and robust way for now
|
||||
* - sergey -
|
||||
*/
|
||||
if (rj->scene->r.layers.first != rj->scene->r.layers.last) {
|
||||
if (rj->scene->r.layers.first != rj->scene->r.layers.last ||
|
||||
rj->image_outdated) {
|
||||
void *lock;
|
||||
Image *ima = rj->image;
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, &rj->iuser, &lock);
|
||||
|
@@ -1987,8 +1987,8 @@ void add_halo_flare(Render *re)
|
||||
rr->renlay= rl;
|
||||
re->display_draw(re->ddh, rr, NULL);
|
||||
}
|
||||
|
||||
R.r.mode= mode;
|
||||
}
|
||||
|
||||
R.r.mode= mode;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user