aboutsummaryrefslogtreecommitdiffstats
path: root/components/canvas/webgl_thread.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-10-08 11:56:11 -0400
committerGitHub <noreply@github.com>2019-10-08 11:56:11 -0400
commita7d48dca80497083e8ad6db059536fc1f3b96701 (patch)
tree05f59c87f05a835237acb51b590f87c126a5a172 /components/canvas/webgl_thread.rs
parent26e5281bfc9c5f91ec75fde8c39480bda993a83f (diff)
parent26df1962c38421251a998b8acc7d6652116d4866 (diff)
downloadservo-a7d48dca80497083e8ad6db059536fc1f3b96701.tar.gz
servo-a7d48dca80497083e8ad6db059536fc1f3b96701.zip
Auto merge of #24333 - mmatyas:webgl_fns_samplers, r=jdm
Add WebGLSampler support Reference: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.13 <!-- Please describe your changes on the following line: --> cc @jdm @zakorgy --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24333) <!-- Reviewable:end -->
Diffstat (limited to 'components/canvas/webgl_thread.rs')
-rw-r--r--components/canvas/webgl_thread.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs
index 65eeff2a7c1..f8e63cd1fa3 100644
--- a/components/canvas/webgl_thread.rs
+++ b/components/canvas/webgl_thread.rs
@@ -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