Open 3D Engine Atom Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::DX12::Device Class Reference

Inherits AZ::DX12::Device_Windows.

Public Member Functions

 AZ_CLASS_ALLOCATOR (Device, AZ::SystemAllocator)
 
 AZ_RTTI (Device, "{89670048-DC28-434D-A0BE-C76165419769}", Base)
 
RHI::ResultCode CreateSwapChain (IUnknown *window, const DXGI_SWAP_CHAIN_DESCX &swapChainDesc, RHI::Ptr< IDXGISwapChainX > &swapChain)
 
RHI::ResultCode CreateSwapChain (const DXGI_SWAP_CHAIN_DESCX &swapChainDesc, AZStd::array< RHI::Ptr< ID3D12Resource >, RHI::Limits::Device::FrameCountMax > &outSwapChainResources)
 
void GetImageAllocationInfo (const RHI::ImageDescriptor &descriptor, D3D12_RESOURCE_ALLOCATION_INFO &info)
 
void GetPlacedImageAllocationInfo (const RHI::ImageDescriptor &descriptor, D3D12_RESOURCE_ALLOCATION_INFO &info)
 
MemoryView CreateD3d12maBuffer (const RHI::BufferDescriptor &bufferDescriptor, D3D12_RESOURCE_STATES initialState, D3D12_HEAP_TYPE heapType)
 
MemoryView CreateBufferCommitted (const RHI::BufferDescriptor &bufferDescriptor, D3D12_RESOURCE_STATES initialState, D3D12_HEAP_TYPE heapType)
 
MemoryView CreateImageCommitted (const RHI::ImageDescriptor &imageDescriptor, const RHI::ClearValue *optimizedClearValue, D3D12_RESOURCE_STATES initialState, D3D12_HEAP_TYPE heapType)
 
MemoryView CreateBufferPlaced (const RHI::BufferDescriptor &bufferDescriptor, D3D12_RESOURCE_STATES initialState, ID3D12Heap *heap, size_t heapByteOffset)
 
MemoryView CreateImagePlaced (const RHI::ImageDescriptor &imageDescriptor, const RHI::ClearValue *optimizedClearValue, D3D12_RESOURCE_STATES initialState, ID3D12Heap *heap, size_t heapByteOffset)
 
MemoryView CreateImageReserved (const RHI::ImageDescriptor &imageDescriptor, D3D12_RESOURCE_STATES initialState, ImageTileLayout &imageTilingInfo)
 
void QueueForRelease (RHI::Ptr< ID3D12Object > dx12Object)
 
void QueueForRelease (const MemoryView &memoryView)
 
MemoryView AcquireStagingMemory (size_t size, size_t alignment)
 
RHI::ConstPtr< PipelineLayoutAcquirePipelineLayout (const RHI::PipelineLayoutDescriptor &descriptor)
 Acquires a pipeline layout from the internal cache.
 
CommandListAcquireCommandList (RHI::HardwareQueueClass hardwareQueueClass)
 
RHI::ConstPtr< SamplerAcquireSampler (const RHI::SamplerState &state)
 Acquires a sampler from the internal cache.
 
const PhysicalDeviceGetPhysicalDevice () const
 
ID3D12DeviceX * GetDevice ()
 
MemoryPageAllocatorGetConstantMemoryPageAllocator ()
 
CommandQueueContextGetCommandQueueContext ()
 
DescriptorContextGetDescriptorContext ()
 
AsyncUploadQueueGetAsyncUploadQueue ()
 
bool IsAftermathInitialized () const
 
bool AssertSuccess (HRESULT opResult)
 
void OnDeviceRemoved ()
 
uint32_t GetBindlessSrgSlot () const
 
- Public Member Functions inherited from AZ::DX12::Device_Windows
void * GetAftermathGPUCrashTracker ()
 
- Public Member Functions inherited from AZ::RHI::Device
 AZ_RTTI (Device, "{C7E70BE4-3AA5-4214-91E6-52A8ECC31A34}", Object)
 
bool IsInitialized () const
 Returns whether the device is initialized.
 
ResultCode Init (int deviceIndex, PhysicalDevice &physicalDevice)
 
ResultCode BeginFrame ()
 
ResultCode EndFrame ()
 
ResultCode WaitForIdle ()
 
ResultCode CompileMemoryStatistics (MemoryStatistics &memoryStatistics, MemoryStatisticsReportFlags reportFlags)
 
ResultCode UpdateCpuTimingStatistics () const
 
const PhysicalDeviceGetPhysicalDevice () const
 Returns the physical device associated with this device.
 
int GetDeviceIndex () const
 Returns the device index.
 
const DeviceDescriptorGetDescriptor () const
 Returns the descriptor associated with the device.
 
const DeviceFeaturesGetFeatures () const
 Returns the set of features supported by this device.
 
const DeviceLimitsGetLimits () const
 Returns the set of hardware limits for this device.
 
const ResourcePoolDatabaseGetResourcePoolDatabase () const
 Returns the resource pool database.
 
ResourcePoolDatabaseGetResourcePoolDatabase ()
 Returns the mutable resource pool database.
 
FormatCapabilities GetFormatCapabilities (Format format) const
 Returns a union of all capabilities of a specific format.
 
Format GetNearestSupportedFormat (Format requestedFormat, FormatCapabilities requestedCapabilities) const
 Return the nearest supported format for this device.
 
virtual AZStd::vector< Format > GetValidSwapChainImageFormats (const WindowHandle &windowHandle) const
 
virtual AZStd::chrono::microseconds GpuTimestampToMicroseconds (uint64_t gpuTimestamp, HardwareQueueClass queueClass) const =0
 Converts a GPU timestamp to microseconds.
 
virtual void PreShutdown ()=0
 
virtual ResourceMemoryRequirements GetResourceMemoryRequirements (const ImageDescriptor &descriptor)=0
 Get the memory requirements for allocating an image resource.
 
virtual ResourceMemoryRequirements GetResourceMemoryRequirements (const BufferDescriptor &descriptor)=0
 Get the memory requirements for allocating a buffer resource.
 
virtual void ObjectCollectionNotify (RHI::ObjectCollectorNotifyFunction notifyFunction)=0
 Notifies after all objects currently in the platform release queue are released.
 
ResultCode InitBindlessSrg (RHI::Ptr< RHI::ShaderResourceGroupLayout > bindlessSrgLayout)
 
virtual RHI::ResultCode CompactSRGMemory ()
 Allows the back-ends to compact SRG related memory if applicable.
 
virtual ShadingRateImageValue ConvertShadingRate (ShadingRate rate) const =0
 Converts a shading rate enum to the proper texel value to be used in a shading rate image.
 
bool WasDeviceRemoved ()
 
void SetDeviceRemoved ()
 
void SetLastExecutingScope (const AZStd::string_view scopeName)
 
AZStd::string_view GetLastExecutingScope () const
 
virtual Ptr< XRDeviceDescriptorBuildXRDescriptor () const
 Builds an implementation specific XR device descriptor based on this graphics device.
 
- Public Member Functions inherited from AZ::RHI::Object
 AZ_RTTI (Object, "{E43378F1-2331-4173-94B8-990ED20E6003}")
 
void SetName (const Name &name)
 Sets the name of the object.
 
const Name & GetName () const
 Returns the name set on the object by SetName.
 
uint32_t use_count ()
 Returns the current use count of the object.
 

Static Public Member Functions

static RHI::Ptr< DeviceCreate ()
 

Additional Inherited Members

- Protected Types inherited from AZ::RHI::Device
using FormatCapabilitiesList = AZStd::array< FormatCapabilities, static_cast< uint32_t >(Format::Count)>
 
- Protected Member Functions inherited from AZ::RHI::Object
void add_ref () const
 
void release () const
 
- Protected Attributes inherited from AZ::RHI::Device
DeviceFeatures m_features
 
DeviceLimits m_limits
 
ResourcePoolDatabase m_resourcePoolDatabase
 
DeviceDescriptor m_descriptor
 
- Protected Attributes inherited from AZ::RHI::Object
AZStd::atomic_int m_useCount = 0
 

Member Function Documentation

◆ AcquireCommandList()

CommandList * AZ::DX12::Device::AcquireCommandList ( RHI::HardwareQueueClass  hardwareQueueClass)

Acquires a new command list for the frame given the hardware queue class. The command list is automatically reclaimed after the current frame has flushed through the GPU.

◆ AcquireStagingMemory()

MemoryView AZ::DX12::Device::AcquireStagingMemory ( size_t  size,
size_t  alignment 
)

Allocates host memory from the internal frame allocator that is suitable for staging uploads to the GPU for the current frame. The memory is valid for the lifetime of the frame and is automatically reclaimed after the frame has completed on the GPU.

◆ AssertSuccess()

bool AZ::DX12::Device::AssertSuccess ( HRESULT  opResult)

Check the opResult return true if it was success If it's device lost, triggers device removal handling

◆ QueueForRelease() [1/2]

void AZ::DX12::Device::QueueForRelease ( const MemoryView memoryView)

Queues the backing Memory instance of a MemoryView for release (by taking a reference) after the current frame has flushed through the GPU. The reference on the MemoryView itself is not released.

◆ QueueForRelease() [2/2]

void AZ::DX12::Device::QueueForRelease ( RHI::Ptr< ID3D12Object >  dx12Object)

Queues a DX12 COM object for release (by taking a reference) after the current frame has flushed through the GPU.


The documentation for this class was generated from the following file: