Add WebGL function glGetTexParameter

Set the expected result of the test `tex-input-validation.html` to CRASH, since
that is caused by unrelated problems. The test was previously not executing
completely, because it stopped when it didn't find the implementation of
getTexParameter.
This commit is contained in:
Martina Kollarova 2018-02-28 16:03:48 +02:00
parent 7931df716d
commit 288ef50fb7
11 changed files with 156 additions and 264 deletions

View file

@ -758,6 +758,8 @@ impl WebGLImpl {
Self::buffer_parameter(ctx.gl(), target, param_id, chan),
WebGLCommand::GetParameter(param_id, chan) =>
Self::parameter(ctx.gl(), param_id, chan),
WebGLCommand::GetTexParameter(target, pname, chan) =>
Self::get_tex_parameter(ctx.gl(), target, pname, chan),
WebGLCommand::GetProgramParameter(program_id, param_id, chan) =>
Self::program_parameter(ctx.gl(), program_id, param_id, chan),
WebGLCommand::GetShaderParameter(shader_id, param_id, chan) =>
@ -1061,6 +1063,27 @@ impl WebGLImpl {
chan.send(result).unwrap();
}
fn get_tex_parameter(gl: &gl::Gl,
target: u32,
pname: u32,
chan: WebGLSender<WebGLResult<WebGLParameter>> ) {
let result = match pname {
gl::TEXTURE_MAG_FILTER |
gl::TEXTURE_MIN_FILTER |
gl::TEXTURE_WRAP_S |
gl::TEXTURE_WRAP_T => {
let parameter = gl.get_tex_parameter_iv(target, pname);
if parameter == 0 {
Ok(WebGLParameter::Invalid)
} else {
Ok(WebGLParameter::Int(parameter))
}
}
_ => Err(WebGLError::InvalidEnum)
};
chan.send(result).unwrap();
}
fn finish(gl: &gl::Gl, chan: WebGLSender<()>) {
gl.finish();
chan.send(()).unwrap();