Add property for extents the dirty rect calculated range for the renderer.
Change-Id: Ibdfe6ea2a90906d01d29c93b0e632d5e631249d4
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
VisualRenderer baseVisualRenderer = VisualRenderer::New(geometry, shader);
Renderer baseRenderer = Renderer::New(geometry, shader);
- DALI_TEST_EQUALS(baseRenderer.GetPropertyCount(), 32, TEST_LOCATION);
- DALI_TEST_EQUALS(baseVisualRenderer.GetPropertyCount(), 32 + 8, TEST_LOCATION);
- DALI_TEST_EQUALS(renderer.GetPropertyCount(), 32 + 8 + 7, TEST_LOCATION);
+ DALI_TEST_EQUALS(baseRenderer.GetPropertyCount(), 33, TEST_LOCATION);
+ DALI_TEST_EQUALS(baseVisualRenderer.GetPropertyCount(), 33 + 8, TEST_LOCATION);
+ DALI_TEST_EQUALS(renderer.GetPropertyCount(), 33 + 8 + 7, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "cornerRadius", Property::VECTOR4, true, true, true, DecoratedVisualRenderer::Property::CORNER_RADIUS, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "cornerRadiusPolicy", Property::FLOAT, true, false, true, DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY, TEST_LOCATION);
DALI_PROPERTY("renderingBehavior", INTEGER, true, false, false, Dali::DevelRenderer::Property::RENDERING_BEHAVIOR)
DALI_PROPERTY("blendEquation", INTEGER, true, false, false, Dali::DevelRenderer::Property::BLEND_EQUATION)
DALI_PROPERTY("instanceCount", INTEGER, true, false, false, Dali::DevelRenderer::Property::INSTANCE_COUNT)
+ DALI_PROPERTY("updateAreaExtents", EXTENTS, true, false, false, Dali::DevelRenderer::Property::UPDATE_AREA_EXTENTS)
*/
Geometry geometry = CreateQuadGeometry();
Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- DALI_TEST_EQUALS(renderer.GetPropertyCount(), 32, TEST_LOCATION);
+ DALI_TEST_EQUALS(renderer.GetPropertyCount(), 33, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "depthIndex", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_INDEX, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "faceCullingMode", Property::INTEGER, true, false, false, Renderer::Property::FACE_CULLING_MODE, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "renderingBehavior", Property::INTEGER, true, false, false, DevelRenderer::Property::RENDERING_BEHAVIOR, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "blendEquation", Property::INTEGER, true, false, false, DevelRenderer::Property::BLEND_EQUATION, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "instanceCount", Property::INTEGER, true, false, false, DevelRenderer::Property::INSTANCE_COUNT, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "updateAreaExtents", Property::EXTENTS, true, false, false, DevelRenderer::Property::UPDATE_AREA_EXTENTS, TEST_LOCATION);
END_TEST;
}
END_TEST;
}
+namespace
+{
TestGraphicsBuffer* FindUniformBuffer(int bufferIndex, TestGraphicsController& graphics)
{
int counter = 0;
renderer["uBlendShapeWeight[55]"] = w2;
renderer["uBlendShapeWeight[127]"] = w3;
}
+} // namespace
int UtcDaliRendererUniformBlocks01(void)
{
END_TEST;
}
+
+int utcDaliRendererPartialUpdateUpdateAreaExtents(void)
+{
+ TestApplication application(
+ TestApplication::DEFAULT_SURFACE_WIDTH,
+ TestApplication::DEFAULT_SURFACE_HEIGHT,
+ TestApplication::DEFAULT_HORIZONTAL_DPI,
+ TestApplication::DEFAULT_VERTICAL_DPI,
+ true,
+ true);
+
+ tet_infoline("Check the damaged rect with renderer's UPDATE_AREA_EXTENTS property");
+
+ const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
+
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
+ Geometry geometry = CreateQuadGeometry();
+ Renderer renderer = Renderer::New(geometry, shader);
+
+ Actor actor = Actor::New();
+ actor.AddRenderer(renderer);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
+ actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+
+ std::vector<Rect<int>> damagedRects;
+ Rect<int> clippingRect;
+
+ // 1. Actor added, damaged rect is added size of actor
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+
+ // Aligned by 16
+ clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
+
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+ DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
+
+ // Check dirty rect empty
+ application.SendNotification();
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
+ DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Set update area extents
+ renderer.SetProperty(DevelRenderer::Property::UPDATE_AREA_EXTENTS, Dali::Extents(8u, 40u, 8u, 72u));
+ DALI_TEST_EQUALS(renderer.GetProperty<Extents>(DevelRenderer::Property::UPDATE_AREA_EXTENTS), Dali::Extents(8u, 40u, 8u, 72u), TEST_LOCATION);
+ application.SendNotification();
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+
+ // Aligned by 16
+ clippingRect = Rect<int>(0, 688, 80, 112); // in screen coordinates
+
+ DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ END_TEST;
+}
VisualRenderer renderer = VisualRenderer::New(geometry, shader);
Renderer baseRenderer = Renderer::New(geometry, shader);
- DALI_TEST_EQUALS(baseRenderer.GetPropertyCount(), 32, TEST_LOCATION);
- DALI_TEST_EQUALS(renderer.GetPropertyCount(), 32 + 8, TEST_LOCATION);
+ DALI_TEST_EQUALS(baseRenderer.GetPropertyCount(), 33, TEST_LOCATION);
+ DALI_TEST_EQUALS(renderer.GetPropertyCount(), 33 + 8, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "transformOffset", Property::VECTOR2, true, true, true, VisualRenderer::Property::TRANSFORM_OFFSET, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "transformSize", Property::VECTOR2, true, true, true, VisualRenderer::Property::TRANSFORM_SIZE, TEST_LOCATION);
#define DALI_RENDERER_DEVEL_H
/*
- * 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.
* @details name "instanceCount", type INTEGER
*/
INSTANCE_COUNT = OPACITY + 3,
+
+ /**
+ * @brief Increase the range of update area by pixel value.
+ * @note Extents the area - the position and the size - used for the attached actor's damaged area calculation.
+ * This value be appended after calculate all update area, like visual offset.
+ * @see Dali::Actor::Property::UPDATE_AREA_HINT
+ * @details name "updateAreaExtents", type EXTENTS
+ * @SINCE_2_4.11
+ */
+ UPDATE_AREA_EXTENTS = OPACITY + 4,
};
} // namespace Property
DALI_PROPERTY("renderingBehavior", INTEGER, true, false, false, Dali::DevelRenderer::Property::RENDERING_BEHAVIOR)
DALI_PROPERTY("blendEquation", INTEGER, true, false, false, Dali::DevelRenderer::Property::BLEND_EQUATION)
DALI_PROPERTY("instanceCount", INTEGER, true, false, false, Dali::DevelRenderer::Property::INSTANCE_COUNT)
+DALI_PROPERTY("updateAreaExtents", EXTENTS, true, false, false, Dali::DevelRenderer::Property::UPDATE_AREA_EXTENTS)
DALI_PROPERTY_TABLE_END(DEFAULT_RENDERER_PROPERTY_START_INDEX, RendererDefaultProperties)
// Property string to enumeration tables:
}
break;
}
+ case DevelRenderer::Property::UPDATE_AREA_EXTENTS:
+ {
+ Extents updateAreaExtents;
+ if(propertyValue.Get(updateAreaExtents))
+ {
+ if(mUpdateAreaExtents != updateAreaExtents)
+ {
+ mUpdateAreaExtents = updateAreaExtents;
+ SetUpdateAreaExtentsMessage(GetEventThreadServices(), GetRendererSceneObject(), mUpdateAreaExtents);
+ }
+ }
+ break;
+ }
}
}
mDepthIndex(0),
mIndexedDrawFirstElement(0),
mIndexedDrawElementCount(0),
+ mUpdateAreaExtents(),
mStencilParameters(RenderMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP),
mBlendingOptions(),
mDepthFunction(DepthFunction::LESS),
value = int(mInstanceCount);
break;
}
+ case DevelRenderer::Property::UPDATE_AREA_EXTENTS:
+ {
+ value = mUpdateAreaExtents;
+ break;
+ }
default:
{
// Must be a scene-graph only property
uint32_t mIndexedDrawElementCount; ///< Number of elements to draw
uint32_t mInstanceCount{0}; ///< Number of instances to draw
+ Dali::Extents mUpdateAreaExtents;
+
Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
BlendingOptions mBlendingOptions; ///< Local copy of blending options bitmask
#define DALI_INTERNAL_SCENE_GRAPH_RENDERER_MESSAGES_H
/*
- * 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/update/common/property-resetter.h>
#include <dali/internal/update/manager/update-manager.h>
#include <dali/internal/update/rendering/scene-graph-renderer.h>
+#include <dali/public-api/common/extents.h>
namespace Dali::Internal::SceneGraph
{
new(slot) LocalType(&renderer, &SceneGraph::Renderer::SetInstanceCount, instanceCount);
}
+inline void SetUpdateAreaExtentsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Extents& updateAreaExtents)
+{
+ using LocalType = MessageValue1<SceneGraph::Renderer, Extents>;
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+ new(slot) LocalType(&renderer, &SceneGraph::Renderer::SetUpdateAreaExtents, updateAreaExtents);
+}
+
} // namespace Dali::Internal::SceneGraph
#endif //DALI_INTERNAL_SCENE_GRAPH_RENDERER_MESSAGES_H
/*
- * 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.
RESEND_SET_RENDER_CALLBACK = 1 << 21
};
+inline Vector4 AdjustExtents(const Vector4& updateArea, const Dali::Extents& updateAreaExtents)
+{
+ if(DALI_LIKELY(updateAreaExtents == Dali::Extents()))
+ {
+ return updateArea;
+ }
+ const float left = updateArea.x - updateArea.z * 0.5f - static_cast<float>(updateAreaExtents.start);
+ const float right = updateArea.x + updateArea.z * 0.5f + static_cast<float>(updateAreaExtents.end);
+ const float top = updateArea.y - updateArea.w * 0.5f - static_cast<float>(updateAreaExtents.top);
+ const float bottom = updateArea.y + updateArea.w * 0.5f + static_cast<float>(updateAreaExtents.bottom);
+ return Vector4((left + right) * 0.5f, (top + bottom) * 0.5f, (right - left), (bottom - top));
+}
+
} // Anonymous namespace
RendererKey Renderer::NewKey()
mIndexedDrawElementsCount(0u),
mBlendBitmask(0u),
mResendFlag(0u),
+ mUpdateAreaExtents(),
mDepthFunction(DepthFunction::LESS),
mFaceCullingMode(FaceCullingMode::NONE),
mBlendMode(BlendMode::AUTO),
mResendFlag |= RESEND_STENCIL_OPERATION_ON_Z_PASS;
}
+void Renderer::SetUpdateAreaExtents(const Dali::Extents& updateAreaExtents)
+{
+ if(mUpdateAreaExtents != updateAreaExtents)
+ {
+ mUpdateAreaExtents = updateAreaExtents;
+ SetUpdated(true);
+ }
+}
+
void Renderer::SetRenderCallback(RenderCallback* callback)
{
if(mRenderCallback != callback)
{
if(mVisualProperties)
{
- return mVisualProperties->GetVisualTransformedUpdateArea(updateBufferIndex, originalUpdateArea);
+ return AdjustExtents(mVisualProperties->GetVisualTransformedUpdateArea(updateBufferIndex, originalUpdateArea), mUpdateAreaExtents);
}
- return originalUpdateArea;
+ return AdjustExtents(originalUpdateArea, mUpdateAreaExtents);
}
void Renderer::OnVisualRendererPropertyUpdated(bool bake)
mInstanceCount = instanceCount;
}
+ /**
+ * @brief Set the extents of update area. It will be used when we calculate damaged rect.
+ */
+ void SetUpdateAreaExtents(const Dali::Extents& updateAreaExtents);
+
+ /**
+ * @brief Get the extents of update area. It will be used when we calculate damaged rect.
+ */
+ Dali::Extents GetUpdateAreaExtents() const
+ {
+ return mUpdateAreaExtents;
+ }
+
/**
* Sets RenderCallback object
*
UniformMap::SizeType mUniformMapChangeCounter{0u}; ///< Value to check if uniform data should be updated
UniformMap::SizeType mShaderMapChangeCounter{0u}; ///< Value to check if uniform data should be updated
+ Dali::Extents mUpdateAreaExtents;
+
DepthFunction::Type mDepthFunction : 4; ///< Local copy of the depth function
FaceCullingMode::Type mFaceCullingMode : 3; ///< Local copy of the mode of face culling
BlendMode::Type mBlendMode : 3; ///< Local copy of the mode of blending