ASAN fixes (#1147)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
mwilsnd
2023-05-25 14:53:40 -05:00
committed by Bart Louwers
parent b823f036fe
commit 1c8304a609
5 changed files with 13 additions and 7 deletions

View File

@@ -50,7 +50,7 @@ public:
items(std::move(other.items)) {}
public:
~VertexAttribute() = default;
virtual ~VertexAttribute() = default;
int getIndex() const { return index; }
void setIndex(int value) { index = value; }

View File

@@ -22,6 +22,9 @@ private:
: VertexAttribute(std::move(other)),
glType(other.glType) {}
public:
virtual ~VertexAttributeGL() = default;
public:
platform::GLenum getGLType() const { return glType; }
void setGLType(platform::GLenum value);

View File

@@ -834,7 +834,8 @@ void RenderOrchestrator::observeLayerGroups(std::function<void(const LayerGroup&
void RenderOrchestrator::updateLayers(gfx::ShaderRegistry& shaders,
gfx::Context& context,
const TransformState& state,
const std::shared_ptr<UpdateParameters>& updateParameters) {
const std::shared_ptr<UpdateParameters>& updateParameters,
const RenderTree& renderTree) {
const bool isMapModeContinuous = updateParameters->mode == MapMode::Continuous;
const auto transitionOptions = isMapModeContinuous ? updateParameters->transitionOptions
: style::TransitionOptions();
@@ -850,10 +851,11 @@ void RenderOrchestrator::updateLayers(gfx::ShaderRegistry& shaders,
// Layer index, similar but not identical to `layerRenderItems` index in render_impl
// int32_t i = static_cast<int32_t>(layerRenderItems.size()) - 1;
// for (auto it = layerRenderItems.begin(); it != layerRenderItems.end() && i >= 0; ++it, --i) {
auto index = static_cast<int32_t>(renderLayers.size()) - 1;
auto index = static_cast<int32_t>(renderTree.getLayerRenderItems().size()) - 1;
for (auto& kv : renderLayers) {
kv.second->update(index--, shaders, context, state, changes);
for (const auto& item : renderTree.getLayerRenderItems()) {
auto& renderLayer = static_cast<const LayerRenderItem&>(item.get()).layer.get();
renderLayer.update(index--, shaders, context, state, changes);
}
addChanges(changes);

View File

@@ -112,7 +112,8 @@ public:
void updateLayers(gfx::ShaderRegistry&,
gfx::Context&,
const TransformState&,
const std::shared_ptr<UpdateParameters>&);
const std::shared_ptr<UpdateParameters>&,
const RenderTree&);
void processChanges();

View File

@@ -39,7 +39,7 @@ void Renderer::render(const std::shared_ptr<UpdateParameters>& updateParameters)
if (impl->staticData && impl->staticData->shaders) {
auto& context = impl->backend.getContext();
auto& shaders = *impl->staticData->shaders;
impl->orchestrator.updateLayers(shaders, context, state, updateParameters);
impl->orchestrator.updateLayers(shaders, context, state, updateParameters, *renderTree);
}
impl->render(*renderTree);