core: rename mbgl directories to mln (#4511)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
62
include/mln/gl/renderer_backend.hpp
Normal file
62
include/mln/gl/renderer_backend.hpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
|
||||
#include <mln/gfx/renderer_backend.hpp>
|
||||
#include <mln/util/image.hpp>
|
||||
#include <mln/util/size.hpp>
|
||||
#include <mln/util/util.hpp>
|
||||
|
||||
namespace mln {
|
||||
|
||||
class ProgramParameters;
|
||||
|
||||
namespace gl {
|
||||
|
||||
using ProcAddress = void (*)();
|
||||
using FramebufferID = uint32_t;
|
||||
|
||||
class RendererBackend : public gfx::RendererBackend {
|
||||
public:
|
||||
RendererBackend(gfx::ContextMode);
|
||||
RendererBackend(gfx::ContextMode, const TaggedScheduler&);
|
||||
~RendererBackend() override;
|
||||
|
||||
/// Called prior to rendering to update the internally assumed OpenGL state.
|
||||
virtual void updateAssumedState() = 0;
|
||||
|
||||
/// One-time shader initialization
|
||||
void initShaders(gfx::ShaderRegistry&, const ProgramParameters& programParameters) override;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<gfx::Context> createContext() override;
|
||||
|
||||
/// Called with the name of an OpenGL extension that should be loaded.
|
||||
/// RendererBackend implementations must call the API-specific version that
|
||||
/// obtains the function pointer for this function, or a null pointer if
|
||||
/// unsupported/unavailable.
|
||||
virtual ProcAddress getExtensionFunctionPointer(const char*) = 0;
|
||||
|
||||
/// Reads the color pixel data from the currently bound framebuffer.
|
||||
PremultipliedImage readFramebuffer(const Size&);
|
||||
|
||||
/// A constant to signal that a framebuffer is bound, but with an unknown ID.
|
||||
static constexpr const FramebufferID ImplicitFramebufferBinding = std::numeric_limits<FramebufferID>::max();
|
||||
|
||||
/// Tells the renderer that OpenGL state has already been set by the windowing toolkit.
|
||||
/// It sets the internal assumed state to the supplied values.
|
||||
void assumeFramebufferBinding(FramebufferID fbo);
|
||||
void assumeViewport(int32_t x, int32_t y, const Size&);
|
||||
void assumeScissorTest(int32_t, int32_t, uint32_t, uint32_t);
|
||||
|
||||
/// Returns true when assumed framebuffer binding hasn't changed from the implicit binding.
|
||||
bool implicitFramebufferBound();
|
||||
|
||||
public:
|
||||
/// Triggers an OpenGL state update if the internal assumed state doesn't
|
||||
/// match the supplied values.
|
||||
void setFramebufferBinding(FramebufferID fbo);
|
||||
void setViewport(int32_t x, int32_t y, const Size&);
|
||||
void setScissorTest(int32_t, int32_t, uint32_t, uint32_t);
|
||||
};
|
||||
|
||||
} // namespace gl
|
||||
} // namespace mln
|
||||
Reference in New Issue
Block a user