#pragma once #ifdef __APPLE__ #if BOO_HAS_METAL #include "boo/BooObject.hpp" #include "boo/IGraphicsContext.hpp" #include "boo/System.hpp" #include "boo/graphicsdev/IGraphicsCommandQueue.hpp" #include "boo/graphicsdev/IGraphicsDataFactory.hpp" namespace boo { struct BaseGraphicsData; class MetalDataFactory : public IGraphicsDataFactory { public: class Context final : public IGraphicsDataFactory::Context { friend class MetalDataFactoryImpl; MetalDataFactory& m_parent; ObjToken m_data; Context(MetalDataFactory& parent __BooTraceArgs); ~Context(); public: Platform platform() const { return Platform::Metal; } const char* platformName() const { return "Metal"; } ObjToken newStaticBuffer(BufferUse use, const void* data, size_t stride, size_t count); ObjToken newDynamicBuffer(BufferUse use, size_t stride, size_t count); ObjToken newStaticTexture(size_t width, size_t height, size_t mips, TextureFormat fmt, TextureClampMode clampMode, const void* data, size_t sz); ObjToken newStaticArrayTexture(size_t width, size_t height, size_t layers, size_t mips, TextureFormat fmt, TextureClampMode clampMode, const void* data, size_t sz); ObjToken newDynamicTexture(size_t width, size_t height, TextureFormat fmt, TextureClampMode clampMode); ObjToken newRenderTexture(size_t width, size_t height, TextureClampMode clampMode, size_t colorBindCount, size_t depthBindCount); ObjToken newCubeRenderTexture(size_t width, size_t mips); ObjToken newShaderStage(const uint8_t* data, size_t size, PipelineStage stage); ObjToken newShaderPipeline(ObjToken vertex, ObjToken fragment, ObjToken geometry, ObjToken control, ObjToken evaluation, const VertexFormatInfo& vtxFmt, const AdditionalPipelineInfo& additionalInfo, bool asynchronous = true); ObjToken newShaderDataBinding( const ObjToken& pipeline, const ObjToken& vbo, const ObjToken& instVbo, const ObjToken& ibo, size_t ubufCount, const ObjToken* ubufs, const PipelineStage* ubufStages, const size_t* ubufOffs, const size_t* ubufSizes, size_t texCount, const ObjToken* texs, const int* texBindIdxs, const bool* depthBind, size_t baseVert = 0, size_t baseInst = 0); }; static std::vector CompileMetal(const char* source, PipelineStage stage); }; } // namespace boo #endif #endif // __APPLE__