mantle - introducing a new api for graphics - amd at gdc14

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

If you can't read please download the document

Upload: amd-developer-central

Post on 16-Apr-2017

5.735 views

Category:

Technology


0 download

TRANSCRIPT

Slide 1

MantleIntroducing a New API for Graphics

Guennadi Riguer

#| AMD Gaming Evolved GDC 2014 | March 19, 2014More Mantle @ GDC 2014Rendering Battlefield 4 with MantleJohan Andersson, Technical Director, DICE/EALocation: Room 2009, West Hall, Date: Wednesday, March 19, Time: 3:30pm-4:30pm

Nitrous & Mantle: Combining Efficient Engine Design with a Modern APIDan Baker, Partner, Oxide GamesTim Kipp, Partner, Oxide GamesLocation: Room 2009, West Hall, Date: Wednesday, March 19, Time: 5:00pm-6:00pm

#| AMD Gaming Evolved GDC 2014 | March 19, 2014

Direct3D and the Future of Graphics APIsJohan Andersson, Technical Director, DICE/EADan Baker, Partner, Oxide GamesDave Oldcorn, Software Engineering Fellow, AMDLocation:Room 3020, West Hall, Date:Thursday, March 20, 5:30pm-6:30pm

#| AMD Gaming Evolved GDC 2014 | March 19, 2014

Cevat Yerli

Founder, CEO & President of Crytek

#| AMD Gaming Evolved GDC 2014 | March 19, 2014

CRYENGINE Mantle Support 2014 Crytek

#| AMD Gaming Evolved GDC 2014 | March 19, 2014

CRYENGINE

Cryteks 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 NOTTINGHAMSTUDIO FRANKFURT AM MAINSTUDIO BUDAPESTSTUDIO SOFIASTUDIO KIEVSTUDIO ISTANBULSTUDIO SHANGHAISTUDIO SEOULSTUDIO AUSTIN

#| AMD Gaming Evolved GDC 2014 | March 19, 2014

1999

2002

2003

2004

Crytek is founded in Coburg, Germany.The first CryENGINE is born.

TIMELINEThe 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 Cryteks first game for the PlayStation 3 and Xbox 360, as well as the PC. 2009The new CRYENGINE is released for XBoxOne, PS4, Wii-U and PCRYSE is released.

2013

2013

2014

CRYENGINE adds full native Linux support

#| AMD Gaming Evolved GDC 2014 | March 19, 2014

7

CRYTEK & AMDOver 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 AMDs developer relations, driver, hardware architecture and HSA teams.

#| AMD Gaming Evolved GDC 2014 | March 19, 2014

8

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

#| AMD Gaming Evolved GDC 2014 | March 19, 2014

9

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 weve been able to see this vision together.

We are looking forward to showing the results of Mantle and CRYENGINE very soon

#| AMD Gaming Evolved GDC 2014 | March 19, 2014

10

Thank you!

#| AMD Gaming Evolved GDC 2014 | March 19, 2014AgendaMantle InnovationMantle Hello, world!Mantle SDKTools

#| AMD Gaming Evolved GDC 2014 | March 19, 2014What Is MantleMantle is a new graphics APIJust right abstraction levelModern API for modern GPUsDesigned by developers for developersWhat Mantle is not:Its not quite down to the metal APIIts not some magic solution

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Design GoalsAggressive performance goals100K draws/frameFaster GPU performanceEfficient multi-threadingLinear scaling with CPU coresMulti-platform

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Mantle InnovationsGeneralized memoryCommand buffer building/execution modelMemory/image state managementMonolithic pipelinesNew resource binding model

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Hello, World!

#| AMD Gaming Evolved GDC 2014 | March 19, 2014GPUs and Devices

GPU

Device

GPU

DeviceApplication

#| AMD Gaming Evolved GDC 2014 | March 19, 2014GPU Detection ExampleGR_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);}

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Device Creation ExampleGR_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);

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Memory Model

Memory heap 1

Memory heap 2

Memory heap N. . .MemMemMemMemMemMemMemMem

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Memory ModelMore general GPU memory accessApplication controls almost all GPU memoryPage granularity allocations with control of heapsSub-allocate for small resources from poolsLeverages GPU virtual address spaceNo direct CPU access

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Allocation ExampleGR_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);

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Memory ManagementMantle is on top of OS video memory managerApplication tracks use of memoryProvides memory references for GPUCould get really smart, just like on consolesUse of memory pools is encouragedReduces amount of memory tracking

#| AMD Gaming Evolved GDC 2014 | March 19, 2014ResourcesGeneralized GPU resourcesOther APIsIndex buffersVertex buffersConstant buffersStaging resourcesTexturesUAVsTexture Arrays. . .MemoryMantleImages

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Application manages internal object memoryDecoupled Object Memory

MemoryStateAPI objectOther APIsMantle MemoryStateAPI object

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Object Memory Binding ExampleGR_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);}

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Programming Model

GraphicsComputeDMAGPU. . .

Queues

ApplicationApp threadApp threadApp threadApp threadApp thread

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Device QueuesQueue per physical HW engineUniversal: graphics & computeAsync computeAsync DMA (extension)More efficient use of HW resourcesParallel execution

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Parallel Execution Speedup

Universalqueue

UniversalqueueAsync. compute queueAsync. DMAqueue

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Command Buffer ExampleGR_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);

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Command Buffer SubmissionFlexible command buffer submission:Multiple submissions of once recorded bufferBatch submission of multiple buffersApplication provides all memory references

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Submission Examplefor (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);

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Resource PreparationMantle doesnt perform any hazard trackingApplication notifies of hazard conditionsUses preparation operationIncludes WAW hazard (e.g. back-to-back compute)Usage-based state modelIndicates transition of usage (e.g. from image write to read)

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Resource Preparation

Render target

Shader resource

Cache flushDecompression. . .

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Memory Preparation ExampleGR_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);

#| AMD Gaming Evolved GDC 2014 | March 19, 2014PipelinesMonolithic pipeline combines shaders and stateSerialization to reduce compile timeBenefitsReduced runtime validationShader linkage optimizationsForward looking abstraction model

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Pipeline StateSome state is bundled with pipelineAffects shader compilationE.g. target formats, blending enable, topology, etc.If abused, could lead to more pipelinesStates carefully selected to avoid thisPipeline state has to match dynamic state

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Graphics Pipeline

IAVS

HSDSTessellatorGSRSPSDBCBPipeline stateIndex Data

Resources

Targets

Dynamic state

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Resource Binding ModelConventional binding is costlyBindless has pros and consNew binding modelBest of both worlds

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Descriptor SetsPre-build data structuresContainers for arrays of resource descriptorsCan be nestedCan be bound with an offsetMultiple bind pointsGlobally accessible by all pipeline shaders

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Descriptor Set HierarchyPipeline

MemoryImageMemory

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Pipeline Resource MappingMaps shader resources to descriptor setsShader IL linear resource namespaces (t#, s#, u#, )Descriptor set hierarchical structureMatches descriptor set layout at execution timeRelative to the bind pointSeparate per shader stageSpecified at pipeline creation

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Better Experience with MantleImproved CPU & GPU efficiencyIncreased application responsivenessEmpowering lower spec systemsMore predictable performance and behaviorSharing PC optimizations with consolesOpportunity for novel techniques

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Mantle SDKStephan Hodes

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Mantle SDK - Beta

Mantle Beta SDK developer websiteOpening in AprilWeb based access of Mantle SDK files, samples and documentationSelected access onlyNDA requiredContact AMD DeveloperRelations to register interest

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Mantle SDK - Content

Core SDKLibrariesHeader filesExtensionsShader IL ConverterDocumentationSamplesDeveloper Forum

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Mantle SDK - Content

Core SDKDocumentationAPI referenceProgramming GuideExtension SpecificationsBest PracticesSamplesDeveloper Forum

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Mantle SDK - Content

Core SDKDocumentationSamplesShow how to use MantleDemonstrate features HLSL pipeline creation sourceDeveloper Forum

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Mantle SDK ToolsValidation and profiling layerGPU PerfStudio for Mantle

#| AMD Gaming Evolved GDC 2014 | March 19, 2014Mantle ToolsGordon SelleyJohn Larkin

#| AMD Gaming Evolved GDC 2014 | March 19, 2014GPU PerfStudio2AMDs GPU performance and debugging tool for graphics applicationsSupports DirectX11 and OpenGL applicationsRecently added support for Steam Linux Mantle support currently in development Demonstrate the API and GPU trace tools with a Mantle applicationPoint out the main Mantle API features in the tool

#| AMD Gaming Evolved GDC 2014 | March 19, 2014GPU PerfStudio2Visit us at the AMD Booth 1024 South Hall: GPU PerfStudio2 demos with Mantle Steam Linux (OpenGL)DirectX11 CodeXL OpenCL and OpenGL Optimization and DebuggingAMD is hiring

#| AMD Gaming Evolved GDC 2014 | March 19, 2014GPU PerfStudio2 Mantle Demo

#| AMD Gaming Evolved GDC 2014 | March 19, 2014