[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

@@ -46,26 +46,38 @@ public:
Shaders::fragmentSource)) {
}
static typename AllUniforms::Values computeAllUniformValues(
const UniformValues& uniformValues,
const PaintPropertyBinders& paintPropertyBinders,
const typename PaintProperties::PossiblyEvaluated& currentProperties,
float currentZoom) {
return uniformValues
.concat(paintPropertyBinders.uniformValues(currentZoom, currentProperties));
}
static typename Attributes::Bindings computeAllAttributeBindings(
const gl::VertexBuffer<LayoutVertex>& layoutVertexBuffer,
const PaintPropertyBinders& paintPropertyBinders,
const typename PaintProperties::PossiblyEvaluated& currentProperties) {
return LayoutAttributes::bindings(layoutVertexBuffer)
.concat(paintPropertyBinders.attributeBindings(currentProperties));
}
static uint32_t activeBindingCount(const typename Attributes::Bindings& allAttributeBindings) {
return Attributes::activeBindingCount(allAttributeBindings);
}
template <class DrawMode>
void draw(gl::Context& context,
DrawMode drawMode,
gl::DepthMode depthMode,
gl::StencilMode stencilMode,
gl::ColorMode colorMode,
const UniformValues& uniformValues,
const gl::VertexBuffer<LayoutVertex>& layoutVertexBuffer,
const gl::IndexBuffer<DrawMode>& indexBuffer,
const SegmentVector<Attributes>& segments,
const PaintPropertyBinders& paintPropertyBinders,
const typename PaintProperties::PossiblyEvaluated& currentProperties,
float currentZoom,
const typename AllUniforms::Values& allUniformValues,
const typename Attributes::Bindings& allAttributeBindings,
const std::string& layerID) {
typename AllUniforms::Values allUniformValues = uniformValues
.concat(paintPropertyBinders.uniformValues(currentZoom, currentProperties));
typename Attributes::Bindings allAttributeBindings = LayoutAttributes::bindings(layoutVertexBuffer)
.concat(paintPropertyBinders.attributeBindings(currentProperties));
for (auto& segment : segments) {
auto vertexArrayIt = segment.vertexArrays.find(layerID);