mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
webgl: Ensure that framebuffers have a color attachment before reading or writing.
This commit is contained in:
parent
80ed829241
commit
d179435eab
4 changed files with 129 additions and 4 deletions
|
@ -203,6 +203,16 @@ impl WebGLFramebuffer {
|
||||||
return self.status.get();
|
return self.status.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn check_status_for_rendering(&self) -> u32 {
|
||||||
|
let result = self.check_status();
|
||||||
|
if result == constants::FRAMEBUFFER_COMPLETE {
|
||||||
|
if self.color.borrow().is_none() {
|
||||||
|
return constants::FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
pub fn renderbuffer(&self, attachment: u32, rb: Option<&WebGLRenderbuffer>) -> WebGLResult<()> {
|
pub fn renderbuffer(&self, attachment: u32, rb: Option<&WebGLRenderbuffer>) -> WebGLResult<()> {
|
||||||
let binding = match attachment {
|
let binding = match attachment {
|
||||||
constants::COLOR_ATTACHMENT0 => &self.color,
|
constants::COLOR_ATTACHMENT0 => &self.color,
|
||||||
|
|
|
@ -339,7 +339,7 @@ impl WebGLRenderingContext {
|
||||||
// this: clear() and getParameter(IMPLEMENTATION_COLOR_READ_*).
|
// this: clear() and getParameter(IMPLEMENTATION_COLOR_READ_*).
|
||||||
fn validate_framebuffer(&self) -> WebGLResult<()> {
|
fn validate_framebuffer(&self) -> WebGLResult<()> {
|
||||||
match self.bound_framebuffer.get() {
|
match self.bound_framebuffer.get() {
|
||||||
Some(ref fb) if fb.check_status() != constants::FRAMEBUFFER_COMPLETE => {
|
Some(ref fb) if fb.check_status_for_rendering() != constants::FRAMEBUFFER_COMPLETE => {
|
||||||
Err(InvalidFramebufferOperation)
|
Err(InvalidFramebufferOperation)
|
||||||
},
|
},
|
||||||
_ => Ok(()),
|
_ => Ok(()),
|
||||||
|
|
|
@ -1,5 +1,91 @@
|
||||||
[framebuffer-object-attachment.html]
|
[framebuffer-object-attachment.html]
|
||||||
expected: CRASH
|
[WebGL test #474: at (0, 0) expected: 0,255,0,255 was 0,0,0,0]
|
||||||
[WebGL test #1: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #475: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be 36053. Was 36054.]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #465: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be 36053. Was 36054.]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #547: getError expected: INVALID_OPERATION. Was INVALID_FRAMEBUFFER_OPERATION : After CopyTexSubImage2D from missing attachment]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #463: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be 36053. Was 36054.]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #478: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be 36053. Was 36054.]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #470: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be 36053. Was 36054.]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #1: gl.checkFramebufferStatus(gl.FRAMEBUFFER) returned 36054]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #543: getError expected: INVALID_OPERATION. Was INVALID_FRAMEBUFFER_OPERATION : After ReadPixels from missing attachment]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #2: gl.checkFramebufferStatus(gl.FRAMEBUFFER) returned 36054]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #469: at (0, 0) expected: 0,255,0,255 was 0,0,0,0]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #483: getError expected: NO_ERROR. Was INVALID_FRAMEBUFFER_OPERATION : ]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #477: at (0, 0) expected: 0,255,0,255 was 0,0,0,0]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #476: getError expected: NO_ERROR. Was INVALID_FRAMEBUFFER_OPERATION : ]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #473: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be 36053. Was 36054.]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #467: at (0, 0) expected: 0,255,0,255 was 0,0,0,0]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #468: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be 36053. Was 36054.]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #3: gl.checkFramebufferStatus(gl.FRAMEBUFFER) returned 36054]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #466: getError expected: NO_ERROR. Was INVALID_FRAMEBUFFER_OPERATION : ]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #471: getError expected: NO_ERROR. Was INVALID_FRAMEBUFFER_OPERATION : ]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #545: getError expected: INVALID_OPERATION. Was INVALID_FRAMEBUFFER_OPERATION : After CopyTexImage2D from missing attachment]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #481: getError expected: NO_ERROR. Was INVALID_FRAMEBUFFER_OPERATION : ]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #507: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT was FRAMEBUFFER_UNSUPPORTED or FRAMEBUFFER_UNSUPPORTED]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #482: at (0, 0) expected: 0,255,0,255 was 0,0,0,0]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #510: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT was FRAMEBUFFER_UNSUPPORTED or FRAMEBUFFER_UNSUPPORTED]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #480: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be 36053. Was 36054.]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #472: at (0, 0) expected: 0,255,0,255 was 0,0,0,0]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #479: at (0, 0) expected: 0,255,0,255 was 0,0,0,0]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #464: at (0, 0) expected: 0,255,0,255 was 0,0,0,0]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #525: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT was FRAMEBUFFER_UNSUPPORTED or FRAMEBUFFER_UNSUPPORTED]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,31 @@
|
||||||
[framebuffer-object-attachment.html]
|
[framebuffer-object-attachment.html]
|
||||||
expected: CRASH
|
[WebGL test #13: checkFramebufferStatus expects [FRAMEBUFFER_COMPLETE\], was FRAMEBUFFER_INCOMPLETE_ATTACHMENT]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #20: checkFramebufferStatus expects [FRAMEBUFFER_COMPLETE\], was FRAMEBUFFER_INCOMPLETE_ATTACHMENT]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #30: getError expected: NO_ERROR. Was INVALID_ENUM : ]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #21: checkFramebufferStatus expects [FRAMEBUFFER_COMPLETE\], was FRAMEBUFFER_UNSUPPORTED]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #25: checkFramebufferStatus expects [FRAMEBUFFER_COMPLETE\], was FRAMEBUFFER_UNSUPPORTED]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #23: checkFramebufferStatus expects [FRAMEBUFFER_COMPLETE\], was FRAMEBUFFER_UNSUPPORTED]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #24: checkFramebufferStatus expects [FRAMEBUFFER_COMPLETE\], was FRAMEBUFFER_UNSUPPORTED]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #22: checkFramebufferStatus expects [FRAMEBUFFER_COMPLETE\], was FRAMEBUFFER_UNSUPPORTED]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #14: getError expected: NO_ERROR. Was INVALID_ENUM : ]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[WebGL test #16: gl.getParameter(gl.RED_BITS) + gl.getParameter(gl.GREEN_BITS) + gl.getParameter(gl.BLUE_BITS) + gl.getParameter(gl.ALPHA_BITS) >= 16 should be true. Was false.]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue