LibWeb: Implement WebGL getParameter(GL_VERTEX_ARRAY_BINDING)

This commit is contained in:
Undefine 2025-11-07 18:58:56 +01:00 committed by Jelle Raaijmakers
parent f373ab7011
commit b0fcb35134
Notes: github-actions[bot] 2025-11-27 18:21:05 +00:00
3 changed files with 11 additions and 0 deletions

View file

@ -1208,6 +1208,8 @@ void WebGL2RenderingContextImpl::delete_vertex_array(GC::Root<WebGLVertexArrayOb
}
glDeleteVertexArrays(1, &vertex_array_handle);
if (m_current_vertex_array == vertex_array)
m_current_vertex_array = nullptr;
}
bool WebGL2RenderingContextImpl::is_vertex_array(GC::Root<WebGLVertexArrayObject> vertex_array)
@ -1239,7 +1241,9 @@ void WebGL2RenderingContextImpl::bind_vertex_array(GC::Root<WebGLVertexArrayObje
}
array_handle = handle_or_error.release_value();
}
glBindVertexArray(array_handle);
m_current_vertex_array = array;
}
void WebGL2RenderingContextImpl::compressed_tex_image3d(WebIDL::UnsignedLong target, WebIDL::Long level, WebIDL::UnsignedLong internalformat, WebIDL::Long width, WebIDL::Long height, WebIDL::Long depth, WebIDL::Long border, GC::Root<WebIDL::ArrayBufferView> src_data, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length_override)

View file

@ -1526,6 +1526,11 @@ JS::Value WebGLRenderingContextImpl::get_parameter(WebIDL::UnsignedLong pname)
glGetIntegervRobustANGLE(GL_UNPACK_SKIP_ROWS, 1, nullptr, &result);
return JS::Value(result);
}
case GL_VERTEX_ARRAY_BINDING: { // FIXME: Allow this for VERTEX_ARRAY_BINDING_OES
if (!m_current_vertex_array)
return JS::js_null();
return JS::Value(m_current_vertex_array);
}
case MAX_CLIENT_WAIT_TIMEOUT_WEBGL:
// FIXME: Make this an actual limit
return JS::js_infinity();
@ -2312,6 +2317,7 @@ void WebGLRenderingContextImpl::visit_edges(JS::Cell::Visitor& visitor)
visitor.visit(m_transform_feedback_binding);
visitor.visit(m_pixel_pack_buffer_binding);
visitor.visit(m_pixel_unpack_buffer_binding);
visitor.visit(m_current_vertex_array);
}
}

View file

@ -164,6 +164,7 @@ protected:
GC::Ptr<WebGLTexture> m_texture_binding_2d_array;
GC::Ptr<WebGLTexture> m_texture_binding_3d;
GC::Ptr<WebGLTransformFeedback> m_transform_feedback_binding;
GC::Ptr<WebGLVertexArrayObject> m_current_vertex_array;
NonnullOwnPtr<OpenGLContext> m_context;
};