vcl/opengl/texture.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
New commits: commit 1e3869ea1ce71922280ad9fc4e95e52fed722571 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Sun Apr 14 18:22:21 2019 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Tue Apr 16 13:45:12 2019 +0200 in dbgutil mode initialize texture contents with predictable garbage So that textures do not start with random uninitialized contents. Change-Id: Ie240f5f71ed77d5c6c22a120e96540a2d0d7c2ed Reviewed-on: https://gerrit.libreoffice.org/70773 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx index 19b48967e314..e0af455194c7 100644 --- a/vcl/opengl/texture.cxx +++ b/vcl/opengl/texture.cxx @@ -65,7 +65,21 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nWidth, int nHeight, bool bAllocate ) CHECK_GL_ERROR(); if( bAllocate ) { +#ifdef DBG_UTIL + std::vector< sal_uInt8 > buffer; + buffer.resize( nWidth * nHeight * 4 ); + for( size_t i = 0; i < size_t( nWidth * nHeight ); ++i ) + { // pre-fill the texture with deterministic garbage + bool odd = (i & 0x01); + buffer[ i * 4 ] = odd ? 0x40 : 0xBF; + buffer[ i * 4 + 1 ] = 0x80; + buffer[ i * 4 + 2 ] = odd ? 0xBF : 0x40; + buffer[ i * 4 + 3 ] = 0xFF; + } + glTexImage2D( GL_TEXTURE_2D, 0, constInternalFormat, nWidth, nHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer.data()); +#else glTexImage2D( GL_TEXTURE_2D, 0, constInternalFormat, nWidth, nHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr ); +#endif CHECK_GL_ERROR(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits