diff --git a/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl b/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl index 752f24c1708..be9e9bea818 100644 --- a/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl +++ b/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl @@ -106,7 +106,7 @@ interface mixin WebGLRenderingContextBase { WebGLActiveInfo? getActiveAttrib(WebGLProgram program, GLuint index); WebGLActiveInfo? getActiveUniform(WebGLProgram program, GLuint index); - [FIXME] sequence? getAttachedShaders(WebGLProgram program); + sequence? getAttachedShaders(WebGLProgram program); GLint getAttribLocation(WebGLProgram program, DOMString name); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateWebGLRenderingContext.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateWebGLRenderingContext.cpp index 2fa0165a502..176b59fa4e1 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateWebGLRenderingContext.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateWebGLRenderingContext.cpp @@ -55,6 +55,16 @@ static ByteString to_cpp_type(const IDL::Type& type, const IDL::Interface& inter return "Optional"sv; return "String"sv; } + if (type.name() == "sequence") { + auto& parameterized_type = as(type); + auto sequence_cpp_type = idl_type_name_to_cpp_type(parameterized_type.parameters().first(), interface); + + if (type.is_nullable()) { + return ByteString::formatted("Optional>", sequence_cpp_type.name); + } + + return ByteString::formatted("Vector<{}>", sequence_cpp_type.name); + } auto cpp_type = idl_type_name_to_cpp_type(type, interface); return cpp_type.name; } @@ -1044,6 +1054,24 @@ public: continue; } + if (function.name == "getAttachedShaders"sv) { + generate_webgl_object_handle_unwrap(function_impl_generator, "program"sv, "OptionalNone {}"sv); + function_impl_generator.append(R"~~~( + (void)program_handle; + + Vector> result; + + if (program->attached_vertex_shader()) + result.append(GC::make_root(*program->attached_vertex_shader())); + + if (program->attached_fragment_shader()) + result.append(GC::make_root(*program->attached_fragment_shader())); + + return result; +)~~~"); + continue; + } + if (function.name == "bufferData"sv && function.overload_index == 0) { function_impl_generator.append(R"~~~( glBufferData(target, size, 0, usage);