END_TEST;
}
+int UtcDaliRendererSetBlendMode08(void)
+{
+ TestApplication application;
+
+ tet_infoline("Test setting the blend mode to auto with opaque color and Advanced Blend Equation.");
+
+ if( Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SCREEN ) )
+ {
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
+
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::OPACITY, 1.0f);
+ actor.AddRenderer(renderer);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+ application.GetScene().Add(actor);
+
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO);
+ renderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true );
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::SCREEN );
+
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ glAbstraction.EnableEnableDisableCallTrace(true);
+
+ application.SendNotification();
+ application.Render();
+
+ TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
+ std::ostringstream blendStr;
+ blendStr << GL_BLEND;
+ DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str()));
+ }
+
+ END_TEST;
+}
+
+int UtcDaliRendererSetBlendMode08b(void)
+{
+ TestApplication application;
+
+ tet_infoline("Test setting the blend mode to off with opaque color and Advanced Blend Equation.");
+
+ if( Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SCREEN ) )
+ {
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
+
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::OPACITY, 1.0f);
+ actor.AddRenderer(renderer);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+ application.GetScene().Add(actor);
+
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::OFF);
+ renderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true );
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::SCREEN );
+
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ glAbstraction.EnableEnableDisableCallTrace(true);
+
+ application.SendNotification();
+ application.Render();
+
+ TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
+ std::ostringstream blendStr;
+ blendStr << GL_BLEND;
+ DALI_TEST_CHECK(!glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str()));
+ }
+
+ END_TEST;
+}
+
int UtcDaliRendererGetBlendMode(void)
{
TestApplication application;
( ( indexA >= BLENDING_EQUATION_ADVANCED_INDEX_START ) && ( indexA <= BLENDING_EQUATION_ADVANCED_INDEX_END ) ) );
}
+bool BlendingOptions::IsAdvancedBlendEquationIncluded( unsigned int bitmask )
+{
+ unsigned int indexRgb = bitmask & MASK_EQUATION_RGB;
+ indexRgb = indexRgb >> SHIFT_TO_EQUATION_RGB;
+ unsigned int indexA = bitmask & MASK_EQUATION_ALPHA;
+ indexA = indexA >> SHIFT_TO_EQUATION_ALPHA;
+
+ return ( ( ( indexRgb >= BLENDING_EQUATION_ADVANCED_INDEX_START ) && ( indexRgb <= BLENDING_EQUATION_ADVANCED_INDEX_END ) ) ||
+ ( ( indexA >= BLENDING_EQUATION_ADVANCED_INDEX_START ) && ( indexA <= BLENDING_EQUATION_ADVANCED_INDEX_END ) ) );
+}
+
bool BlendingOptions::IsAdvancedBlendEquation( DevelBlendEquation::Type equation )
{
switch ( equation )
#include <dali/internal/render/renderers/render-geometry.h>
#include <dali/internal/render/shaders/program.h>
#include <dali/internal/render/shaders/scene-graph-shader.h>
+#include <dali/internal/common/blending-options.h>
namespace Dali
{
}
case BlendMode::AUTO:
{
+ if(BlendingOptions::IsAdvancedBlendEquationIncluded(mBlendBitmask))
+ {
+ opacityType = Renderer::TRANSLUCENT;
+ break;
+ }
+
bool shaderRequiresBlending( mShader->HintEnabled( Dali::Shader::Hint::OUTPUT_IS_TRANSPARENT ) );
if( shaderRequiresBlending || ( mTextureSet && mTextureSet->HasAlpha() ) )
{
{
opacityType = Renderer::TRANSLUCENT;
}
+
break;
}
case BlendMode::OFF: // the renderer should never use blending