Change parameters.currentLayer to index instead of layerIndex (#2956)

This commit is contained in:
Alex Cristici
2024-10-29 13:31:01 +02:00
committed by GitHub
parent ab00edfab1
commit e95e0e1e63
9 changed files with 51 additions and 48 deletions

View File

@@ -151,9 +151,6 @@ public:
/// Set sub-layer index
virtual void setSubLayerIndex(int32_t value) { subLayerIndex = value; }
void setLayerIndex(int32_t value) { layerIndex = value; }
int32_t getLayerIndex() const { return layerIndex; }
/// Depth writability for 2D drawables
DepthMaskType getDepthType() const { return depthType; }
@@ -293,7 +290,6 @@ protected:
DrawPriority drawPriority = 0;
int32_t lineWidth = 1;
int32_t subLayerIndex = 0;
int32_t layerIndex = 0;
DepthMaskType depthType; // = DepthMaskType::ReadOnly;
UniqueDrawableData drawableData{};
gfx::VertexAttributeArrayPtr vertexAttributes;

View File

@@ -169,12 +169,7 @@ public:
void setStencilTiles(RenderTiles);
void updateLayerIndex(int32_t value) override {
layerIndex = value;
for (auto* drawable : sortedDrawables) {
drawable->setLayerIndex(value);
}
}
void updateLayerIndex(int32_t value) override { layerIndex = value; }
protected:
// When stencil clipping is enabled for the layer, this is the set
@@ -245,12 +240,7 @@ public:
std::size_t clearDrawables() override;
void updateLayerIndex(int32_t value) override {
layerIndex = value;
for (auto& drawable : drawables) {
drawable->setLayerIndex(value);
}
}
void updateLayerIndex(int32_t value) override { layerIndex = value; }
protected:
using DrawableCollection = std::set<gfx::UniqueDrawable, gfx::DrawableLessByPriority>;

View File

@@ -62,6 +62,16 @@ public:
}
}
/// Execute the given function for each contained layer group in reversed order
template <typename Func /* void(LayerGroupBase&) */>
void visitLayerGroupsReversed(Func f) {
for (auto rit = layerGroupsByLayerIndex.rbegin(); rit != layerGroupsByLayerIndex.rend(); ++rit) {
if (rit->second) {
f(*rit->second);
}
}
}
/// Upload the layer groups
void upload(gfx::UploadPass& uploadPass);