Bug 948002 - Add extra comments of meaning of GLenum to IsValidFBOXXX calls. r=jgilbert
authorDan Glastonbury <dglastonbury@mozilla.com>
Fri, 24 Jan 2014 16:28:47 +1000
changeset 181616 56af0a9846fd5698ac8e03f023333e94e650d797
parent 181615 2b636fd22dd76cb1df680f968b591514a323769f
child 181617 9f2bf80444ebe28a3482470b3dac6fb22d03b67d
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs948002
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 948002 - Add extra comments of meaning of GLenum to IsValidFBOXXX calls. r=jgilbert
content/canvas/src/WebGLFramebuffer.cpp
--- a/content/canvas/src/WebGLFramebuffer.cpp
+++ b/content/canvas/src/WebGLFramebuffer.cpp
@@ -122,16 +122,20 @@ WebGLFramebuffer::Attachment::RectangleO
         return Texture()->ImageInfoAt(mTexImageTarget, mTexImageLevel);
     } else if (Renderbuffer()) {
         return *Renderbuffer();
     }
 
     MOZ_CRASH("Should not get here.");
 }
 
+/* The following IsValidFBOTextureXXX functions check the internal
+   format that is used by GL or GL ES texture formats.  This
+   corresponds to the state that is stored in
+   WebGLTexture::ImageInfo::InternalFormat()*/
 static inline bool
 IsValidFBOTextureColorFormat(GLenum internalFormat)
 {
     return (
         /* linear 8-bit formats */
         internalFormat == LOCAL_GL_ALPHA ||
         internalFormat == LOCAL_GL_LUMINANCE ||
         internalFormat == LOCAL_GL_LUMINANCE_ALPHA ||
@@ -144,51 +148,60 @@ IsValidFBOTextureColorFormat(GLenum inte
         internalFormat == LOCAL_GL_ALPHA32F_ARB ||
         internalFormat == LOCAL_GL_LUMINANCE32F_ARB ||
         internalFormat == LOCAL_GL_LUMINANCE_ALPHA32F_ARB ||
         internalFormat == LOCAL_GL_RGB32F_ARB ||
         internalFormat == LOCAL_GL_RGBA32F_ARB);
 }
 
 static inline bool
-IsValidFBOTextureDepthFormat(GLenum internalFormat) {
+IsValidFBOTextureDepthFormat(GLenum internalFormat)
+{
     return (
         internalFormat == LOCAL_GL_DEPTH_COMPONENT ||
         internalFormat == LOCAL_GL_DEPTH_COMPONENT16 ||
         internalFormat == LOCAL_GL_DEPTH_COMPONENT32);
 }
 
 static inline bool
-IsValidFBOTextureDepthStencilFormat(GLenum internalFormat) {
+IsValidFBOTextureDepthStencilFormat(GLenum internalFormat)
+{
     return (
         internalFormat == LOCAL_GL_DEPTH_STENCIL ||
         internalFormat == LOCAL_GL_DEPTH24_STENCIL8);
 }
 
+/* The following IsValidFBORenderbufferXXX functions check the internal
+   format that is stored by WebGLRenderbuffer::InternalFormat(). Valid
+   values can be found in WebGLContext::RenderbufferStorage. */
 static inline bool
-IsValidFBORenderbufferColorFormat(GLenum internalFormat) {
+IsValidFBORenderbufferColorFormat(GLenum internalFormat)
+{
     return (
         internalFormat == LOCAL_GL_RGB565 ||
         internalFormat == LOCAL_GL_RGB5_A1 ||
         internalFormat == LOCAL_GL_RGBA4 ||
         internalFormat == LOCAL_GL_SRGB8_ALPHA8_EXT);
 }
 
 static inline bool
-IsValidFBORenderbufferDepthFormat(GLenum internalFormat) {
+IsValidFBORenderbufferDepthFormat(GLenum internalFormat)
+{
     return internalFormat == LOCAL_GL_DEPTH_COMPONENT16;
 }
 
 static inline bool
-IsValidFBORenderbufferDepthStencilFormat(GLenum internalFormat) {
-    return internalFormat == LOCAL_GL_DEPTH24_STENCIL8;
+IsValidFBORenderbufferDepthStencilFormat(GLenum internalFormat)
+{
+    return internalFormat == LOCAL_GL_DEPTH_STENCIL;
 }
 
 static inline bool
-IsValidFBORenderbufferStencilFormat(GLenum internalFormat) {
+IsValidFBORenderbufferStencilFormat(GLenum internalFormat)
+{
     return internalFormat == LOCAL_GL_STENCIL_INDEX8;
 }
 
 bool
 WebGLFramebuffer::Attachment::IsComplete() const
 {
     if (!HasImage())
         return false;