LibWeb/WebGL: Respect UNPACK_FLIP_Y_WEBGL pixel storage parameter

When this is true, we have to vertically flip TexImageSource provided
images before uploading them.

Fixes several graphical glitches on Google Maps.
Fixes globe being upside down on Shopify's homepage.
Likely fixes more websites.
This commit is contained in:
Luke Wilde 2025-10-23 20:24:14 +01:00 committed by Andreas Kling
parent 008699c129
commit 3e7061da40
Notes: github-actions[bot] 2025-10-25 10:57:35 +00:00
4 changed files with 45 additions and 3 deletions

View file

@ -1501,6 +1501,8 @@ JS::Value WebGLRenderingContextImpl::get_parameter(WebIDL::UnsignedLong pname)
set_error(GL_INVALID_ENUM);
return JS::js_null();
}
case UNPACK_FLIP_Y_WEBGL:
return JS::Value(m_unpack_flip_y);
default:
dbgln("Unknown WebGL parameter name: {:x}", pname);
set_error(GL_INVALID_ENUM);
@ -1793,6 +1795,13 @@ void WebGLRenderingContextImpl::link_program(GC::Root<WebGLProgram> program)
void WebGLRenderingContextImpl::pixel_storei(WebIDL::UnsignedLong pname, WebIDL::Long param)
{
m_context->make_current();
switch (pname) {
case UNPACK_FLIP_Y_WEBGL:
m_unpack_flip_y = param != GL_FALSE;
return;
}
glPixelStorei(pname, param);
}