38 const std::vector<ShaderStageIOSlot>& inputs,
39 const std::vector<ShaderStageBufferLayout>& layouts);
45 size_t vertex_offset);
48 const std::vector<TextureAndSampler>& bound_textures,
49 const std::vector<BufferResource>& bound_buffers,
59 BindUniformDataVerticesAndMatrices);
61 BindUniformFailsWithoutFloatType);
65 struct VertexAttribPointer {
68 GLenum
type = GL_FLOAT;
69 GLenum normalized = GL_FALSE;
73 std::vector<std::vector<VertexAttribPointer>> vertex_attrib_arrays_;
75 absl::flat_hash_map<std::string, GLint> uniform_locations_;
76 absl::flat_hash_map<std::string, std::pair<GLint, GLuint>> ubo_locations_;
78 using BindingMap = absl::flat_hash_map<std::string, std::vector<GLint>>;
79 BindingMap binding_map_ = {};
80 GLuint vertex_array_object_ = 0;
81 GLuint program_handle_ = GL_NONE;
82 bool use_ubo_ =
false;
84 const std::vector<GLint>& ComputeUniformLocations(
85 const ShaderMetadata* metadata);
87 bool ReadUniformsBindingsV2(
const ProcTableGLES& gl, GLuint program);
89 bool ReadUniformsBindingsV3(
const ProcTableGLES& gl, GLuint program);
91 GLint ComputeTextureLocation(
const ShaderMetadata* metadata);
93 bool BindUniformBuffer(
const ProcTableGLES& gl,
const BufferResource& buffer);
95 bool BindUniformBufferV2(
const ProcTableGLES& gl,
96 const BufferView& buffer,
97 const ShaderMetadata* metadata,
98 const DeviceBufferGLES& device_buffer_gles);
100 bool BindUniformBufferV3(
const ProcTableGLES& gl,
101 const BufferView& buffer,
102 const ShaderMetadata* metadata,
103 const DeviceBufferGLES& device_buffer_gles);
105 std::optional<size_t> BindTextures(
106 const ProcTableGLES& gl,
107 const std::vector<TextureAndSampler>& bound_textures,
110 size_t unit_start_index = 0);
117 void SetUniformBindings(
118 absl::flat_hash_map<std::string, GLint> uniform_locations) {
119 uniform_locations_ = std::move(uniform_locations);