View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vídeos

Abrir menu Fechar menu
  • Coleções
  • Todos os vídeos
  • Sobre

Mais vídeos

  • Sobre
  • Código
  • Go bindless with Metal 3

    Learn how you can unleash powerful rendering techniques like ray tracing when you go bindless with Metal 3. We'll show you how to make your app's bindless journey a joy by simplifying argument buffers, allocating acceleration structures from heaps, and benefitting from the improvements to the Metal's validation layer and Debugger Tools. We'll also explore how you can command more CPU and GPU performance with long-term resource structures.

    Recursos

    • Rendering reflections in real time using ray tracing
    • Metal for Accelerating Ray Tracing
    • Metal
      • Vídeo HD
      • Vídeo SD

    Vídeos relacionados

    WWDC23

    • Bring your game to Mac, Part 2: Compile your shaders

    WWDC22

    • Discover Metal 3
    • Maximize your Metal ray tracing performance
    • Profile and optimize your game's memory

    WWDC21

    • Enhance your app with Metal ray tracing
    • Explore bindless rendering in Metal
    • Explore hybrid rendering with Metal ray tracing
  • Buscar neste vídeo...
    • 5:38 - Write argument buffers in Metal 3

      // Write argument buffers in Metal 3
      
      struct Mesh
      {
         uint64_t normals; // 64-bit uint for constant packed_float3*
      };
      
      NSUInteger meshArgumentSize = sizeof(struct Mesh);
      
      id<MTLBuffer> meshArgumentBuffer = [device newBufferWithLength:meshArgumentSize
                                                             options:storageMode];
      
      struct Mesh* meshes = (struct Mesh *)(meshArgumentBuffer.contents); 
       
      meshes->normals = normalBuffer.gpuAddress + normalBufferOffset;
    • 6:31 - // Shader struct:

      // Shader struct:
      
      struct Mesh
      {
         constant packed_float3* normals;
      };
      
      // Host-side struct:
      
      struct Mesh
      {
          uint64_t normals;
      };
    • 6:53 - Shared struct:

      // Shared struct:
      
      #if __METAL_VERSION__
      #define CONSTANT_PTR(x) constant x*
      #else
      #define CONSTANT_PTR(x) uint64_t
      #endif
      
      struct Mesh
      {
          CONSTANT_PTR(packed_float3) normals;
      };
    • 7:53 - Write unbounded arrays of resources in Metal 3

      // Write unbounded arrays of resources in Metal 3
      
      struct Mesh
      {
         uint64_t normals; // 64-bit uint for constant packed_float3*
      };
      
      NSUInteger meshArgumentSize = sizeof(struct Mesh) * meshes.count;
      
      id<MTLBuffer> meshArgumentBuffer = [device newBufferWithLength:meshArgumentSize
                                                              options:storageMode];
      
      struct Mesh* meshes = (struct Mesh *)(meshArgumentBuffer.contents); 
      
      for ( NSUInteger i = 0; i < meshes.count; ++i )
      {
         meshes[i].normals = normalBuffers[i].gpuAddress + normalBufferOffsets[i];
      }
    • 9:03 - Metal shading language: unbounded arrays option 1

      // Metal shading language:
      
      struct Mesh
      {
         constant packed_float3* normals;
      };
      
      
      fragment half4 fragmentShader(ColorInOut v          [[stage_in]],
                                    constant Mesh* meshes [[buffer(0)]] )
      {
          /* determine mesh to read, e.g. geometry_id */
      
          packed_float3 n0 = meshes[ geometry_id ].normals[0];
          packed_float3 n1 = meshes[ geometry_id ].normals[1];
          packed_float3 n2 = meshes[ geometry_id ].normals[2];
      
          /* interpolate normals and calculate shading */
      }
    • 9:25 - Metal shading language: unbounded arrays option 2

      // Metal shading language:
      struct Mesh
      {
         constant packed_float3* normals;
      };
      
      struct Scene
      {
         constant Mesh*     meshes;     // mesh array
         constant Material* materials;  // material array
      };
      
      fragment half4 fragmentShader(ColorInOut v          [[stage_in]],
                                    constant Scene& scene [[buffer(0)]] )
      {
          /* determine mesh to read, e.g. geometry_id */
          packed_float3 n0 = scene.meshes[ geometry_id ].normals[0];
          packed_float3 n1 = scene.meshes[ geometry_id ].normals[1];
          packed_float3 n2 = scene.meshes[ geometry_id ].normals[2];
          /* interpolate normals and calculate shading */
      }
    • 11:00 - Size and alignment for MTLAccelerationStructure in a MTLHeap

      heapAccelerationStructureSizeAndAlignWithDescriptor:
    • 13:49 - Store individual indirect resources in NSMutableSet

      // Argument buffer loading
      for (NSUInteger i = 0; i < mesh.submeshes.count; ++i) {
      
          Submesh*      submesh     = mesh.submeshes[i];
          id<MTLBuffer> indexBuffer = submesh.indexBuffer;
          NSArray*      textures    = submesh.textures;
      
          // Copy index buffer into argument buffer
         submeshAB[i].indices = indexBuffer.gpuAddress;
      
          // Copy material textures into argument buffer
         for (NSUInteger m = 0; m < textures.count; ++m) {
              submeshAB[i].textures[m] = textures[m].gpuResourceID;
          }
      
          // Remember indirect resources
          [sceneResources addObject:indexBuffer];
          [sceneResources addObjectsFromArray:textures];
      }

Developer Footer

  • Vídeos
  • WWDC22
  • Go bindless with Metal 3
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines