2018-10-07 03:36:44 +00:00
|
|
|
#pragma once
|
2015-11-09 02:24:45 +00:00
|
|
|
#if __APPLE__
|
|
|
|
|
2015-12-31 04:54:11 +00:00
|
|
|
#if !__has_feature(objc_arc)
|
|
|
|
#error ARC Required
|
|
|
|
#endif
|
|
|
|
|
2016-07-31 20:25:02 +00:00
|
|
|
#if BOO_HAS_METAL
|
2015-11-16 22:03:46 +00:00
|
|
|
|
|
|
|
#include <Metal/Metal.h>
|
|
|
|
#include <QuartzCore/CAMetalLayer.h>
|
2015-11-18 23:55:25 +00:00
|
|
|
#include <unordered_map>
|
2015-12-09 22:23:22 +00:00
|
|
|
#include <mutex>
|
2015-11-16 22:03:46 +00:00
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
namespace boo {
|
2015-11-18 23:55:25 +00:00
|
|
|
class IWindow;
|
2018-12-08 05:17:51 +00:00
|
|
|
struct MetalContext {
|
|
|
|
id<MTLDevice> m_dev = nullptr;
|
|
|
|
id<MTLCommandQueue> m_q = nullptr;
|
|
|
|
struct Window {
|
|
|
|
CAMetalLayer* m_metalLayer = nullptr;
|
|
|
|
std::mutex m_resizeLock;
|
|
|
|
bool m_needsResize;
|
|
|
|
CGSize m_size;
|
|
|
|
};
|
|
|
|
std::unordered_map<IWindow*, Window> m_windows;
|
|
|
|
uint32_t m_sampleCount = 1;
|
|
|
|
uint32_t m_anisotropy = 1;
|
|
|
|
MTLPixelFormat m_pixelFormat = MTLPixelFormatBGRA8Unorm;
|
2015-11-09 02:24:45 +00:00
|
|
|
};
|
2018-12-08 05:17:51 +00:00
|
|
|
} // namespace boo
|
2015-11-09 02:24:45 +00:00
|
|
|
|
2015-11-16 22:03:46 +00:00
|
|
|
#else
|
2018-12-08 05:17:51 +00:00
|
|
|
namespace boo {
|
|
|
|
struct MetalContext {};
|
|
|
|
} // namespace boo
|
2015-11-16 22:03:46 +00:00
|
|
|
#endif
|
|
|
|
|
2015-11-09 02:24:45 +00:00
|
|
|
#endif // __APPLE__
|