All Projects → xmartlabs → Metalperformanceshadersproxy

xmartlabs / Metalperformanceshadersproxy

Licence: mit
A proxy for MetalPerformanceShaders which takes to a stub on a simulator and to the real implementation on iOS devices.

Projects that are alternatives of or similar to Metalperformanceshadersproxy

react-device-frameset
React device frameset component
Stars: ✭ 30 (-26.83%)
Mutual labels:  device, simulator
Wiremockui
Wiremock UI - Tool for creating mock servers, proxies servers and proxies servers with the option to save the data traffic from an existing API or Site.
Stars: ✭ 38 (-7.32%)
Mutual labels:  proxy, stub
Stubmatic
Mock HTTP calls without coding. Designed specially for testing and testers.
Stars: ✭ 118 (+187.8%)
Mutual labels:  simulator, stub
Mockingbird
Simplify software testing, by easily mocking any system using HTTP/HTTPS, allowing a team to test and develop against a service that is not complete or is unstable or just to reproduce planned/edge cases.
Stars: ✭ 149 (+263.41%)
Mutual labels:  proxy, stub
Devicekit
DeviceKit is a value-type replacement of UIDevice.
Stars: ✭ 3,566 (+8597.56%)
Mutual labels:  simulator, device
Proxy Watcher
A library that recursively watches an object for mutations via Proxies and tells you which paths changed.
Stars: ✭ 35 (-14.63%)
Mutual labels:  proxy
Mipsgo
MIPS Simulator written in Go
Stars: ✭ 34 (-17.07%)
Mutual labels:  simulator
Tiny Http Proxy
Maybe the tiniest HTTP proxy that also has a cache
Stars: ✭ 34 (-17.07%)
Mutual labels:  proxy
Gravitational Waves Playground
Make gravitational waves visible in an interactive iPad simulation.
Stars: ✭ 33 (-19.51%)
Mutual labels:  metal
Waliyun
阿里云Node.js Open API SDK(完整版)
Stars: ✭ 40 (-2.44%)
Mutual labels:  proxy
Furion
Socks5 + SSL Proxy
Stars: ✭ 39 (-4.88%)
Mutual labels:  proxy
Vaulty
Tokenize, encrypt/decrypt, mask your data on the fly with Vaulty proxy
Stars: ✭ 38 (-7.32%)
Mutual labels:  proxy
Pioneer
A game of lonely space adventure
Stars: ✭ 979 (+2287.8%)
Mutual labels:  simulator
Wepsim
WepSIM: Web Elemental Processor SIMulator
Stars: ✭ 38 (-7.32%)
Mutual labels:  simulator
Axios Module
Secure and easy axios integration with Nuxt.js
Stars: ✭ 998 (+2334.15%)
Mutual labels:  proxy
Dispatchproxyasync
System.Reflection.DispatchProxy to Async Proxy
Stars: ✭ 33 (-19.51%)
Mutual labels:  proxy
Blender Flip Fluids
FLIP Fluids is a powerful liquid simulation plugin that gives you the ability to create high quality fluid effects all within Blender, the free and open source 3D creation suite.
Stars: ✭ 983 (+2297.56%)
Mutual labels:  simulator
Reading And Comprehense Twemproxy0.4.1
redis、memcached缓存代理twemproxy源码详细分析注释,带详尽中文注释及函数调用关系。(源码学习交流QQ群:568892619)
Stars: ✭ 39 (-4.88%)
Mutual labels:  proxy
Squid
Squid Web Proxy Cache
Stars: ✭ 981 (+2292.68%)
Mutual labels:  proxy
Sst Elements
SST Architectural Simulation Components and Libraries
Stars: ✭ 36 (-12.2%)
Mutual labels:  simulator

MetalPerformanceShadersProxy

Build status Platform iOS Swift 4 compatible Carthage compatible CocoaPods compatible License: MIT

By Xmartlabs SRL

A proxy for MetalPerformanceShaders (and dependents) which takes to a stub on a simulator and to the real implementation on a device. It works both for Swift and Objective-C.

It's usually a problem not to be able to compile for a simulator target when using Metal shaders. By using this proxy, you are being able to compile and to run on simulators. Note that trying to run the Metal shaders on a simulator will fail. Nevertheless, it allows a project that implements Metal shaders to:

  • Upload a pod to CocoaPods.
  • Make a framework to work with Carthage.
  • Run an app on a simulator to use features that don't depend on Metal shaders.
  • Compile unit tests.
  • Test automatically (maybe with a CI server) with simulators the parts of an app that don't depend on Metal shaders.

Usage

If you use Metal, you probably use CVMetalTexture.h and CVMetalTextureCache.h from CoreVideo or CAMetalDrawable.h from QuartzCore. But they are not available when targetting the simulator. To make them available, just do:

import MetalPerformanceShadersProxy

This pod will add no stub to devices (no footprint!), as the proxy uses preprocessor macros to decide which implementation to use.

Note that if a stub method is called, a exception will be thrown.

currentDrawable from MTKView

currentDrawable property of MTKView is of type CAMetalDrawable in the device but of type MTLDrawable in the simulator. So you need to cast it in your code to use it properly. E.g., if you have

let texture = view.currentDrawable.texture

change it to

let texture = (view.currentDrawable as? CAMetalDrawable)?.texture

This is the best workaround we came up with. If you happen to have a better idea, please open an issue.

Advanced: Control when to use the stub

If for some reason you want to control when to use the stub, you can import the stub like:

#if condition
    import MetalPerformanceShadersStub
#endif

How it was created

See CREATION for an explanation.

Requirements

  • iOS 9.0+
  • Xcode 9.0+

To use with previous Xcode versions, see previous releases.

Getting involved

  • If you want to contribute please feel free to submit pull requests.
  • If you have a feature request please open an issue.
  • If you found a bug or need help please check older issues before submitting an issue..

In particular, if you find a missing Metal-dependent framework, open an issue or better submit a pull request 😄

Before contribute check the CONTRIBUTING file for more info.

If you use MetalPerformanceShadersProxy in your app, we would love to hear about it! Drop us a line on Twitter.

Examples

Follow these 3 steps to run Example project: clone MetalPerformanceShadersProxy repository, open MetalPerformanceShadersProxy workspace and run the Example project.

As a real example, you can check out the Bender library.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

To install MetalPerformanceShadersProxy, simply add the following line to your Podfile:

pod 'MetalPerformanceShadersProxy', '~> 0.3'

If you just want the stub:

pod 'MetalPerformanceShadersProxy/Stub', '~> 0.3'

Carthage

Carthage is a simple, decentralized dependency manager for Cocoa.

To install MetalPerformanceShadersProxy, simply add the following line to your Cartfile:

github "xmartlabs/MetalPerformanceShadersProxy" ~> 0.2

Author

Changelog

It can be found in the CHANGELOG file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].