转载请注明出处为KlayGE游戏引擎,本文的永久链接为http://www.klayge.org/?p=2815

AMD Mantle的SDK一直都没出,但现在至少有了支持Mantle的Catalyst 14.1驱动。Geeks3D网站有个帖子列出了mantle32.dll和mantle64.dll等几个DLL中包含的函数入口。

Mantle本身存在于mantle32.dll和mantle64.dll。导出的函数接口如下:

  • IcdDbgMessage
  • DllMain
  • grAllocMemory
  • grAttachImageViewDescriptors
  • grAttachMemoryViewDescriptors
  • grAttachNestedDescriptors
  • grAttachSamplerDescriptors
  • grBeginCommandBuffer
  • grBeginDescriptorSetUpdate
  • grBindObjectMemory
  • grClearDescriptorSetSlots
  • grCmdBeginQuery
  • grCmdBindDescriptorSet
  • grCmdBindDynamicMemoryView
  • grCmdBindIndexData
  • grCmdBindPipeline
  • grCmdBindStateObject
  • grCmdBindTargets
  • grCmdClearColorImage
  • grCmdClearColorImageRaw
  • grCmdClearDepthStencil
  • grCmdCloneImageData
  • grCmdCopyImage
  • grCmdCopyImageToMemory
  • grCmdCopyMemory
  • grCmdCopyMemoryToImage
  • grCmdDbgMarkerBegin
  • grCmdDbgMarkerEnd
  • grCmdDispatch
  • grCmdDispatchIndirect
  • grCmdDraw
  • grCmdDrawIndexed
  • grCmdDrawIndexedIndirect
  • grCmdDrawIndirect
  • grCmdEndQuery
  • grCmdFillMemory
  • grCmdInitAtomicCounters
  • grCmdLoadAtomicCounters
  • grCmdMemoryAtomic
  • grCmdPrepareImages
  • grCmdPrepareMemoryRegions
  • grCmdResetEvent
  • grCmdResetQueryPool
  • grCmdResolveImage
  • grCmdSaveAtomicCounters
  • grCmdSetEvent
  • grCmdUpdateMemory
  • grCmdWriteTimestamp
  • grCreateColorBlendState
  • grCreateColorTargetView
  • grCreateCommandBuffer
  • grCreateComputePipeline
  • grCreateDepthStencilState
  • grCreateDepthStencilView
  • grCreateDescriptorSet
  • grCreateDevice
  • grCreateEvent
  • grCreateFence
  • grCreateGraphicsPipeline
  • grCreateImage
  • grCreateImageView
  • grCreateMsaaState
  • grCreateQueryPool
  • grCreateQueueSemaphore
  • grCreateRasterState
  • grCreateSampler
  • grCreateShader
  • grCreateViewportState
  • grDbgRegisterMsgCallback
  • grDbgSetDeviceOption
  • grDbgSetGlobalOption
  • grDbgSetMessageFilter
  • grDbgSetObjectTag
  • grDbgSetValidationLevel
  • grDbgUnregisterMsgCallback
  • grDestroyDevice
  • grDestroyObject
  • grDeviceWaitIdle
  • grEndCommandBuffer
  • grEndDescriptorSetUpdate
  • grFreeMemory
  • grGetDeviceQueue
  • grGetEventStatus
  • grGetExtensionSupport
  • grGetFenceStatus
  • grGetFormatInfo
  • grGetGpuInfo
  • grGetImageSubresourceInfo
  • grGetMemoryHeapCount
  • grGetMemoryHeapInfo
  • grGetMultiGpuCompatibility
  • grGetObjectInfo
  • grGetQueryPoolResults
  • grInitAndEnumerateGpus
  • grLoadPipeline
  • grMapMemory
  • grOpenPeerImage
  • grOpenPeerMemory
  • grOpenSharedMemory
  • grOpenSharedQueueSemaphore
  • grPinSystemMemory
  • grQueueSetGlobalMemReferences
  • grQueueSubmit
  • grQueueWaitIdle
  • grRemapVirtualMemoryPages
  • grResetCommandBuffer
  • grResetEvent
  • grSetEvent
  • grSetMemoryPriority
  • grSignalQueueSemaphore
  • grStorePipeline
  • grUnmapMemory
  • grWaitForFences
  • grWaitQueueSemaphore
  • grWsiWinCreatePresentableImage
  • grWsiWinGetDisplayModeList
  • grWsiWinGetDisplays
  • grWsiWinGetScanLine
  • grWsiWinQueuePresent
  • grWsiWinReleaseFullscreenOwnership
  • grWsiWinSetGammaRamp
  • grWsiWinSetMaxQueuedFrames
  • grWsiWinTakeFullscreenOwnership
  • grWsiWinWaitForVerticalBlank

还有一组mantleaxl32.dll / mantleaxl64.dll,包含了这些函数入口:

  • DllMain
  • grAddPerfExperimentCounter
  • grAddPerfExperimentTrace
  • grCmdBeginPerfExperiment
  • grCmdBindBorderColorPalette
  • grCmdCopyOcclusionData
  • grCmdElse
  • grCmdEndIf
  • grCmdEndPerfExperiment
  • grCmdEndWhile
  • grCmdIf
  • grCmdInsertTraceMarker
  • grCmdResetMemoryPredication
  • grCmdResetOcclusionPredication
  • grCmdSetMemoryPredication
  • grCmdSetOcclusionPredication
  • grCmdWhile
  • grCreateAdvancedMsaaState
  • grCreateBorderColorPalette
  • grCreateFmaskImageView
  • grCreatePerfExperiment
  • grFinalizePerfExperiment
  • grGetExtensionLibraryVersion
  • grQueueDelay
  • grUpdateBorderColorPalette

虽然还不知道Mantle的细节,从函数名上判断,程序可以通过Mantle建立command buffer,并且可以很容易访问显存内容,不需要各种bind。这么一来,CPU调用图形API的开销可以降低很多。所以Mantle说能比D3D快50%也不奇怪了。但相信D3D和OpenGL如果经过一些改进,也可以很容易到达同样的高度。

有了驱动支持,相信很快SDK也会有动静。