diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-09-07 10:40:30 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-09-07 11:28:11 +0200 |
commit | 1293692ef8874f4d810f9a08114bcbfe11d4ac8f (patch) | |
tree | 270398a6fcc6fc23ad88b18edd8d71a51062499d /components/script/dom/webglbuffer.rs | |
parent | 5a206d51373bb304b80a6469b518cafb35322a93 (diff) | |
download | servo-1293692ef8874f4d810f9a08114bcbfe11d4ac8f.tar.gz servo-1293692ef8874f4d810f9a08114bcbfe11d4ac8f.zip |
Simplify WebGLBuffer::buffer_data
There is no need to pass the target to that buffer method, given the buffer
has been retrieved by looking up the one bound to that target in the context.
Diffstat (limited to 'components/script/dom/webglbuffer.rs')
-rw-r--r-- | components/script/dom/webglbuffer.rs | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/components/script/dom/webglbuffer.rs b/components/script/dom/webglbuffer.rs index d874cc7a73a..138c34130a3 100644 --- a/components/script/dom/webglbuffer.rs +++ b/components/script/dom/webglbuffer.rs @@ -62,10 +62,7 @@ impl WebGLBuffer { self.id } - pub fn buffer_data<T>(&self, target: u32, data: T, usage: u32) -> WebGLResult<()> - where - T: Into<Vec<u8>>, - { + pub fn buffer_data(&self, data: Vec<u8>, usage: u32) -> WebGLResult<()> { match usage { WebGLRenderingContextConstants::STREAM_DRAW | WebGLRenderingContextConstants::STATIC_DRAW | @@ -73,17 +70,11 @@ impl WebGLBuffer { _ => return Err(WebGLError::InvalidEnum), } - if let Some(previous_target) = self.target.get() { - if target != previous_target { - return Err(WebGLError::InvalidOperation); - } - } - let data = data.into(); self.capacity.set(data.len()); self.usage.set(usage); self.upcast::<WebGLObject>() .context() - .send_command(WebGLCommand::BufferData(target, data.into(), usage)); + .send_command(WebGLCommand::BufferData(self.target.get().unwrap(), data.into(), usage)); Ok(()) } |