Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TangentSpaceCalc::populateVertexArray leaves hardware buffers locked when throwing an exception #183

Closed
Spectre-srs opened this issue Feb 17, 2021 · 1 comment

Comments

@Spectre-srs
Copy link

System Information

  • Ogre Version: 2.1.0 (Baldur)
  • Operating System / Platform: Windows //probably irrelevant
  • RenderSystem: OpenGL //maybe irrelevant

Detailled description

  • in file "OgreTangentSpaceCalc.cpp"
  • in TangentSpaceCalc::populateVertexArray

on lines 576 and 593, two hardware buffers are being locked:

pUvBase = static_cast<unsigned char*>(uvBuf->lock(HardwareBuffer::HBL_READ_ONLY));
pUvBase = static_cast<unsigned char*>(uvBuf->lock(HardwareBuffer::HBL_READ_ONLY));

after that, on line 600, code checks if model has normals and throws an exception if not:

const VertexElement *normElem = dcl->findElementBySemantic(VES_NORMAL);
if (!normElem)
    OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "No vertex normals found", "TangentSpaceCalc::build");

which leaves buffers in a locked state, cascading down into further problems, for example:

  • in file "OgreMesh2.cpp"
  • in Mesh::importV1

on line 526 is a try-catch block that encapsulates calculation of tangents, captures this exception from it, ignores it and continues, immediately running into the already locked buffer exception in SubMesh::importFromV1 method on line 546

@paroj paroj closed this as completed Feb 17, 2021
@paroj paroj reopened this Feb 17, 2021
@darksylinc
Copy link
Member

Fixed. Thanks for the report!

darksylinc added a commit that referenced this issue Feb 17, 2021
Thanks Eugene for bringing this up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants