Skip to content

Commit

Permalink
Fix the signature of WebGLRenderingContext::BufferSubData
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Apr 4, 2018
1 parent 3c56d2f commit bb2b6a7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion components/script/dom/webgl2renderingcontext.rs
Expand Up @@ -241,7 +241,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
}

/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
fn BufferSubData(&self, target: u32, offset: i64, data: Option<ArrayBufferViewOrArrayBuffer>) {
fn BufferSubData(&self, target: u32, offset: i64, data: ArrayBufferViewOrArrayBuffer) {
self.base.BufferSubData(target, offset, data)
}

Expand Down
8 changes: 3 additions & 5 deletions components/script/dom/webglrenderingcontext.rs
Expand Up @@ -1711,13 +1711,11 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}

// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
fn BufferSubData(&self, target: u32, offset: i64, data: Option<ArrayBufferViewOrArrayBuffer>) {
fn BufferSubData(&self, target: u32, offset: i64, data: ArrayBufferViewOrArrayBuffer) {
let data_vec = match data {
// Typed array is rooted, so we can safely temporarily retrieve its slice
Some(ArrayBufferViewOrArrayBuffer::ArrayBuffer(mut inner)) => inner.to_vec(),
Some(ArrayBufferViewOrArrayBuffer::ArrayBufferView(mut inner)) => inner.to_vec(),
// Spec: If data is null then an INVALID_VALUE error is generated.
None => return self.webgl_error(InvalidValue),
ArrayBufferViewOrArrayBuffer::ArrayBuffer(mut inner) => inner.to_vec(),
ArrayBufferViewOrArrayBuffer::ArrayBufferView(mut inner) => inner.to_vec(),
};

let bound_buffer = handle_potential_webgl_error!(self, self.bound_buffer(target), return);
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/webidls/WebGLRenderingContext.webidl
Expand Up @@ -496,7 +496,7 @@ interface WebGLRenderingContextBase
void bufferData(GLenum target, object? data, GLenum usage);
[Throws]
void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
void bufferSubData(GLenum target, GLintptr offset, /*[AllowShared]*/ BufferSource? data);
void bufferSubData(GLenum target, GLintptr offset, /*[AllowShared]*/ BufferSource data);

[WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
void clear(GLbitfield mask);
Expand Down

0 comments on commit bb2b6a7

Please sign in to comment.