@@ -1035,6 +1035,36 @@ void WebGL2RenderingContextImpl::bind_buffer_range(WebIDL::UnsignedLong target,
10351035 glBindBufferRange (target, index, buffer_handle, offset, size);
10361036}
10371037
1038+ Optional<Vector<WebIDL::UnsignedLong>> WebGL2RenderingContextImpl::get_uniform_indices (GC::Root<WebGLProgram> program, Vector<String> const & uniform_names)
1039+ {
1040+ m_context->make_current ();
1041+
1042+ auto handle_or_error = program->handle (this );
1043+ if (handle_or_error.is_error ()) {
1044+ set_error (GL_INVALID_OPERATION);
1045+ return OptionalNone {};
1046+ }
1047+
1048+ auto program_handle = handle_or_error.release_value ();
1049+
1050+ Vector<Vector<GLchar>> uniform_names_strings;
1051+ uniform_names_strings.ensure_capacity (uniform_names.size ());
1052+ for (auto const & uniform_name : uniform_names) {
1053+ uniform_names_strings.unchecked_append (null_terminated_string (uniform_name));
1054+ }
1055+
1056+ Vector<GLchar const *> uniform_names_characters;
1057+ uniform_names_characters.ensure_capacity (uniform_names_strings.size ());
1058+ for (auto const & uniform_name_string : uniform_names_strings) {
1059+ uniform_names_characters.unchecked_append (uniform_name_string.data ());
1060+ }
1061+
1062+ auto result_buffer = MUST (ByteBuffer::create_zeroed (uniform_names_characters.size () * sizeof (WebIDL::UnsignedLong)));
1063+ auto result_span = result_buffer.bytes ().reinterpret <WebIDL::UnsignedLong>();
1064+ glGetUniformIndices (program_handle, uniform_names_characters.size (), uniform_names_characters.data (), result_span.data ());
1065+ return Vector<WebIDL::UnsignedLong> { result_span };
1066+ }
1067+
10381068JS::Value WebGL2RenderingContextImpl::get_active_uniforms (GC::Root<WebGLProgram> program, Vector<WebIDL::UnsignedLong> uniform_indices, WebIDL::UnsignedLong pname)
10391069{
10401070 m_context->make_current ();
0 commit comments