[core] refactor program object creation
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <mbgl/util/run_loop.hpp>
|
||||
#include <mbgl/util/default_styles.hpp>
|
||||
|
||||
#include <mbgl/gfx/backend.hpp>
|
||||
#include <mbgl/gfx/headless_frontend.hpp>
|
||||
#include <mbgl/style/style.hpp>
|
||||
|
||||
@@ -17,6 +18,7 @@ int main(int argc, char *argv[]) {
|
||||
args::ArgumentParser argumentParser("Mapbox GL render tool");
|
||||
args::HelpFlag helpFlag(argumentParser, "help", "Display this help menu", {"help"});
|
||||
|
||||
args::ValueFlag<std::string> backendValue(argumentParser, "Backend", "Rendering backend", {"backend"});
|
||||
args::ValueFlag<std::string> tokenValue(argumentParser, "key", "Mapbox access token", {'t', "token"});
|
||||
args::ValueFlag<std::string> styleValue(argumentParser, "URL", "Map stylesheet", {'s', "style"});
|
||||
args::ValueFlag<std::string> outputValue(argumentParser, "file", "Output file name", {'o', "output"});
|
||||
|
||||
@@ -26,6 +26,7 @@ target_include_directories(mbgl-test
|
||||
|
||||
target_link_libraries(mbgl-test PRIVATE
|
||||
gtest
|
||||
args
|
||||
mbgl-core
|
||||
shelf-pack-cpp
|
||||
unique_resource
|
||||
|
||||
@@ -27,8 +27,8 @@ include(${CMAKE_SOURCE_DIR}/vendor/unique_resource.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/vendor/variant.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/vendor/vector-tile.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/vendor/wagyu.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/vendor/args.cmake)
|
||||
|
||||
if(MBGL_PLATFORM STREQUAL "linux" OR MBGL_PLATFORM STREQUAL "macos")
|
||||
include(${CMAKE_SOURCE_DIR}/vendor/args.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/vendor/glfw.cmake)
|
||||
endif()
|
||||
|
||||
44
include/mbgl/gfx/backend.hpp
Normal file
44
include/mbgl/gfx/backend.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
|
||||
namespace mbgl {
|
||||
namespace gfx {
|
||||
|
||||
class Backend {
|
||||
public:
|
||||
enum class Type : uint8_t {
|
||||
OpenGL,
|
||||
};
|
||||
|
||||
static constexpr Type DefaultType = Type::OpenGL;
|
||||
|
||||
static void SetType(const Type value) {
|
||||
if (Value(value) != value) {
|
||||
abort(); // SetType must be called prior to any GetType calls.
|
||||
}
|
||||
}
|
||||
|
||||
static Type GetType() {
|
||||
return Value(DefaultType);
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
static std::unique_ptr<T> Create(Args... args) {
|
||||
return Create<Type::OpenGL, T, Args...>(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
private:
|
||||
template <Type, typename T, typename... Args>
|
||||
static std::unique_ptr<T> Create(Args...);
|
||||
|
||||
static Type Value(Type value) {
|
||||
static const Type type = value;
|
||||
return type;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mbgl
|
||||
@@ -30,6 +30,11 @@ public:
|
||||
// Returns the device's context.
|
||||
Context& getContext();
|
||||
|
||||
template <typename T>
|
||||
T& getContext() {
|
||||
return static_cast<T&>(getContext());
|
||||
}
|
||||
|
||||
bool contextIsShared() const {
|
||||
return contextMode == ContextMode::Shared;
|
||||
}
|
||||
|
||||
@@ -17,9 +17,6 @@ public:
|
||||
RendererBackend(gfx::ContextMode);
|
||||
~RendererBackend() override;
|
||||
|
||||
// Returns the backend's context which manages OpenGL state.
|
||||
Context& getGLContext();
|
||||
|
||||
// Called prior to rendering to update the internally assumed OpenGL state.
|
||||
virtual void updateAssumedState() = 0;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ void AndroidRendererBackend::updateAssumedState() {
|
||||
|
||||
void AndroidRendererBackend::markContextLost() {
|
||||
if (context) {
|
||||
getGLContext().setCleanupOnDestruction(false);
|
||||
getContext<gl::Context>().setCleanupOnDestruction(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/gfx/renderable.hpp>
|
||||
#include <mbgl/gfx/backend.hpp>
|
||||
#include <mbgl/gfx/renderer_backend.hpp>
|
||||
#include <mbgl/util/image.hpp>
|
||||
|
||||
@@ -15,8 +16,12 @@ namespace gfx {
|
||||
class HeadlessBackend : public gfx::Renderable {
|
||||
public:
|
||||
// Factory.
|
||||
static std::unique_ptr<HeadlessBackend> make(Size = { 256, 256 }, gfx::ContextMode = gfx::ContextMode::Unique);
|
||||
|
||||
static std::unique_ptr<HeadlessBackend>
|
||||
Create(const Size size = { 256, 256 },
|
||||
const gfx::ContextMode contextMode = gfx::ContextMode::Unique) {
|
||||
return Backend::Create<HeadlessBackend, Size, gfx::ContextMode>(size, contextMode);
|
||||
}
|
||||
|
||||
virtual PremultipliedImage readStillImage() = 0;
|
||||
virtual RendererBackend* getRendererBackend() = 0;
|
||||
void setSize(Size);
|
||||
|
||||
@@ -23,9 +23,9 @@ HeadlessFrontend::HeadlessFrontend(Size size_,
|
||||
const gfx::ContextMode contextMode,
|
||||
const optional<std::string> localFontFamily)
|
||||
: size(size_),
|
||||
pixelRatio(pixelRatio_),
|
||||
backend(gfx::HeadlessBackend::make( { static_cast<uint32_t>(size.width * pixelRatio),
|
||||
static_cast<uint32_t>(size.height * pixelRatio) }, contextMode)),
|
||||
pixelRatio(pixelRatio_),
|
||||
backend(gfx::HeadlessBackend::Create({ static_cast<uint32_t>(size.width * pixelRatio),
|
||||
static_cast<uint32_t>(size.height * pixelRatio) }, contextMode)),
|
||||
asyncInvalidate([this] {
|
||||
if (renderer && updateParameters) {
|
||||
gfx::BackendScope guard { *getBackend() };
|
||||
|
||||
@@ -79,20 +79,22 @@ void HeadlessBackend::updateAssumedState() {
|
||||
PremultipliedImage HeadlessBackend::readStillImage() {
|
||||
return static_cast<gl::Context&>(getContext()).readFramebuffer<PremultipliedImage>(size);
|
||||
}
|
||||
|
||||
|
||||
RendererBackend* HeadlessBackend::getRendererBackend() {
|
||||
return this;
|
||||
}
|
||||
|
||||
} // namespace gl
|
||||
|
||||
#ifndef OVERRIDE_HEADLESS_BACKEND_FACTORY
|
||||
// Default factory implementation.
|
||||
std::unique_ptr<gfx::HeadlessBackend> gfx::HeadlessBackend::make(Size size, gfx::ContextMode contextMode) {
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<gfx::HeadlessBackend>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const Size size, const gfx::ContextMode contextMode) {
|
||||
return std::make_unique<gl::HeadlessBackend>(size, contextMode);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mbgl
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/util/size.hpp>
|
||||
#include <mbgl/gfx/backend.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace gfx {
|
||||
@@ -8,6 +9,8 @@ class RendererBackend;
|
||||
} // namespace gfx
|
||||
} // namespace mbgl
|
||||
|
||||
struct GLFWwindow;
|
||||
|
||||
class GLFWBackend {
|
||||
public:
|
||||
explicit GLFWBackend() = default;
|
||||
@@ -15,6 +18,10 @@ public:
|
||||
GLFWBackend& operator=(const GLFWBackend&) = delete;
|
||||
virtual ~GLFWBackend() = default;
|
||||
|
||||
static std::unique_ptr<GLFWBackend> Create(GLFWwindow* window, bool capFrameRate) {
|
||||
return mbgl::gfx::Backend::Create<GLFWBackend, GLFWwindow*, bool>(window, capFrameRate);
|
||||
}
|
||||
|
||||
virtual mbgl::gfx::RendererBackend& getRendererBackend() = 0;
|
||||
virtual mbgl::Size getSize() const = 0;
|
||||
virtual void setSize(mbgl::Size) = 0;
|
||||
|
||||
@@ -72,3 +72,15 @@ void GLFWGLBackend::setSize(const mbgl::Size newSize) {
|
||||
void GLFWGLBackend::swap() {
|
||||
glfwSwapBuffers(window);
|
||||
}
|
||||
|
||||
namespace mbgl {
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<GLFWBackend>
|
||||
Backend::Create<mbgl::gfx::Backend::Type::OpenGL>(GLFWwindow* window, bool capFrameRate) {
|
||||
return std::make_unique<GLFWGLBackend>(window, capFrameRate);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "glfw_view.hpp"
|
||||
#include "glfw_gl_backend.hpp"
|
||||
#include "glfw_backend.hpp"
|
||||
#include "glfw_renderer_frontend.hpp"
|
||||
#include "ny_route.hpp"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <mbgl/util/chrono.hpp>
|
||||
#include <mbgl/util/geo.hpp>
|
||||
#include <mbgl/renderer/renderer.hpp>
|
||||
#include <mbgl/gfx/backend.hpp>
|
||||
#include <mbgl/gfx/backend_scope.hpp>
|
||||
#include <mbgl/map/camera.hpp>
|
||||
|
||||
@@ -76,6 +77,10 @@ GLFWView::GLFWView(bool fullscreen_, bool benchmark_)
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||
#endif
|
||||
|
||||
if (mbgl::gfx::Backend::GetType() != mbgl::gfx::Backend::Type::OpenGL) {
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
}
|
||||
|
||||
glfwWindowHint(GLFW_RED_BITS, 8);
|
||||
glfwWindowHint(GLFW_GREEN_BITS, 8);
|
||||
glfwWindowHint(GLFW_BLUE_BITS, 8);
|
||||
@@ -100,7 +105,7 @@ GLFWView::GLFWView(bool fullscreen_, bool benchmark_)
|
||||
|
||||
glfwGetWindowSize(window, &width, &height);
|
||||
|
||||
backend = std::make_unique<GLFWGLBackend>(window, benchmark);
|
||||
backend = GLFWBackend::Create(window, benchmark);
|
||||
|
||||
pixelRatio = static_cast<float>(backend->getSize().width) / width;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class RendererBackend;
|
||||
|
||||
class GLFWView : public mbgl::MapObserver {
|
||||
public:
|
||||
GLFWView(bool fullscreen = false, bool benchmark = false);
|
||||
GLFWView(bool fullscreen, bool benchmark);
|
||||
~GLFWView() override;
|
||||
|
||||
float getPixelRatio() const;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "glfw_renderer_frontend.hpp"
|
||||
#include "settings_json.hpp"
|
||||
|
||||
#include <mbgl/gfx/backend.hpp>
|
||||
#include <mbgl/util/default_styles.hpp>
|
||||
#include <mbgl/util/logging.hpp>
|
||||
#include <mbgl/util/platform.hpp>
|
||||
@@ -42,6 +43,7 @@ int main(int argc, char *argv[]) {
|
||||
args::Flag benchmarkFlag(argumentParser, "benchmark", "Toggle benchmark", {'b', "benchmark"});
|
||||
args::Flag offlineFlag(argumentParser, "offline", "Toggle offline", {'o', "offline"});
|
||||
|
||||
args::ValueFlag<std::string> backendValue(argumentParser, "Backend", "Rendering backend", {"backend"});
|
||||
args::ValueFlag<std::string> styleValue(argumentParser, "URL", "Map stylesheet", {'s', "style"});
|
||||
args::ValueFlag<std::string> cacheDBValue(argumentParser, "file", "Cache database file name", {'c', "cache"});
|
||||
args::ValueFlag<double> lonValue(argumentParser, "degrees", "Longitude", {'x', "lon"});
|
||||
|
||||
@@ -6,12 +6,23 @@
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include <mbgl/util/run_loop.hpp>
|
||||
#include <mbgl/gfx/backend.hpp>
|
||||
|
||||
#include "node_map.hpp"
|
||||
#include "node_logging.hpp"
|
||||
#include "node_request.hpp"
|
||||
#include "node_expression.hpp"
|
||||
|
||||
|
||||
void SetBackendType(const Nan::FunctionCallbackInfo<v8::Value>& info) {
|
||||
if (info.Length() < 1 || info[0]->IsUndefined()) {
|
||||
return Nan::ThrowTypeError("Requires a render backend name");
|
||||
}
|
||||
|
||||
const std::string backendName { *Nan::Utf8String(info[0]) };
|
||||
(void)backendName;
|
||||
}
|
||||
|
||||
void RegisterModule(v8::Local<v8::Object> target, v8::Local<v8::Object> module) {
|
||||
// This has the effect of:
|
||||
// a) Ensuring that the static local variable is initialized before any thread contention.
|
||||
@@ -19,6 +30,8 @@ void RegisterModule(v8::Local<v8::Object> target, v8::Local<v8::Object> module)
|
||||
static mbgl::util::RunLoop nodeRunLoop;
|
||||
nodeRunLoop.stop();
|
||||
|
||||
Nan::SetMethod(target, "setBackendType", SetBackendType);
|
||||
|
||||
node_mbgl::NodeMap::Init(target);
|
||||
node_mbgl::NodeRequest::Init();
|
||||
node_mbgl::NodeExpression::Init(target);
|
||||
|
||||
@@ -178,8 +178,8 @@ constexpr const uint8_t ShaderSource<${ShaderName}Program>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<${ShaderName}Program>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<${ShaderName}Program>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<${ShaderName}Program>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -321,6 +321,7 @@
|
||||
"mbgl/actor/message.hpp": "include/mbgl/actor/message.hpp",
|
||||
"mbgl/actor/scheduler.hpp": "include/mbgl/actor/scheduler.hpp",
|
||||
"mbgl/annotation/annotation.hpp": "include/mbgl/annotation/annotation.hpp",
|
||||
"mbgl/gfx/backend.hpp": "include/mbgl/gfx/backend.hpp",
|
||||
"mbgl/gfx/backend_scope.hpp": "include/mbgl/gfx/backend_scope.hpp",
|
||||
"mbgl/gfx/renderable.hpp": "include/mbgl/gfx/renderable.hpp",
|
||||
"mbgl/gfx/renderer_backend.hpp": "include/mbgl/gfx/renderer_backend.hpp",
|
||||
@@ -513,7 +514,6 @@
|
||||
"mbgl/gfx/color_mode.hpp": "src/mbgl/gfx/color_mode.hpp",
|
||||
"mbgl/gfx/command_encoder.hpp": "src/mbgl/gfx/command_encoder.hpp",
|
||||
"mbgl/gfx/context.hpp": "src/mbgl/gfx/context.hpp",
|
||||
"mbgl/gfx/context_impl.hpp": "src/mbgl/gfx/context_impl.hpp",
|
||||
"mbgl/gfx/cull_face_mode.hpp": "src/mbgl/gfx/cull_face_mode.hpp",
|
||||
"mbgl/gfx/debug_group.hpp": "src/mbgl/gfx/debug_group.hpp",
|
||||
"mbgl/gfx/depth_mode.hpp": "src/mbgl/gfx/depth_mode.hpp",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/gfx/backend.hpp>
|
||||
#include <mbgl/gfx/renderbuffer.hpp>
|
||||
#include <mbgl/gfx/command_encoder.hpp>
|
||||
#include <mbgl/gfx/draw_scope.hpp>
|
||||
@@ -17,12 +18,11 @@ class OffscreenTexture;
|
||||
|
||||
class Context {
|
||||
protected:
|
||||
Context(ContextType type_, uint32_t maximumVertexBindingCount_)
|
||||
: backend(type_), maximumVertexBindingCount(maximumVertexBindingCount_) {
|
||||
Context(uint32_t maximumVertexBindingCount_)
|
||||
: maximumVertexBindingCount(maximumVertexBindingCount_) {
|
||||
}
|
||||
|
||||
public:
|
||||
const ContextType backend;
|
||||
static constexpr const uint32_t minimumRequiredVertexBindingCount = 8;
|
||||
const uint32_t maximumVertexBindingCount;
|
||||
bool supportsHalfFloatTextures = false;
|
||||
@@ -80,11 +80,9 @@ protected:
|
||||
|
||||
public:
|
||||
template <typename Name>
|
||||
std::unique_ptr<Program<Name>> createProgram(const ProgramParameters&);
|
||||
|
||||
private:
|
||||
template <typename Backend, typename Name>
|
||||
std::unique_ptr<Program<Name>> createProgram(const ProgramParameters&);
|
||||
std::unique_ptr<Program<Name>> createProgram(const ProgramParameters& programParameters) {
|
||||
return Backend::Create<Program<Name>, const ProgramParameters&>(programParameters);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual std::unique_ptr<CommandEncoder> createCommandEncoder() = 0;
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/gfx/context.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
namespace gl {
|
||||
class Context;
|
||||
} // namespace gl
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <typename Name>
|
||||
std::unique_ptr<Program<Name>> Context::createProgram(const ProgramParameters& programParameters) {
|
||||
if (backend == ContextType::OpenGL) {
|
||||
return createProgram<gl::Context, Name>(programParameters);
|
||||
}
|
||||
assert(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mbgl
|
||||
@@ -5,10 +5,6 @@
|
||||
namespace mbgl {
|
||||
namespace gfx {
|
||||
|
||||
enum class ContextType : uint8_t {
|
||||
OpenGL,
|
||||
};
|
||||
|
||||
enum class PrimitiveType : uint8_t {
|
||||
Point,
|
||||
Line,
|
||||
|
||||
@@ -50,7 +50,7 @@ static_assert(underlying_type(UniformDataType::Sampler2D) == GL_SAMPLER_2D, "Ope
|
||||
static_assert(underlying_type(UniformDataType::SamplerCube) == GL_SAMPLER_CUBE, "OpenGL type mismatch");
|
||||
|
||||
Context::Context(RendererBackend& backend_)
|
||||
: gfx::Context(gfx::ContextType::OpenGL, [] {
|
||||
: gfx::Context([] {
|
||||
GLint value;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &value));
|
||||
return value;
|
||||
|
||||
@@ -21,50 +21,46 @@ std::unique_ptr<gfx::Context> RendererBackend::createContext() {
|
||||
return std::move(result);
|
||||
}
|
||||
|
||||
gl::Context& RendererBackend::getGLContext() {
|
||||
return static_cast<gl::Context&>(getContext());
|
||||
}
|
||||
|
||||
PremultipliedImage RendererBackend::readFramebuffer(const Size& size) {
|
||||
return getGLContext().readFramebuffer<PremultipliedImage>(size);
|
||||
return getContext<gl::Context>().readFramebuffer<PremultipliedImage>(size);
|
||||
}
|
||||
|
||||
void RendererBackend::assumeFramebufferBinding(const gl::FramebufferID fbo) {
|
||||
getGLContext().bindFramebuffer.setCurrentValue(fbo);
|
||||
getContext<gl::Context>().bindFramebuffer.setCurrentValue(fbo);
|
||||
if (fbo != ImplicitFramebufferBinding) {
|
||||
assert(gl::value::BindFramebuffer::Get() == getGLContext().bindFramebuffer.getCurrentValue());
|
||||
assert(gl::value::BindFramebuffer::Get() == getContext<gl::Context>().bindFramebuffer.getCurrentValue());
|
||||
}
|
||||
}
|
||||
|
||||
void RendererBackend::assumeViewport(int32_t x, int32_t y, const Size& size) {
|
||||
getGLContext().viewport.setCurrentValue({ x, y, size });
|
||||
assert(gl::value::Viewport::Get() == getGLContext().viewport.getCurrentValue());
|
||||
getContext<gl::Context>().viewport.setCurrentValue({ x, y, size });
|
||||
assert(gl::value::Viewport::Get() == getContext<gl::Context>().viewport.getCurrentValue());
|
||||
}
|
||||
|
||||
void RendererBackend::assumeScissorTest(bool enabled) {
|
||||
getGLContext().scissorTest.setCurrentValue(enabled);
|
||||
assert(gl::value::ScissorTest::Get() == getGLContext().scissorTest.getCurrentValue());
|
||||
getContext<gl::Context>().scissorTest.setCurrentValue(enabled);
|
||||
assert(gl::value::ScissorTest::Get() == getContext<gl::Context>().scissorTest.getCurrentValue());
|
||||
}
|
||||
|
||||
bool RendererBackend::implicitFramebufferBound() {
|
||||
return getGLContext().bindFramebuffer.getCurrentValue() == ImplicitFramebufferBinding;
|
||||
return getContext<gl::Context>().bindFramebuffer.getCurrentValue() == ImplicitFramebufferBinding;
|
||||
}
|
||||
|
||||
void RendererBackend::setFramebufferBinding(const gl::FramebufferID fbo) {
|
||||
getGLContext().bindFramebuffer = fbo;
|
||||
getContext<gl::Context>().bindFramebuffer = fbo;
|
||||
if (fbo != ImplicitFramebufferBinding) {
|
||||
assert(gl::value::BindFramebuffer::Get() == getGLContext().bindFramebuffer.getCurrentValue());
|
||||
assert(gl::value::BindFramebuffer::Get() == getContext<gl::Context>().bindFramebuffer.getCurrentValue());
|
||||
}
|
||||
}
|
||||
|
||||
void RendererBackend::setViewport(int32_t x, int32_t y, const Size& size) {
|
||||
getGLContext().viewport = { x, y, size };
|
||||
assert(gl::value::Viewport::Get() == getGLContext().viewport.getCurrentValue());
|
||||
getContext<gl::Context>().viewport = { x, y, size };
|
||||
assert(gl::value::Viewport::Get() == getContext<gl::Context>().viewport.getCurrentValue());
|
||||
}
|
||||
|
||||
void RendererBackend::setScissorTest(bool enabled) {
|
||||
getGLContext().scissorTest = enabled;
|
||||
assert(gl::value::ScissorTest::Get() == getGLContext().scissorTest.getCurrentValue());
|
||||
getContext<gl::Context>().scissorTest = enabled;
|
||||
assert(gl::value::ScissorTest::Get() == getContext<gl::Context>().scissorTest.getCurrentValue());
|
||||
}
|
||||
|
||||
RendererBackend::~RendererBackend() = default;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <mbgl/programs/background_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
#include <mbgl/renderer/image_atlas.hpp>
|
||||
#include <mbgl/renderer/cross_faded_property_evaluator.hpp>
|
||||
#include <mbgl/tile/tile_id.hpp>
|
||||
@@ -7,9 +6,6 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<BackgroundProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
template std::unique_ptr<gfx::Program<BackgroundPatternProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
using namespace style;
|
||||
|
||||
static_assert(sizeof(BackgroundLayoutVertex) == 4, "expected BackgroundLayoutVertex size");
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include <mbgl/programs/circle_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<CircleProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
static_assert(sizeof(CircleLayoutVertex) == 4, "expected CircleLayoutVertex size");
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
#include <mbgl/programs/clipping_mask_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<ClippingMaskProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
#include <mbgl/programs/collision_box_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<CollisionBoxProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
template std::unique_ptr<gfx::Program<CollisionCircleProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
static_assert(sizeof(CollisionBoxProgram::LayoutVertex) == 24, "expected CollisionBoxVertex size");
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
#include <mbgl/programs/debug_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<DebugProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <mbgl/programs/fill_extrusion_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
#include <mbgl/renderer/image_atlas.hpp>
|
||||
#include <mbgl/renderer/cross_faded_property_evaluator.hpp>
|
||||
#include <mbgl/tile/tile_id.hpp>
|
||||
@@ -8,9 +7,6 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<FillExtrusionProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
template std::unique_ptr<gfx::Program<FillExtrusionPatternProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
using namespace style;
|
||||
|
||||
static_assert(sizeof(FillExtrusionLayoutVertex) == 12, "expected FillExtrusionLayoutVertex size");
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <mbgl/programs/fill_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
#include <mbgl/renderer/image_atlas.hpp>
|
||||
#include <mbgl/renderer/cross_faded_property_evaluator.hpp>
|
||||
#include <mbgl/tile/tile_id.hpp>
|
||||
@@ -7,11 +6,6 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<FillProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
template std::unique_ptr<gfx::Program<FillPatternProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
template std::unique_ptr<gfx::Program<FillOutlineProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
template std::unique_ptr<gfx::Program<FillOutlinePatternProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
using namespace style;
|
||||
|
||||
static_assert(sizeof(FillLayoutVertex) == 4, "expected FillLayoutVertex size");
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<BackgroundProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<BackgroundProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<BackgroundProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<BackgroundProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<BackgroundPatternProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<BackgroundPatternProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<BackgroundPatternProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<BackgroundPatternProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<CircleProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<CircleProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<CircleProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<CircleProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<ClippingMaskProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<ClippingMaskProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<ClippingMaskProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<ClippingMaskProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<CollisionBoxProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<CollisionBoxProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<CollisionBoxProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<CollisionBoxProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<CollisionCircleProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<CollisionCircleProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<CollisionCircleProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<CollisionCircleProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<DebugProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<DebugProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<DebugProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<DebugProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<FillProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<FillProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<FillProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<FillProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<FillExtrusionProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<FillExtrusionProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<FillExtrusionProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<FillExtrusionProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<FillExtrusionPatternProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<FillExtrusionPatternProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<FillExtrusionPatternProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<FillExtrusionPatternProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<FillOutlineProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<FillOutlineProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<FillOutlineProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<FillOutlineProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<FillOutlinePatternProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<FillOutlinePatternProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<FillOutlinePatternProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<FillOutlinePatternProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<FillPatternProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<FillPatternProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<FillPatternProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<FillPatternProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<HeatmapProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<HeatmapProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<HeatmapProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<HeatmapProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<HeatmapTextureProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<HeatmapTextureProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<HeatmapTextureProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<HeatmapTextureProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<HillshadeProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<HillshadeProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<HillshadeProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<HillshadeProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<HillshadePrepareProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<HillshadePrepareProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<HillshadePrepareProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<HillshadePrepareProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<LineProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<LineProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<LineProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<LineProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<LineGradientProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<LineGradientProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<LineGradientProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<LineGradientProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<LinePatternProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<LinePatternProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<LinePatternProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<LinePatternProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<LineSDFProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<LineSDFProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<LineSDFProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<LineSDFProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<RasterProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<RasterProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<RasterProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<RasterProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<SymbolIconProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<SymbolIconProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<SymbolIconProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<SymbolIconProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<SymbolSDFIconProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<SymbolSDFIconProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<SymbolSDFIconProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<SymbolSDFIconProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<SymbolSDFTextProgram>::hash[8];
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<SymbolSDFTextProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
std::unique_ptr<gfx::Program<SymbolSDFTextProgram>>
|
||||
Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
|
||||
return std::make_unique<gl::Program<SymbolSDFTextProgram>>(programParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include <mbgl/programs/heatmap_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<HeatmapProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
static_assert(sizeof(HeatmapLayoutVertex) == 4, "expected HeatmapLayoutVertex size");
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include <mbgl/programs/heatmap_texture_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<HeatmapTextureProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
static_assert(sizeof(HeatmapTextureLayoutVertex) == 4, "expected HeatmapTextureLayoutVertex size");
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include <mbgl/programs/hillshade_prepare_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<HillshadePrepareProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
static_assert(sizeof(HillshadePrepareLayoutVertex) == 8, "expected HillshadeLayoutVertex size");
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include <mbgl/programs/hillshade_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<HillshadeProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
static_assert(sizeof(HillshadeLayoutVertex) == 8, "expected HillshadeLayoutVertex size");
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <mbgl/programs/line_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
#include <mbgl/style/layers/line_layer_properties.hpp>
|
||||
#include <mbgl/renderer/render_tile.hpp>
|
||||
#include <mbgl/renderer/image_atlas.hpp>
|
||||
@@ -9,11 +8,6 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<LineProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
template std::unique_ptr<gfx::Program<LinePatternProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
template std::unique_ptr<gfx::Program<LineGradientProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
template std::unique_ptr<gfx::Program<LineSDFProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
using namespace style;
|
||||
|
||||
static_assert(sizeof(LineLayoutVertex) == 12, "expected LineLayoutVertex size");
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include <mbgl/programs/raster_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<RasterProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
static_assert(sizeof(RasterLayoutVertex) == 8, "expected RasterLayoutVertex size");
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <mbgl/programs/symbol_program.hpp>
|
||||
#include <mbgl/gfx/context_impl.hpp>
|
||||
#include <mbgl/renderer/render_tile.hpp>
|
||||
#include <mbgl/map/transform_state.hpp>
|
||||
#include <mbgl/style/layers/symbol_layer_impl.hpp>
|
||||
@@ -10,10 +9,6 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template std::unique_ptr<gfx::Program<SymbolIconProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
template std::unique_ptr<gfx::Program<SymbolSDFTextProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
template std::unique_ptr<gfx::Program<SymbolSDFIconProgram>> gfx::Context::createProgram(const ProgramParameters&);
|
||||
|
||||
using namespace style;
|
||||
|
||||
static_assert(sizeof(SymbolLayoutVertex) == 16, "expected SymbolLayoutVertex size");
|
||||
|
||||
@@ -87,6 +87,10 @@ public:
|
||||
};
|
||||
|
||||
TEST(CustomLayer, Basic) {
|
||||
if (gfx::Backend::GetType() != gfx::Backend::Type::OpenGL) {
|
||||
return;
|
||||
}
|
||||
|
||||
util::RunLoop loop;
|
||||
|
||||
HeadlessFrontend frontend { 1 };
|
||||
|
||||
@@ -85,6 +85,10 @@ struct Buffer {
|
||||
};
|
||||
|
||||
TEST(GLContextMode, Shared) {
|
||||
if (gfx::Backend::GetType() != gfx::Backend::Type::OpenGL) {
|
||||
return;
|
||||
}
|
||||
|
||||
util::RunLoop loop;
|
||||
|
||||
HeadlessFrontend frontend { 1, {}, gfx::ContextMode::Shared };
|
||||
|
||||
@@ -610,6 +610,10 @@ TEST(Map, AddLayer) {
|
||||
}
|
||||
|
||||
TEST(Map, WithoutVAOExtension) {
|
||||
if (gfx::Backend::GetType() != gfx::Backend::Type::OpenGL) {
|
||||
return;
|
||||
}
|
||||
|
||||
MapTest<DefaultFileSource> test { ":memory:", "test/fixtures/api/assets" };
|
||||
|
||||
gfx::BackendScope scope { *test.frontend.getBackend() };
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#include <mbgl/actor/scheduler.hpp>
|
||||
#include <mbgl/gfx/backend.hpp>
|
||||
#include <mbgl/test.hpp>
|
||||
#include <mbgl/test/util.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <args.hxx>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
int runTests(int argc, char *argv[]) {
|
||||
@@ -12,6 +15,12 @@ int runTests(int argc, char *argv[]) {
|
||||
#endif
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
args::ArgumentParser argumentParser("Unit tests");
|
||||
args::ValueFlag<std::string> backendValue(argumentParser, "Backend", "Rendering backend", {"backend"});
|
||||
|
||||
argumentParser.ParseCLI(argc, argv);
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ using namespace mbgl;
|
||||
using namespace mbgl::platform;
|
||||
|
||||
TEST(OffscreenTexture, EmptyRed) {
|
||||
if (gfx::Backend::GetType() != gfx::Backend::Type::OpenGL) {
|
||||
return;
|
||||
}
|
||||
|
||||
gl::HeadlessBackend backend({ 512, 256 });
|
||||
gfx::BackendScope scope { backend };
|
||||
|
||||
@@ -76,6 +80,10 @@ struct Buffer {
|
||||
|
||||
|
||||
TEST(OffscreenTexture, RenderToTexture) {
|
||||
if (gfx::Backend::GetType() != gfx::Backend::Type::OpenGL) {
|
||||
return;
|
||||
}
|
||||
|
||||
gl::HeadlessBackend backend({ 512, 256 });
|
||||
gfx::BackendScope scope { backend };
|
||||
auto& context = static_cast<gl::Context&>(backend.getContext());
|
||||
|
||||
Reference in New Issue
Block a user