From: Eunki, Hong Date: Fri, 13 Sep 2024 09:58:28 +0000 (+0900) Subject: Fix Svace/Coverity issue after merge precompile shader refactorize X-Git-Tag: dali_2.3.42~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=921132eb28afb1e60eefa94e2efea86246c4a89d;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Fix Svace/Coverity issue after merge precompile shader refactorize Change-Id: Ic137fae18ab49da19473e870145c0f9387e17300 Signed-off-by: Eunki, Hong --- diff --git a/dali-toolkit/internal/visuals/custom-shader-factory.cpp b/dali-toolkit/internal/visuals/custom-shader-factory.cpp index e0b345cf0d..eb05b7bbfe 100644 --- a/dali-toolkit/internal/visuals/custom-shader-factory.cpp +++ b/dali-toolkit/internal/visuals/custom-shader-factory.cpp @@ -28,7 +28,6 @@ namespace Toolkit { namespace Internal { - CustomShaderFactory::CustomShaderFactory() { } @@ -39,8 +38,8 @@ CustomShaderFactory::~CustomShaderFactory() bool CustomShaderFactory::AddPrecompiledShader(PrecompileShaderOption& option) { - auto shaderName = option.GetShaderName(); - auto vertexShader = option.GetVertexShader(); + auto shaderName = option.GetShaderName(); + auto vertexShader = option.GetVertexShader(); auto fragmentShader = option.GetFragmentShader(); return SavePrecompileShader(shaderName, vertexShader, fragmentShader); } @@ -54,7 +53,7 @@ void CustomShaderFactory::GetPreCompiledShader(RawShaderData& shaders) shaders.shaderCount = 0; // precompile requested shader first - for(uint32_t i = 0; i < mRequestedPrecompileShader.size(); i++ ) + for(uint32_t i = 0; i < mRequestedPrecompileShader.size(); i++) { vertexPrefix.push_back(mRequestedPrecompileShader[i].vertexPrefix); fragmentPrefix.push_back(mRequestedPrecompileShader[i].fragmentPrefix); @@ -68,17 +67,18 @@ void CustomShaderFactory::GetPreCompiledShader(RawShaderData& shaders) shaders.vertexShader = ""; // Custom shader use prefix shader only. No need to set vertexShader and fragmentShader. shaders.fragmentShader = ""; // Custom shader use prefix shader only. No need to set vertexShader and fragmentShader. shaders.shaderCount = std::move(shaderCount); - shaders.custom = true; + shaders.custom = true; } bool CustomShaderFactory::SavePrecompileShader(std::string& shaderName, std::string& vertexShader, std::string& fragmentShader) { RequestShaderInfo info; - info.name = shaderName; - info.vertexPrefix = vertexShader; + info.type = VisualFactoryCache::SHADER_TYPE_MAX; ///< Not be used + info.name = shaderName; + info.vertexPrefix = vertexShader; info.fragmentPrefix = fragmentShader; mRequestedPrecompileShader.push_back(info); - DALI_LOG_RELEASE_INFO("Add precompile shader success!!(%s)",shaderName.c_str()); + DALI_LOG_RELEASE_INFO("Add precompile shader success!!(%s)", shaderName.c_str()); return true; } diff --git a/dali-toolkit/internal/visuals/visual-factory-cache.h b/dali-toolkit/internal/visuals/visual-factory-cache.h index 7270b349b6..cc59ea7081 100644 --- a/dali-toolkit/internal/visuals/visual-factory-cache.h +++ b/dali-toolkit/internal/visuals/visual-factory-cache.h @@ -143,7 +143,7 @@ public: WIREFRAME_SHADER, ARC_BUTT_CAP_SHADER, ARC_ROUND_CAP_SHADER, - SHADER_TYPE_MAX = ARC_ROUND_CAP_SHADER + SHADER_TYPE_MAX }; /** @@ -156,7 +156,7 @@ public: NINE_PATCH_GEOMETRY, NINE_PATCH_BORDER_GEOMETRY, WIREFRAME_GEOMETRY, - GEOMETRY_TYPE_MAX = WIREFRAME_GEOMETRY + GEOMETRY_TYPE_MAX }; public: @@ -368,8 +368,8 @@ private: uint32_t height; }; - Geometry mGeometry[GEOMETRY_TYPE_MAX + 1]; - Shader mShader[SHADER_TYPE_MAX + 1]; + Geometry mGeometry[GEOMETRY_TYPE_MAX]; + Shader mShader[SHADER_TYPE_MAX]; bool mLoadYuvPlanes; ///< A global flag to specify if the image should be loaded as yuv planes diff --git a/dali-toolkit/internal/visuals/visual-factory-impl.cpp b/dali-toolkit/internal/visuals/visual-factory-impl.cpp index 8242f75054..92b2fa87ee 100644 --- a/dali-toolkit/internal/visuals/visual-factory-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-impl.cpp @@ -39,11 +39,11 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -422,7 +422,7 @@ void VisualFactory::DiscardVisual(Toolkit::Visual::Base visual) bool VisualFactory::AddPrecompileShader(const Property::Map& map) { PrecompileShaderOption shaderOption(map); - auto type = shaderOption.GetShaderType(); + auto type = shaderOption.GetShaderType(); if(type == PrecompileShaderOption::ShaderType::UNKNOWN) { DALI_LOG_ERROR("AddPrecompileShader is failed. we can't find shader type"); @@ -567,7 +567,7 @@ CustomShaderFactory& VisualFactory::GetCustomShaderFactory() bool VisualFactory::AddPrecompileShader(PrecompileShaderOption& option) { auto type = option.GetShaderType(); - bool ret = false; + bool ret = false; switch(type) { case PrecompileShaderOption::ShaderType::COLOR: @@ -588,6 +588,7 @@ bool VisualFactory::AddPrecompileShader(PrecompileShaderOption& option) case PrecompileShaderOption::ShaderType::NPATCH: { ret = GetNpatchShaderFactory().AddPrecompiledShader(option); + break; } case PrecompileShaderOption::ShaderType::MODEL_3D: { @@ -601,7 +602,7 @@ bool VisualFactory::AddPrecompileShader(PrecompileShaderOption& option) } default: { - DALI_LOG_ERROR("AddPrecompileShader is failed. we can't find shader factory type:%d",type); + DALI_LOG_ERROR("AddPrecompileShader is failed. we can't find shader factory type:%d", type); break; } }