Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
|
#include <gpu_resource.h>
Public Member Functions | |
GpuResource () | |
GpuResource (ID3D12Resource *resource, D3D12_RESOURCE_STATES current_state) | |
virtual | ~GpuResource () |
void | Associate (ID3D12Resource *resource, D3D12_RESOURCE_STATES current_state) |
void | Destroy () |
ID3D12Resource * | operator-> () |
const ID3D12Resource * | operator-> () const |
operator ID3D12Resource * () | |
ID3D12Resource * | Get () |
const D3D12_RESOURCE_STATES & | GetState () const |
const D3D12_RESOURCE_STATES & | GetTransitionState () const |
Protected Member Functions | |
void | AddToMemoryProfiler () |
void | RemoveFromMemoryProfiler () |
Protected Attributes | |
WString | name_ |
ID3D12Resource * | resource_ |
D3D12_RESOURCE_STATES | usage_state_ |
D3D12_RESOURCE_STATES | transition_state_ |
D3D12_GPU_VIRTUAL_ADDRESS | gpu_virtual_address_ |
Wraps ID3D12Resource objects.
This GpuResource class wraps the entire ID3D12Resource object. It is useful because it keeps track of the current resource state it currently is in and allows for efficient state switching by CommandContexts. Every resource in Blowbox should be wrapped by this class. If you want access to the underlying ID3D12Resource, you can use GpuResource::Get().
blowbox::GpuResource::GpuResource | ( | ) |
Constructs an empty GpuResource.
blowbox::GpuResource::GpuResource | ( | ID3D12Resource * | resource, |
D3D12_RESOURCE_STATES | current_state | ||
) |
Constructs a GpuResource that wraps a certain ID3D12Resource object.
[in] | resource | The resource that needs to be wrapped. |
[in] | current_state | The state of the resource that needs to be wrapped. |
|
virtual |
Destructs a GpuResource.
|
protected |
Adds this GpuResource to the MemoryProfiler.
void blowbox::GpuResource::Associate | ( | ID3D12Resource * | resource, |
D3D12_RESOURCE_STATES | current_state | ||
) |
Associate this GpuResource with another ID3D12Resource.
[in] | resource | The resource that this GpuResource should associate itself with. |
[in] | current_state | The state of the resource that this GpuResource should associate itself with. |
void blowbox::GpuResource::Destroy | ( | ) |
Destroys the underlying GpuResource.
|
inline |
Returns the underlying ID3D12Resource.
|
inline |
Returns the current resource state of the resource.
|
inline |
Returns the current transition state of the resource.
|
inline |
Implicitly convert this GpuResource to a ID3D12Resource.
|
inline |
Pointer operator that returns the underlying resource.
|
inline |
Pointer operator that returns the underlying resource.
|
protected |
Removes this GpuResource from the MemoryProfiler.
|
protected |
The virtual address of the ID3D12Resource in VRAM.
|
protected |
The name of this resource.
|
protected |
The ID3D12Resource that is being wrapped by the GpuResource.
|
protected |
The current transition state of the GpuResource.
|
protected |
The current resource state of the ID3D12Resource.