Skip to content

Commit

Permalink
[WPE] Always call glBindAttribLocation before glLinkProgram
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=255006

Reviewed by Don Olmstead.

Reorder glBindAttribLocation() calls to be done before glLinkProgram().
While existing code worked with many GL implementations, that behavior
shall not be relied upon: the specification indicates that attribute
bindings go into effect after calling glLinkProgram().

Thanks to user "mizmar" for reporting the issue and outlining the
solution.

* Source/WebKit/UIProcess/API/wpe/qt/WPEQtViewBackend.cpp:
(WPEQtViewBackend::WPEQtViewBackend): Reorder GL calls.
* Tools/wpe/backends/fdo/WindowViewBackend.cpp:
(WPEToolingBackends::WindowViewBackend::WindowViewBackend): Ditto.

Canonical link: https://commits.webkit.org/262592@main
  • Loading branch information
aperezdc committed Apr 4, 2023
1 parent d097460 commit 08c4edf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Source/WebKit/UIProcess/API/wpe/qt/WPEQtViewBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ WPEQtViewBackend::WPEQtViewBackend(const QSizeF& size, EGLDisplay display, EGLCo
m_program = glFunctions->glCreateProgram();
glFunctions->glAttachShader(m_program, vertexShader);
glFunctions->glAttachShader(m_program, fragmentShader);
glFunctions->glLinkProgram(m_program);

glFunctions->glBindAttribLocation(m_program, 0, "pos");
glFunctions->glBindAttribLocation(m_program, 1, "texture");

glFunctions->glLinkProgram(m_program);
m_textureUniform = glFunctions->glGetUniformLocation(m_program, "u_texture");

static struct wpe_view_backend_exportable_fdo_egl_client exportableClient = {
Expand Down
3 changes: 2 additions & 1 deletion Tools/wpe/backends/WindowViewBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,11 @@ WindowViewBackend::WindowViewBackend(uint32_t width, uint32_t height)
m_program = glCreateProgram();
glAttachShader(m_program, vertexShader);
glAttachShader(m_program, fragmentShader);
glLinkProgram(m_program);

glBindAttribLocation(m_program, 0, "pos");
glBindAttribLocation(m_program, 1, "texture");

glLinkProgram(m_program);
m_textureUniform = glGetUniformLocation(m_program, "u_texture");
}

Expand Down

0 comments on commit 08c4edf

Please sign in to comment.