Bug 1316544 - Fix conformance test fail in texture-image-webgl-specific r=jgilbert a=gchang
authorChih-Yi Leu <cleu@mozilla.com>
Thu, 17 Nov 2016 21:22:00 +0100
changeset 352972 1977f2887f5c9c6c8518a4bcf98660fd330227ec
parent 352971 d0afc1865fcc78b86da8eafe642c1fc0f764bdbc
child 352973 862d2138d2cbf9093dadcebb8800d10e565b6463
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, gchang
bugs1316544
milestone52.0a2
Bug 1316544 - Fix conformance test fail in texture-image-webgl-specific r=jgilbert a=gchang
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;