Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/drape
diff options
context:
space:
mode:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2018-10-02 18:24:43 +0300
committerVladimir Byko-Ianko <bykoianko@gmail.com>2018-10-04 13:57:58 +0300
commit63548b973f57a453a3299fc31e72f9f7a0d93d7c (patch)
tree6263b8aaab9f62dba3ed5eddf071f889697b4b5a /drape
parent0b8b83c8ff49d731218013aba599c630a21fa7c5 (diff)
Fixed Xcode compilation for MacOS.
Diffstat (limited to 'drape')
-rw-r--r--drape/data_buffer.cpp5
-rw-r--r--drape/drape_global.hpp6
-rw-r--r--drape/hw_texture.cpp9
-rw-r--r--drape/mesh_object.cpp2
-rw-r--r--drape/mesh_object.hpp4
-rw-r--r--drape/render_state.cpp11
-rw-r--r--drape/vertex_array_buffer.cpp3
7 files changed, 26 insertions, 14 deletions
diff --git a/drape/data_buffer.cpp b/drape/data_buffer.cpp
index 7864377889..d671d9d07e 100644
--- a/drape/data_buffer.cpp
+++ b/drape/data_buffer.cpp
@@ -1,7 +1,6 @@
#include "drape/data_buffer.hpp"
#include "drape/data_buffer_impl.hpp"
-
-#include "std/target_os.hpp"
+#include "drape/drape_global.hpp"
namespace dp
{
@@ -36,7 +35,7 @@ void DataBuffer::MoveToGPU(ref_ptr<GraphicsContext> context, GPUBuffer::Target t
}
else if (apiVersion == dp::ApiVersion::Metal)
{
-#if defined(OMIM_OS_IPHONE) && !defined(OMIM_OS_IPHONE_SIMULATOR)
+#if defined(OMIM_METAL_AVAILABLE)
if (currentSize != 0)
{
m_impl = CreateImplForMetal(context, m_impl->Data(), m_impl->GetElementSize(),
diff --git a/drape/drape_global.hpp b/drape/drape_global.hpp
index 2a90388711..2c0f7e8572 100644
--- a/drape/drape_global.hpp
+++ b/drape/drape_global.hpp
@@ -6,8 +6,14 @@
#include "base/assert.hpp"
+#include "std/target_os.hpp"
+
#include <cstdint>
+#if defined(OMIM_OS_IPHONE) && !defined(OMIM_OS_IPHONE_SIMULATOR) && !defined(OMIM_OS_MAC)
+#define OMIM_METAL_AVAILABLE
+#endif
+
namespace dp
{
enum class ApiVersion
diff --git a/drape/hw_texture.cpp b/drape/hw_texture.cpp
index f5108ff902..b230a5fb20 100644
--- a/drape/hw_texture.cpp
+++ b/drape/hw_texture.cpp
@@ -1,5 +1,6 @@
#include "drape/hw_texture.hpp"
+#include "drape/drape_global.hpp"
#include "drape/gl_functions.hpp"
#include "drape/utils/gpu_mem_tracker.hpp"
@@ -12,7 +13,9 @@
#if defined(OMIM_OS_IPHONE)
#include "drape/hw_texture_ios.hpp"
+#endif
+#if defined(OMIM_METAL_AVAILABLE)
extern drape_ptr<dp::HWTextureAllocator> CreateMetalAllocator();
extern ref_ptr<dp::HWTextureAllocator> GetDefaultMetalAllocator();
#endif
@@ -253,7 +256,7 @@ drape_ptr<HWTextureAllocator> CreateAllocator(ref_ptr<dp::GraphicsContext> conte
auto const apiVersion = context->GetApiVersion();
if (apiVersion == dp::ApiVersion::Metal)
{
-#if defined(OMIM_OS_IPHONE) && !defined(OMIM_OS_IPHONE_SIMULATOR)
+#if defined(OMIM_METAL_AVAILABLE)
return CreateMetalAllocator();
#endif
CHECK(false, ("Metal rendering is supported now only on iOS."));
@@ -263,7 +266,7 @@ drape_ptr<HWTextureAllocator> CreateAllocator(ref_ptr<dp::GraphicsContext> conte
if (apiVersion == dp::ApiVersion::OpenGLES3)
return make_unique_dp<OpenGLHWTextureAllocator>();
-#if defined(OMIM_OS_IPHONE) && !defined(OMIM_OS_IPHONE_SIMULATOR)
+#if defined(OMIM_METAL_AVAILABLE)
return make_unique_dp<HWTextureAllocatorApple>();
#else
return make_unique_dp<OpenGLHWTextureAllocator>();
@@ -275,7 +278,7 @@ ref_ptr<HWTextureAllocator> GetDefaultAllocator(ref_ptr<dp::GraphicsContext> con
CHECK(context != nullptr, ());
if (context->GetApiVersion() == dp::ApiVersion::Metal)
{
-#if defined(OMIM_OS_IPHONE) && !defined(OMIM_OS_IPHONE_SIMULATOR)
+#if defined(OMIM_METAL_AVAILABLE)
return GetDefaultMetalAllocator();
#endif
CHECK(false, ("Metal rendering is supported now only on iOS."));
diff --git a/drape/mesh_object.cpp b/drape/mesh_object.cpp
index 81c777d052..152d9af5ea 100644
--- a/drape/mesh_object.cpp
+++ b/drape/mesh_object.cpp
@@ -153,7 +153,7 @@ MeshObject::MeshObject(ref_ptr<dp::GraphicsContext> context, DrawPrimitive drawP
}
else if (apiVersion == dp::ApiVersion::Metal)
{
-#if defined(OMIM_OS_IPHONE) && !defined(OMIM_OS_IPHONE_SIMULATOR)
+#if defined(OMIM_METAL_AVAILABLE)
InitForMetal();
#endif
}
diff --git a/drape/mesh_object.hpp b/drape/mesh_object.hpp
index 06e1d1c65c..7d769e0f40 100644
--- a/drape/mesh_object.hpp
+++ b/drape/mesh_object.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include "drape/drape_global.hpp"
#include "drape/graphics_context.hpp"
#include "drape/pointers.hpp"
#include "drape/render_state.hpp"
@@ -99,8 +100,11 @@ private:
};
void InitForOpenGL();
+
+#if defined(OMIM_METAL_AVAILABLE)
// Definition of this method is in a .mm-file.
void InitForMetal();
+#endif
void Bind(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program);
void Unbind(ref_ptr<dp::GpuProgram> program);
diff --git a/drape/render_state.cpp b/drape/render_state.cpp
index b12752b868..311e7bc4a2 100644
--- a/drape/render_state.cpp
+++ b/drape/render_state.cpp
@@ -1,11 +1,10 @@
#include "drape/render_state.hpp"
+#include "drape/drape_global.hpp"
#include "drape/gl_functions.hpp"
#include "drape/gl_gpu_program.hpp"
#include "base/buffer_vector.hpp"
-#include "std/target_os.hpp"
-
namespace dp
{
namespace
@@ -14,7 +13,7 @@ std::string const kColorTextureName = "u_colorTex";
std::string const kMaskTextureName = "u_maskTex";
} // namespace
-#if defined(OMIM_OS_IPHONE) && !defined(OMIM_OS_IPHONE_SIMULATOR)
+#if defined(OMIM_METAL_AVAILABLE)
// Definitions of these methods are in a .mm-file.
extern void ApplyDepthStencilStateForMetal(ref_ptr<GraphicsContext> context);
extern void ApplyPipelineStateForMetal(ref_ptr<GraphicsContext> context, ref_ptr<GpuProgram> program,
@@ -220,7 +219,7 @@ void TextureState::ApplyTextures(ref_ptr<GraphicsContext> context, RenderState c
}
else if (apiVersion == dp::ApiVersion::Metal)
{
-#if defined(OMIM_OS_IPHONE) && !defined(OMIM_OS_IPHONE_SIMULATOR)
+#if defined(OMIM_METAL_AVAILABLE)
ApplyTexturesForMetal(context, program, state);
#endif
}
@@ -245,7 +244,7 @@ void ApplyState(ref_ptr<GraphicsContext> context, ref_ptr<GpuProgram> program, R
if (apiVersion == dp::ApiVersion::Metal)
{
// For Metal rendering blending state is a part of the pipeline state.
-#if defined(OMIM_OS_IPHONE) && !defined(OMIM_OS_IPHONE_SIMULATOR)
+#if defined(OMIM_METAL_AVAILABLE)
ApplyPipelineStateForMetal(context, program, state.GetBlending().m_isEnabled);
#endif
}
@@ -261,7 +260,7 @@ void ApplyState(ref_ptr<GraphicsContext> context, ref_ptr<GpuProgram> program, R
if (apiVersion == dp::ApiVersion::Metal)
{
// For Metal rendering we have to apply depth-stencil state after SetX functions calls.
-#if defined(OMIM_OS_IPHONE) && !defined(OMIM_OS_IPHONE_SIMULATOR)
+#if defined(OMIM_METAL_AVAILABLE)
ApplyDepthStencilStateForMetal(context);
#endif
}
diff --git a/drape/vertex_array_buffer.cpp b/drape/vertex_array_buffer.cpp
index 79c7bfb360..f869dedc65 100644
--- a/drape/vertex_array_buffer.cpp
+++ b/drape/vertex_array_buffer.cpp
@@ -1,5 +1,6 @@
#include "drape/vertex_array_buffer.hpp"
+#include "drape/drape_global.hpp"
#include "drape/gl_functions.hpp"
#include "drape/gl_gpu_program.hpp"
#include "drape/index_storage.hpp"
@@ -206,7 +207,7 @@ void VertexArrayBuffer::Build(ref_ptr<GraphicsContext> context, ref_ptr<GpuProgr
}
else if (apiVersion == dp::ApiVersion::Metal)
{
-#if defined(OMIM_OS_IPHONE) && !defined(OMIM_OS_IPHONE_SIMULATOR)
+#if defined(OMIM_METAL_AVAILABLE)
m_impl = CreateImplForMetal(make_ref(this));
#endif
}