← Back to team overview

dx-packages team mailing list archive

[Bug 1083149] Re: Invalid texture operations

 

** Changed in: nux (Ubuntu)
       Status: New => Fix Released

** Changed in: nux (Ubuntu)
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of DX
Packages, which is subscribed to nux in Ubuntu.
Matching subscriptions: dx-packages
https://bugs.launchpad.net/bugs/1083149

Title:
  Invalid texture operations

Status in Nux:
  Fix Released
Status in nux package in Ubuntu:
  Fix Released

Bug description:
  ** Critical Design Error!! **

  In IOpenGLTexture2D.cpp the IOpenGLTexture2D destructor is called 2
  times for some textures and the UnReference function can't find the
  already deleted object. We end up with a loop and we see nothing.

  How to reproduce it:
  First of all you need to compile without optimisations (otherwise you will see nothing):
  export CXXFLAGS=-O0
  export CFLAGS=-O0
  make AM_DEFAULT_VERBOSITY=1

  Then add this line at the beginning of the IOpenGLTexture2D::~IOpenGLTexture2D() destructor:
  printf("IOpenGLTexture2D texture destructor: %p, function called: %s\n", this, __PRETTY_FUNCTION__);

  Then go to the gputests and run the texture_copy_blur example.
  You won't get an image and at some points you will get prints like that:

  IOpenGLTexture2D texture destructor: 0xa917338, function called: virtual nux::IOpenGLTexture2D::~IOpenGLTexture2D()
  IOpenGLTexture2D texture destructor: 0xa917338, function called: virtual nux::IOpenGLTexture2D::~IOpenGLTexture2D()

  The exact same function (same pointer, same name, that is the
  IOpenGLTexture destructor) is called 2 times for some textures.

  Now, if you change the case RTTEXTURE of the function  void
  RenderingStats::UnRegister(IOpenGLResource *GraphicsObject) in
  RunTimeStats.cpp to look like this:

  case RTTEXTURE:
        {
          int id = NUX_STATIC_CAST(IOpenGLBaseTexture *, GraphicsObject)->GetOpenGLID();
          if(!glIsTexture(id))
            printf("I am not a texture, I can't be deleted\n");

          _texture_2d_array.erase(std::remove(_texture_2d_array.begin(),
  _texture_2d_array.end(), id), _texture_2d_array.end());

          m_NumTex2D--;
          m_GPUSizeTex2D -= GetTextureSize(NUX_REINTERPRET_CAST(IOpenGLBaseTexture *, GraphicsObject));
          m_TotalGPUSize -= m_GPUSizeTex2D;
          break;
        }

  and recompile (WITHOUT optimisations) you will get something like
  this:

  IOpenGLTexture2D texture destructor: 0xa917338, function called: virtual nux::IOpenGLTexture2D::~IOpenGLTexture2D()
  I am not a texture, I can't be deleted
  IOpenGLTexture2D texture destructor: 0xa917338, function called: virtual nux::IOpenGLTexture2D::~IOpenGLTexture2D()
  I am not a texture, I can't be deleted
  IOpenGLTexture2D texture destructor: 0xa917338, function called: virtual nux::IOpenGLTexture2D::~IOpenGLTexture2D()
  I am not a texture, I can't be deleted

  Because an already deleted texture can't be deleted again.

  If we add optimisations again, the texture_copy_blur example runs as
  usual but it still tries to delete the same texture multiple times.

  comment #2: This happens because 2 different IOpenGLTexture2D objects
  have the same texture id.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nux/+bug/1083149/+subscriptions