Add WebGL2 specific version strings

Updated the `VERSION` and `SHADING_LANGUAGE_VERSION` WebGL parameters
to report the correct version strings when WebGL2 is in use.

See: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.2
This commit is contained in:
Mátyás Mustoha 2020-01-17 11:52:01 +01:00
parent 0650fc3199
commit 01ca317235
2 changed files with 10 additions and 7 deletions

View file

@ -441,6 +441,16 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
fn GetParameter(&self, cx: JSContext, parameter: u32) -> JSVal {
match parameter {
constants::VERSION => unsafe {
rooted!(in(*cx) let mut rval = UndefinedValue());
"WebGL 2.0".to_jsval(*cx, rval.handle_mut());
return rval.get();
},
constants::SHADING_LANGUAGE_VERSION => unsafe {
rooted!(in(*cx) let mut rval = UndefinedValue());
"WebGL GLSL ES 3.00".to_jsval(*cx, rval.handle_mut());
return rval.get();
},
constants::MAX_CLIENT_WAIT_TIMEOUT_WEBGL => {
return Int32Value(
self.base.limits().max_client_wait_timeout_webgl.as_nanos() as i32