Mantle - Introducing a new API for Graphics - AMD at GDC14

6,057 views

Published on

This AMD technology presentation from the 2014 Game Developers Conference in San Francisco March 17-21 explains how Mantle features can enable developers to improve both CPU and GPU performance in their titles. Also view this and other presentations at http://developer.amd.com/resources/documentation-articles/conference-presentations/

Published in: Technology, Business
0 Comments
12 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,057
On SlideShare
0
From Embeds
0
Number of Embeds
97
Actions
Shares
0
Downloads
92
Comments
0
Likes
12
Embeds 0
No embeds

No notes for slide

Mantle - Introducing a new API for Graphics - AMD at GDC14

  1. 1. 1 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MANTLE INTRODUCING A NEW API FOR GRAPHICS Guennadi Riguer
  2. 2. 2 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MORE MANTLE @ GDC 2014 Rendering Battlefield 4 with Mantle Johan Andersson, Technical Director, DICE/EA Location: Room 2009, West Hall, Date: Wednesday, March 19, Time: 3:30pm-4:30pm Nitrous & Mantle: Combining Efficient Engine Design with a Modern API Dan Baker, Partner, Oxide Games Tim Kipp, Partner, Oxide Games Location: Room 2009, West Hall, Date: Wednesday, March 19, Time: 5:00pm-6:00pm
  3. 3. 3 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 Direct3D and the Future of Graphics APIs Johan Andersson, Technical Director, DICE/EA Dan Baker, Partner, Oxide Games Dave Oldcorn, Software Engineering Fellow, AMD Location: Room 3020, West Hall, Date: Thursday, March 20, 5:30pm-6:30pm
  4. 4. Cevat Yerli Founder, CEO & President of Crytek
  5. 5. CRYENGINE Mantle Support © 2014 Crytek
  6. 6. 6 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 CRYENGINE Crytek‘s proprietary game development solution CRYENGINE is used in all nine Crytek studios across the globe. CRYENGINE support for more than 70 Licensees in the U.S., Europe and Asia. STUDIO NOTTINGHAM STUDIO FRANKFURT AM MAIN STUDIO BUDAPEST STUDIO SOFIA STUDIO KIEV STUDIO ISTANBUL STUDIO SHANGHAI STUDIO SEOULSTUDIO AUSTIN
  7. 7. 1999 2002 2003 2004 Crytek is founded in Coburg, Germany. The first CryENGINE® is born.TIMELINE The first iteration of CryENGINE®. Development of Far Cry. CryENGINE® is showcased for the first time at GDC. Far Cry is released. Crytek partners with EA to develop its second game, Crysis. CryENGINE® 2 debuts at GDC. Sci-fi FPS Crysis is released and wins critical acclaim for its high quality graphics and gameplay. 2007 The new and improved CryENGINE® 3 is released. Crysis 2 is announced, again in partnership with EA. It is Crytek’s first game for the PlayStation® 3 and Xbox 360, as well as the PC.2009 The new CRYENGINE is released for XBoxOne, PS4, Wii-U and PC RYSE is released.20132013 2014 CRYENGINE adds full native Linux support
  8. 8. 8 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 CRYTEK & AMD Over 10 years of collaboration AMD and CRYTEK share an intense passion for games and technology advancement . Crytek has always been on the cutting edge of making the most of the hardware available to deliver best visuals possible to our gamers and the best technology to our CRYENGINE developers. Close collaboration with AMD’s developer relations, driver, hardware architecture and HSA teams.
  9. 9. 9 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 CRYENGINE AND MANTLE Getting closer to the metal To achieve our vision of CG quality, real-time graphics this generation we need lower-level access to the hardware on PC and console. Working with AMD we look forward to greater flexibility and power using Mantle with CRYENGINE – the first game engine to support Mantle. Finally the GPU and CPU are at our mercy… 
  10. 10. 10 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 EXCITING FUTURE Games are going to look even better! We have pioneered effects in Ryse: Son Of Rome, but had to use them sparingly. In future these complex simulations and graphics effects will work in tandem, and be much more widespread. Thanks to our long term relationship with AMD we’ve been able to see this vision together. We are looking forward to showing the results of Mantle and CRYENGINE very soon…
  11. 11. 11 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 Thank you!
  12. 12. 12 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 AGENDA Mantle Innovation Mantle “Hello, world!” Mantle SDK Tools
  13. 13. 13 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 WHAT IS MANTLE Mantle is a new graphics API –“Just right” abstraction level –Modern API for modern GPUs –Designed by developers for developers What Mantle is not: –It’s not quite “down to the metal” API –It’s not some “magic” solution
  14. 14. 14 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 DESIGN GOALS Aggressive performance goals –100K draws/frame –Faster GPU performance Efficient multi-threading –Linear scaling with CPU cores Multi-platform
  15. 15. 15 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MANTLE INNOVATIONS Generalized memory Command buffer building/execution model Memory/image state management Monolithic pipelines New resource binding model
  16. 16. 16 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 “HELLO, WORLD!”
  17. 17. 17 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 GPUS AND DEVICES GPU Device GPU Device Application
  18. 18. 18 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 GPU DETECTION EXAMPLE GR_APPLICATION_INFO appInfo = {}; appInfo.pAppName = “myApp”; appInfo.pEngineName = “myEngine”; appInfo.apiVersion = GR_API_VERSION; GR_UINT32 gpuCount; GR_PHYSICAL_GPU gpus[GR_MAX_PHYSICAL_GPUS]; GR_RESULT result = grInitAndEnumerateGpus( &appInfo, NULL, &gpuCount, &gpus[0]); if (result == GR_SUCCESS) { FindSuitableGpu(gpus, gpuCount); }
  19. 19. 19 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 DEVICE CREATION EXAMPLE GR_DEVICE_QUEUE_CREATE_INFO dqci = {}; dqci.queueCount = 1; dqci.queueType = GR_QUEUE_UNIVERSAL; GR_CHAR* extNames[] = {"GR_WSI_WINDOWS", "GR_BORDER_COLOR_PALETTE"}; GR_DEVICE_CREATE_INFO info = {}; info.queueRecordCount = 1; info.pRequestedQueues = &dqci; info.extensionCount = 2; info.ppEnabledExtensionNames = extNames; info.maxValidationLevel = GR_VALIDATION_LEVEL_0; GR_RESULT result = grCreateDevice(gpu, &info, &device);
  20. 20. 20 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MEMORY MODEL Memory heap 1 Memory heap 2 Memory heap N . . . Mem Mem Mem Mem Mem Mem Mem Mem
  21. 21. 21 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MEMORY MODEL More general GPU memory access Application controls almost all GPU memory Page granularity allocations with control of heaps –Sub-allocate for small resources from pools Leverages GPU virtual address space No direct CPU access
  22. 22. 22 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 ALLOCATION EXAMPLE GR_MEMORY_ALLOC_INFO allocInfo = {}; allocInfo.memPriority = GR_MEMORY_PRIORITY_NORMAL; allocInfo.size = numPages * gpuPageSize; allocInfo.heapCount = 2; allocInfo.heaps[0] = firstChoiceHeapId; allocInfo.heaps[1] = secondChoiceHeapId; GR_RESULT result = grAllocMemory(device, &allocInfo, memory);
  23. 23. 23 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MEMORY MANAGEMENT Mantle is on top of OS video memory manager Application tracks use of memory –Provides memory references for GPU Could get really smart, just like on consoles –Use of memory pools is encouraged –Reduces amount of memory tracking
  24. 24. 24 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 RESOURCES Generalized GPU resources Other APIs Index buffers Vertex buffers Constant buffers Staging resources Textures UAVs Texture Arrays . . . Memory Mantle Images
  25. 25. 25 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 Application manages internal object memory DECOUPLED OBJECT MEMORY Memory State API object Other APIs Mantle Memory State API object
  26. 26. 26 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 OBJECT MEMORY BINDING EXAMPLE GR_MEMORY_REQUIREMENTS memReqs = {}; GR_SIZE reqSize = sizeof(GR_MEMORY_REQUIREMENTS); GR_RESULT result = grGetObjectInfo(object, GR_INFO_TYPE_MEMORY_REQUIREMENTS, &reqSize, &memReqs); if (memReqs.size > 0) { GR_GPU_SIZE bindOffs = 0; GR_GPU_MEMORY mem = GetMatchingMemObject(&memReqs, &bindOffs); grBindObjectMemory(object, mem, bindOffs); }
  27. 27. 27 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 PROGRAMMING MODEL Graphics Compute DMA GPU . . . Queues Application App thread App thread App thread App thread App thread
  28. 28. 28 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 DEVICE QUEUES Queue per physical HW engine –Universal: graphics & compute –Async compute –Async DMA (extension) More efficient use of HW resources –Parallel execution
  29. 29. 29 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 PARALLEL EXECUTION SPEEDUP Universal queue Universal queue Async. compute queue Async. DMA queue
  30. 30. 30 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 COMMAND BUFFER EXAMPLE GR_CMD_BUFFER cmdBuffer = GR_NULL_HANDLE; GR_CMD_BUFFER_CREATE_INFO info = {}; info.queueType = GR_QUEUE_UNIVERSAL; grCreateCommandBuffer(device, &info, &cmdBuffer); grBeginCommandBuffer(cmdBuffer, 0); grCmdSetEvent(cmdBuffer, event); . . . grEndCommandBuffer(cmdBuffer);
  31. 31. 31 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 COMMAND BUFFER SUBMISSION Flexible command buffer submission: –Multiple submissions of once recorded buffer –Batch submission of multiple buffers Application provides all memory references
  32. 32. 32 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 SUBMISSION EXAMPLE for (GR_UINT bufIdx = 0; bufIdx < NumCmdBuf; bufIdx++) RecordCmdBuffer(cmdBuffer[bufIdx]); GR_MEMORY_REF memRefs[MAX_REFS]; GR_UINT numMemRefs = 0; memRefs[numMemRefs].mem = someMemory; memRefs[numMemRefs++].flags = 0; memRefs[numMemRefs].mem = someOtherMemory; memRefs[numMemRefs++].flags = GR_MEMORY_REF_READ_ONLY; grQueueSubmit(queue, NumCmdBuf, &cmdBuffer[0], numMemRefs, memRefs, fence);
  33. 33. 33 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 RESOURCE PREPARATION Mantle doesn’t perform any hazard tracking Application notifies of hazard conditions –Uses preparation operation –Includes WAW hazard (e.g. back-to-back compute) Usage-based state model –Indicates transition of usage (e.g. from image write to read)
  34. 34. 34 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 RESOURCE PREPARATION Render target Shader resource Cache flush Decompression . . .
  35. 35. 35 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MEMORY PREPARATION EXAMPLE GR_MEMORY_STATE_TRANSITION memPrep[2] = {}; memPrep[0].mem = firstMem; memPrep[0].oldState = GR_MEMORY_STATE_DATA_TRANSFER; memPrep[0].newState = GR_MEMORY_STATE_GRAPHICS_SHADER_READ_ONLY; memPrep[0].offset = 0; memPrep[0].regionSize = 100; memPrep[1].mem = otherMem; memPrep[1].oldState = GR_MEMORY_STATE_COMPUTE_SHADER_WRITE_ONLY; memPrep[1].newState = GR_MEMORY_STATE_COMPUTE_SHADER_WRITE_ONLY; memPrep[1].offset = 384; memPrep[1].regionSize = 768; grCmdPrepareMemoryRegions(cmdBuffer, 2, memPrep);
  36. 36. 36 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 PIPELINES Monolithic pipeline combines shaders and state –Serialization to reduce compile time Benefits –Reduced runtime validation –Shader linkage optimizations –Forward looking abstraction model
  37. 37. 37 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 PIPELINE STATE Some state is bundled with pipeline –Affects shader compilation –E.g. target formats, blending enable, topology, etc. If abused, could lead to more pipelines –States carefully selected to avoid this Pipeline state has to match dynamic state
  38. 38. 38 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 GRAPHICS PIPELINE IA VS HS DS Tessellator GS RS PS DB CB Pipeline state Index Data Resources TargetsDynamic state
  39. 39. 39 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 RESOURCE BINDING MODEL Conventional binding is costly Bindless has pros and cons New binding model –Best of both worlds
  40. 40. 40 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 DESCRIPTOR SETS Pre-build data structures –Containers for arrays of resource descriptors –Can be nested –Can be bound with an offset Multiple bind points Globally accessible by all pipeline shaders
  41. 41. 41 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 DESCRIPTOR SET HIERARCHY Pipeline Memory Image Memory
  42. 42. 42 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 PIPELINE RESOURCE MAPPING Maps shader resources to descriptor sets –Shader IL – linear resource namespaces (t#, s#, u#, …) –Descriptor set – hierarchical structure Matches descriptor set layout at execution time –Relative to the bind point –Separate per shader stage Specified at pipeline creation
  43. 43. 43 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 BETTER EXPERIENCE WITH MANTLE Improved CPU & GPU efficiency –Increased application responsiveness –Empowering lower spec systems More predictable performance and behavior Sharing PC optimizations with consoles Opportunity for novel techniques
  44. 44. 44 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MANTLE SDK Stephan Hodes
  45. 45. 45 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MANTLE SDK - BETA Mantle Beta SDK developer website –Opening in April Web based access of Mantle SDK files, samples and documentation –Selected access only –NDA required –Contact AMD Developer Relations to register interest
  46. 46. 46 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MANTLE SDK - CONTENT Core SDK –Libraries –Header files –Extensions –Shader IL Converter Documentation Samples Developer Forum
  47. 47. 47 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MANTLE SDK - CONTENT Core SDK Documentation –API reference –Programming Guide –Extension Specifications –Best Practices Samples Developer Forum
  48. 48. 48 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MANTLE SDK - CONTENT Core SDK Documentation Samples –Show how to use Mantle –Demonstrate features  HLSL pipeline creation source Developer Forum
  49. 49. 49 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MANTLE SDK – TOOLS Validation and profiling layer GPU PerfStudio for Mantle
  50. 50. 50 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 MANTLE TOOLS Gordon Selley John Larkin
  51. 51. 51 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 GPU PERFSTUDIO2 AMD’s GPU performance and debugging tool for graphics applications Supports DirectX11® and OpenGL applications Recently added support for Steam Linux® Mantle support currently in development –Demonstrate the API and GPU trace tools with a Mantle application –Point out the main Mantle API features in the tool
  52. 52. 52 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 GPU PERFSTUDIO2 Visit us at the AMD Booth 1024 South Hall: – GPU PerfStudio2 demos with Mantle Steam Linux (OpenGL) DirectX11 ® – CodeXL OpenCL™ and OpenGL Optimization and Debugging –AMD is hiring
  53. 53. 53 | AMD Gaming Evolved – GDC 2014 | March 19, 2014 GPU PERFSTUDIO2 – MANTLE DEMO

×