#define DALI_GRAPHICS_PIPELINE_CREATE_INFO_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
{
namespace Graphics
{
+class RenderTarget;
/**
* @brief Interface class for generating Pipeline types in the graphics API.
*
return *this;
}
+ /**
+ * @brief Sets render target that pipeline will be used with
+ *
+ * The pipeline must know which render target (this or compatible)
+ * it will be used with.
+ *
+ * It is valid not to set render target but only if device supports
+ * 'dynamic rendering'. Our current implementation doesn't support it
+ * but it may in the future.
+ *
+ * @param[in] value Pointer to valid RenderTarget objet
+ * @return reference to this structure
+ */
+ auto& SetRenderTarget(RenderTarget* value)
+ {
+ renderTarget = value;
+ return *this;
+ }
+
GraphicsStructureType type{GraphicsStructureType::PIPELINE_CREATE_INFO_STRUCT};
ExtensionCreateInfo* nextExtension{nullptr};
InputAssemblyState* inputAssemblyState{nullptr};
PipelineDynamicStateMask dynamicStateMask{0u};
+ RenderTarget* renderTarget{nullptr};
+
const AllocationCallbacks* allocationCallbacks{nullptr};
};
const Rect<int32_t>& viewport,
const Rect<int>& rootClippingRect,
int orientation,
- const Uint16Pair& sceneSize)
+ const Uint16Pair& sceneSize,
+ Graphics::RenderTarget* renderTarget)
{
DALI_PRINT_RENDER_LIST(renderList);
for(auto queue = 0u; queue < MAX_QUEUE; ++queue)
{
// Render the item. It will write into the command buffer everything it has to render
- item.mRenderer->Render(secondaryCommandBuffer, bufferIndex, *item.mNode, item.mModelMatrix, item.mModelViewMatrix, viewMatrix, projectionMatrix, item.mScale, item.mSize, !item.mIsOpaque, instruction, queue);
+ item.mRenderer->Render(secondaryCommandBuffer, bufferIndex, *item.mNode, item.mModelMatrix, item.mModelViewMatrix, viewMatrix, projectionMatrix, item.mScale, item.mSize, !item.mIsOpaque, instruction, renderTarget, queue);
}
}
}
const Rect<int32_t>& viewport,
const Rect<int>& rootClippingRect,
int orientation,
- const Uint16Pair& sceneSize)
+ const Uint16Pair& sceneSize,
+ Graphics::RenderTarget* renderTarget)
{
DALI_TRACE_BEGIN_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_RENDER_INSTRUCTION_PROCESS", [&](std::ostringstream& oss) { oss << "[" << instruction.RenderListCount() << "]"; });
viewport,
rootClippingRect,
orientation,
- sceneSize);
+ sceneSize,
+ renderTarget);
// Execute command buffer
auto* commandBuffer = renderList->GetCommandBuffer();
#define DALI_INTERNAL_RENDER_ALGORITHMS_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
* @param[in] rootClippingRect The clipping rectangle
* @param[in] orientation The Scene's surface orientation.
* @param[in] sceneSize The Scene's surface size.
+ * @param[in] renderTarget The RenderTarget associated with instruction
*/
void ProcessRenderInstruction(const SceneGraph::RenderInstruction& instruction,
BufferIndex bufferIndex,
const Rect<int32_t>& viewport,
const Rect<int>& rootClippingRect,
int orientation,
- const Uint16Pair& sceneSize);
+ const Uint16Pair& sceneSize,
+ Graphics::RenderTarget* renderTarget);
/**
* Resets main command buffer (per scene)
}
private:
- /**
- * @brief Calculate a 2D AABB (axis aligned bounding box) in screen space.
- * The RenderItems dimensions are translated and a Z value of 0 is assumed for this purpose.
- * No projection is performed, but rotation on Z is supported.
- * @param[in] item The RenderItem to generate an AABB for
- * @return The generated AABB in screen space
- */
- inline Dali::ClippingBox CalculateScreenSpaceAABB(const Dali::Internal::SceneGraph::RenderItem& item);
-
/**
* @brief Perform any scissor clipping related operations based on the current RenderItem.
* This includes:
* @param[in] rootClippingRect The root clipping rectangle
* @param[in] orientation The Scene's surface orientation
* @param[in] sceneSize The Scene's surface size.
+ * @param[in] renderTarget The render target associated with render instruction
*/
inline void ProcessRenderList(const Dali::Internal::SceneGraph::RenderList& renderList,
BufferIndex bufferIndex,
const Rect<int32_t>& viewport,
const Rect<int>& rootClippingRect,
int orientation,
- const Uint16Pair& sceneSize);
+ const Uint16Pair& sceneSize,
+ Graphics::RenderTarget* renderTarget);
// Member variables:
viewportRect,
clippingRect,
surfaceOrientation,
- Uint16Pair(surfaceRect.width, surfaceRect.height));
+ Uint16Pair(surfaceRect.width, surfaceRect.height),
+ currentRenderTarget);
Graphics::SyncObject* syncObject{nullptr};
// If the render instruction has an associated render tracker (owned separately)
.SetVertexInputState(&level0->inputState)
.SetRasterizationState(&level1->rs)
.SetColorBlendState(&level2->colorBlendState)
- .SetProgramState(&programState);
+ .SetProgramState(&programState)
+ .SetRenderTarget(queryInfo.renderTarget);
// Store a pipeline per renderer per render (renderer can be owned by multiple nodes,
// and re-drawn in multiple instructions).
Program* program;
Geometry* geometry;
+ Graphics::RenderTarget* renderTarget;
+
bool cameraUsingReflection;
// Blending
const Vector3& size,
bool blend,
const Dali::Internal::SceneGraph::RenderInstruction& instruction,
+ Graphics::RenderTarget* renderTarget,
uint32_t queueIndex)
{
// Before doing anything test if the call happens in the right queue
if(program)
{
// Prepare the graphics pipeline. This may either re-use an existing pipeline or create a new one.
- auto& pipeline = PrepareGraphicsPipeline(*program, instruction, node, blend);
+ auto& pipeline = PrepareGraphicsPipeline(*program, instruction, renderTarget, node, blend);
commandBuffer.BindPipeline(pipeline);
Graphics::Pipeline& Renderer::PrepareGraphicsPipeline(
Program& program,
const Dali::Internal::SceneGraph::RenderInstruction& instruction,
+ Graphics::RenderTarget* renderTarget,
const SceneGraph::NodeDataProvider& node,
bool blend)
{
queryInfo.blendingOptions = &mBlendingOptions;
queryInfo.alphaPremultiplied = mPremultipliedAlphaEnabled;
queryInfo.cameraUsingReflection = instruction.GetCamera()->GetReflectionUsed();
+ queryInfo.renderTarget = renderTarget;
queryInfo.GenerateHash();
* @param[in] size Size of the render item
* @param[in] blend If true, blending is enabled
* @param[in] instruction. for use case like reflection where CullFace needs to be adjusted
+ * @param[in] renderTarget render target associated with instruction
+ * @param[in] queueIndex Index of the render queue
*
* @return True if commands have been added to the command buffer
*/
const Vector3& size,
bool blend,
const Dali::Internal::SceneGraph::RenderInstruction& instruction,
+ Graphics::RenderTarget* renderTarget,
uint32_t queueIndex);
/**
Graphics::Pipeline& PrepareGraphicsPipeline(
Program& program,
const Dali::Internal::SceneGraph::RenderInstruction& instruction,
+ Graphics::RenderTarget* renderTarget,
const SceneGraph::NodeDataProvider& node,
bool blend);