aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglprogram.rs
diff options
context:
space:
mode:
authorecoal95 <ecoal95@gmail.com>2015-06-15 00:22:15 +0200
committerecoal95 <ecoal95@gmail.com>2015-07-06 19:54:06 +0200
commit42bd43a696939c3259284a01b8ef64aa13a9939c (patch)
tree254952a1f89c690b12667f2a101f970c3a29551c /components/script/dom/webglprogram.rs
parentb1765c68821d12a21cd304f7dffaa3bdc8f101e4 (diff)
downloadservo-42bd43a696939c3259284a01b8ef64aa13a9939c.tar.gz
servo-42bd43a696939c3259284a01b8ef64aa13a9939c.zip
webgl: Make bind* calls more spec-compliant
Diffstat (limited to 'components/script/dom/webglprogram.rs')
-rw-r--r--components/script/dom/webglprogram.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs
index 63496f9bff6..35ac00689a8 100644
--- a/components/script/dom/webglprogram.rs
+++ b/components/script/dom/webglprogram.rs
@@ -5,9 +5,17 @@
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use dom::bindings::codegen::Bindings::WebGLProgramBinding;
use dom::bindings::global::GlobalRef;
-use dom::bindings::js::Root;
+use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::utils::reflect_dom_object;
use dom::webglobject::WebGLObject;
+use dom::webglshader::{WebGLShader, WebGLShaderHelpers};
+use dom::webglrenderingcontext::MAX_UNIFORM_AND_ATTRIBUTE_LEN;
+
+use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
+
+use canvas_traits::{CanvasMsg, CanvasWebGLMsg, WebGLResult, WebGLError};
+use std::sync::mpsc::{channel, Sender};
+use std::cell::Cell;
#[dom_struct]
pub struct WebGLProgram {
@@ -47,7 +55,7 @@ pub trait WebGLProgramHelpers {
fn delete(self);
fn link(self);
fn use_program(self);
- fn attach_shader(self, shader: JSRef<WebGLShader>) -> WebGLResult<()>;
+ fn attach_shader(self, shader: &WebGLShader) -> WebGLResult<()>;
fn get_attrib_location(self, name: String) -> WebGLResult<Option<i32>>;
fn get_uniform_location(self, name: String) -> WebGLResult<Option<i32>>;
}
@@ -72,7 +80,7 @@ impl<'a> WebGLProgramHelpers for &'a WebGLProgram {
}
/// glAttachShader
- fn attach_shader(self, shader: &'a WebGLShader) -> WebGLResult<()> {
+ fn attach_shader(self, shader: &WebGLShader) -> WebGLResult<()> {
let shader_slot = match shader.gl_type() {
constants::FRAGMENT_SHADER => &self.fragment_shader,
constants::VERTEX_SHADER => &self.vertex_shader,
@@ -85,7 +93,7 @@ impl<'a> WebGLProgramHelpers for &'a WebGLProgram {
return Err(WebGLError::InvalidOperation);
}
- shader_slot.set(Some(JS::from_rooted(shader)));
+ shader_slot.set(Some(JS::from_ref(shader)));
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::AttachShader(self.id, shader.id()))).unwrap();