Cache metal pipeline state (#1658)
Co-authored-by: Alex Cristici <alex.cristici@gmail.com>
This commit is contained in:
@@ -68,7 +68,7 @@ public:
|
||||
const gfx::ShaderProgramBasePtr& getShader() const { return shader; }
|
||||
|
||||
/// Set the shader to be used
|
||||
void setShader(gfx::ShaderProgramBasePtr value) { shader = std::move(value); }
|
||||
virtual void setShader(gfx::ShaderProgramBasePtr value) { shader = std::move(value); }
|
||||
|
||||
/// The pass on which we'll be rendered
|
||||
mbgl::RenderPass getRenderPass() const { return renderPass; }
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
const gfx::ColorMode& getColorMode() const;
|
||||
|
||||
/// Set color mode
|
||||
void setColorMode(const gfx::ColorMode&);
|
||||
virtual void setColorMode(const gfx::ColorMode&);
|
||||
|
||||
/// Get the vertex attributes that override default values in the shader program
|
||||
virtual const gfx::VertexAttributeArray& getVertexAttributes() const = 0;
|
||||
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
|
||||
virtual void wait() {}
|
||||
|
||||
bool operator!=(const Renderable& other) const { return resource.get() != other.resource.get(); }
|
||||
|
||||
protected:
|
||||
Size size;
|
||||
std::unique_ptr<RenderableResource> resource;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <mbgl/gfx/draw_mode.hpp>
|
||||
#include <mbgl/mtl/upload_pass.hpp>
|
||||
#include <mbgl/programs/segment.hpp>
|
||||
#include <mbgl/mtl/mtl_fwd.hpp>
|
||||
#include <mbgl/mtl/render_pass.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -53,6 +55,10 @@ public:
|
||||
|
||||
void upload(gfx::UploadPass&);
|
||||
|
||||
void setColorMode(const gfx::ColorMode&) override;
|
||||
|
||||
void setShader(gfx::ShaderProgramBasePtr) override;
|
||||
|
||||
protected:
|
||||
// For testing only.
|
||||
Drawable(std::unique_ptr<Impl>);
|
||||
@@ -72,6 +78,10 @@ protected:
|
||||
const std::unique_ptr<Impl> impl;
|
||||
|
||||
gfx::AttributeBindingArray attributeBindings;
|
||||
|
||||
mutable MTLRenderPipelineStatePtr pipelineState;
|
||||
|
||||
mutable std::optional<gfx::RenderPassDescriptor> renderPassDescriptor;
|
||||
};
|
||||
|
||||
} // namespace mtl
|
||||
|
||||
Reference in New Issue
Block a user