Bug 255006 - [WPE] Always call glBindAttribLocation before glLinkProgram
Summary: [WPE] Always call glBindAttribLocation before glLinkProgram
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WPE WebKit (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adrian Perez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-04 13:55 PDT by Adrian Perez
Modified: 2023-04-04 14:41 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Perez 2023-04-04 13:55:01 PDT
There are currently two places where we wrongly call glBindAttribLocation()
after glLinkProgram(), which is wrong:

  - Tools/wpe/backends/fdo/WindowViewBackend.cpp:827
  - Source/WebKit/UIProcess/API/wpe/qt/WPEQtViewBackend.cpp:111

While this works by chance on most GL implementations (they seem to assign the
locations in the same order as declared in shader sources), there is no guarantee
about this--and actually the current code was reported to not work on an iMX8 Mini
with the proprietary Vivante driver.

The documentation tells that glLinkProgram() is what makes the bindings
effective:

  “Attribute variable name-to-generic attribute index bindings for a program
   object can be explicitly assigned at any time by calling glBindAttribLocation.
   Attribute bindings do not go into effect until glLinkProgram is called.”

                              -- https://docs.gl/es2/glBindAttribLocation

This means we should be calling glLinkProgram() *after* glBindAttribLocation().
Comment 1 Adrian Perez 2023-04-04 13:59:21 PDT
This bug, and the solution for it, was reported by user “mizmar”
Thanks a lot! 👏️
Comment 2 Adrian Perez 2023-04-04 14:20:38 PDT
Pull request: https://github.com/WebKit/WebKit/pull/12392
Comment 3 EWS 2023-04-04 14:40:57 PDT
Committed 262592@main (0b1da7fc6eb2): <https://commits.webkit.org/262592@main>

Reviewed commits have been landed. Closing PR #12392 and removing active labels.