Merge branch 'topic/metal-sep21' into main (#1695)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Tim Sylvester <tim@wetdogweather.com> Co-authored-by: Bart Louwers <bart@emeel.net> Co-authored-by: Alex Cristici <alex.cristici@gmail.com> Co-authored-by: Stefan Karschti <stefan.karschti@gmail.com> Co-authored-by: Alex Cristici <alex@skoon.energy> Co-authored-by: Bart Louwers <bart.louwers@gmail.com> Co-authored-by: Wei Chen <alanchenboy@gmail.com> Co-authored-by: Siarhei Fedartsou <siarhei.fedartsou@gmail.com> Co-authored-by: tdcosta100 <tdcosta100@gmail.com>
This commit is contained in:
@@ -13,6 +13,7 @@ namespace mbgl {
|
||||
class LayerGroupBase;
|
||||
class PaintParameters;
|
||||
class RenderOrchestrator;
|
||||
class RenderTree;
|
||||
class TileLayerGroup;
|
||||
|
||||
using LayerGroupBasePtr = std::shared_ptr<LayerGroupBase>;
|
||||
@@ -28,6 +29,7 @@ using UniqueDrawable = std::unique_ptr<Drawable>;
|
||||
|
||||
class LayerTweaker;
|
||||
using LayerTweakerPtr = std::shared_ptr<LayerTweaker>;
|
||||
using LayerTweakerWeakPtr = std::weak_ptr<LayerTweaker>;
|
||||
|
||||
/**
|
||||
A layer-like group of drawables, not a group of layers.
|
||||
@@ -86,16 +88,16 @@ public:
|
||||
/// @return The number of items removed
|
||||
virtual std::size_t removeDrawablesIf(const std::function<bool(gfx::Drawable&)>&& f) = 0;
|
||||
|
||||
/// Attach a tweaker to be run on this layer group for each frame
|
||||
void setLayerTweaker(LayerTweakerPtr tweaker) { layerTweaker = std::move(tweaker); }
|
||||
/// Attach a tweaker to be run on this layer group for each frame.
|
||||
/// Tweaker lifetime is controlled by the render layer and drawables, the layer group retains a weak reference.
|
||||
void addLayerTweaker(const LayerTweakerPtr& tweaker) { layerTweakers.emplace_back(tweaker); }
|
||||
|
||||
/// Get the tweaker attached to this layer group
|
||||
const LayerTweakerPtr& getLayerTweaker() const { return layerTweaker; }
|
||||
void runTweakers(const RenderTree&, PaintParameters&);
|
||||
|
||||
protected:
|
||||
bool enabled = true;
|
||||
int32_t layerIndex;
|
||||
LayerTweakerPtr layerTweaker;
|
||||
std::vector<LayerTweakerWeakPtr> layerTweakers;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
namespace mbgl {
|
||||
namespace gfx {
|
||||
class Drawable;
|
||||
class UniformBuffer;
|
||||
using UniformBufferPtr = std::shared_ptr<UniformBuffer>;
|
||||
} // namespace gfx
|
||||
@@ -45,17 +46,21 @@ public:
|
||||
/// Build the common expression inupts UBO
|
||||
static shaders::ExpressionInputsUBO buildExpressionUBO(double zoom, uint64_t frameCount);
|
||||
|
||||
/// @brief Set the collection of attribute names which will be provided at uniform values rather than per-vertex
|
||||
/// attributes.
|
||||
/// @details These values should not have "a_" prefixes, as produced by `readDataDrivenPaintProperties`.
|
||||
void setPropertiesAsUniforms(std::vector<std::string>);
|
||||
|
||||
/// @brief Check whether a property name exists within the previously set collection.
|
||||
/// @details The string value provided is expected to have the "a_" prefix, as defined in the shader classes.
|
||||
bool hasPropertyAsUniform(std::string_view) const;
|
||||
shaders::AttributeSource getAttributeSource(const std::string_view& attribName) const;
|
||||
#endif // MLN_RENDER_BACKEND_METAL
|
||||
|
||||
/// @brief Set the collection of attribute names which will be provided at uniform values rather than per-vertex
|
||||
/// attributes.
|
||||
/// @details These values should not have "a_" prefixes, as produced by `readDataDrivenPaintProperties`.
|
||||
#if MLN_RENDER_BACKEND_OPENGL
|
||||
void setPropertiesAsUniforms(const std::vector<std::string>&) {}
|
||||
#else
|
||||
void setPropertiesAsUniforms(std::vector<std::string>);
|
||||
#endif
|
||||
|
||||
void enableOverdrawInspector(bool);
|
||||
|
||||
virtual void execute(LayerGroupBase&, const RenderTree&, const PaintParameters&) = 0;
|
||||
@@ -63,6 +68,9 @@ public:
|
||||
void updateProperties(Immutable<style::LayerProperties>);
|
||||
|
||||
protected:
|
||||
/// Determine whether this tweaker should apply to the given drawable
|
||||
bool checkTweakDrawable(const gfx::Drawable&) const;
|
||||
|
||||
/// Calculate matrices for this tile.
|
||||
/// @param nearClipped If true, the near plane is moved further to enhance depth buffer precision.
|
||||
/// @param inViewportPixelUnits If false, the translation is scaled based on the current zoom.
|
||||
@@ -78,7 +86,6 @@ protected:
|
||||
protected:
|
||||
std::string id;
|
||||
Immutable<style::LayerProperties> evaluatedProperties;
|
||||
bool propertiesUpdated = true;
|
||||
|
||||
#if MLN_RENDER_BACKEND_METAL
|
||||
// For Metal, whether a property is provided through attribtues or uniforms is specified in
|
||||
@@ -86,7 +93,12 @@ protected:
|
||||
std::vector<std::string> propertiesAsUniforms;
|
||||
#endif // MLN_RENDER_BACKEND_METAL
|
||||
|
||||
bool propertiesChanged = true;
|
||||
// Indicates that the evaluated properties have changed
|
||||
bool propertiesUpdated = true;
|
||||
|
||||
// Indicates that the properties-as-uniforms has changed
|
||||
bool permutationUpdated = true;
|
||||
|
||||
bool overdrawInspector = false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user