Merge pull request from hyperlogic/bug-fix/debug-draw-races

Fixes for race conditions in DebugDraw
This commit is contained in:
Anthony Thibault 2017-03-15 10:38:26 -07:00 committed by GitHub
commit 495deba771
3 changed files with 7 additions and 3 deletions
.eslintrc.js
interface/src
libraries/render-utils/src

View file

@ -17,6 +17,7 @@ module.exports = {
"Clipboard": false,
"Controller": false,
"DialogsManager": false,
"DebugDraw": false,
"Entities": false,
"FaceTracker": false,
"GlobalServices": false,

View file

@ -608,6 +608,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
}
}
// make sure the debug draw singleton is initialized on the main thread.
DebugDraw::getInstance().removeMarker("");
_runningMarker.startRunningMarker();

View file

@ -346,7 +346,9 @@ void AnimDebugDraw::update() {
numVerts += (int)markerMap.size() * VERTICES_PER_BONE;
auto myAvatarMarkerMap = DebugDraw::getInstance().getMyAvatarMarkerMap();
numVerts += (int)myAvatarMarkerMap.size() * VERTICES_PER_BONE;
numVerts += (int)DebugDraw::getInstance().getRays().size() * VERTICES_PER_RAY;
auto rays = DebugDraw::getInstance().getRays();
DebugDraw::getInstance().clearRays();
numVerts += (int)rays.size() * VERTICES_PER_RAY;
// allocate verts!
std::vector<AnimDebugDrawData::Vertex> vertices;
@ -398,10 +400,9 @@ void AnimDebugDraw::update() {
}
// draw rays from shared DebugDraw singleton
for (auto& iter : DebugDraw::getInstance().getRays()) {
for (auto& iter : rays) {
addLine(std::get<0>(iter), std::get<1>(iter), std::get<2>(iter), v);
}
DebugDraw::getInstance().clearRays();
data._vertexBuffer->resize(sizeof(AnimDebugDrawData::Vertex) * numVerts);
data._vertexBuffer->setSubData<AnimDebugDrawData::Vertex>(0, vertices);