Metal layer depth range support (#2013)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alex Cristici <alex.cristici@gmail.com>
This commit is contained in:
mwilsnd
2024-01-16 09:31:44 -05:00
committed by GitHub
parent 29c16a4a81
commit d6c2b148dd
28 changed files with 109 additions and 31 deletions

View File

@@ -152,6 +152,9 @@ 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; }
@@ -252,6 +255,7 @@ 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

@@ -72,7 +72,7 @@ public:
int32_t getLayerIndex() const { return layerIndex; }
/// Update the layer index to a new value
void updateLayerIndex(int32_t value) { layerIndex = value; }
virtual void updateLayerIndex(int32_t value) { layerIndex = value; }
/// Get the number of drawables contained
virtual std::size_t getDrawableCount() const = 0;
@@ -163,6 +163,13 @@ public:
void setStencilTiles(RenderTiles);
void updateLayerIndex(int32_t value) override {
layerIndex = value;
for (auto* drawable : sortedDrawables) {
drawable->setLayerIndex(value);
}
}
protected:
// When stencil clipping is enabled for the layer, this is the set
// of tile IDs that need to be rendered to the stencil buffer.
@@ -232,6 +239,13 @@ public:
std::size_t clearDrawables() override;
void updateLayerIndex(int32_t value) override {
layerIndex = value;
for (auto& drawable : drawables) {
drawable->setLayerIndex(value);
}
}
protected:
using DrawableCollection = std::set<gfx::UniqueDrawable, gfx::DrawableLessByPriority>;
DrawableCollection drawables;

View File

@@ -57,6 +57,7 @@ public:
style::TranslateAnchorType,
bool nearClipped,
bool inViewportPixelUnits,
const gfx::Drawable& drawable,
bool aligned = false);
protected: