Clean more legacy code (#3478)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Alex Cristici
2025-05-16 19:29:25 +03:00
committed by GitHub
parent 2538ac1f31
commit b585b0086f
108 changed files with 212 additions and 937 deletions

View File

@@ -1,38 +0,0 @@
#include <mbgl/programs/programs.hpp>
#include <mbgl/util/logging.hpp>
#include <exception>
namespace mbgl {
Programs::Programs(const ProgramParameters& programParameters_)
: programParameters(programParameters_) {}
Programs::~Programs() = default;
/// @brief Register a list of types with a shader registry instance
/// @tparam ...T Type list parameter pack
/// @param registry A shader registry instance
/// programParameters_ ProgramParameters used to initialize each instance
template <typename... T>
void registerTypes(gfx::ShaderRegistry& registry, const ProgramParameters& programParameters_) {
/// The following fold expression will create a shared_ptr for every type
/// in the parameter pack and register it with the shader registry.
/// Registration calls are wrapped in a lambda that throws on registration
/// failure, we shouldn't expect registration to faill unless the shader
/// registry instance provided already has conflicting programs present.
(
[](bool expr) {
if (!expr) {
throw std::runtime_error("Failed to register " + std::string(T::Name) + " with shader registry!");
}
}(registry.getLegacyGroup().registerShader(std::make_shared<T>(programParameters_))),
...);
}
void Programs::registerWith(gfx::ShaderRegistry& registry) {
/// The following types will be registered
registerTypes<ClippingMaskProgram>(registry, programParameters);
}
} // namespace mbgl