hlwhl / webview_cef

WebView for Flutter Desktop Apps using CEF(Chromium Embedded Framework) [Work in Progress]
Apache License 2.0
189 stars 55 forks source link

WebGL support #51

Closed ssiddabattula closed 1 year ago

ssiddabattula commented 1 year ago

WebGL is not rendering in WebView_CEF. Can you please enable WebGL rendering? We use WebView_CEF in our flutter project that requires WebGL rendering. We have tried using WebView_Windows but the content rendering is fuzzy. We have tried DPI scaling settings, Pixel Snap and everything that we could find in discussion forums. But we couldn't resolve the fuzzy rendering issue. We came across WebView_CEF which renders well without any of the rendering issues faced in WebView_Windows but when it comes to WebGL, WebView_CEF is not working. You can try opening https://sketchfab.com/ and you will see that the homepage demo bot fails to load. Any fix to make WebView_CEF work with WebGL is highly appreciated.

On further research we found that swiftshader is enabled by default in CEF 3071 branch and newer when GPU is disabled and that swiftshader is required to render WebGL. It looks like CEF branch is 5040, GPU is disabled, and WebGL is enabled in the code but we still can't figure out why WebGL is not loading. Any direction to resolving this is highly appreciated.

hlwhl commented 1 year ago

Which platform you are using?

ssiddabattula commented 1 year ago

We are deploying the solution on windows using Flutter - We have some WebGL content which we want our customers to use on their IFPs(Interactive Flat Panel). Currently the web browser i.e. Google and other website are working fine and are performant, when we load WebGL it is not rendering and shows error prompt attached as screenshot. WebGL loads and performs fine when using Chrome or Edge browser on the device. Device is running Windows 10 Pro OS.

Please suggest how can we resolve this, as this is a table-stake feature for our customers.

WhatsApp Image 2023-05-19 at 1 41 04 PM WhatsApp Image 2023-05-19 at 1 41 05 PM

hlwhl commented 1 year ago

@ssiddabattula Investigating.

hlwhl commented 1 year ago

@ssiddabattula I tried the website, seems no issue on my environment. Could you please provide more information? image

hlwhl commented 1 year ago

@ssiddabattula Which brand of GPU you are running on?

imsaxenashubham commented 1 year ago

Thanks for the quick revert.

I am attaching a few screenshots for you to check - you can find the specs for the system in Screenshot A

We are running Our simulations in a native web browser in Screenshot B and Sketchfab in Screenshot C - all work fine, unfortunately, when we create our own build with flutter windows CEF - the browsing experience renders well but fails at WebGL components, I'll send a sample build (Flutter Windows) soon in our next post.

A B c

hlwhl commented 1 year ago

gpu_resources.zip Unzip it, and put files next to your release exe file and try WebGL is working or not. image

ssiddabattula commented 1 year ago

Just to clarify further, we ran the example source code in https://github.com/hlwhl/webview_cef on our developer laptop and received the following error when accessing WebGL simulations.

Practically WebGL error

All the systems and devices we have been testing and expected to be used by the customers won't have GPU but are primarily CPU based. I think if GPU is disabled, shiftshader will be enabled automatically and WebGL rendering may function.

Let me know if you would like to get login credentials to www.Practically.com to check the simulations yourself. Alternatively, we can give anydesk login to the Promethean IFP device running windows 10 pro.

hlwhl commented 1 year ago

@ssiddabattula You are using integrated GPU provided by intel if the machine doesn't have standalone GPU. Please have a try on the following solution. If WebGPU still doesn't work, please attach log file named "debug.log" next to your app or logs shown in debug console.

gpu_resources.zip Unzip it, and put files next to your release exe file and try WebGL is working or not. image

ssiddabattula commented 1 year ago

@hlwhl thanks for prompt response. WebGL is now working after unzipping and copying files at the EXE. I am assuming we should include these shiftshader files in our build. Thank you very much for your prompt help. We have been struggling with WebView_Windows for months and finally this seem to resolve our issues.

hlwhl commented 1 year ago

@ssiddabattula Thanks for reporting the bug. I'll close it after it got fixed because others may need the solution.

ssiddabattula commented 1 year ago

@hlwhl Sure..we are also waiting for sanity reports from our testing team. Will report back our findings.

hlwhl commented 1 year ago

@hlwhl Sure..we are also waiting for sanity reports from our testing team. Will report back our findings.

Lovely!😄

imsaxenashubham commented 1 year ago

We have encountered another obstacle in our current task. Specifically, we are unable to set headers using the URL within the webview. We are seeking a solution or workaround that will enable us to overcome this limitation and successfully set headers in the webview.

hlwhl commented 1 year ago

We have encountered another obstacle in our current task. Specifically, we are unable to set headers using the URL within the webview. We are seeking a solution or workaround that will enable us to overcome this limitation and successfully set headers in the webview.

@imsaxenashubham What do you mean by headers? Http requests headers?

hlwhl commented 1 year ago

Yes HTTP request headers. We have some content on the web that authenticated users can only access. We are identifying these users based on the ci_session header cookie. Is there a way where we can set these from flutter?

@imsaxenashubham Currently this feature is unavailable. You can achieve this by using CEF's request handler. See https://magpcss.org/ceforum/apidocs/projects/(default)/CefClient.html#GetRequestHandler() .

ssiddabattula commented 1 year ago

@hlwhl Thanks for the information. We have modified our DRM authentication URL to do the job for us. Unless we encounter any other issues, we are good to go for now.

hlwhl commented 1 year ago

fixed by ver 0.0.9

chan27-2 commented 1 year ago

https://streamable.com/wuxpc9 @hlwhl WebGL is enabled but the interaction and models are not loading properly.