Merge pull request #7781 from zzmp/log/pipeline-flood

Avoid missing pipeline log flood
This commit is contained in:
Brad Hefta-Gaub 2016-05-05 00:15:10 -07:00
commit 1e30ba43ea
3 changed files with 15 additions and 5 deletions

View file

@ -46,7 +46,7 @@ void renderShape(RenderArgs* args, const ShapePlumberPointer& shapeContext, cons
} else if (key.hasOwnPipeline()) {
item.render(args);
} else {
qDebug() << "Item could not be rendered: invalid key ?" << key;
qDebug() << "Item could not be rendered with invalid key" << key;
}
}
@ -96,7 +96,7 @@ void render::renderStateSortShapes(const SceneContextPointer& sceneContext, cons
} else if (key.hasOwnPipeline()) {
ownPipelineBucket.push_back(item);
} else {
qDebug() << "Item could not be rendered: invalid key ?" << key;
qDebug() << "Item could not be rendered with invalid key" << key;
}
}
}

View file

@ -95,7 +95,11 @@ const ShapePipelinePointer ShapePlumber::pickPipeline(RenderArgs* args, const Ke
const auto& pipelineIterator = _pipelineMap.find(key);
if (pipelineIterator == _pipelineMap.end()) {
qDebug() << "Couldn't find a pipeline from ShapeKey ?" << key;
// The first time we can't find a pipeline, we should log it
if (_missingKeys.find(key) == _missingKeys.end()) {
_missingKeys.insert(key);
qDebug() << "Couldn't find a pipeline for" << key;
}
return PipelinePointer(nullptr);
}

View file

@ -12,6 +12,8 @@
#ifndef hifi_render_ShapePipeline_h
#define hifi_render_ShapePipeline_h
#include <unordered_set>
#include <gpu/Batch.h>
#include <RenderArgs.h>
@ -147,7 +149,7 @@ public:
bool hasOwnPipeline() const { return _flags[OWN_PIPELINE]; }
bool isValid() const { return !_flags[INVALID]; }
// Hasher for use in unordered_maps
// Comparator for use in stl containers
class Hash {
public:
size_t operator() (const ShapeKey& key) const {
@ -155,7 +157,7 @@ public:
}
};
// Comparator for use in unordered_maps
// Comparator for use in stl containers
class KeyEqual {
public:
bool operator()(const ShapeKey& lhs, const ShapeKey& rhs) const { return lhs._flags == rhs._flags; }
@ -271,7 +273,11 @@ public:
protected:
void addPipelineHelper(const Filter& filter, Key key, int bit, const PipelinePointer& pipeline);
PipelineMap _pipelineMap;
private:
mutable std::unordered_set<Key, Key::Hash, Key::KeyEqual> _missingKeys;
};
using ShapePlumberPointer = std::shared_ptr<ShapePlumber>;
}