38 const std::vector<ShaderStageIOSlot>& inputs,
39 const std::vector<ShaderStageBufferLayout>& layouts);
55 const std::vector<TextureAndSampler>& bound_textures,
56 const std::vector<BufferResource>& bound_buffers,
66 BindUniformDataVerticesAndMatrices);
68 BindUniformFailsWithoutFloatType);
72 struct VertexAttribPointer {
75 GLenum
type = GL_FLOAT;
76 GLenum normalized = GL_FALSE;
80 GLuint vertex_attrib_divisor = 0u;
82 std::vector<std::vector<VertexAttribPointer>> vertex_attrib_arrays_;
84 absl::flat_hash_map<std::string, GLint> uniform_locations_;
85 absl::flat_hash_map<std::string, std::pair<GLint, GLuint>> ubo_locations_;
87 using BindingMap = absl::flat_hash_map<std::string, std::vector<GLint>>;
88 BindingMap binding_map_ = {};
89 GLuint vertex_array_object_ = 0;
90 GLuint program_handle_ = GL_NONE;
91 bool use_ubo_ =
false;
93 const std::vector<GLint>& ComputeUniformLocations(
94 const ShaderMetadata* metadata);
96 bool ReadUniformsBindingsV2(
const ProcTableGLES& gl, GLuint program);
98 bool ReadUniformsBindingsV3(
const ProcTableGLES& gl, GLuint program);
100 GLint ComputeTextureLocation(
const ShaderMetadata* metadata);
102 bool BindUniformBuffer(
const ProcTableGLES& gl,
const BufferResource& buffer);
104 bool BindUniformBufferV2(
const ProcTableGLES& gl,
105 const BufferView& buffer,
106 const ShaderMetadata* metadata,
107 const DeviceBufferGLES& device_buffer_gles);
109 bool BindUniformBufferV3(
const ProcTableGLES& gl,
110 const BufferView& buffer,
111 const ShaderMetadata* metadata,
112 const DeviceBufferGLES& device_buffer_gles);
114 std::optional<size_t> BindTextures(
115 const ProcTableGLES& gl,
116 const std::vector<TextureAndSampler>& bound_textures,
119 size_t unit_start_index = 0);
126 void SetUniformBindings(
127 absl::flat_hash_map<std::string, GLint> uniform_locations) {
128 uniform_locations_ = std::move(uniform_locations);