[core] Don't crash when attribute count is exceeded

This commit is contained in:
Konstantin Käfer
2018-05-04 01:31:43 +02:00
committed by Lauren Budorick
parent f6da3ba9be
commit c3346f473a
23 changed files with 557 additions and 237 deletions

View File

@@ -62,19 +62,34 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) {
LineBucket& bucket = *reinterpret_cast<LineBucket*>(tile.tile.getBucket(*baseImpl));
auto draw = [&] (auto& program, auto&& uniformValues) {
program.get(evaluated).draw(
auto& programInstance = program.get(evaluated);
const auto& paintPropertyBinders = bucket.paintPropertyBinders.at(getID());
const auto allUniformValues = programInstance.computeAllUniformValues(
std::move(uniformValues),
paintPropertyBinders,
evaluated,
parameters.state.getZoom()
);
const auto allAttributeBindings = programInstance.computeAllAttributeBindings(
*bucket.vertexBuffer,
paintPropertyBinders,
evaluated
);
checkRenderability(parameters, programInstance.activeBindingCount(allAttributeBindings));
programInstance.draw(
parameters.context,
gl::Triangles(),
parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly),
parameters.stencilModeForClipping(tile.clip),
parameters.colorModeForRenderPass(),
std::move(uniformValues),
*bucket.vertexBuffer,
*bucket.indexBuffer,
bucket.segments,
bucket.paintPropertyBinders.at(getID()),
evaluated,
parameters.state.getZoom(),
allUniformValues,
allAttributeBindings,
getID()
);
};