diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-07-07 21:52:10 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-07-08 10:11:44 +0200 |
commit | 6996d1ce369f8335ffa9e303fbcf1c917fe7c3e9 (patch) | |
tree | b6c16e6348d2078e44f60a2cc25339afc27c409b /components/script/dom/webglshader.rs | |
parent | 0e93f06d8dcf04a50571c525aa2b6f767ef734ff (diff) | |
download | servo-6996d1ce369f8335ffa9e303fbcf1c917fe7c3e9.tar.gz servo-6996d1ce369f8335ffa9e303fbcf1c917fe7c3e9.zip |
Fix gl.getShaderSource and gl.getShaderInfoLog
It only returns null if there was an error, and the only error isn't
implemented yet.
Diffstat (limited to 'components/script/dom/webglshader.rs')
-rw-r--r-- | components/script/dom/webglshader.rs | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs index 9b4827e5ce9..1feb73d2d3a 100644 --- a/components/script/dom/webglshader.rs +++ b/components/script/dom/webglshader.rs @@ -35,8 +35,8 @@ pub struct WebGLShader { webgl_object: WebGLObject, id: WebGLShaderId, gl_type: u32, - source: DomRefCell<Option<DOMString>>, - info_log: DomRefCell<Option<String>>, + source: DomRefCell<DOMString>, + info_log: DomRefCell<DOMString>, is_deleted: Cell<bool>, attached_counter: Cell<u32>, compilation_status: Cell<ShaderCompilationStatus>, @@ -56,8 +56,8 @@ impl WebGLShader { webgl_object: WebGLObject::new_inherited(), id: id, gl_type: shader_type, - source: DomRefCell::new(None), - info_log: DomRefCell::new(None), + source: Default::default(), + info_log: Default::default(), is_deleted: Cell::new(false), attached_counter: Cell::new(0), compilation_status: Cell::new(ShaderCompilationStatus::NotCompiled), @@ -113,10 +113,6 @@ impl WebGLShader { } let source = self.source.borrow(); - let source = match source.as_ref() { - Some(source) => source, - None => return Ok(()), - }; let params = BuiltInResources { MaxVertexAttribs: limits.max_vertex_attribs as c_int, @@ -166,7 +162,7 @@ impl WebGLShader { }, }; - match validator.compile_and_translate(&[source]) { + match validator.compile_and_translate(&[&source]) { Ok(translated_source) => { debug!("Shader translated: {}", translated_source); // NOTE: At this point we should be pretty sure that the compilation in the paint thread @@ -182,7 +178,7 @@ impl WebGLShader { }, } - *self.info_log.borrow_mut() = Some(validator.info_log()); + *self.info_log.borrow_mut() = validator.info_log().into(); // TODO(emilio): More data (like uniform data) should be collected // here to properly validate uniforms. @@ -220,18 +216,18 @@ impl WebGLShader { } /// glGetShaderInfoLog - pub fn info_log(&self) -> Option<String> { + pub fn info_log(&self) -> DOMString { self.info_log.borrow().clone() } /// Get the shader source - pub fn source(&self) -> Option<DOMString> { + pub fn source(&self) -> DOMString { self.source.borrow().clone() } /// glShaderSource pub fn set_source(&self, source: DOMString) { - *self.source.borrow_mut() = Some(source); + *self.source.borrow_mut() = source; } pub fn successfully_compiled(&self) -> bool { |