Bug 261870 - REGRESSION(267646@main): [TextureMapper][WPE] 2.42 doesn't render anything on the rpi3 with the proprietary drivers
Summary: REGRESSION(267646@main): [TextureMapper][WPE] 2.42 doesn't render anything on...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WPE WebKit (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-21 04:06 PDT by Miguel Gomez
Modified: 2023-12-19 12:18 PST (History)
4 users (show)

See Also:


Attachments
WIP patch (3.38 KB, patch)
2023-12-07 13:29 PST, Fujii Hironori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Miguel Gomez 2023-09-21 04:06:19 PDT
I've bisected the problem to e9cc37c74045a5ceaa356c37802b1dbddaec0775.
Comment 1 Fujii Hironori 2023-09-21 15:34:21 PDT
I guess the shader compiler is reporting an error.
You can check it by enabling debug logging. WebCoreLogging=Compositing
Comment 2 Fujii Hironori 2023-09-21 21:52:59 PDT
GTK used WEBKIT_DEBUG env var.
https://docs.webkit.org/Build%20%26%20Debug/Logging.html#linux
Comment 3 Michael Catanzaro 2023-12-04 12:45:28 PST
Hi Miguel, can you check the debug logging and report back for Fujii please?
Comment 4 Miguel Gomez 2023-12-07 06:34:04 PST
These are the errors coming from the shader program:

Program log: ERROR:OPTIMIZER-3 (fragment shader, line 48) Support for for loops is restricted : right side of condition expression must be constant

Program log: ERROR:OPTIMIZER-3 (fragment shader, line 49) Support for for loops is restricted : right side of condition expression must be constant

The problem seems to be the loops in the applyBlurFilter and applyAlphaBlur functions. The loop condition is i < u_gaussianKernelHalfSize, but u_gaussianKernelHalfSize is an uniform, not a constant.

I guess there are some limitations to what rpi3 proprietary drivers can do.
Comment 5 Fujii Hironori 2023-12-07 13:29:23 PST
Created attachment 468928 [details]
WIP patch
Comment 6 Miguel Gomez 2023-12-10 03:52:35 PST
It seems this is not a problem on rpi3, but a problem wiht GLES2. 

From the specs in https://registry.khronos.org/OpenGL/specs/es/2.0/GLSL_ES_Specification_1.00.pdf :


In general, control flow is limited to forward branching and to loops where the maximum number of iterations can easily be determined at compile time.

[…]

for loops are supported but with the following restrictions:

[…]

The for statement has the form:
for ( init-declaration ; condition ; expression ) statement
[…]

condition has the form
loop_index relational_operator constant_expression
where relational_operator is one of: > >= < <= == or !=

When working on the desktop, eglCreate context is probably returning a GLES3 context even when we request a GLES2 one (the specs state that it may return a backwards compatible version). When this happens, the error doesn't trigger because GLES3 doesn't have the loop limitation.

But the rpi3 supports GLES2 only and that's why the problem reproduces there. Fujii, the condition you're looking for in your patch is something like GLContext::current()->version() <= 200, which means that were using GLES2. But this needs to checked at runtime and not during compilation, so a change in the approach is required.
Comment 7 Fujii Hironori 2023-12-14 20:52:13 PST
Pull request: https://github.com/WebKit/WebKit/pull/21847
Comment 8 EWS 2023-12-19 12:18:46 PST
Committed 272287@main (767a3b1ebacc): <https://commits.webkit.org/272287@main>

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