项目
在 GitHub 查看
naleksiev/mtlpp
关于
C++ Metal 封装库
设计与媒体可以做什么
- Complete API wrapper (iOS 10, tvOS 10, and OS X 10.12).
- Objective-C free headers - allow compiling agains the Metal API on any platform (no linking on platforms without Metal).
- Configurable AVAILABILITY and DEPRECATED validation.
- Amalgamated mtlpp.hpp and mtlpp.mm - or use the contents of src/ folder.
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文mtlpp - C++ wrapper around Metal
Complete wrapper around Metal (Apple's low-level graphics API).
#include "mtlpp.hpp"
int main()
{
mtlpp::Device device = mtlpp::Device::CreateSystemDefaultDevice();
mtlpp::CommandQueue commandQueue = device.NewCommandQueue();
mtlpp::CommandBuffer commandBuffer = commandQueue.CommandBuffer();
mtlpp::TextureDescriptor textureDesc = mtlpp::TextureDescriptor::Texture2DDescriptor(
mtlpp::PixelFormat::RGBA8Unorm, 320, 240, false);
textureDesc.SetUsage(mtlpp::TextureUsage::RenderTarget);
mtlpp::Texture texture = device.NewTexture(textureDesc);
// ...
return 0;
}
Main features
- Complete API wrapper (iOS 10, tvOS 10, and OS X 10.12).
- Objective-C free headers - allow compiling agains the Metal API on any platform (no linking on platforms without Metal).
- Configurable AVAILABILITY and DEPRECATED validation.
- Amalgamated
mtlpp.hppandmtlpp.mm- or use the contents ofsrc/folder.
Interop
mtlpp uses Toll-Free Bridging. The example below demonstrates how MTKView (MetalKit) can interop with mtlpp.
MTKView * mtkView;
// Objective-C to C++
mtlpp::Device device = ns::Handle{ (__bridge void*)mtkView.device };
// C++ to Objective-C
mtkView.device = (__bridge id<MTLDevice>)device.GetPtr();
探索相关项目
加载中…