mirror of
https://github.com/AxioDL/boo.git
synced 2025-05-15 20:01:33 +00:00
Metal platform fixes
This commit is contained in:
parent
0ee5944387
commit
2ec943f0b2
@ -84,6 +84,7 @@ elseif(APPLE)
|
|||||||
find_library(OPENGL_LIBRARY OpenGL)
|
find_library(OPENGL_LIBRARY OpenGL)
|
||||||
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET OR CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.10)
|
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET OR CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.10)
|
||||||
find_library(METAL_LIBRARY Metal)
|
find_library(METAL_LIBRARY Metal)
|
||||||
|
list(APPEND _BOO_SYS_DEFINES -DBOO_HAS_METAL=1)
|
||||||
else()
|
else()
|
||||||
set(METAL_LIBRARY "")
|
set(METAL_LIBRARY "")
|
||||||
endif()
|
endif()
|
||||||
|
@ -5,29 +5,29 @@
|
|||||||
|
|
||||||
#ifndef ENABLE_BITWISE_ENUM
|
#ifndef ENABLE_BITWISE_ENUM
|
||||||
#define ENABLE_BITWISE_ENUM(type)\
|
#define ENABLE_BITWISE_ENUM(type)\
|
||||||
inline type operator|(type a, type b)\
|
constexpr type operator|(type a, type b)\
|
||||||
{\
|
{\
|
||||||
using T = std::underlying_type_t<type>;\
|
using T = std::underlying_type_t<type>;\
|
||||||
return type(static_cast<T>(a) | static_cast<T>(b));\
|
return type(static_cast<T>(a) | static_cast<T>(b));\
|
||||||
}\
|
}\
|
||||||
inline type operator&(type a, type b)\
|
constexpr type operator&(type a, type b)\
|
||||||
{\
|
{\
|
||||||
using T = std::underlying_type_t<type>;\
|
using T = std::underlying_type_t<type>;\
|
||||||
return type(static_cast<T>(a) & static_cast<T>(b));\
|
return type(static_cast<T>(a) & static_cast<T>(b));\
|
||||||
}\
|
}\
|
||||||
inline type& operator|=(type& a, const type& b)\
|
constexpr type& operator|=(type& a, const type& b)\
|
||||||
{\
|
{\
|
||||||
using T = std::underlying_type_t<type>;\
|
using T = std::underlying_type_t<type>;\
|
||||||
a = type(static_cast<T>(a) | static_cast<T>(b));\
|
a = type(static_cast<T>(a) | static_cast<T>(b));\
|
||||||
return a;\
|
return a;\
|
||||||
}\
|
}\
|
||||||
inline type& operator&=(type& a, const type& b)\
|
constexpr type& operator&=(type& a, const type& b)\
|
||||||
{\
|
{\
|
||||||
using T = std::underlying_type_t<type>;\
|
using T = std::underlying_type_t<type>;\
|
||||||
a = type(static_cast<T>(a) & static_cast<T>(b));\
|
a = type(static_cast<T>(a) & static_cast<T>(b));\
|
||||||
return a;\
|
return a;\
|
||||||
}\
|
}\
|
||||||
inline type operator~(const type& key)\
|
constexpr type operator~(const type& key)\
|
||||||
{\
|
{\
|
||||||
using T = std::underlying_type_t<type>;\
|
using T = std::underlying_type_t<type>;\
|
||||||
return type(~static_cast<T>(key));\
|
return type(~static_cast<T>(key));\
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
#ifndef GDEV_METAL_HPP
|
#ifndef GDEV_METAL_HPP
|
||||||
#define GDEV_METAL_HPP
|
#define GDEV_METAL_HPP
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
#if BOO_HAS_METAL
|
||||||
#include <Availability.h>
|
|
||||||
|
|
||||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100
|
|
||||||
#define BOO_HAS_METAL 1
|
|
||||||
|
|
||||||
#include "IGraphicsDataFactory.hpp"
|
#include "IGraphicsDataFactory.hpp"
|
||||||
#include "IGraphicsCommandQueue.hpp"
|
#include "IGraphicsCommandQueue.hpp"
|
||||||
@ -80,9 +76,6 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
#define BOO_HAS_METAL 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
#endif // GDEV_METAL_HPP
|
#endif // GDEV_METAL_HPP
|
||||||
|
@ -621,10 +621,6 @@ struct MetalShaderDataBinding : IShaderDataBinding
|
|||||||
}
|
}
|
||||||
for (size_t i=0 ; i<texCount ; ++i)
|
for (size_t i=0 ; i<texCount ; ++i)
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
|
||||||
if (!texs[i])
|
|
||||||
Log.report(logvisor::Fatal, "null texture %d provided to newShaderDataBinding", int(i));
|
|
||||||
#endif
|
|
||||||
m_texs[i] = texs[i];
|
m_texs[i] = texs[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -653,6 +649,7 @@ struct MetalShaderDataBinding : IShaderDataBinding
|
|||||||
[enc setVertexBuffer:GetBufferGPUResource(m_ubufs[i], b) offset:0 atIndex:i+2];
|
[enc setVertexBuffer:GetBufferGPUResource(m_ubufs[i], b) offset:0 atIndex:i+2];
|
||||||
}
|
}
|
||||||
for (size_t i=0 ; i<m_texCount ; ++i)
|
for (size_t i=0 ; i<m_texCount ; ++i)
|
||||||
|
if (m_texs[i])
|
||||||
[enc setFragmentTexture:GetTextureGPUResource(m_texs[i], b) atIndex:i];
|
[enc setFragmentTexture:GetTextureGPUResource(m_texs[i], b) atIndex:i];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -6,10 +6,7 @@
|
|||||||
#error ARC Required
|
#error ARC Required
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Availability.h>
|
#if BOO_HAS_METAL
|
||||||
|
|
||||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100
|
|
||||||
#define BOO_HAS_METAL 1
|
|
||||||
|
|
||||||
#include <Metal/Metal.h>
|
#include <Metal/Metal.h>
|
||||||
#include <QuartzCore/CAMetalLayer.h>
|
#include <QuartzCore/CAMetalLayer.h>
|
||||||
@ -35,7 +32,6 @@ struct MetalContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define BOO_HAS_METAL 0
|
|
||||||
namespace boo
|
namespace boo
|
||||||
{
|
{
|
||||||
struct MetalContext {};
|
struct MetalContext {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user