Add support for WebGL2 GetFragDataLocation

Adds support for the `GetFragDataLocation` WebGL2 call.

See: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.7
This commit is contained in:
Mátyás Mustoha 2020-03-06 11:42:21 +01:00
parent e1f6dfd716
commit ced67af6b2
9 changed files with 62 additions and 32 deletions

View file

@ -365,6 +365,30 @@ impl WebGLProgram {
Ok(location)
}
/// glGetFragDataLocation
pub fn get_frag_data_location(&self, name: DOMString) -> WebGLResult<i32> {
if !self.is_linked() || self.is_deleted() {
return Err(WebGLError::InvalidOperation);
}
if !validate_glsl_name(&name)? {
return Ok(-1);
}
if name.starts_with("gl_") {
return Ok(-1);
}
let (sender, receiver) = webgl_channel().unwrap();
self.upcast::<WebGLObject>()
.context()
.send_command(WebGLCommand::GetFragDataLocation(
self.id,
name.into(),
sender,
));
Ok(receiver.recv().unwrap())
}
/// glGetUniformLocation
pub fn get_uniform_location(
&self,