Add WebGLSampler support

Reference: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.13
This commit is contained in:
Mátyás Mustoha 2019-10-04 11:22:07 +02:00
parent 78438113d4
commit 26df1962c3
16 changed files with 394 additions and 88 deletions

View file

@ -1637,6 +1637,30 @@ impl WebGLImpl {
let value = ctx.gl().get_query_object_uiv(query_id.get(), pname);
sender.send(value).unwrap()
},
WebGLCommand::GenerateSampler(ref sender) => {
let id = ctx.gl().gen_samplers(1)[0];
sender.send(unsafe { WebGLSamplerId::new(id) }).unwrap()
},
WebGLCommand::DeleteSampler(sampler_id) => {
ctx.gl().delete_samplers(&[sampler_id.get()]);
},
WebGLCommand::BindSampler(unit, sampler_id) => {
ctx.gl().bind_sampler(unit, sampler_id.get());
},
WebGLCommand::SetSamplerParameterInt(sampler_id, pname, value) => {
ctx.gl().sampler_parameter_i(sampler_id.get(), pname, value);
},
WebGLCommand::SetSamplerParameterFloat(sampler_id, pname, value) => {
ctx.gl().sampler_parameter_f(sampler_id.get(), pname, value);
},
WebGLCommand::GetSamplerParameterInt(sampler_id, pname, ref sender) => {
let value = ctx.gl().get_sampler_parameter_iv(sampler_id.get(), pname)[0];
sender.send(value).unwrap();
},
WebGLCommand::GetSamplerParameterFloat(sampler_id, pname, ref sender) => {
let value = ctx.gl().get_sampler_parameter_fv(sampler_id.get(), pname)[0];
sender.send(value).unwrap();
},
}
// TODO: update test expectations in order to enable debug assertions