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