LibWeb: Implement WebGL2's readPixels with a byte offset argument

We pass it in as a `void*` since that's what this API expects when you
have bound the GL_PIXEL_PACK_BUFFER buffer.
This commit is contained in:
Jelle Raaijmakers 2025-10-29 15:22:32 -07:00 committed by Jelle Raaijmakers
parent 7b5940d27d
commit 25d78f7c8e
Notes: github-actions[bot] 2025-10-30 23:21:34 +00:00
3 changed files with 15 additions and 1 deletions

View file

@ -1496,6 +1496,19 @@ void WebGL2RenderingContextImpl::read_pixels(WebIDL::Long x, WebIDL::Long y, Web
glReadPixelsRobustANGLE(x, y, width, height, format, type, span.size(), nullptr, nullptr, nullptr, span.data());
}
void WebGL2RenderingContextImpl::read_pixels(WebIDL::Long x, WebIDL::Long y, WebIDL::Long width, WebIDL::Long height,
WebIDL::UnsignedLong format, WebIDL::UnsignedLong type, WebIDL::LongLong offset)
{
m_context->make_current();
if (!m_pixel_pack_buffer_binding) {
set_error(GL_INVALID_OPERATION);
return;
}
glReadPixelsRobustANGLE(x, y, width, height, format, type, 0, nullptr, nullptr, nullptr, reinterpret_cast<void*>(offset));
}
void WebGL2RenderingContextImpl::active_texture(WebIDL::UnsignedLong texture)
{
m_context->make_current();