Bug 1316544 - Fix conformance test fail in texture-image-webgl-specific r=jgilbert
authorChih-Yi Leu <cleu@mozilla.com>
Thu, 17 Nov 2016 21:22:00 +0100
changeset 323285 9dc2ef01f861a6e710d885f074f5f7cee5207471
parent 323284 f438bfb22339793b15dc1a63140dbbb85a998e5f
child 323286 1c66c26641eadba32e72da8ff00837d2d904700d
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersjgilbert
bugs1316544
milestone53.0a1
Bug 1316544 - Fix conformance test fail in texture-image-webgl-specific r=jgilbert
dom/canvas/WebGLTexture.h
dom/canvas/WebGLTextureUpload.cpp
--- a/dom/canvas/WebGLTexture.h
+++ b/dom/canvas/WebGLTexture.h
@@ -244,17 +244,17 @@ protected:
                                        GLint level, uint32_t width, uint32_t height,
                                        uint32_t depth,
                                        WebGLTexture::ImageInfo** const out_imageInfo);
     bool ValidateTexImageSelection(const char* funcName, TexImageTarget target,
                                    GLint level, GLint xOffset, GLint yOffset,
                                    GLint zOffset, uint32_t width, uint32_t height,
                                    uint32_t depth,
                                    WebGLTexture::ImageInfo** const out_imageInfo);
-    bool ValidateCopyTexImageForFeedback(const char* funcName, uint32_t level) const;
+    bool ValidateCopyTexImageForFeedback(const char* funcName, uint32_t level, GLint layer = 0) const;
 
     bool ValidateUnpack(const char* funcName, const webgl::TexUnpackBlob* blob,
                         bool isFunc3D, const webgl::PackingInfo& srcPI) const;
 public:
     void TexStorage(const char* funcName, TexTarget target, GLsizei levels,
                     GLenum sizedFormat, GLsizei width, GLsizei height, GLsizei depth);
     void TexImage(const char* funcName, TexImageTarget target, GLint level,
                   GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth,
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -1913,24 +1913,25 @@ ValidateCopyDestUsage(const char* funcNa
                                      funcName, srcFormat->name, dstFormat->name);
         return nullptr;
     }
 
     return dstUsage;
 }
 
 bool
-WebGLTexture::ValidateCopyTexImageForFeedback(const char* funcName, uint32_t level) const
+WebGLTexture::ValidateCopyTexImageForFeedback(const char* funcName, uint32_t level, GLint layer) const
 {
     const auto& fb = mContext->mBoundReadFramebuffer;
     if (fb) {
         const auto& attach = fb->ColorReadBuffer();
         MOZ_ASSERT(attach);
 
         if (attach->Texture() == this &&
+            attach->Layer() == layer &&
             uint32_t(attach->MipLevel()) == level)
         {
             // Note that the TexImageTargets *don't* have to match for this to be
             // undefined per GLES 3.0.4 p211, thus an INVALID_OP in WebGL.
             mContext->ErrorInvalidOperation("%s: Feedback loop detected, as this texture"
                                             " is already attached to READ_FRAMEBUFFER's"
                                             " READ_BUFFER-selected COLOR_ATTACHMENT%u.",
                                             funcName, attach->mAttachmentPoint);
@@ -2111,17 +2112,17 @@ WebGLTexture::CopyTexSubImage(const char
 
     const webgl::FormatUsageInfo* srcUsage;
     uint32_t srcWidth;
     uint32_t srcHeight;
     if (!mContext->ValidateCurFBForRead(funcName, &srcUsage, &srcWidth, &srcHeight))
         return;
     auto srcFormat = srcUsage->format;
 
-    if (!ValidateCopyTexImageForFeedback(funcName, level))
+    if (!ValidateCopyTexImageForFeedback(funcName, level, zOffset))
         return;
 
     ////////////////////////////////////
     // Check that source and dest info are compatible
 
     if (!ValidateCopyTexImageFormats(mContext, funcName, srcFormat, dstFormat))
         return;