mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibWeb: Support GL_TEXTURE_2D for the ANGLE target
This will be the returned egl configuration attribute for EGL_BIND_TO_TEXTURE_TARGET_ANGLE once we transition to using the Metal ANGLE backend directly.
This commit is contained in:
parent
41dbdbc816
commit
d5a84b402b
Notes:
github-actions[bot]
2025-06-09 21:42:14 +00:00
Author: https://github.com/Lubrsi
Commit: d5a84b402b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4056
Reviewed-by: https://github.com/ADKaster
1 changed files with 5 additions and 8 deletions
|
@ -194,22 +194,19 @@ void OpenGLContext::allocate_painting_surface_if_needed()
|
|||
|
||||
eglMakeCurrent(m_impl->display, m_impl->surface, m_impl->surface, m_impl->context);
|
||||
|
||||
// This extension is not enabled by default in WebGL compatibility mode, so we need to request it.
|
||||
glRequestExtensionANGLE("GL_ANGLE_texture_rectangle");
|
||||
|
||||
EGLint texture_target_angle = 0;
|
||||
eglGetConfigAttrib(display, config, EGL_BIND_TO_TEXTURE_TARGET_ANGLE, &texture_target_angle);
|
||||
VERIFY(texture_target_angle == EGL_TEXTURE_RECTANGLE_ANGLE);
|
||||
EGLint texture_target_name = 0;
|
||||
eglGetConfigAttrib(display, config, EGL_BIND_TO_TEXTURE_TARGET_ANGLE, &texture_target_name);
|
||||
VERIFY(texture_target_name == EGL_TEXTURE_RECTANGLE_ANGLE || texture_target_name == EGL_TEXTURE_2D);
|
||||
|
||||
GLuint texture = 0;
|
||||
glGenTextures(1, &texture);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ANGLE, texture);
|
||||
glBindTexture(texture_target_name == EGL_TEXTURE_RECTANGLE_ANGLE ? GL_TEXTURE_RECTANGLE_ANGLE : GL_TEXTURE_2D, texture);
|
||||
auto result = eglBindTexImage(display, m_impl->surface, EGL_BACK_BUFFER);
|
||||
VERIFY(result == EGL_TRUE);
|
||||
|
||||
glGenFramebuffers(1, &m_impl->framebuffer);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_impl->framebuffer);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ANGLE, texture, 0);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture_target_name == EGL_TEXTURE_RECTANGLE_ANGLE ? GL_TEXTURE_RECTANGLE_ANGLE : GL_TEXTURE_2D, texture, 0);
|
||||
|
||||
// NOTE: ANGLE doesn't allocate depth buffer for us, so we need to do it manually
|
||||
// FIXME: Depth buffer only needs to be allocated if it's configured in WebGL context attributes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue