Fixed metal vertex attribute update render tests (#1867)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -56,6 +56,9 @@ public:
|
||||
return newAttrs;
|
||||
}
|
||||
|
||||
/// Indicates whether any values have changed
|
||||
bool isDirty() const override;
|
||||
|
||||
private:
|
||||
gfx::UniqueVertexAttribute create(int index, gfx::AttributeDataType dataType, std::size_t count) const override {
|
||||
return gfx::UniqueVertexAttribute(new VertexAttribute(index, dataType, count));
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
#include <mbgl/gfx/program.hpp>
|
||||
#include <mbgl/gfx/uniform.hpp>
|
||||
#include <mbgl/gfx/uniform_buffer.hpp>
|
||||
#include <mbgl/gfx/vertex_attribute.hpp>
|
||||
#include <mbgl/mtl/mtl_fwd.hpp>
|
||||
#include <mbgl/mtl/render_pass.hpp>
|
||||
#include <mbgl/mtl/uniform_buffer.hpp>
|
||||
#include <mbgl/mtl/upload_pass.hpp>
|
||||
#include <mbgl/mtl/vertex_attribute.hpp>
|
||||
#include <mbgl/mtl/vertex_buffer_resource.hpp>
|
||||
#include <mbgl/programs/segment.hpp>
|
||||
#include <mbgl/renderer/paint_parameters.hpp>
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
gfx::IndexVectorBasePtr indexes;
|
||||
std::size_t vertexCount = 0;
|
||||
gfx::AttributeDataType vertexType = gfx::AttributeDataType::Invalid;
|
||||
gfx::VertexAttributeArray vertexAttributes;
|
||||
VertexAttributeArray vertexAttributes;
|
||||
|
||||
std::vector<gfx::UniqueVertexBufferResource> attributeBuffers;
|
||||
|
||||
|
||||
@@ -33,5 +33,18 @@ const gfx::UniqueVertexBufferResource& VertexAttribute::getBuffer(gfx::VertexAtt
|
||||
return attrib_.getBuffer();
|
||||
}
|
||||
|
||||
bool VertexAttributeArray::isDirty() const {
|
||||
return std::any_of(attrs.begin(), attrs.end(), [](const auto& kv) {
|
||||
if (kv.second) {
|
||||
// If we have shared data, the dirty flag from that overrides ours
|
||||
const auto& attrib = static_cast<const VertexAttribute&>(*kv.second);
|
||||
if (const auto& shared = attrib.getSharedRawData()) {
|
||||
return shared->getDirty();
|
||||
}
|
||||
}
|
||||
return kv.second && kv.second->isDirty();
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace mtl
|
||||
} // namespace mbgl
|
||||
|
||||
Reference in New Issue
Block a user