add failIfMajorPerformanceCaveat option

See https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.2.1 :
If the value is true, context creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls. This could happen for a number of reasons, including:
* An implementation might switch to a software rasterizer if the user's GPU driver is known to be unstable.
* An implementation might require reading back the framebuffer from GPU memory to system memory before compositing it with the rest of the page, significantly reducing performance. 

Applications that don't require high performance should leave this parameter at its default value of false. Applications that require high performance may set this parameter to true, and if context creation fails then the application may prefer to use a fallback rendering path such as a 2D canvas context. Alternatively the application can retry WebGL context creation with this parameter set to false, with the knowledge that a reduced-fidelity rendering mode should be used to improve performance.
This commit is contained in:
Zaphod
2019-11-01 14:26:27 +03:00
committed by Joshua Granick
parent 984a33e35e
commit 45e38dfca2

View File

@@ -284,7 +284,8 @@ class HTML5Window
depth: Reflect.hasField(contextAttributes, "depth") ? contextAttributes.depth : true, depth: Reflect.hasField(contextAttributes, "depth") ? contextAttributes.depth : true,
premultipliedAlpha: true, premultipliedAlpha: true,
stencil: Reflect.hasField(contextAttributes, "stencil") ? contextAttributes.stencil : false, stencil: Reflect.hasField(contextAttributes, "stencil") ? contextAttributes.stencil : false,
preserveDrawingBuffer: false preserveDrawingBuffer: false,
failIfMajorPerformanceCaveat: true
}; };
var glContextType = ["webgl", "experimental-webgl"]; var glContextType = ["webgl", "experimental-webgl"];