#define OUT_COLOR gl_FragColor
//@ignore:off
-UNIFORM_BLOCK FragBlock
+UNIFORM_BLOCK UtcFragBlock
{
UNIFORM lowp vec4 uColor;
};
#define texture2D texture
#define texture2DLod textureLod
#define textureCubeLod textureLod
-layout(std140) uniform FragBlock
+layout(std140) uniform UtcFragBlock
{
lowp vec4 uColor;
};
#define texture2D texture
#define texture2DLod textureLod
#define textureCubeLod textureLod
-layout(set=0, binding=1, std140) uniform FragBlock
+layout(set=0, binding=1, std140) uniform UtcFragBlock
{
lowp vec4 uColor;
};
INPUT mediump vec2 aTexCoord;
OUTPUT mediump vec2 vTexCoord;
FLAT OUTPUT mediump int vInteger;
-UNIFORM_BLOCK VertBlock
+UNIFORM_BLOCK UtcVertBlock
{
UNIFORM highp mat4 uMvpMatrix;
UNIFORM highp vec3 uSize;
in mediump vec2 aTexCoord;
out mediump vec2 vTexCoord;
flat out mediump int vInteger;
-layout(std140) uniform VertBlock
+layout(std140) uniform UtcVertBlock
{
highp mat4 uMvpMatrix;
highp vec3 uSize;
layout(location = 1) in mediump vec2 aTexCoord;
layout(location=0) out mediump vec2 vTexCoord;
layout(location=1) out mediump int vInteger;
-layout(set=0, binding=0, std140) uniform VertBlock
+layout(set=0, binding=0, std140) uniform UtcVertBlock
{
highp mat4 uMvpMatrix;
highp vec3 uSize;
#define OUT_COLOR gl_FragColor
//@ignore:off
-UNIFORM_BLOCK FragBlock
+UNIFORM_BLOCK UtcFragBlock
{
UNIFORM lowp vec4 uColor;
};
#define texture2D texture
#define texture2DLod textureLod
#define textureCubeLod textureLod
-layout(std140) uniform FragBlock
+layout(std140) uniform UtcFragBlock
{
lowp vec4 uColor;
};
#define texture2D texture
#define texture2DLod textureLod
#define textureCubeLod textureLod
-layout(set=0, binding=1, std140) uniform FragBlock
+layout(set=0, binding=1, std140) uniform UtcFragBlock
{
lowp vec4 uColor;
};
#define OUT_COLOR gl_FragColor
//@ignore:off
-UNIFORM_BLOCK FragBlock
+UNIFORM_BLOCK UtcFragBlock
{
UNIFORM lowp vec4 uColor;
};
#define texture2D texture
#define texture2DLod textureLod
#define textureCubeLod textureLod
-layout(std140) uniform FragBlock
+layout(std140) uniform UtcFragBlock
{
lowp vec4 uColor;
};
#define texture2D texture
#define texture2DLod textureLod
#define textureCubeLod textureLod
-layout(set=0, binding=1, std140) uniform FragBlock
+layout(set=0, binding=1, std140) uniform UtcFragBlock
{
lowp vec4 uColor;
};
INPUT mediump vec2 aPosition;
INPUT mediump vec2 aTexCoord;
OUTPUT mediump vec2 vTexCoord;
-UNIFORM_BLOCK VertBlock
+UNIFORM_BLOCK UtcVertBlock
{
UNIFORM highp mat4 uMvpMatrix;
UNIFORM highp vec3 uSize;
in mediump vec2 aPosition;
in mediump vec2 aTexCoord;
out mediump vec2 vTexCoord;
-layout(std140) uniform VertBlock
+layout(std140) uniform UtcVertBlock
{
highp mat4 uMvpMatrix;
highp vec3 uSize;
layout(location = 0) in mediump vec2 aPosition;
layout(location = 1) in mediump vec2 aTexCoord;
layout(location=0) out mediump vec2 vTexCoord;
-layout(set=0, binding=0, std140) uniform VertBlock
+layout(set=0, binding=0, std140) uniform UtcVertBlock
{
highp mat4 uMvpMatrix;
highp vec3 uSize;
//@ignore:off
// Some amazing uniform block
-UNIFORM_BLOCK FragBlock// another breaking comment
+UNIFORM_BLOCK UtcFragBlock// another breaking comment
{
UNIFORM lowp vec4 uColor;// This is color (used to cause a parsing error!)
};
// Some amazing uniform block
-layout(set=0, binding=1, std140) uniform FragBlock// another breaking comment
+layout(set=0, binding=1, std140) uniform UtcFragBlock// another breaking comment
{
lowp vec4 uColor;// This is color (used to cause a parsing error!)
};
OUTPUT medium vec2 vTexCoord2;// other output
// Some vertex block
-UNIFORM_BLOCK VertBlock//block comment
+UNIFORM_BLOCK UtcVertBlock//block comment
{
UNIFORM highp mat4 uMvpMatrix;//comment0
UNIFORM highp vec3 uSize;//comment1
layout(location=1) out medium vec2 vTexCoord2;// other output
// Some vertex block
-layout(set=0, binding=0, std140) uniform VertBlock//block comment
+layout(set=0, binding=0, std140) uniform UtcVertBlock//block comment
{
highp mat4 uMvpMatrix;//comment0
highp vec3 uSize;//comment1
//@version 100
// Some amazing uniform block
-UNIFORM_BLOCK FragBlock// another breaking comment
+UNIFORM_BLOCK UtcFragBlock// another breaking comment
{
UNIFORM lowp vec4 uColor;// This is color (used to cause a parsing error!)
};
#define textureCubeLod textureLod
// Some amazing uniform block
-layout(set=0, binding=1, std140) uniform FragBlock// another breaking comment
+layout(set=0, binding=1, std140) uniform UtcFragBlock// another breaking comment
{
lowp vec4 uColor;// This is color (used to cause a parsing error!)
};
OUTPUT medium vec2 vTexCoord2;// other output
// Some vertex block
-UNIFORM_BLOCK VertBlock//block comment
+UNIFORM_BLOCK UtcVertBlock//block comment
{
UNIFORM highp mat4 uMvpMatrix;//comment0
UNIFORM highp vec3 uSize;//comment1
layout(location=4) out medium vec2 vTexCoord2;// other output
// Some vertex block
-layout(set=0, binding=0, std140) uniform VertBlock//block comment
+layout(set=0, binding=0, std140) uniform UtcVertBlock//block comment
{
highp mat4 uMvpMatrix;//comment0
highp vec3 uSize;//comment1
@version 100
-UNIFORM_BLOCK SharedBlock0
+UNIFORM_BLOCK UtcSharedBlock0
{
UNIFORM highp vec4 uOther;
};
-UNIFORM_BLOCK FragBlock
+UNIFORM_BLOCK UtcFragBlock
{
UNIFORM lowp vec4 uColor;
};
UNIFORM sampler2D sTexture;
UNIFORM samplerCube sTextureCube;
-UNIFORM_BLOCK SharedBlock1
+UNIFORM_BLOCK UtcSharedBlock1
{
UNIFORM highp vec4 uColor;
};
@version 100
#extension GL_OES_EGL_image_external:require
-UNIFORM_BLOCK SharedBlock0
+UNIFORM_BLOCK UtcSharedBlock0
{
UNIFORM highp vec4 uOther;
};
-UNIFORM_BLOCK FragBlock
+UNIFORM_BLOCK UtcFragBlock
{
UNIFORM lowp vec4 uColor;
};
UNIFORM SamplerExternalOES sTexture;
UNIFORM samplerCube sTextureCube;
-UNIFORM_BLOCK SharedBlock1
+UNIFORM_BLOCK UtcSharedBlock1
{
UNIFORM highp vec4 uColor;
};
@version 100
#extension GL_OES_EGL_image_external:require
-UNIFORM_BLOCK SharedBlock0
+UNIFORM_BLOCK UtcSharedBlock0
{
UNIFORM highp vec4 uOther;
};
-UNIFORM_BLOCK FragBlock
+UNIFORM_BLOCK UtcFragBlock
{
UNIFORM lowp vec4 uColor;
};
UNIFORM SamplerExternalOES sTexture;
UNIFORM samplerCube sTextureCube;
-UNIFORM_BLOCK SharedBlock1
+UNIFORM_BLOCK UtcSharedBlock1
{
UNIFORM highp vec4 uColor;
};
@version 100
#extension GL_OES_EGL_image_external_essl3:require
-UNIFORM_BLOCK SharedBlock0
+UNIFORM_BLOCK UtcSharedBlock0
{
UNIFORM highp vec4 uOther;
};
-UNIFORM_BLOCK FragBlock
+UNIFORM_BLOCK UtcFragBlock
{
UNIFORM lowp vec4 uColor;
};
UNIFORM SamplerExternalOES sTexture;
UNIFORM samplerCube sTextureCube;
-UNIFORM_BLOCK SharedBlock1
+UNIFORM_BLOCK UtcSharedBlock1
{
UNIFORM highp vec4 uColor;
};
INPUT mediump vec2 aTexCoord;
OUTPUT mediump vec2 vTexCoord;
-UNIFORM_BLOCK SharedBlock1
+UNIFORM_BLOCK UtcSharedBlock1
{
UNIFORM highp vec4 uOther;
};
-UNIFORM_BLOCK VertBlock
+UNIFORM_BLOCK UtcVertBlock
{
UNIFORM highp mat4 uMvpMatrix;
UNIFORM highp vec3 uSize;
};
-UNIFORM_BLOCK SharedBlock0
+UNIFORM_BLOCK UtcSharedBlock0
{
UNIFORM highp vec4 uColor;
};
-UNIFORM_BLOCK SharedBlock0
+UNIFORM_BLOCK UtcSharedBlock0
{
UNIFORM highp vec4 uOther;
};
-UNIFORM_BLOCK FragBlock
+UNIFORM_BLOCK UtcFragBlock
{
UNIFORM lowp vec4 uColor;
};
UNIFORM sampler2D sTexture;
UNIFORM samplerCube sTextureCube;
-UNIFORM_BLOCK SharedBlock1
+UNIFORM_BLOCK UtcSharedBlock1
{
UNIFORM highp vec4 uColor;
};
#define texture2D texture
#define texture2DLod textureLod
#define textureCubeLod textureLod
-layout(set=0, binding=2, std140) uniform SharedBlock0
+layout(set=0, binding=2, std140) uniform UtcSharedBlock0
{
highp vec4 uOther;
};
-layout(set=0, binding=3, std140) uniform FragBlock
+layout(set=0, binding=3, std140) uniform UtcFragBlock
{
lowp vec4 uColor;
};
layout(binding = 4) uniform sampler2D sTexture;
layout(binding = 5) uniform samplerCube sTextureCube;
-layout(set=0, binding=0, std140) uniform SharedBlock1
+layout(set=0, binding=0, std140) uniform UtcSharedBlock1
{
highp vec4 uColor;
};
INPUT mediump vec2 aTexCoord;
OUTPUT mediump vec2 vTexCoord;
-UNIFORM_BLOCK SharedBlock1
+UNIFORM_BLOCK UtcSharedBlock1
{
UNIFORM highp vec4 uOther;
};
-UNIFORM_BLOCK VertBlock
+UNIFORM_BLOCK UtcVertBlock
{
UNIFORM highp mat4 uMvpMatrix;
UNIFORM highp vec3 uSize;
};
-UNIFORM_BLOCK SharedBlock0
+UNIFORM_BLOCK UtcSharedBlock0
{
UNIFORM highp vec4 uColor;
};
layout(location = 1) in mediump vec2 aTexCoord;
layout(location=0) out mediump vec2 vTexCoord;
-layout(set=0, binding=0, std140) uniform SharedBlock1
+layout(set=0, binding=0, std140) uniform UtcSharedBlock1
{
highp vec4 uOther;
};
-layout(set=0, binding=1, std140) uniform VertBlock
+layout(set=0, binding=1, std140) uniform UtcVertBlock
{
highp mat4 uMvpMatrix;
highp vec3 uSize;
};
-layout(set=0, binding=2, std140) uniform SharedBlock0
+layout(set=0, binding=2, std140) uniform UtcSharedBlock0
{
highp vec4 uColor;
};
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
#include <dali/internal/graphics/common/shader-parser.h>
#include <sstream>
+// Happy trick for Tizen platform! since 2025-04-22. eunkiki.hong@samsung.com
+// Since uniform buffer reduce fps near 10% than before, let we ignore uniform block feature
+// except several default SharedUniformBlocks, like "VisualVertBlock".
+// If we resolve performance issue, please remove below code!
+#define IGNORE_UNIFORM_BLOCKS_FOR_NORMAL_CASES 1
+
+#if IGNORE_UNIFORM_BLOCKS_FOR_NORMAL_CASES
+#include <unordered_set>
+#endif
+
namespace
{
const std::vector<std::string> MATRIX_DATA_TYPE_TOKENS{"mat3", "mat4", "mat2"};
(c == '_') ||
(c == '#');
}
+
+#if IGNORE_UNIFORM_BLOCKS_FOR_NORMAL_CASES
+const std::unordered_set<std::string_view> gExceptUniformBlockNames{
+ "VisualVertBlock", ///< Default VisualRenderer properties
+ "GaussianBlurSampleBlock", ///< GaussianBlur effects
+ "PunctualLightBlock", ///< For Scene3D::Light
+ "SharedFragmentBlock", ///< For uniform-blocks.example
+ "UtcVertBlock", ///< For UTC
+ "UtcFragBlock", ///< For UTC
+};
+#endif
} // namespace
namespace Dali::Internal::ShaderParser
}
else if(lang >= OutputLanguage::GLSL_3 && lang <= OutputLanguage::GLSL_3_MAX)
{
- ss << "layout(std140) uniform" << l.line.substr(l.tokens[0].first + l.tokens[0].second).c_str() << "\n";
- gles3plus = true;
+#if IGNORE_UNIFORM_BLOCKS_FOR_NORMAL_CASES
+ if(gExceptUniformBlockNames.find(uniformBlockName) != gExceptUniformBlockNames.end())
+#endif
+ {
+ ss << "layout(std140) uniform" << l.line.substr(l.tokens[0].first + l.tokens[0].second).c_str() << "\n";
+ gles3plus = true;
+ }
}
if(gles3plus) // remove word UNIFORM for gles3+/spirv
{
}
ss << "};\n";
}
- else if(lang == OutputLanguage::GLSL_100_ES)
+ else
{
while(l.line.find('{') == std::string::npos)
{