boo/lib/mac/CocoaCommon.hpp
Lioncash baff71cdc3 General: Tidy up includes
Alphabetizes includes and resolves quite a few instances of indirect
inclusions, making the requirements of several interfaces explicit. This
also trims out includes that aren't actually necessary (likely due to
changes in the API over time).
2019-08-19 21:02:56 -04:00

41 lines
754 B
C++

#pragma once
#if __APPLE__
#if !__has_feature(objc_arc)
#error ARC Required
#endif
#if BOO_HAS_METAL
#include <Metal/Metal.h>
#include <QuartzCore/CAMetalLayer.h>
#include <mutex>
#include <unordered_map>
namespace boo {
class IWindow;
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;
};
} // namespace boo
#else
namespace boo {
struct MetalContext {};
} // namespace boo
#endif
#endif // __APPLE__