1 #ifndef DALI_GRAPHICS_GLES_CONTEXT_H
2 #define DALI_GRAPHICS_GLES_CONTEXT_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 #include <dali/graphics-api/graphics-command-buffer.h>
22 #include "gles-graphics-types.h"
24 namespace Dali::Graphics
26 class EglGraphicsController;
33 * @brief Context represents single GLES context
38 explicit Context(EglGraphicsController& controller);
43 * @brief Flushes the context
45 * Flushes the context by issuing GL calls to set the required
48 * @param[in] reset If true then state is reset unconditionally
50 void Flush(bool reset, const GLES::DrawCallDescriptor& drawCall);
53 * @brief Returns context Id
56 uint32_t GetContextId() const
62 * @brief Binds textures to the context
64 * Bindings are merged, they are resolved at later time
65 * when the draw call is issued. Then the texture binding
66 * slots (GL active texture binding) are enabled/disabled accordingly
67 * to the uniform layout.
69 * @param[in] bindings List of bindings
72 void BindTextures(const std::vector<Graphics::TextureBinding>& bindings);
75 * @brief Vertex buffers to bind
77 * The bindings are taken from a command buffer being
78 * currently processed and copied into the local storage.
81 void BindVertexBuffers(const std::vector<GLES::VertexBufferBindingDescriptor>& bindings);
84 * @brief Binds index buffer
86 * @param indexBufferBinding
88 void BindIndexBuffer(const IndexBufferBindingDescriptor& indexBufferBinding);
91 * @brief Binds pipeline to the context
94 void BindPipeline(const GLES::Pipeline* newPipeline);
97 * @brief Binds uniform buffers to the context
99 * @param[in] uboBindings real UBO binfins
100 * @param[in] standaloneBindings emulated (legacy) UBO object
102 void BindUniformBuffers(const std::vector<UniformBufferBindingDescriptor>& uboBindings, const UniformBufferBindingDescriptor& standaloneBindings);
105 * @brief Resolves blend state on the currently attached pipeline
107 void ResolveBlendState();
110 * @brief Resolves rasterization state on the currently attached pipeline
112 void ResolveRasterizationState();
115 * @brief Resolves uniform buffers and binds data to the pipeline
117 void ResolveUniformBuffers();
120 * @brief Special usecase for legacy shaders, called by ResolveUniformBuffers()
122 void ResolveStandaloneUniforms();
126 * @brief Clear current state
132 std::unique_ptr<Impl> mImpl;
135 } // namespace Dali::Graphics
136 #endif //DALI_GRAPHICS_GLES_CONTEXT_H