Merge pull request #11332 from sethalves/squelch-cannot-render

suppress repeated 'item could not be rendered' messages
This commit is contained in:
Seth Alves 2017-09-08 16:23:22 -07:00 committed by GitHub
commit f5d77104c3

View file

@ -9,6 +9,8 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <LogHandler.h>
#include "DrawTask.h"
#include "Logging.h"
@ -48,12 +50,14 @@ void renderShape(RenderArgs* args, const ShapePlumberPointer& shapeContext, cons
if (args->_shapePipeline) {
args->_shapePipeline->prepareShapeItem(args, key, item);
item.render(args);
}
}
args->_shapePipeline = nullptr;
} else if (key.hasOwnPipeline()) {
item.render(args);
} else {
qCDebug(renderlogging) << "Item could not be rendered with invalid key" << key;
static QString repeatedCouldNotBeRendered = LogHandler::getInstance().addRepeatedMessageRegex(
"Item could not be rendered with invalid key.*");
}
args->_itemShapeKey = 0;
}
@ -62,7 +66,7 @@ void render::renderShapes(const RenderContextPointer& renderContext,
const ShapePlumberPointer& shapeContext, const ItemBounds& inItems, int maxDrawnItems, const ShapeKey& globalKey) {
auto& scene = renderContext->_scene;
RenderArgs* args = renderContext->args;
int numItemsToDraw = (int)inItems.size();
if (maxDrawnItems != -1) {
numItemsToDraw = glm::min(numItemsToDraw, maxDrawnItems);
@ -104,6 +108,8 @@ void render::renderStateSortShapes(const RenderContextPointer& renderContext,
} else if (key.hasOwnPipeline()) {
ownPipelineBucket.push_back( std::make_tuple(item, key) );
} else {
static QString repeatedCouldNotBeRendered = LogHandler::getInstance().addRepeatedMessageRegex(
"Item could not be rendered with invalid key.*");
qCDebug(renderlogging) << "Item could not be rendered with invalid key" << key;
}
}
@ -113,7 +119,7 @@ void render::renderStateSortShapes(const RenderContextPointer& renderContext,
for (auto& pipelineKey : sortedPipelines) {
auto& bucket = sortedShapes[pipelineKey];
args->_shapePipeline = shapeContext->pickPipeline(args, pipelineKey);
if (!args->_shapePipeline) {
if (!args->_shapePipeline) {
continue;
}
args->_itemShapeKey = pipelineKey._flags.to_ulong();
@ -182,7 +188,7 @@ void DrawBounds::run(const RenderContextPointer& renderContext,
if (!_drawBuffer) {
_drawBuffer = std::make_shared<gpu::Buffer>(sizeOfItemBound);
}
_drawBuffer->setData(numItems * sizeOfItemBound, (const gpu::Byte*) items.data());
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {