fix pvs warning

This commit is contained in:
2019-11-27 15:55:41 +07:00
parent 7fdc227b17
commit 371e05574b
2 changed files with 55 additions and 45 deletions

View File

@@ -6,8 +6,10 @@ cd $BUILD_DIR/pvs_analyze
rm -rf pvs_report rm -rf pvs_report
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=On ../.. cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=On ../..
pvs-studio-analyzer analyze\ pvs-studio-analyzer analyze\
--disableLicenseExpirationCheck\
-e ../../untests\ -e ../../untests\
-e ../../modules\ -e ../../modules\
-e ../../headers/3rdparty\
-e ../../sources/3rdparty\ -e ../../sources/3rdparty\
-o pvs_report.log\ -o pvs_report.log\
-j8 -j8

View File

@@ -273,66 +273,74 @@ namespace e2d::render_system_impl
texture_ptr tex_p; texture_ptr tex_p;
const texture_asset* texture_asset_ptr = atlas_page const texture_asset* texture_asset_ptr = atlas_page
? static_cast<texture_asset*>(atlas_page->rendererObject) ? static_cast<const texture_asset*>(atlas_page->rendererObject)
: nullptr; : nullptr;
if ( texture_asset_ptr ) { if ( texture_asset_ptr ) {
tex_p = texture_asset_ptr->content(); tex_p = texture_asset_ptr->content();
} }
render::sampler_min_filter tex_min_f = render::sampler_min_filter::linear; render::sampler_min_filter tex_min_f = render::sampler_min_filter::linear;
switch ( atlas_page->minFilter ) { if ( atlas_page ) {
case SP_ATLAS_NEAREST: switch ( atlas_page->minFilter ) {
case SP_ATLAS_MIPMAP_NEAREST_LINEAR: case SP_ATLAS_NEAREST:
case SP_ATLAS_MIPMAP_NEAREST_NEAREST: case SP_ATLAS_MIPMAP_NEAREST_LINEAR:
tex_min_f = render::sampler_min_filter::nearest; case SP_ATLAS_MIPMAP_NEAREST_NEAREST:
break; tex_min_f = render::sampler_min_filter::nearest;
default: break;
tex_min_f = render::sampler_min_filter::linear; default:
break; tex_min_f = render::sampler_min_filter::linear;
break;
}
} }
render::sampler_mag_filter tex_mag_f = render::sampler_mag_filter::linear; render::sampler_mag_filter tex_mag_f = render::sampler_mag_filter::linear;
switch ( atlas_page->magFilter ) { if ( atlas_page ) {
case SP_ATLAS_NEAREST: switch ( atlas_page->magFilter ) {
case SP_ATLAS_MIPMAP_NEAREST_LINEAR: case SP_ATLAS_NEAREST:
case SP_ATLAS_MIPMAP_NEAREST_NEAREST: case SP_ATLAS_MIPMAP_NEAREST_LINEAR:
tex_mag_f = render::sampler_mag_filter::nearest; case SP_ATLAS_MIPMAP_NEAREST_NEAREST:
break; tex_mag_f = render::sampler_mag_filter::nearest;
default: break;
tex_mag_f = render::sampler_mag_filter::linear; default:
break; tex_mag_f = render::sampler_mag_filter::linear;
break;
}
} }
render::sampler_wrap tex_wrap_s = render::sampler_wrap::repeat; render::sampler_wrap tex_wrap_s = render::sampler_wrap::repeat;
switch ( atlas_page->uWrap ) { if ( atlas_page ) {
case SP_ATLAS_MIRROREDREPEAT: switch ( atlas_page->uWrap ) {
tex_wrap_s = render::sampler_wrap::mirror; case SP_ATLAS_MIRROREDREPEAT:
break; tex_wrap_s = render::sampler_wrap::mirror;
case SP_ATLAS_CLAMPTOEDGE: break;
tex_wrap_s = render::sampler_wrap::clamp; case SP_ATLAS_CLAMPTOEDGE:
break; tex_wrap_s = render::sampler_wrap::clamp;
case SP_ATLAS_REPEAT: break;
tex_wrap_s = render::sampler_wrap::repeat; case SP_ATLAS_REPEAT:
break; tex_wrap_s = render::sampler_wrap::repeat;
default: break;
E2D_ASSERT_MSG(false, "unexpected wrap mode for slot"); default:
break; E2D_ASSERT_MSG(false, "unexpected wrap mode for slot");
break;
}
} }
render::sampler_wrap tex_wrap_t = render::sampler_wrap::repeat; render::sampler_wrap tex_wrap_t = render::sampler_wrap::repeat;
switch ( atlas_page->vWrap ) { if ( atlas_page ) {
case SP_ATLAS_MIRROREDREPEAT: switch ( atlas_page->vWrap ) {
tex_wrap_t = render::sampler_wrap::mirror; case SP_ATLAS_MIRROREDREPEAT:
break; tex_wrap_t = render::sampler_wrap::mirror;
case SP_ATLAS_CLAMPTOEDGE: break;
tex_wrap_t = render::sampler_wrap::clamp; case SP_ATLAS_CLAMPTOEDGE:
break; tex_wrap_t = render::sampler_wrap::clamp;
case SP_ATLAS_REPEAT: break;
tex_wrap_t = render::sampler_wrap::repeat; case SP_ATLAS_REPEAT:
break; tex_wrap_t = render::sampler_wrap::repeat;
default: break;
E2D_ASSERT_MSG(false, "unexpected wrap mode for slot"); default:
break; E2D_ASSERT_MSG(false, "unexpected wrap mode for slot");
break;
}
} }
material_asset::ptr mat_a; material_asset::ptr mat_a;