#define DALI_GRAPHICS_COMMAND_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.
};
};
+// Native rendering (using native APIs)
+
+enum class DrawNativeAPI
+{
+ GLES,
+ UNDEFINED
+};
+
+struct DrawNativeInfo
+{
+ DrawNativeAPI api; ///< API used by the callback
+ Dali::CallbackBase* callback; ///< Callback pointer
+
+ /**
+ * The call allows binding the resource so they can be passed into the callback
+ * Each resource will pass API specific data (for example GL texture and buffer ids)
+ */
+ Graphics::Texture** textureList; ///< Textures to be used by the call
+ uint32_t textureCount; ///< Number of texture used by the callback
+ Graphics::Buffer** bufferList; ///< Buffers to be used by the call
+ uint32_t bufferCount; ///< Number of buffers used by the callback
+
+ /**
+ * The GLES api specific structure that stores pointers to objects to be filled when requested
+ * by caller. The structure cointains void* to avoid creating any complex constructors and keep
+ * the class trivial.
+ */
+ struct GLESNativeInfo
+ {
+ void* eglSharedContextStoragePointer; ///< Indicates the storage object to pass the shared context, must be null if not in use
+ } glesNativeInfo;
+
+ void* userData; ///< Data passed into the callback (unspecified type, callback should decode it)
+ void* reserved; ///< Reserved for internal use
+};
+
/**
* @brief CommandBuffer contains a stream of commands to be executed
* by the controller.
* @param[in] buffers List of buffers to bind
* @param[in] offsets List of offsets for each buffer
*/
- virtual void BindVertexBuffers(uint32_t firstBinding,
- std::vector<const Buffer*> buffers,
- std::vector<uint32_t> offsets) = 0;
+ virtual void BindVertexBuffers(uint32_t firstBinding,
+ const std::vector<const Buffer*>& buffers,
+ const std::vector<uint32_t>& offsets) = 0;
/**
* @brief Binds uniform buffers
*
* @param[in] textureBindings List of texture bindings
*/
- virtual void BindTextures(std::vector<TextureBinding>& textureBindings) = 0;
+ virtual void BindTextures(const std::vector<TextureBinding>& textureBindings) = 0;
/**
* @brief Binds samplers
*
* @param[in] samplerBindings List of sampler bindings
*/
- virtual void BindSamplers(std::vector<SamplerBinding>& samplerBindings) = 0;
+ virtual void BindSamplers(const std::vector<SamplerBinding>& samplerBindings) = 0;
/**
* @brief Binds buffer containing push constants
* @param[in] clearValues clear values (compatible with renderpass spec)
*/
virtual void BeginRenderPass(
- RenderPass* renderPass,
- RenderTarget* renderTarget,
- Rect2D renderArea,
- std::vector<ClearValue> clearValues) = 0;
+ RenderPass* renderPass,
+ RenderTarget* renderTarget,
+ Rect2D renderArea,
+ const std::vector<ClearValue>& clearValues) = 0;
/**
* @brief Ends current render pass
uint32_t stride) = 0;
/**
+ * @brief Draws using native API (via callback)
+ *
+ * DrawNative should be use in order to acquire direct access to the
+ * graphics API like GL. Upon command execution, the backend will
+ * invoke given callback and pass API-specific arguments (for example,
+ * the GL callback will receive EGL context used for rendering).
+ *
+ * The client side must make sure the callback is valid for the
+ * time of execution.
+ *
+ * @param[in] drawInfo NativeDrawInfo structure
+ */
+ virtual void DrawNative(const DrawNativeInfo* drawInfo) = 0;
+
+ /**
* @brief Resets CommandBuffer
*
* This function resets the command buffer and discards all previously