2 // Copyright (c) Microsoft. All rights reserved.
3 // This code is licensed under the MIT License (MIT).
4 // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
5 // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
6 // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
7 // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 // Developed by Minigraph
11 // Author: James Stanard
18 friend class CommandContext
;
19 friend class GraphicsContext
;
20 friend class ComputeContext
;
24 m_UsageState(D3D12_RESOURCE_STATE_COMMON
),
25 m_TransitioningState((D3D12_RESOURCE_STATES
)-1),
26 m_GpuVirtualAddress(D3D12_GPU_VIRTUAL_ADDRESS_NULL
)
29 GpuResource(ID3D12Resource
* pResource
, D3D12_RESOURCE_STATES CurrentState
) :
30 m_pResource(pResource
),
31 m_UsageState(CurrentState
),
32 m_TransitioningState((D3D12_RESOURCE_STATES
)-1),
33 m_GpuVirtualAddress(D3D12_GPU_VIRTUAL_ADDRESS_NULL
)
37 virtual void Destroy()
39 m_pResource
= nullptr;
40 m_GpuVirtualAddress
= D3D12_GPU_VIRTUAL_ADDRESS_NULL
;
43 ID3D12Resource
* operator->() { return m_pResource
.Get(); }
44 const ID3D12Resource
* operator->() const { return m_pResource
.Get(); }
46 ID3D12Resource
* GetResource() { return m_pResource
.Get(); }
47 const ID3D12Resource
* GetResource() const { return m_pResource
.Get(); }
49 D3D12_GPU_VIRTUAL_ADDRESS
GetGpuVirtualAddress() const { return m_GpuVirtualAddress
; }
53 Microsoft::WRL::ComPtr
<ID3D12Resource
> m_pResource
;
54 D3D12_RESOURCE_STATES m_UsageState
;
55 D3D12_RESOURCE_STATES m_TransitioningState
;
56 D3D12_GPU_VIRTUAL_ADDRESS m_GpuVirtualAddress
;