Remove getDataSize and setPixels from PixelBufferAccess.
authorJarkko Pöyry <jpoyry@google.com>
Mon, 20 Apr 2015 22:13:56 +0000 (15:13 -0700)
committerJarkko Pöyry <jpoyry@google.com>
Tue, 21 Apr 2015 20:19:17 +0000 (13:19 -0700)
- Remove functions that were not safe to use with non-tightly packed
  pixel buffer accesses.

Change-Id: I32b83b089da40ccd052f9d7250498a9c4aa4036f

framework/common/tcuTexture.cpp
framework/common/tcuTexture.hpp
modules/gles3/functional/es3fPixelBufferObjectTests.cpp
modules/gles31/functional/es31fShaderImageLoadStoreTests.cpp

index 1100e3b..02e5007 100644 (file)
@@ -600,12 +600,6 @@ PixelBufferAccess::PixelBufferAccess (TextureLevel& level)
 {
 }
 
-void PixelBufferAccess::setPixels (const void* buf, int bufSize) const
-{
-       DE_ASSERT(bufSize == getDataSize());
-       deMemcpy(getDataPtr(), buf, bufSize);
-}
-
 Vec4 ConstPixelBufferAccess::getPixel (int x, int y, int z) const
 {
        DE_ASSERT(de::inBounds(x, 0, m_size.x()));
index 2fb0d6a..e07402d 100644 (file)
@@ -295,8 +295,6 @@ public:
        const IVec3&                    getPitch                                        (void) const    { return m_pitch;                                       }
 
        const void*                             getDataPtr                                      (void) const    { return m_data;                                        }
-       int                                             getDataSize                                     (void) const    { return m_size.z()*m_pitch.z();        }
-
        const void*                             getPixelPtr                                     (int x, int y, int z = 0) const { return (const deUint8*)m_data + x * m_pitch.x() + y * m_pitch.y() + z * m_pitch.z(); }
 
        Vec4                                    getPixel                                        (int x, int y, int z = 0) const;
@@ -349,7 +347,6 @@ public:
        void*                           getDataPtr                      (void) const { return m_data; }
        void*                           getPixelPtr                     (int x, int y, int z = 0) const { return (deUint8*)m_data + x * m_pitch.x() + y * m_pitch.y() + z * m_pitch.z(); }
 
-       void                            setPixels                       (const void* buf, int bufSize) const;
        void                            setPixel                        (const tcu::Vec4& color, int x, int y, int z = 0) const;
        void                            setPixel                        (const tcu::IVec4& color, int x, int y, int z = 0) const;
        void                            setPixel                        (const tcu::UVec4& color, int x, int y, int z = 0) const { setPixel(color.cast<int>(), x, y, z); }
index 2d92630..c98d4ab 100644 (file)
@@ -533,18 +533,20 @@ TestCase::IterateResult ReadPixelsTest::iterate(void)
                DE_ASSERT(false);
        }
 
-       tcu::Texture2D readRefrence(readFormat, width, height);
+       tcu::Texture2D  readRefrence    (readFormat, width, height);
+       const int               readDataSize    = readRefrence.getWidth() * readRefrence.getHeight() * readFormat.getPixelSize();
+
        readRefrence.allocLevel(0);
 
        GLuint pixelBuffer = (GLuint)-1;
 
        GLU_CHECK_CALL(glGenBuffers(1, &pixelBuffer));
        GLU_CHECK_CALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, pixelBuffer));
-       GLU_CHECK_CALL(glBufferData(GL_PIXEL_PACK_BUFFER, readRefrence.getLevel(0).getDataSize(), NULL, GL_STREAM_READ));
+       GLU_CHECK_CALL(glBufferData(GL_PIXEL_PACK_BUFFER, readDataSize, NULL, GL_STREAM_READ));
 
        GLU_CHECK_CALL(glReadPixels(0, 0, width, height, readPixelsFormat, readPixelsType, 0));
 
-       const deUint8* bufferData = (const deUint8*)glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, readRefrence.getLevel(0).getDataSize(), GL_MAP_READ_BIT);
+       const deUint8* bufferData = (const deUint8*)glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, readDataSize, GL_MAP_READ_BIT);
        GLU_CHECK_MSG("glMapBufferRange() failed");
 
        tcu::ConstPixelBufferAccess readResult(readFormat, width, height, 1, bufferData);
index b518678..833769c 100644 (file)
@@ -1025,14 +1025,14 @@ static bool readBufferTextureWithMappingAndVerify (const RenderContext&                 render
 {
        tcu::TextureLevel                       result                  (textureFormat, imageSize, 1);
        const PixelBufferAccess         resultAccess    = result.getAccess();
-       DE_ASSERT(resultAccess.getDataSize() == imageSize * textureFormat.getPixelSize());
+       const int                                       dataSize                = imageSize * textureFormat.getPixelSize();
 
        const tcu::ScopedLogSection section(glLog.getLog(), "Verification", "Result verification (read texture's buffer with a mapping)");
        glLog.glBindBuffer(GL_TEXTURE_BUFFER, bufferGL);
 
        {
-               const BufferMemMap bufMap(renderCtx.getFunctions(), GL_TEXTURE_BUFFER, 0, resultAccess.getDataSize(), GL_MAP_READ_BIT);
-               deMemcpy(resultAccess.getDataPtr(), bufMap.getPtr(), resultAccess.getDataSize());
+               const BufferMemMap bufMap(renderCtx.getFunctions(), GL_TEXTURE_BUFFER, 0, dataSize, GL_MAP_READ_BIT);
+               deMemcpy(resultAccess.getDataPtr(), bufMap.getPtr(), dataSize);
        }
 
        return verifyLayer(glLog.getLog(), resultAccess, 0);