Metal Optimizations (#1748)
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <mbgl/mtl/mtl_fwd.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace mbgl {
|
||||
@@ -108,10 +109,19 @@ public:
|
||||
|
||||
virtual bool emplaceOrUpdateUniformBuffer(gfx::UniformBufferPtr&, const void* data, std::size_t size);
|
||||
|
||||
/// Get a reusable buffer containing the standard fixed tile vertices (+/- `util::EXTENT`)
|
||||
const BufferResource& getTileVertexBuffer();
|
||||
|
||||
/// Get a reusable buffer containing the standard fixed tile indexes
|
||||
const BufferResource& getTileIndexBuffer();
|
||||
|
||||
private:
|
||||
RendererBackend& backend;
|
||||
bool cleanupOnDestruction = true;
|
||||
|
||||
std::optional<BufferResource> tileVertexBuffer;
|
||||
std::optional<BufferResource> tileIndexBuffer;
|
||||
|
||||
gfx::RenderingStats stats;
|
||||
};
|
||||
|
||||
|
||||
@@ -30,11 +30,11 @@ public:
|
||||
constexpr auto& fragMain = shaders::ShaderSource<ShaderID, gfx::Backend::Type::Metal>::fragmentMainFunction;
|
||||
|
||||
const std::string shaderName = std::string(name);
|
||||
const auto shaderSource = std::string(shaders::prelude) + source;
|
||||
|
||||
auto shader = get<mtl::ShaderProgram>(shaderName);
|
||||
if (!shader) {
|
||||
auto& context = static_cast<Context&>(gfxContext);
|
||||
const auto shaderSource = std::string(shaders::prelude) + source;
|
||||
shader = context.createProgram(shaderName, shaderSource, vertMain, fragMain, programParameters, {});
|
||||
assert(shader);
|
||||
if (!shader || !registerShader(shader, shaderName)) {
|
||||
|
||||
Reference in New Issue
Block a user