Jump to content

Detect when browser use software rendering to display WebGL content


gani
 Share

Recommended Posts

Hi I'm newbie with Pixi.js but already love it :).

 

Maybe it will sounds strange but some modern browsers on old machines tries to render a WebGL content with CPU instead of using the GPU acceleration and obviously the perfomance is poor (happen on old Chrome 36 and IE11)

 

I'm asking for a method to check if the above is true and to switch the renderer into Canvas.

 

And one more question - Is there a way to run somekind of a simple "stress" test to detect poor WebGL performance?

 

Any help would be greatly appreciated.

 

 

p.s. sorry for my bad English

Link to comment
Share on other sites

Thanks for the reply :).

 

Am I defining it right?

var renderer = new PIXI.autoDetectRenderer(windowWidth, windowHeight, { transparent: true, failIfMajorPerformanceCaveat: true }); 

What is the worst scenario that could cause failIfMajorPerformanceCaveat ?

 

Also is IE and Safari supporting this parameter (in the above article is mentioned only Chrome)?

Link to comment
Share on other sites

First `autoDetectRenderer` is not a constructor, it is just a function. Don't use the `new` keyword.

 

What is the worst scenario that could cause failIfMajorPerformanceCaveat ?

 

I don't know what that means. The spec explains exacty what the parameter does, and example conditions that make it fail creation. I don't know if the param is supported in IE/Safari, you will need to do some research. Keep in mind also that autoDetectRenderer doesn't try to create a webgl context with your params and then fallback to canvas on failure. Instead it just detects webgl support and then creates the proper renderer. Also, you can see that in v2 the context options are hard-coded for the webgl renderer:

 

https://github.com/GoodBoyDigital/pixi.js/blob/master/src/pixi/renderers/webgl/WebGLRenderer.js#L147-L153

 

You can't pass arbitrary properties into the context creation. You will have to create a custom renderer, or open an issue on the github tracker to add support for this param. This param is pretty new, so we haven't thought about how to add proper support for it yet.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...