MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / Buffer

Class Buffer

SampleFramework12/v1.00/Graphics/GraphicsTypes.h:92–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90};
91
92struct Buffer
93{
94 ID3D12Resource* Resource = nullptr;
95 uint64 CurrBuffer = 0;
96 uint8* CPUAddress = 0;
97 uint64 GPUAddress = 0;
98 uint64 Alignment = 0;
99 uint64 Size = 0;
100 bool32 Dynamic = false;
101 BufferLifetime Lifetime = BufferLifetime::Persistent;
102
103 #if UseAsserts_
104 uint64 UploadFrame = uint64(-1);
105 #endif
106
107 Buffer();
108 ~Buffer();
109
110 void Initialize(uint64 size, uint64 alignment, bool32 dynamic, BufferLifetime lifetime, bool32 allowUAV, const void* initData, D3D12_RESOURCE_STATES initialState);
111 void Shutdown();
112
113 MapResult Map();
114 MapResult MapAndSetData(const void* data, uint64 dataSize);
115 template<typename T> MapResult MapAndSetData(const T& data) { return MapAndSetData(&data, sizeof(T)); }
116 void UpdateData(const void* srcData, uint64 srcSize, uint64 dstOffset);
117
118 void Transition(ID3D12GraphicsCommandList* cmdList, D3D12_RESOURCE_STATES before, D3D12_RESOURCE_STATES after) const;
119 void MakeReadable(ID3D12GraphicsCommandList* cmdList) const;
120 void MakeWritable(ID3D12GraphicsCommandList* cmdList) const;
121 void UAVBarrier(ID3D12GraphicsCommandList* cmdList) const;
122
123 bool Initialized() const { return Size > 0; }
124
125 #if UseAsserts_
126 bool ReadyForBinding() const;
127 #endif
128
129private:
130
131 Buffer(const Buffer& other) { }
132};
133
134// For aligning to float4 boundaries
135#define Float4Align __declspec(align(16))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected