Skip to content

Commit

Permalink
Auto merge of #13102 - anholt:webgl-is-program, r=emilio
Browse files Browse the repository at this point in the history
webgl: Add isProgram() support.

<!-- Please describe your changes on the following line: -->
webgl: Add isProgram() support.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

There's one failure still, where a deleted program should still be
considered to be a program until it's unbound.  However, I recently
made it so that we unbind at delete time, and we may need to partially
back that change out.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13102)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Aug 29, 2016
2 parents 11e8e42 + 847ab63 commit d37d4d6
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 86 deletions.
4 changes: 4 additions & 0 deletions components/script/dom/webglprogram.rs
Expand Up @@ -87,6 +87,10 @@ impl WebGLProgram {
}
}

pub fn is_deleted(&self) -> bool {
self.is_deleted.get()
}

/// glLinkProgram
pub fn link(&self) {
self.linked.set(false);
Expand Down
5 changes: 5 additions & 0 deletions components/script/dom/webglrenderingcontext.rs
Expand Up @@ -1403,6 +1403,11 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
frame_buffer.map_or(false, |buf| buf.target().is_some() && !buf.is_deleted())
}

// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn IsProgram(&self, program: Option<&WebGLProgram>) -> bool {
program.map_or(false, |p| !p.is_deleted())
}

// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7
fn IsRenderbuffer(&self, render_buffer: Option<&WebGLRenderbuffer>) -> bool {
render_buffer.map_or(false, |buf| buf.ever_bound() && !buf.is_deleted())
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/webidls/WebGLRenderingContext.webidl
Expand Up @@ -605,7 +605,7 @@ interface WebGLRenderingContextBase
[WebGLHandlesContextLoss] GLboolean isBuffer(WebGLBuffer? buffer);
//[WebGLHandlesContextLoss] GLboolean isEnabled(GLenum cap);
[WebGLHandlesContextLoss] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer);
//[WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program);
[WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program);
[WebGLHandlesContextLoss] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer);
[WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader);
[WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture);
Expand Down

This file was deleted.

Expand Up @@ -14,10 +14,7 @@
[WebGL test #14: gl.isShader(fragmentShader) should be true. Threw exception TypeError: gl.isShader is not a function]
expected: FAIL

[WebGL test #17: gl.isProgram(program) should be true. Threw exception TypeError: gl.isProgram is not a function]
expected: FAIL

[WebGL test #20: gl.isProgram(program) should be false. Threw exception TypeError: gl.isProgram is not a function]
[WebGL test #17: gl.isProgram(program) should be true. Was false.]
expected: FAIL

[WebGL test #21: gl.isShader(fragmentShader) should be false. Threw exception TypeError: gl.isShader is not a function]
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit d37d4d6

Please sign in to comment.