Giter Site home page Giter Site logo

muizidn / metal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dehesa/sample-metal

0.0 0.0 0.0 3.95 MB

Examples for Apple's Metal APIs (rendering and compute).

License: MIT License

Swift 85.01% Metal 13.80% Objective-C 0.09% C 0.40% C++ 0.70%

metal's Introduction

Metal Logo & Name

This repo contains code with examples on how to use Apple's Metal GPU APIs. Some sample code has been created entirely by me, while others have been picked from Github. The latter ones are in this repo because they have been heavily modified, not only to support the latest version of Swift, but also to add support to iOS or macOS (when applicable). Links to the source Github repos or websites are provided.

Swift 5.1 metal platforms Xcode 11 License

Projects

  • Apple's sample code.

    Basic Tessellation.

    This sample shows how to tessellate a triangle or quad patch with adjustable per-patch tessellation factors.

    macOS app tessellating a triangle

  • Command-Line apps.

    GPU Inspector.

    Prints on stdout a brief description of all your available GPUs. For example:

    Intel(R) HD Graphics 530
        Built-in GPU (low power)
        Unified memory (shared with CPU)
            max recommended working set: 1.61 GB
        Feature set support
            family: common 1, common 2, common 3, mac 1, mac 2
            sets: 1v1, 1v2, 1v3, 1v4, 2v1
        General Purpose Computing
            max threadgroup memory: 66 KB
            max threads per threadgroup: [1024, 1024, 1024]
            threads execution width: 32
    
    AMD Radeon Pro 460
        Built-in GPU
        Discrete memory
            max recommended working set: 4.29 GB
        Feature set support
            family: common 1, common 2, common 3, mac 1, mac 2
            sets: 1v1, 1v2, 1v3, 1v4, 2v1
        General Purpose Computing
            max threadgroup memory: 66 KB
            max threads per threadgroup: [1024, 1024, 1024]
            threads execution width: 64
    

    Gray converter.

    Based on Safx' Gray converter compute sample, this small command-line utility transforms a picture into its gray-scale version and place it on the user's desktop.

    The command-line app expects one argument with the location of the image to transform (e.g. $(PROJECT_DIR)/Sources/GrayScale/Assets/Sample.jpg). If you run the program through Xcode, there is a default argument defined on the Xcode Scheme.

  • Metal by Example.
    Warren Moore wrote this book in 2015. It was and it remains one of the best introductions to Metal I have found. I've migrated most chapters to the latest Swift and I've added support to macOS.

  • Shader Exam.
    Leon Denise wrote a tweet with a typical shader exam he gives to his students on SupInfo.com.

Command-Line Apps

You can run Command-Line projects from Xcode and see the result in Xcode console; however, you can also build those projects on your terminal and execute them outside.

  1. Clone the project.

    git clone https://github.com/dehesa/Metal
  2. Navigate to the Command-Line source folder.

    cd "Command Line"
    
  3. Build the project you are interested in.

    xcodebuild -project "$PROJECT_NAME.xcodeproj"
  4. Execute the Command-Line tool from the build/Release folder.

    cd build/Release
    ./$TOOL_NAME

metal's People

Contributors

dehesa avatar warrenm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.