Auto merge of #13872 - anholt:webgl-fbo, r=emilio

webgl: Add basic support for framebuffer attachments

This is by no means a complete implementation, but I've slowed down on working on it, so I think we should look at what it takes to merge the current code.  There are some major features missing, like initializing renderbuffers to 0 (uninitialized memory leak), tracking the attachments' attributes (width/height/format) for parameter requests, and lots of missing glCheckFramebufferStatus() validation.  On the other hand, this is enough to run some demos using FBOs.

---
<!-- 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
- [X] These changes fix #13639 (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. -->

<!-- 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/13872)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-10-27 21:39:15 -05:00 committed by GitHub
commit fbec79e920
23 changed files with 625 additions and 112 deletions

View file

@ -501,7 +501,7 @@ interface WebGLRenderingContextBase
[Throws]
void bufferSubData(GLenum target, GLintptr offset, object? data);
//[WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
[WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
void clear(GLbitfield mask);
void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void clearDepth(GLclampf depth);
@ -566,11 +566,11 @@ interface WebGLRenderingContextBase
void enableVertexAttribArray(GLuint index);
void finish();
void flush();
//void framebufferRenderbuffer(GLenum target, GLenum attachment,
// GLenum renderbuffertarget,
// WebGLRenderbuffer? renderbuffer);
//void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget,
// WebGLTexture? texture, GLint level);
void framebufferRenderbuffer(GLenum target, GLenum attachment,
GLenum renderbuffertarget,
WebGLRenderbuffer? renderbuffer);
void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget,
WebGLTexture? texture, GLint level);
void frontFace(GLenum mode);
void generateMipmap(GLenum target);
@ -626,8 +626,8 @@ interface WebGLRenderingContextBase
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type, object? pixels);
//void renderbufferStorage(GLenum target, GLenum internalformat,
// GLsizei width, GLsizei height);
void renderbufferStorage(GLenum target, GLenum internalformat,
GLsizei width, GLsizei height);
void sampleCoverage(GLclampf value, GLboolean invert);
void scissor(GLint x, GLint y, GLsizei width, GLsizei height);