Delete useless define of default shaders
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / image-visual-shader-factory.cpp
index 16ba9ca..ceb5848 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -52,18 +52,17 @@ enum class ImageVisualRequireFlag : uint32_t
   ALPHA_MASKING  = 1 << 2,
 };
 
   ALPHA_MASKING  = 1 << 2,
 };
 
-static constexpr auto SHADER_TYPE_COUNT = 8u;
+static constexpr auto          SHADER_TYPE_COUNT = 8u;
 VisualFactoryCache::ShaderType SHADER_TYPE_TABLE[SHADER_TYPE_COUNT] =
 VisualFactoryCache::ShaderType SHADER_TYPE_TABLE[SHADER_TYPE_COUNT] =
-{
-  VisualFactoryCache::IMAGE_SHADER,
-  VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER,
-  VisualFactoryCache::IMAGE_SHADER_BORDERLINE,
-  VisualFactoryCache::IMAGE_SHADER_ROUNDED_BORDERLINE,
-  VisualFactoryCache::IMAGE_SHADER_MASKING,
-  VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER_MASKING,
-  VisualFactoryCache::IMAGE_SHADER_BORDERLINE_MASKING,
-  VisualFactoryCache::IMAGE_SHADER_ROUNDED_BORDERLINE_MASKING
-};
+  {
+    VisualFactoryCache::IMAGE_SHADER,
+    VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER,
+    VisualFactoryCache::IMAGE_SHADER_BORDERLINE,
+    VisualFactoryCache::IMAGE_SHADER_ROUNDED_BORDERLINE,
+    VisualFactoryCache::IMAGE_SHADER_MASKING,
+    VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER_MASKING,
+    VisualFactoryCache::IMAGE_SHADER_BORDERLINE_MASKING,
+    VisualFactoryCache::IMAGE_SHADER_ROUNDED_BORDERLINE_MASKING};
 
 } // unnamed namespace
 
 
 } // unnamed namespace
 
@@ -112,7 +111,7 @@ ImageVisualShaderFactory::~ImageVisualShaderFactory()
 
 Shader ImageVisualShaderFactory::GetShader(VisualFactoryCache& factoryCache, const ImageVisualShaderFeature::FeatureBuilder& featureBuilder)
 {
 
 Shader ImageVisualShaderFactory::GetShader(VisualFactoryCache& factoryCache, const ImageVisualShaderFeature::FeatureBuilder& featureBuilder)
 {
-  Shader shader;
+  Shader                         shader;
   VisualFactoryCache::ShaderType shaderType = VisualFactoryCache::IMAGE_SHADER;
 
   const auto& atlasing                = featureBuilder.mTextureAtlas;
   VisualFactoryCache::ShaderType shaderType = VisualFactoryCache::IMAGE_SHADER;
 
   const auto& atlasing                = featureBuilder.mTextureAtlas;
@@ -121,8 +120,8 @@ Shader ImageVisualShaderFactory::GetShader(VisualFactoryCache& factoryCache, con
   const auto& borderline              = featureBuilder.mBorderline;
   const auto& alphaMaskingOnRendering = featureBuilder.mAlphaMaskingOnRendering;
   const auto& changeFragmentShader    = (featureBuilder.mTexture && DevelTexture::IsNative(featureBuilder.mTexture))
   const auto& borderline              = featureBuilder.mBorderline;
   const auto& alphaMaskingOnRendering = featureBuilder.mAlphaMaskingOnRendering;
   const auto& changeFragmentShader    = (featureBuilder.mTexture && DevelTexture::IsNative(featureBuilder.mTexture))
-                                          ? ImageVisualShaderFeature::ChangeFragmentShader::NEED_CHANGE
-                                          : ImageVisualShaderFeature::ChangeFragmentShader::DONT_CHANGE;
+                                       ? ImageVisualShaderFeature::ChangeFragmentShader::NEED_CHANGE
+                                       : ImageVisualShaderFeature::ChangeFragmentShader::DONT_CHANGE;
 
   if(atlasing == ImageVisualShaderFeature::TextureAtlas::ENABLED)
   {
 
   if(atlasing == ImageVisualShaderFeature::TextureAtlas::ENABLED)
   {
@@ -169,33 +168,33 @@ Shader ImageVisualShaderFactory::GetShader(VisualFactoryCache& factoryCache, con
     {
       if(defaultTextureWrapping == ImageVisualShaderFeature::DefaultTextureWrapMode::APPLY)
       {
     {
       if(defaultTextureWrapping == ImageVisualShaderFeature::DefaultTextureWrapMode::APPLY)
       {
-        fragmentShaderPrefixList += "#define ATLAS_DEFAULT_WARP 1\n";
+        fragmentShaderPrefixList += "#define ATLAS_DEFAULT_WARP\n";
       }
       else
       {
       }
       else
       {
-        fragmentShaderPrefixList += "#define ATLAS_CUSTOM_WARP 1\n";
+        fragmentShaderPrefixList += "#define ATLAS_CUSTOM_WARP\n";
       }
     }
     else
     {
       if(roundedCorner == ImageVisualShaderFeature::RoundedCorner::ENABLED)
       {
       }
     }
     else
     {
       if(roundedCorner == ImageVisualShaderFeature::RoundedCorner::ENABLED)
       {
-        vertexShaderPrefixList   += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
-        fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
+        vertexShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
+        fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
       }
       if(borderline == ImageVisualShaderFeature::Borderline::ENABLED)
       {
       }
       if(borderline == ImageVisualShaderFeature::Borderline::ENABLED)
       {
-        vertexShaderPrefixList   += "#define IS_REQUIRED_BORDERLINE 1\n";
-        fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE 1\n";
+        vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
+        fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
       }
       if(alphaMaskingOnRendering == ImageVisualShaderFeature::AlphaMaskingOnRendering::ENABLED)
       {
       }
       if(alphaMaskingOnRendering == ImageVisualShaderFeature::AlphaMaskingOnRendering::ENABLED)
       {
-        vertexShaderPrefixList   += "#define IS_REQUIRED_ALPHA_MASKING 1\n";
-        fragmentShaderPrefixList += "#define IS_REQUIRED_ALPHA_MASKING 1\n";
+        vertexShaderPrefixList += "#define IS_REQUIRED_ALPHA_MASKING\n";
+        fragmentShaderPrefixList += "#define IS_REQUIRED_ALPHA_MASKING\n";
       }
     }
 
       }
     }
 
-    std::string vertexShader   = std::string(Dali::Shader::GetVertexShaderPrefix()   + vertexShaderPrefixList   + SHADER_IMAGE_VISUAL_SHADER_VERT.data());
+    std::string vertexShader   = std::string(Dali::Shader::GetVertexShaderPrefix() + vertexShaderPrefixList + SHADER_IMAGE_VISUAL_SHADER_VERT.data());
     std::string fragmentShader = std::string(Dali::Shader::GetFragmentShaderPrefix() + fragmentShaderPrefixList + SHADER_IMAGE_VISUAL_SHADER_FRAG.data());
 
     if(changeFragmentShader == ImageVisualShaderFeature::ChangeFragmentShader::NEED_CHANGE)
     std::string fragmentShader = std::string(Dali::Shader::GetFragmentShaderPrefix() + fragmentShaderPrefixList + SHADER_IMAGE_VISUAL_SHADER_FRAG.data());
 
     if(changeFragmentShader == ImageVisualShaderFeature::ChangeFragmentShader::NEED_CHANGE)