mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05:00
LibWeb/WebGL: Implement getAttachedShaders
This commit is contained in:
parent
aa99853a5c
commit
4cb5a980e5
Notes:
github-actions[bot]
2025-01-21 20:38:24 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/4cb5a980e5a Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3239 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/kalenikaliaksandr
2 changed files with 29 additions and 1 deletions
|
@ -106,7 +106,7 @@ interface mixin WebGLRenderingContextBase {
|
||||||
|
|
||||||
WebGLActiveInfo? getActiveAttrib(WebGLProgram program, GLuint index);
|
WebGLActiveInfo? getActiveAttrib(WebGLProgram program, GLuint index);
|
||||||
WebGLActiveInfo? getActiveUniform(WebGLProgram program, GLuint index);
|
WebGLActiveInfo? getActiveUniform(WebGLProgram program, GLuint index);
|
||||||
[FIXME] sequence<WebGLShader>? getAttachedShaders(WebGLProgram program);
|
sequence<WebGLShader>? getAttachedShaders(WebGLProgram program);
|
||||||
|
|
||||||
GLint getAttribLocation(WebGLProgram program, DOMString name);
|
GLint getAttribLocation(WebGLProgram program, DOMString name);
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,16 @@ static ByteString to_cpp_type(const IDL::Type& type, const IDL::Interface& inter
|
||||||
return "Optional<String>"sv;
|
return "Optional<String>"sv;
|
||||||
return "String"sv;
|
return "String"sv;
|
||||||
}
|
}
|
||||||
|
if (type.name() == "sequence") {
|
||||||
|
auto& parameterized_type = as<IDL::ParameterizedType>(type);
|
||||||
|
auto sequence_cpp_type = idl_type_name_to_cpp_type(parameterized_type.parameters().first(), interface);
|
||||||
|
|
||||||
|
if (type.is_nullable()) {
|
||||||
|
return ByteString::formatted("Optional<Vector<{}>>", sequence_cpp_type.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ByteString::formatted("Vector<{}>", sequence_cpp_type.name);
|
||||||
|
}
|
||||||
auto cpp_type = idl_type_name_to_cpp_type(type, interface);
|
auto cpp_type = idl_type_name_to_cpp_type(type, interface);
|
||||||
return cpp_type.name;
|
return cpp_type.name;
|
||||||
}
|
}
|
||||||
|
@ -1044,6 +1054,24 @@ public:
|
||||||
continue;
|
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<GC::Root<WebGLShader>> 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) {
|
if (function.name == "bufferData"sv && function.overload_index == 0) {
|
||||||
function_impl_generator.append(R"~~~(
|
function_impl_generator.append(R"~~~(
|
||||||
glBufferData(target, size, 0, usage);
|
glBufferData(target, size, 0, usage);
|
||||||
|
|
Loading…
Reference in a new issue