| Flutter Impeller |

buffer_bindings_gles.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #pragma once
6
7 #include <map>
8 #include <vector>
9
10 #include "flutter/fml/macros.h"
11 #include "impeller/renderer/backend/gles/gles.h"
12 #include "impeller/renderer/backend/gles/proc_table_gles.h"
13 #include "impeller/renderer/command.h"
14 #include "impeller/renderer/vertex_descriptor.h"
15
16 namespace impeller {
17
18 //------------------------------------------------------------------------------
19 /// @brief Sets up stage bindings for single draw call in the OpenGLES
20 /// backend.
21 ///
22 class BufferBindingsGLES {
23 public:
24 BufferBindingsGLES();
25
26 ~BufferBindingsGLES();
27
28 bool RegisterVertexStageInput(
29 const ProcTableGLES& gl,
30 const std::vector<ShaderStageIOSlot>& inputs,
31 const std::vector<ShaderStageBufferLayout>& layouts);
32
33 bool ReadUniformsBindings(const ProcTableGLES& gl, GLuint program);
34
35 bool BindVertexAttributes(const ProcTableGLES& gl,
36 size_t vertex_offset) const;
37
38 bool BindUniformData(const ProcTableGLES& gl,
39 Allocator& transients_allocator,
40 const Bindings& vertex_bindings,
41 const Bindings& fragment_bindings) const;
42
43 bool UnbindVertexAttributes(const ProcTableGLES& gl) const;
44
45 private:
46 //----------------------------------------------------------------------------
47 /// @brief The arguments to glVertexAttribPointer.
48 ///
49 struct VertexAttribPointer {
50 GLuint index = 0u;
51 GLint size = 4;
52 GLenum type = GL_FLOAT;
53 GLenum normalized = GL_FALSE;
54 GLsizei stride = 0u;
55 GLsizei offset = 0u;
56 };
57 std::vector<VertexAttribPointer> vertex_attrib_arrays_;
58 std::map<std::string, GLint> uniform_locations_;
59
60 bool BindUniformBuffer(const ProcTableGLES& gl,
61 Allocator& transients_allocator,
62 const BufferResource& buffer) const;
63
64 bool BindTextures(const ProcTableGLES& gl,
65 const Bindings& bindings,
66 ShaderStage stage) const;
67
68 FML_DISALLOW_COPY_AND_ASSIGN(BufferBindingsGLES);
69 };
70
71 } // namespace impeller
impeller::BufferBindingsGLES::ReadUniformsBindings
bool ReadUniformsBindings(const ProcTableGLES &gl, GLuint program)
Definition: buffer_bindings_gles.cc:83
impeller::BufferBindingsGLES::RegisterVertexStageInput
bool RegisterVertexStageInput(const ProcTableGLES &gl, const std::vector< ShaderStageIOSlot > &inputs, const std::vector< ShaderStageBufferLayout > &layouts)
Definition: buffer_bindings_gles.cc:24
impeller::BufferBindingsGLES::BufferBindingsGLES
BufferBindingsGLES()
impeller::BufferBindingsGLES
Sets up stage bindings for single draw call in the OpenGLES backend.
Definition: buffer_bindings_gles.h:22
impeller::ShaderStage
ShaderStage
Definition: shader_types.h:20
impeller::Resource< BufferView >
vertex_descriptor.h
command.h
impeller::BufferBindingsGLES::UnbindVertexAttributes
bool UnbindVertexAttributes(const ProcTableGLES &gl) const
Definition: buffer_bindings_gles.cc:169
impeller::Allocator
An object that allocates device memory.
Definition: allocator.h:25
impeller::ProcTableGLES
Definition: proc_table_gles.h:188
proc_table_gles.h
gles.h
impeller::BufferBindingsGLES::BindVertexAttributes
bool BindVertexAttributes(const ProcTableGLES &gl, size_t vertex_offset) const
Definition: buffer_bindings_gles.cc:125
impeller::BufferBindingsGLES::~BufferBindingsGLES
~BufferBindingsGLES()
impeller
Definition: aiks_context.cc:10
impeller::Bindings
Definition: command.h:77
impeller::BufferBindingsGLES::BindUniformData
bool BindUniformData(const ProcTableGLES &gl, Allocator &transients_allocator, const Bindings &vertex_bindings, const Bindings &fragment_bindings) const
Definition: buffer_bindings_gles.cc:142