Let we allow to call FramebufferTexture2DMultisample if possible.
Change-Id: I4874ad78dfe1e468b5571ba4bc0112e7f710f492
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
return true;
}
+bool TestGlAbstraction::IsMultisampledRenderToTextureSupported()
+{
+ return true;
+}
+
bool TestGlAbstraction::IsBlendEquationSupported(DevelBlendEquation::Type blendEquation)
{
return true;
bool IsAdvancedBlendEquationSupported() override;
+ bool IsMultisampledRenderToTextureSupported() override;
+
bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation) override;
std::string GetShaderVersionPrefix();
{
}
+ inline void FramebufferTexture2DMultisample(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) override
+ {
+ // TODO : Check it if need
+ FramebufferTexture2D(target, attachment, textarget, texture, level);
+ }
+
inline void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) override
{
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
END_TEST;
}
+int UtcDaliFrameBufferSetMultiSampingLevel(void)
+{
+ TestApplication application;
+
+ unsigned int width(64);
+ unsigned int height(64);
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL);
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ frameBuffer.AttachColorTexture(texture);
+
+ DevelFrameBuffer::SetMultiSamplingLevel(frameBuffer, 4u);
+
+ CreateRenderTask(application, frameBuffer);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+
+ // We don't have getter API for multisampling level. No testing.
+
+ END_TEST;
+}
+
int UtcDaliFrameBufferGetColorTexture01(void)
{
TestApplication application;
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
}
}
+void SetMultiSamplingLevel(FrameBuffer frameBuffer, uint8_t multiSamplingLevel)
+{
+ GetImplementation(frameBuffer).SetMultiSamplingLevel(multiSamplingLevel);
+}
+
Texture GetColorTexture(const FrameBuffer frameBuffer, uint8_t index)
{
Internal::Texture* texturePtr = GetImplementation(frameBuffer).GetColorTexture(index);
#define DALI_FRAME_BUFFER_DEVEL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
DALI_CORE_API void AttachDepthStencilTexture(FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel);
/**
+ * @brief Sets the level of multisampling in the frame buffer.
+ * @note This API must be called before the frame buffer is attached to render task. (Since multi sample level is immutable)
+ * Otherwise, no effects.
+ *
+ * @param[in] frameBuffer The FrameBuffer handle
+ * @param[in] multiSamplingLevel The level of samples
+ */
+DALI_CORE_API void SetMultiSamplingLevel(FrameBuffer frameBuffer, uint8_t multiSamplingLevel);
+
+/**
* @brief Gets the color texture at the given @a index used as output in the frame buffer.
*
* @param[in] frameBuffer A handle to the FrameBuffer
#define DALI_GRAPHICS_FRAMEBUFFER_CREATE_INFO_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
}
/**
+ * @brief Sets multisampling level of framebuffer
+ *
+ * @param[in] value multisampling level of framebuffer
+ * @return reference to this structure
+ */
+ auto& SetMultiSamplingLevel(uint8_t value)
+ {
+ multiSamplingLevel = value;
+ return *this;
+ }
+
+ /**
* @brief Sets allocation callbacks which will be used when object is created
* and destroyed.
*
std::vector<ColorAttachment> colorAttachments{};
DepthStencilAttachment depthStencilAttachment{};
Extent2D size{};
+ uint8_t multiSamplingLevel{0u};
const AllocationCallbacks* allocationCallbacks{nullptr};
};
virtual bool IsAdvancedBlendEquationSupported() = 0;
/**
+ * Returns current gles can support multisampled render to texture
+ * @Return true current gles support multisampled render to texture
+ */
+ virtual bool IsMultisampledRenderToTextureSupported() = 0;
+
+ /**
* Returns current gles can support the blend equation
* @Return true current gles support the blend equation
*/
virtual void UniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) = 0;
virtual void BlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) = 0;
virtual void RenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) = 0;
+ virtual void FramebufferTexture2DMultisample(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) = 0;
virtual void FramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) = 0;
virtual GLvoid* MapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) = 0;
virtual void FlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length) = 0;
#define DALI_INTERNAL_TYPE_ABSTRACTION_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
struct ParameterType<short int> : public BasicType<short int>
{
};
+template<>
+struct ParameterType<unsigned short int> : public BasicType<unsigned short int>
+{
+};
+
+#if SCHAR_MAX != SHRT_MAX
+template<>
+struct ParameterType<char> : public BasicType<char>
+{
+};
+template<>
+struct ParameterType<unsigned char> : public BasicType<unsigned char>
+{
+};
+#endif
#if INT_MAX != LONG_MAX
template<>
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
}
}
+void FrameBuffer::SetMultiSamplingLevel(uint8_t multiSamplingLevel)
+{
+ SetMultiSamplingLevelToFrameBuffer(mEventThreadServices.GetUpdateManager(), *mRenderObject, multiSamplingLevel);
+}
+
Texture* FrameBuffer::GetColorTexture(uint8_t index) const
{
return (index >= mColorAttachmentCount) ? nullptr : mColor[index].Get();
#define DALI_INTERNAL_FRAME_BUFFER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
void AttachDepthStencilTexture(TexturePtr texture, uint32_t mipmapLevel);
/**
+ * @copydoc Dali::DevelFrameBuffer::SetMultiSamplingLevel()
+ */
+ void SetMultiSamplingLevel(uint8_t multiSamplingLevel);
+
+ /**
* @copydoc Dali::FrameBuffer::GetColorTexture()
*/
Texture* GetColorTexture(uint8_t index) const;
frameBuffer->AttachDepthStencilTexture(texture, mipmapLevel);
}
+void RenderManager::SetMultiSamplingLevelToFrameBuffer(Render::FrameBuffer* frameBuffer, uint8_t multiSamplingLevel)
+{
+ frameBuffer->SetMultiSamplingLevel(multiSamplingLevel);
+}
+
void RenderManager::AddVertexBuffer(OwnerPointer<Render::VertexBuffer>& vertexBuffer)
{
mImpl->vertexBufferContainer.PushBack(vertexBuffer.Release());
#define DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
void AttachDepthStencilTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel);
/**
+ * Set a multisampling level value as texture output to the existing frame buffer
+ * @param[in] frameBuffer The FrameBuffer
+ * @param[in] multiSamplingLevel The level of multisampling
+ */
+ void SetMultiSamplingLevelToFrameBuffer(Render::FrameBuffer* frameBuffer, uint8_t multiSamplingLevel);
+
+ /**
* Initializes a Scene to the render manager
* @param[in] scene The Scene to initialize
*/
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
}
}
+void FrameBuffer::SetMultiSamplingLevel(uint8_t multiSamplingLevel)
+{
+ mCreateInfo.multiSamplingLevel = multiSamplingLevel;
+}
+
bool FrameBuffer::CreateGraphicsObjects()
{
bool created = false;
#define DALI_INTERNAL_RENDER_FRAME_BUFFER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
* Doesn't re-create them if they are already generated, also doesn't
* check for new attachments.
*
- * Creates the framebuffer, attaches color and depth textures, generates
- * render target and render passes.
+ * Creates the framebuffer, attaches color and depth textures, set multi sampling level,
+ * generates render target and render passes.
*
* @return true if there are attachments and the graphics objects have been created.
*/
void AttachDepthStencilTexture(Render::Texture* texture, uint32_t mipmapLevel);
/**
+ * @brief Sets the level of multisampling in the frame buffer. This API is valid only GL_EXT_multisampled_render_to_texture supported.
+ * @param[in] multiSamplingLevel The level of multisampling
+ */
+ void SetMultiSamplingLevel(uint8_t multiSamplingLevel);
+
+ /**
* @brief Get the number of textures bound to this frame buffer as color attachments.
* @return The number of color attachments.
*/
new(slot) DerivedType(&mImpl->renderManager, &RenderManager::AttachDepthStencilTextureToFrameBuffer, frameBuffer, texture, mipmapLevel);
}
+void UpdateManager::SetMultiSamplingLevelToFrameBuffer(Render::FrameBuffer* frameBuffer, uint8_t multiSamplingLevel)
+{
+ using DerivedType = MessageValue2<RenderManager, Render::FrameBuffer*, uint8_t>;
+
+ // Reserve some memory inside the render queue
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot(mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof(DerivedType));
+
+ // Construct message in the render queue memory; note that delete should not be called on the return value
+ new(slot) DerivedType(&mImpl->renderManager, &RenderManager::SetMultiSamplingLevelToFrameBuffer, frameBuffer, multiSamplingLevel);
+}
+
} // namespace SceneGraph
} // namespace Internal
void AttachDepthStencilTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel);
/**
+ * Set a multisampling level value as texture output to the existing FrameBuffer
+ * @param[in] frameBuffer The FrameBuffer
+ * @param[in] multiSamplingLevel The level of multisampling
+ */
+ void SetMultiSamplingLevelToFrameBuffer(Render::FrameBuffer* frameBuffer, uint8_t multiSamplingLevel);
+
+ /**
* This is called when the surface of the scene has been replaced.
* @param[in] scene The scene.
*/
new(slot) LocalType(&manager, &UpdateManager::AttachDepthStencilTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel);
}
+inline void SetMultiSamplingLevelToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, uint8_t multiSamplingLevel)
+{
+ using LocalType = MessageValue2<UpdateManager, Render::FrameBuffer*, uint8_t>;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new(slot) LocalType(&manager, &UpdateManager::SetMultiSamplingLevelToFrameBuffer, &frameBuffer, multiSamplingLevel);
+}
+
inline void SetDepthIndicesMessage(UpdateManager& manager, OwnerPointer<NodeDepths>& nodeDepths)
{
using LocalType = MessageValue1<UpdateManager, OwnerPointer<NodeDepths>>;