aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglrenderingcontext.rs
diff options
context:
space:
mode:
authorFausto Núñez Alberro <fausto.nunez@mailbox.org>2018-04-12 14:24:51 +0200
committerFausto Núñez Alberro <fausto.nunez@mailbox.org>2018-04-24 18:16:51 +0200
commit58760d91d1830ce0bd75c22ebad42c4f9e332845 (patch)
tree3200e955264b921b50b4026933bc3d4a14c94759 /components/script/dom/webglrenderingcontext.rs
parent05fe8fa08d507836ce5659ff56f83022a90b241a (diff)
downloadservo-58760d91d1830ce0bd75c22ebad42c4f9e332845.tar.gz
servo-58760d91d1830ce0bd75c22ebad42c4f9e332845.zip
Implement WebGL GetRenderbufferParameter
This needed a bump of gleam to version 0.4.33
Diffstat (limited to 'components/script/dom/webglrenderingcontext.rs')
-rw-r--r--components/script/dom/webglrenderingcontext.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 8e4757a5841..d68f817dcd6 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -2348,6 +2348,45 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
Int32Value(receiver.recv().unwrap())
}
+ #[allow(unsafe_code)]
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7
+ unsafe fn GetRenderbufferParameter(
+ &self,
+ _cx: *mut JSContext,
+ target: u32,
+ pname: u32
+ ) -> JSVal {
+ let target_matches = target == constants::RENDERBUFFER;
+
+ let pname_matches = match pname {
+ constants::RENDERBUFFER_WIDTH |
+ constants::RENDERBUFFER_HEIGHT |
+ constants::RENDERBUFFER_INTERNAL_FORMAT |
+ constants::RENDERBUFFER_RED_SIZE |
+ constants::RENDERBUFFER_GREEN_SIZE |
+ constants::RENDERBUFFER_BLUE_SIZE |
+ constants::RENDERBUFFER_ALPHA_SIZE |
+ constants::RENDERBUFFER_DEPTH_SIZE |
+ constants::RENDERBUFFER_STENCIL_SIZE => true,
+ _ => false,
+ };
+
+ if !target_matches || !pname_matches {
+ self.webgl_error(InvalidEnum);
+ return NullValue();
+ }
+
+ if self.bound_renderbuffer.get().is_none() {
+ self.webgl_error(InvalidOperation);
+ return NullValue();
+ }
+
+ let (sender, receiver) = webgl_channel().unwrap();
+ self.send_command(WebGLCommand::GetRenderbufferParameter(target, pname, sender));
+
+ Int32Value(receiver.recv().unwrap())
+ }
+
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn GetProgramInfoLog(&self, program: &WebGLProgram) -> Option<DOMString> {
match program.get_info_log() {