[D3D12] Copy index buffer to a scratch buffer for memexporting draws

This commit is contained in:
Triang3l
2019-01-09 13:19:49 +03:00
parent aabe6dec9c
commit 8ad12480a4
3 changed files with 42 additions and 24 deletions

View File

@@ -104,9 +104,20 @@ class SharedMemory {
void RangeWrittenByGPU(uint32_t start, uint32_t length);
// Makes the buffer usable for vertices, indices and texture untiling.
void UseForReading();
inline void UseForReading() {
// Vertex fetch is also allowed in pixel shaders.
TransitionBuffer(D3D12_RESOURCE_STATE_INDEX_BUFFER |
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE |
D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
}
// Makes the buffer usable for texture tiling after a resolve.
void UseForWriting();
inline void UseForWriting() {
TransitionBuffer(D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
}
// Makes the buffer usable as a source for copy commands.
inline void UseAsCopySource() {
TransitionBuffer(D3D12_RESOURCE_STATE_COPY_SOURCE);
}
void CreateSRV(D3D12_CPU_DESCRIPTOR_HANDLE handle);
void CreateRawUAV(D3D12_CPU_DESCRIPTOR_HANDLE handle);