Class D3D12ResourceState

Inheritance Relationships

Base Type

Class Documentation

class D3D12ResourceState : public gpa::d3d12_state_tracker::ObjectState<ID3D12Object>

Public Functions

D3D12ResourceState(ID3D12Resource *pResource, ID3D12Heap *pHeap, UINT64 HeapOffset, D3D12_RESOURCE_DESC const *pDesc, D3D12_RESOURCE_STATES initialResourceState, D3D12_CLEAR_VALUE const *pOptimizedClearValue, ResourceType type)
D3D12ResourceState(ID3D12Resource *pResource, D3D12_RESOURCE_DESC const *pDesc, D3D12_RESOURCE_STATES initialResourceState, D3D12_CLEAR_VALUE const *pOptimizedClearValue, ResourceType type, IDXGISwapChain *parentSwapChain = nullptr, uint32_t backBufferIndex = UINT32_MAX)
~D3D12ResourceState()
virtual GUID GetGUID() override
void OnStateTransition(uint32_t subresource, D3D12_RESOURCE_STATES stateAfter)
void OnMap(uint32_t subresource, D3D12_RANGE const *pReadRange, void **ppData)
void OnUnmap(uint32_t subresource, D3D12_RANGE const *pWrittenRange)
void OnEvict()
void OnMakeResident()
void OnUpdateTileMappings(UINT NumResourceRegions, D3D12_TILED_RESOURCE_COORDINATE const *pResourceRegionStartCoordinates, D3D12_TILE_REGION_SIZE const *pResourceRegionSizes, ID3D12Heap *pHeap, UINT NumRanges, D3D12_TILE_RANGE_FLAGS const *pRangeFlags, UINT const *pHeapRangeStartOffsets, UINT const *pRangeTileCounts, D3D12_TILE_MAPPING_FLAGS Flags)
void OnCopyTileMappings(D3D12_TILED_RESOURCE_COORDINATE const *pDstRegionStartCoordinate, ID3D12Resource *pSrcResource, D3D12_TILED_RESOURCE_COORDINATE const *pSrcRegionStartCoordinate, D3D12_TILE_REGION_SIZE const *pRegionSize, D3D12_TILE_MAPPING_FLAGS Flags)
D3D12_RESOURCE_STATES GetSubresourceState(uint32_t index) const

Returns D3D12_RESOURCE_STATES value representing current state of the specified subresource @detail If the index is invalid, kInvalidResourceState value is returned.

std::vector<D3D12_RESOURCE_STATES> GetStateOfAllSubresources(bool *allSubresourcesStateEqual) const

Returns current state of all subresources.

std::vector<D3D12_RESOURCE_BARRIER> PrepareSetOfBarriersForWholeResource()

Prepares an array of D3D12_RESOURCE_BARRIER structs with current state values @detail D3D12_RESOURCE_BARRIER::Transition::StateBefore and StateAfter will hold current state value If state of all subresources is equal, only one D3D12_RESOURCE_BARRIER struct will be returned and D3D12_RESOURCE_BARRIER::Transition::Subresource field will have D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES value.

ResourceType GetType() const

Returns resource type (Committed, Reserved, Placed)

PlacedResourceInfo GetHeapPlacementInfo() const

Returns heap and offset of placed resources.

ResourceTilingInfo GetTilingInfo() const

Returns resource tiling information of reserved resources @detail Use @GetSubresources to obtain information about current tiling state of particular subresources.

std::vector<SubresourceState> const &GetSubresources() const

Returns states of all subresources @detail See @SubresourceState for details.

uint32_t GetSubresourceCount() const

Returns subresource count.

bool IsBackbuffer() const

Returns true if the resource is a backbuffer.

bool IsAccelerationStructure() const

Returns true if the resource is a acceleration structure.

uint32_t GetBackbufferIndex() const

Returns index of the backbuffer in the swapchain @detail If the resource is not a backbuffer, UINT32_MAX is returned.

IDXGISwapChain *GetParentSwapChain() const

Returns parent IDXGISwapChain object, if the resource is a backbuffer @detail If the resource is not a backbuffer, nullptr is returned.

void SetDirty(bool value)

Sets dirty value.

bool IsDirty()

Returns dirty value.

void RegisterDirtyCallback(std::function<void(ID3D12Resource *dirtyResource)> callback)

Registers callback executed when the resource gets dirty @detail The resource state becomes actually dirty AFTER all callbacks are called.

void UnregisterAllDirtyCallbacks()
bool IsMapped()

Returns true if any subresource is currently mapped.

bool IsResident()

Returns true if the resource is resident.

bool IsTexture() const

Returns true if the resource is a texture (1-, 2- or 3-dimensional)

bool IsCompressed() const

Returns true if the resource is a compressed format.

D3D12_RESOURCE_STATES GetInitialResourceState()

Returns initial resource state value (creation call parameter)

D3D12_CLEAR_VALUE const *GetOptimizedClearValue()

Returns optimized clear value of the resource (creation call parameter)

Returns

Returns nullptr, if the value was not provided during resource creation

D3D12_GPU_VIRTUAL_ADDRESS GetGPUVirtualAddress()
bool GPUVirtualAddressObtained() const

Tells if the workoad obtained GPUVirtualAddress for this resource.

void GPUVirtualAddressObtained(bool val)
bool HasEnhancedBarriers() const

Identify if the resource employs enhanced barriers.

D3D12_BARRIER_LAYOUT GetInitialBarrierLayout() const
UINT32 GetCastableFormatCount() const
DXGI_FORMAT *GetCastableFormats()
ID3D12ProtectedResourceSession *GetProtectedResourceSession() const

Public Members

PlacedResourceInfo mPlacedResourceInfo

Heap residency information of placed resources.

ResourceTilingInfo mTiledResourceInfo

Tiling information common to the whole resource.

Public Static Attributes

static constexpr GUID sGUID = {0x12d26255, 0x5da6, 0x4795, {0x96, 0xbe, 0xc0, 0xad, 0x2b, 0x5d, 0xe4, 0x80}}