Giter Club home page Giter Club logo

Comments (12)

BearishSun avatar BearishSun commented on June 20, 2024

How was this texture asset created? The texture is a cubemap with 4 array slices which is strange.

from bsf.

BearishSun avatar BearishSun commented on June 20, 2024

Never mind that, was looking at the wrong place in the debugger.

from bsf.

hhyyrylainen avatar hhyyrylainen commented on June 20, 2024

I didn't have an actual skybox. So I used the option to import a single texture as all the skybox faces. bs::CubemapSourceType::Single

from bsf.

BearishSun avatar BearishSun commented on June 20, 2024

I cannot reproduce this issue, tried with OpenGL on Windows and Ubuntu, using the Skeletal Example and the provided cubemap asset, both debug and release build configurations.

It could be something hardware specific. What is your GPU?

from bsf.

hhyyrylainen avatar hhyyrylainen commented on June 20, 2024

My GPU is GTX 1080 Ti

from bsf.

BearishSun avatar BearishSun commented on June 20, 2024

That's the same as mine. Since I cannot reproduce the only option is you to debug it on your end. Try breaking with the debugger when it crashes and see if you can deduce in more detail which part failed and if any of the input values look weird.

from bsf.

hhyyrylainen avatar hhyyrylainen commented on June 20, 2024

To me everything just looks initialized, and with possible sizes:

(gdb) p *this
$2 = (bs::ct::GLTextureBuffer) {
  <bs::ct::GLPixelBuffer> = {
    _vptr.GLPixelBuffer = 0x7ffff42d81e0 <vtable for bs::ct::GLTextureBuffer+16>, 
    mSizeInBytes = 16777216, 
    mUsage = bs::GBU_STATIC, 
    mIsLocked = false, 
    mWidth = 2048, 
    mHeight = 2048, 
    mDepth = 1, 
    mFormat = bs::PF_RGBA8, 
    mCurrentLock = {
      <bs::GpuResourceData> = {
        <bs::IReflectable> = {
          _vptr.IReflectable = 0x7ffff7f061b0 <vtable for bs::PixelData+16>
        }, 
        members of bs::GpuResourceData: 
        mData = 0x0, 
        mOwnsData = false, 
        mLocked = false
      }, 
      members of bs::PixelData: 
      mExtents = {
        left = 0, 
        top = 0, 
        right = 0, 
        bottom = 0, 
        front = 0, 
        back = 1
      }, 
      mFormat = bs::PF_UNKNOWN, 
      mRowPitch = 0, 
      mSlicePitch = 0
    }, 
    mLockedBox = {
      left = 0, 
      top = 0, 
      right = 1, 
      bottom = 1, 
      front = 0, 
      back = 1
    }, 
    mBuffer = {
      <bs::GpuResourceData> = {
        <bs::IReflectable> = {
          _vptr.IReflectable = 0x7ffff7f061b0 <vtable for bs::PixelData+16>
        }, 
        members of bs::GpuResourceData: 
        mData = 0x0, 
        mOwnsData = false, 
        mLocked = false
      }, 
      members of bs::PixelData: 
      mExtents = {
        left = 0, 
        top = 0, 
        right = 2048, 
        bottom = 2048, 
        front = 0, 
        back = 1
      }, 
      mFormat = bs::PF_RGBA8, 
      mRowPitch = 2048, 
      mSlicePitch = 4194304
    }, 
    mCurrentLockOptions = bs::GBL_READ_WRITE
  }, 
  members of bs::ct::GLTextureBuffer: 
  mTarget = 34067, 
  mFaceTarget = 34069, 
  mTextureID = 125, 
  mFace = 0, 
  mLevel = 0, 
  mMultisampleCount = 0, 
  mHwGamma = false
}
(gdb) info args
this = 0x7fffeae08aa0
data = @0x4715590: {
  <bs::GpuResourceData> = {
    <bs::IReflectable> = {
      _vptr.IReflectable = 0x7ffff7f061b0 <vtable for bs::PixelData+16>
    }, 
    members of bs::GpuResourceData: 
    mData = 0x7fffb9fec010 "\035\071M\377\035\071M\377\034\071M\377\034\071M\377\034\071M\377\035\071M\377\035:M\377\036;M\377\036;M\377\037;M\377\037;M\377\037;M\377\037;M\377\037;M\377\037;M\377\037;M\377\036:M\377\035\071M\377\035\071M\377\034\071M\377\034\071M\377\035\071M\377\035\071M\377\035\071M\377\035\071M\377\035\071M\377\035\071M\377\035\071M\377\035:M\377\035:M\377\035:M\377\035:M\377\035:M\377\035\071M\377\035\071M\377\035\071M\377\035:M\377\035:M\377\035:M\377\035:M\377\035:M\377\035\071M\377\035\071M\377\035:M\377\035:M\377\035\071M\377\035\071M\377\035\071M\377\035:M\377\035:M\377"..., 
    mOwnsData = true, 
    mLocked = true
  }, 
  members of bs::PixelData: 
  mExtents = {
    left = 0, 
    top = 0, 
    right = 2048, 
    bottom = 2048, 
    front = 0, 
    back = 1
  }, 
  mFormat = bs::PF_RGBA8, 
  mRowPitch = 8192, 
  mSlicePitch = 16777216
}
dest = @0x7ffff4d7d220: {
  left = 0, 
  top = 0, 
  right = 2048, 
  bottom = 2048, 
  front = 0, 
  back = 1
}
(gdb) p data.getData()
$3 = (bs::UINT8 *) 0x7fffb9fec010 "\035\071M\377\035\071M\377\034\071M\377\034\071M\377\034\071M\377\035\071M\377\035:M\377\036;M\377\036;M\377\037;M\377\037;M\377\037;M\377\037;M\377\037;M\377\037;M\377\037;M\377\036:M\377\035\071M\377\035\071M\377\034\071M\377\034\071M\377\035\071M\377\035\071M\377\035\071M\377\035\071M\377\035\071M\377\035\071M\377\035\071M\377\035:M\377\035:M\377\035:M\377\035:M\377\035:M\377\035\071M\377\035\071M\377\035\071M\377\035:M\377\035:M\377\035:M\377\035:M\377\035:M\377\035\071M\377\035\071M\377\035:M\377\035:M\377\035\071M\377\035\071M\377\035\071M\377\035:M\377\035:M\377"...
(gdb) p data.getSize()
$4 = 67108864

Edit: except it looks like the data buffer size (67108864) is different than the texture's size property (16777216)...

from bsf.

BearishSun avatar BearishSun commented on June 20, 2024

Is your app running on an older version of bsf, but the texture was imported using a newer version?

That would explain what I'm seeing:

  • mBuffer.mSlicePitch is 4194304, which is the number of pixels, not bytes
  • data.getSize() returns the 4 times the required number of bytes (again, its interpreting the mSlicePitch as the number of pixels and then multiplying by 4 to convert to number of bytes)

Meaning of mSlicePitch was recently changed to store number of bytes, which would explain the discrepancy.

from bsf.

hhyyrylainen avatar hhyyrylainen commented on June 20, 2024

That is likely correct reasoning. I'm using the default version of the samples, with the version of bsf it's set to use. git submodule update does nothing. But the asset was imported with the version my PR (#391). Then, this is different from the (likely) timing issue with the skybox loading causing a crash.

from bsf.

hhyyrylainen avatar hhyyrylainen commented on June 20, 2024

I have not gotten this crash after I did this change: https://discourse.bsframework.io/t/resource-caching-doesnt-work/499/10?u=hhyyrylainen
That may have fixed it? Maybe it was an issue with something not waiting for the resource properly without registering the asset path?

from bsf.

BearishSun avatar BearishSun commented on June 20, 2024

I'll close it for now, if you get the issue again feel free to re-open.

from bsf.

hhyyrylainen avatar hhyyrylainen commented on June 20, 2024

I think I got this again (I cut the on exit handler code):

#17 0x00007f6ebd21fe50 in on_exit () at /lib64/libc.so.6
#18 0x00007f6ebdddd331 in bs::signalHandler(int, siginfo_t*, void*) (signal=11, info=<optimized out>, context=<optimized out>)
    at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfUtility/Private/Unix/BsUnixCrashHandler.cpp:38
#19 0x00007f6ebd6f7070 in <signal handler called> () at /lib64/libpthread.so.0
#20 0x00007f6e544e192c in std::__shared_ptr<bs::ct::GLPixelBuffer, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<bs::ct::GLPixcelBuffer, (__gnu_cxx::_Lock_policy)2> const&) (this=0x7f6dd2fa50c0) at /usr/include/c++/8/bits/shared_ptr_base.h:1165
#21 0x00007f6e544e192c in std::shared_ptr<bs::ct::GLPixelBuffer>::shared_ptr(std::shared_ptr<bs::ct::GLPixelBuffer> const&) (this=0x7f6dd2fa50c0) at /usr/include/c++/8/bits/shared_ptr.h:129
#22 0x00007f6e544e192c in bs::ct::GLTexture::getBuffer(unsigned int, unsigned int) (this=this@entry=0x90c6040, face=0, mipmap=0) at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfGLRenderAPI/BsGLTexture.cpp:539
#23 0x00007f6e544ec05a in bs::ct::GLRenderTexture::initialize() (this=<optimized out>) at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfCore/RenderAPI/BsTextureView.h:75
#24 0x00007f6ebe2048c8 in bs::ct::TextureManager::createRenderTexture(bs::ct::RENDER_TEXTURE_DESC const&, unsigned int) (this=<optimized out>, desc=..., deviceIdx=deviceIdx@entry=0) at /usr/include/c++/8/bits/shared_ptr_base.h:1018
#25 0x00007f6ebe0d8253 in bs::ct::RenderTexture::create(bs::ct::RENDER_TEXTURE_DESC const&, unsigned int) (desc=..., deviceIdx=deviceIdx@entry=0) at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfCore/RenderAPI/BsRenderTexture.cpp:230
#26 0x00007f6e4c4dc304 in bs::ct::RenderBeastIBLUtility::downsampleCubemap(std::shared_ptr<bs::ct::Texture> const&, unsigned int, std::shared_ptr<bs::ct::Texture> const&, unsigned int) (src=std::shared_ptr<bs::ct::Texture> (use count 3, weak count 1) = {...}, srcMip=1, dst=std::shared_ptr<bs::ct::Texture> (use count 5, weak count 1) = {...}, dstMip=0) at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfRenderBeast/BsRenderBeastIBLUtility.cpp:586
#27 0x00007f6e4c4dc602 in bs::ct::RenderBeastIBLUtility::scaleCubemap(std::shared_ptr<bs::ct::Texture> const&, unsigned int, std::shared_ptr<bs::ct::Texture> const&, unsigned int) const (this=<optimized out>, src=std::shared_ptr<bs::ct::Texture> (use count 6, weak count 1) = {...}, srcMip=1, dst=std::shared_ptr<bs::ct::Texture> (use count 5, weak count 1) = {...}, dstMip=0) at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfRenderBeast/BsRenderBeastIBLUtility.cpp:572
#28 0x00007f6ebdf74f2e in bs::Skybox::<lambda()>::operator() (__closure=0x7948150) at /usr/include/c++/8/ext/atomicity.h:96
#29 0x00007f6ebdf74f2e in std::_Function_handler<bool(), bs::Skybox::filterTexture()::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...) at /usr/include/c++/8/bits/std_function.h:282
#30 0x00007f6ebdf1a3f7 in std::function<bool ()>::operator()() const (this=<optimized out>) at /usr/include/c++/8/bits/std_function.h:682
#31 0x00007f6ebdf1a3f7 in bs::ct::Renderer::<lambda()>::operator() (__closure=<optimized out>) at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfCore/Renderer/BsRenderer.cpp:113
#32 0x00007f6ebdf1a3f7 in bs::ct::Renderer::processTasks(bool, unsigned long) (this=this@entry=0x8f7990, forceAll=forceAll@entry=false, upToFrame=upToFrame@entry=1417) at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfCore/Renderer/BsRenderer.cpp:114
#33 0x00007f6e4c460812 in bs::ct::RenderBeast::renderAllCore(bs::ct::FrameTimings, bs::PerFrameData) (this=0x8f7990, timings=..., perFrameData=...) at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfRenderBeast/BsRenderBeast.cpp:394
#34 0x00007f6ebddf1cb1 in std::function<void ()>::operator()() const (this=0xb861790) at /usr/include/c++/8/bits/std_function.h:682
#35 0x00007f6ebddf1cb1 in bs::CommandQueueBase::playbackWithNotify(std::queue<bs::QueuedCommand, std::deque<bs::QueuedCommand, bs::StdAlloc<bs::QueuedCommand, bs::GenAlloc> > >*, std::function<void (unsigned int)>) (this=<optimized out>, commands=<optimized out>, notifyCallback=...) at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfCore/CoreThread/BsCommandQueue.cpp:126
#36 0x00007f6ebddf29aa in bs::CommandQueueBase::playback(std::queue<bs::QueuedCommand, std::deque<bs::QueuedCommand, bs::StdAlloc<bs::QueuedCommand, bs::GenAlloc> > >*) (this=<optimized out>, commands=<optimized out>) at /usr/include/c++/8/bits/std_function.h:395
#37 0x00007f6ebddf1cb1 in std::function<void ()>::operator()() const (this=0xab7e7f0) at /usr/include/c++/8/bits/std_function.h:682
#38 0x00007f6ebddf1cb1 in bs::CommandQueueBase::playbackWithNotify(std::queue<bs::QueuedCommand, std::deque<bs::QueuedCommand, bs::StdAlloc<bs::QueuedCommand, bs::GenAlloc> > >*, std::function<void (unsigned int)>) (this=this@entry=0xedb5a0, commands=<optimized out>, commands@entry=0x7f6dc4100b90, notifyCallback=...) at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfCore/CoreThread/BsCommandQueue.cpp:126
#39 0x00007f6ebddfe28d in bs::CoreThread::runCoreThread() (this=0x902a40) at /usr/include/c++/8/bits/std_function.h:87
#40 0x00007f6ebdd6e46c in std::function<void ()>::operator()() const (this=0x7f6dd2fa7ba0) at /usr/include/c++/8/bits/std_function.h:682
#41 0x00007f6ebdd6e46c in bs::PooledThread::run() (this=0xb0ff00) at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfUtility/Threading/BsThreadPool.cpp:115
#42 0x00007f6ebd60f9a3 in  () at /lib64/libstdc++.so.6
#43 0x00007f6ebd6ec58e in start_thread () at /lib64/libpthread.so.0
#44 0x00007f6ebd2e2713 in clone () at /lib64/libc.so.6

That's the core thread. The main thread is waiting for a frame to complete.

Some analysis:

(gdb) frame 20
#20 std::__shared_ptr<bs::ct::GLPixelBuffer, (__gnu_cxx::_Lock_policy)2>::__shared_ptr (this=0x7f6dd2fa50c0)
    at /usr/include/c++/8/bits/shared_ptr_base.h:1165
1165	      __shared_ptr(const __shared_ptr&) noexcept = default;
(gdb) list
1160		__shared_ptr(const __shared_ptr<_Yp, _Lp>& __r,
1161			     element_type* __p) noexcept
1162		: _M_ptr(__p), _M_refcount(__r._M_refcount) // never throws
1163		{ }
1164	
1165	      __shared_ptr(const __shared_ptr&) noexcept = default;
1166	      __shared_ptr& operator=(const __shared_ptr&) noexcept = default;
1167	      ~__shared_ptr() = default;
1168	
1169	      template<typename _Yp, typename = _Compatible<_Yp>>
(gdb) info locals
No locals.
(gdb) frame 21
#21 std::shared_ptr<bs::ct::GLPixelBuffer>::shared_ptr (this=0x7f6dd2fa50c0) at /usr/include/c++/8/bits/shared_ptr.h:129
129	      shared_ptr(const shared_ptr&) noexcept = default;
(gdb) l
124	       *  @brief  Construct an empty %shared_ptr.
125	       *  @post   use_count()==0 && get()==0
126	       */
127	      constexpr shared_ptr() noexcept : __shared_ptr<_Tp>() { }
128	
129	      shared_ptr(const shared_ptr&) noexcept = default;
130	
131	      /**
132	       *  @brief  Construct a %shared_ptr that owns the pointer @a __p.
133	       *  @param  __p  A pointer that is convertible to element_type*.
(gdb) frame 22
#22 bs::ct::GLTexture::getBuffer (this=this@entry=0x90c6040, face=0, mipmap=0)
    at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfGLRenderAPI/BsGLTexture.cpp:539
539			return mSurfaceList[idx];
(gdb) list
534			if (mipmap > mProperties.getNumMipmaps())
535				BS_EXCEPT(InvalidParametersException, "Mipmap index out of range");
536	
537			unsigned int idx = face * (mProperties.getNumMipmaps() + 1) + mipmap;
538			assert(idx < mSurfaceList.size());
539			return mSurfaceList[idx];
540		}
541	
542		SPtr<TextureView> GLTexture::createView(const TEXTURE_VIEW_DESC& desc)
543		{
(gdb) info locals
__PRETTY_FUNCTION__ =   "bs::SPtr<bs::ct::GLPixelBuffer> bs::ct::GLTexture::getBuffer(bs::UINT32, bs::UINT32)"
idx = 0
(gdb) info args
this = 0x90c6040
face = 0
mipmap = 0
(gdb) p *this
$1 = (bs::ct::GLTexture) {
  <bs::ct::Texture> = {
    <bs::ct::CoreObject> = {
      _vptr.CoreObject = 0x7f6e54569830 <vtable for bs::ct::GLTexture+16>, 
      mFlags = 2 '\002', 
      mThis = std::weak_ptr<bs::ct::CoreObject> (use count 5, weak count 1) = {
        get() = 0x90c6040
      }
    }, 
    members of bs::ct::Texture: 
    mTextureViews = std::unordered_map with 1 element = {
      [{
        mostDetailMip = 0, 
        numMips = 1, 
        firstArraySlice = 0, 
        numArraySlices = 1, 
        usage = bs::GVU_RENDERTARGET
      }] = std::shared_ptr<bs::ct::TextureView> (use count 2, weak count 0) = {
        get() = 0x7f6da4b9c710
      }
    }, 
    mProperties = {
      mDesc = {
        type = bs::TEX_TYPE_CUBE_MAP, 
        format = bs::PF_RG11B10F, 
        width = 256, 
        height = 256, 
        depth = 1, 
        numMips = 8, 
        usage = 513, 
        hwGamma = false, 
        numSamples = 0, 
        numArraySlices = 1
      }
    }, 
    mInitData = std::shared_ptr<bs::PixelData> (empty) = {
      get() = 0x0
    }
  }, 
  members of bs::ct::GLTexture: 
  mTextureID = 0, 
  mGLFormat = 0, 
  mInternalFormat = bs::PF_UNKNOWN, 
  mGLSupport = @0xa85f30, 
  mLockedBuffer = std::shared_ptr<bs::ct::GLPixelBuffer> (empty) = {
    get() = 0x0
  }, 
  mSurfaceList = std::vector of length 0, capacity 0
}

Let me know if there's more info you'd like me to dig up from the core file.

Edit: apparently I can't reopen this issue

from bsf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.