Geometry geometry = CreateQuadGeometry();
Shader shader = Shader::New("vertexSrc", "fragmentSrc");
TextureSet textureSet = TextureSet::New();
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 50, 50);
+ Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 50, 50);
textureSet.SetTexture(0u, image);
Renderer renderer = Renderer::New(geometry, shader);
application.Render(0);
application.Render();
application.SendNotification();
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
+ Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE);
actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
application.GetScene().Add(actor);
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
layer.SetProperty(Layer::Property::CLIPPING_BOX, testBox);
// Add at least one renderable actor so the GL calls are actually made
- Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
+ Texture img = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
Actor actor = CreateRenderableActor(img);
scene.Add(actor);
Actor CreateActor(bool withAlpha)
{
- Texture texture = Texture::New(TextureType::TEXTURE_2D, withAlpha ? Pixel::Format::RGBA8888 : Pixel::Format::RGB888, 1u, 1u);
+ Texture texture = CreateTexture(TextureType::TEXTURE_2D, withAlpha ? Pixel::Format::RGBA8888 : Pixel::Format::RGB888, 1u, 1u);
Actor actor = CreateRenderableActor(texture);
actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
tet_infoline("Test setting the blend mode to auto with an opaque color and an image with an alpha channel renders with blending enabled");
Geometry geometry = CreateQuadGeometry();
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40);
+ Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40);
Shader shader = CreateShader();
TextureSet textureSet = CreateTextureSet(image);
Geometry geometry = CreateQuadGeometry();
Shader shader = Shader::New("vertexSrc", "fragmentSrc");
TextureSet textureSet = TextureSet::New();
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 50, 50);
+ Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 50, 50);
textureSet.SetTexture(0u, image);
Renderer renderer = Renderer::New(geometry, shader);
renderer.SetTextures(textureSet);
tet_infoline("Test the uniform map precedence is applied properly");
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
+ Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
Shader shader = Shader::New("VertexSource", "FragmentSource");
TextureSet textureSet = CreateTextureSet(image);
tet_infoline("Test the uniform map precedence is applied properly");
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
+ Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
Shader shader = Shader::New("VertexSource", "FragmentSource");
TextureSet textureSet = CreateTextureSet(image);
tet_infoline("Test the uniform map precedence is applied properly");
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
+ Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
Shader shader = Shader::New("VertexSource", "FragmentSource");
TextureSet textureSet = CreateTextureSet(image);
tet_infoline("Test the uniform maps are collected from all objects (same type)");
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
+ Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
Shader shader = Shader::New("VertexSource", "FragmentSource");
TextureSet textureSet = CreateTextureSet(image);
tet_infoline("Test the uniform maps are collected from all objects (different types)");
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
+ Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
Shader shader = Shader::New("VertexSource", "FragmentSource");
TextureSet textureSet = CreateTextureSet(image);
//Create a TextureSet with 4 textures (One more texture in the texture set than active samplers)
//@note Shaders in the test suit have 3 active samplers. See TestGlAbstraction::GetActiveUniform()
- Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64u, 64u);
+ Texture texture = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64u, 64u);
TextureSet textureSet = CreateTextureSet();
textureSet.SetTexture(0, texture);
textureSet.SetTexture(1, texture);
uint32_t width(4);
uint32_t height(4);
- Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ Texture texture = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
TextureSet textureSet = TextureSet::New();
textureSet.SetTexture(0u, texture);
renderer.SetTextures(textureSet);
uint32_t width(4);
uint32_t height(4);
- Texture texture1 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
- Texture texture2 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ Texture texture1 = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ Texture texture2 = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
TextureSet textureSet = TextureSet::New();
textureSet.SetTexture(0u, texture1);
renderer.SetTextures(textureSet);
const Matrix& projectionMatrix,
Integration::DepthBufferAvailable depthBufferAvailable,
Integration::StencilBufferAvailable stencilBufferAvailable,
- Vector<Graphics::Texture*>& boundTextures,
const RenderInstruction& instruction,
const Rect<int32_t>& viewport,
const Rect<int>& rootClippingRect,
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.mSize, !item.mIsOpaque, boundTextures, instruction, queue);
+ item.mRenderer->Render(secondaryCommandBuffer, bufferIndex, *item.mNode, item.mModelMatrix, item.mModelViewMatrix, viewMatrix, projectionMatrix, item.mSize, !item.mIsOpaque, instruction, queue);
}
}
}
BufferIndex bufferIndex,
Integration::DepthBufferAvailable depthBufferAvailable,
Integration::StencilBufferAvailable stencilBufferAvailable,
- Vector<Graphics::Texture*>& boundTextures,
const Rect<int32_t>& viewport,
const Rect<int>& rootClippingRect,
int orientation,
*projectionMatrix,
depthBufferAvailable,
stencilBufferAvailable,
- boundTextures,
instruction, //added for reflection effect
viewport,
rootClippingRect,
#define DALI_INTERNAL_RENDER_ALGORITHMS_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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] bufferIndex The current render buffer index (previous update buffer)
* @param[in] depthBufferAvailable Whether the depth buffer is available
* @param[in] stencilBufferAvailable Whether the stencil buffer is available
- * @param[in] boundTextures The textures bound for rendering
* @param[in] viewport The viewport for drawing
* @param[in] rootClippingRect The clipping rectangle
* @param[in] orientation The Scene's surface orientation.
BufferIndex bufferIndex,
Integration::DepthBufferAvailable depthBufferAvailable,
Integration::StencilBufferAvailable stencilBufferAvailable,
- Vector<Graphics::Texture*>& boundTextures,
const Rect<int32_t>& viewport,
const Rect<int>& rootClippingRect,
int orientation,
const Dali::Internal::SceneGraph::RenderItem& item,
Graphics::CommandBuffer& commandBuffer,
const Dali::Internal::SceneGraph::RenderInstruction& instruction,
- int orientation);
+ int orientation);
/**
* @brief Set up the clipping based on the specified clipping settings.
* @param[in] projectionMatrix The projection matrix from the appropriate camera.
* @param[in] depthBufferAvailable Whether the depth buffer is available
* @param[in] stencilBufferAvailable Whether the stencil buffer is available
- * @param[in] boundTextures The textures bound for rendering
* @param[in] viewport The Viewport
* @param[in] rootClippingRect The root clipping rectangle
* @param[in] orientation The Scene's surface orientation
const Matrix& projectionMatrix,
Integration::DepthBufferAvailable depthBufferAvailable,
Integration::StencilBufferAvailable stencilBufferAvailable,
- Vector<Graphics::Texture*>& boundTextures,
const Dali::Internal::SceneGraph::RenderInstruction& instruction, // in the case of reflection, things like CullFace need to be adjusted for reflection world
const Rect<int32_t>& viewport,
const Rect<int>& rootClippingRect,
Integration::PartialUpdateAvailable partialUpdateAvailable; ///< Whether the partial update is available
std::unique_ptr<Dali::ThreadPool> threadPool; ///< The thread pool
- Vector<Graphics::Texture*> boundTextures; ///< The textures bound for rendering
Vector<Render::TextureKey> updatedTextures{}; ///< The updated texture list
uint32_t frameCount{0u}; ///< The current frame count
float(viewportRect.width),
float(viewportRect.height)});
- // Clear the list of bound textures
- mImpl->boundTextures.Clear();
-
mImpl->renderAlgorithms.ProcessRenderInstruction(
instruction,
mImpl->renderBufferIndex,
depthBufferAvailable,
stencilBufferAvailable,
- mImpl->boundTextures,
viewportRect,
clippingRect,
surfaceOrientation,
mDrawCommands.insert(mDrawCommands.end(), pDrawCommands, pDrawCommands + size);
}
-void Renderer::BindTextures(Graphics::CommandBuffer& commandBuffer, Vector<Graphics::Texture*>& boundTextures)
+bool Renderer::BindTextures(Graphics::CommandBuffer& commandBuffer)
{
uint32_t textureUnit = 0;
: nullptr)
: nullptr;
- boundTextures.PushBack(graphicsTexture);
const Graphics::TextureBinding textureBinding{graphicsTexture, graphicsSampler, textureUnit};
textureBindings.push_back(textureBinding);
++textureUnit;
}
+ else
+ {
+ // Texture is not prepared yet. We should not render now.
+ return false;
+ }
}
}
{
commandBuffer.BindTextures(textureBindings);
}
+
+ return true;
}
void Renderer::SetFaceCullingMode(FaceCullingMode::Type mode)
const Matrix& projectionMatrix,
const Vector3& size,
bool blend,
- Vector<Graphics::Texture*>& boundTextures,
const Dali::Internal::SceneGraph::RenderInstruction& instruction,
uint32_t queueIndex)
{
bool drawn = false;
+ // Check all textures are prepared first.
+ if(!BindTextures(commandBuffer))
+ {
+ return drawn;
+ }
+
// We should have a shader here (as only RenderCallback has no shader, and that's been early out)
Program* program = PrepareProgram(instruction);
if(program)
auto& pipeline = PrepareGraphicsPipeline(*program, instruction, node, blend);
commandBuffer.BindPipeline(pipeline);
- BindTextures(commandBuffer, boundTextures);
if(queueIndex == 0)
{
* @param[in] projectionMatrix The projection matrix.
* @param[in] size Size of the render item
* @param[in] blend If true, blending is enabled
- * @param[in] boundTextures The textures bound for rendering
* @param[in] instruction. for use case like reflection where CullFace needs to be adjusted
*
* @return True if commands have been added to the command buffer
const Matrix& projectionMatrix,
const Vector3& size,
bool blend,
- Vector<Graphics::Texture*>& boundTextures,
const Dali::Internal::SceneGraph::RenderInstruction& instruction,
uint32_t queueIndex);
/**
* Bind the textures and setup the samplers
* @param[in] commandBuffer The command buffer to record binding into
- * @param[in] boundTextures The textures bound for rendering
+ *
+ * @return True if all textures are bounded successfully. False otherwise.
*/
- void BindTextures(Graphics::CommandBuffer& commandBuffer, Vector<Graphics::Texture*>& boundTextures);
+ bool BindTextures(Graphics::CommandBuffer& commandBuffer);
/**
* Prepare a pipeline for this renderer.