d3d12: Rewind constant buffers get value

This commit is contained in:
vlj 2015-06-11 21:08:00 +02:00 committed by Vincent Lejeune
parent c53828787a
commit 75a52219e0
3 changed files with 14 additions and 11 deletions

View File

@ -7,6 +7,9 @@
#include "Emu/Memory/vm.h"
#include "Emu/RSX/GCM.h"
#define SAFE_RELEASE(x) if (x) x->Release();
inline
void check(HRESULT hr)
{

View File

@ -439,7 +439,7 @@ void D3D12GSRender::setScaleOffset()
D3D12_CPU_DESCRIPTOR_HANDLE Handle = getCurrentResourceStorage().m_scaleOffsetDescriptorHeap->GetCPUDescriptorHandleForHeapStart();
Handle.ptr += getCurrentResourceStorage().m_currentScaleOffsetBufferIndex * m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
m_device->CreateConstantBufferView(&constantBufferViewDesc, Handle);
// m_constantsData.m_resourceStoredSinceLastSync.push_back(std::make_tuple(heapOffset, 256, scaleOffsetBuffer));
m_constantsData.m_resourceStoredSinceLastSync.push_back(std::make_tuple(heapOffset, 256, nullptr));
}
void D3D12GSRender::FillVertexShaderConstantsBuffer()
@ -469,7 +469,7 @@ void D3D12GSRender::FillVertexShaderConstantsBuffer()
D3D12_CPU_DESCRIPTOR_HANDLE Handle = getCurrentResourceStorage().m_constantsBufferDescriptorsHeap->GetCPUDescriptorHandleForHeapStart();
Handle.ptr += getCurrentResourceStorage().m_constantsBufferIndex * m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
m_device->CreateConstantBufferView(&constantBufferViewDesc, Handle);
// m_constantsData.m_resourceStoredSinceLastSync.push_back(std::make_tuple(heapOffset, bufferSize, constantsBuffer));
m_constantsData.m_resourceStoredSinceLastSync.push_back(std::make_tuple(heapOffset, bufferSize, nullptr));
}
void D3D12GSRender::FillPixelShaderConstantsBuffer()
@ -533,7 +533,7 @@ void D3D12GSRender::FillPixelShaderConstantsBuffer()
D3D12_CPU_DESCRIPTOR_HANDLE Handle = getCurrentResourceStorage().m_constantsBufferDescriptorsHeap->GetCPUDescriptorHandleForHeapStart();
Handle.ptr += getCurrentResourceStorage().m_constantsBufferIndex * m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
m_device->CreateConstantBufferView(&constantBufferViewDesc, Handle);
// m_constantsData.m_resourceStoredSinceLastSync.push_back(std::make_tuple(heapOffset, bufferSize, constantsBuffer));
m_constantsData.m_resourceStoredSinceLastSync.push_back(std::make_tuple(heapOffset, bufferSize, nullptr));
}

View File

@ -61,13 +61,13 @@ void D3D12GSRender::ResourceStorage::Reset()
m_frameFinishedHandle = 0;
for (auto tmp : m_inUseConstantsBuffers)
std::get<2>(tmp)->Release();
SAFE_RELEASE(std::get<2>(tmp));
for (auto tmp : m_inUseVertexIndexBuffers)
std::get<2>(tmp)->Release();
SAFE_RELEASE(std::get<2>(tmp));
for (auto tmp : m_inUseTextureUploadBuffers)
std::get<2>(tmp)->Release();
SAFE_RELEASE(std::get<2>(tmp));
for (auto tmp : m_inUseTexture2D)
std::get<2>(tmp)->Release();
SAFE_RELEASE(std::get<2>(tmp));
m_inUseConstantsBuffers.clear();
m_inUseVertexIndexBuffers.clear();
m_inUseTextureUploadBuffers.clear();
@ -120,13 +120,13 @@ void D3D12GSRender::ResourceStorage::Release()
{
// NOTE: Should be released only if no command are in flight !
for (auto tmp : m_inUseConstantsBuffers)
std::get<2>(tmp)->Release();
SAFE_RELEASE(std::get<2>(tmp));
for (auto tmp : m_inUseVertexIndexBuffers)
std::get<2>(tmp)->Release();
SAFE_RELEASE(std::get<2>(tmp));
for (auto tmp : m_inUseTextureUploadBuffers)
std::get<2>(tmp)->Release();
SAFE_RELEASE(std::get<2>(tmp));
for (auto tmp : m_inUseTexture2D)
std::get<2>(tmp)->Release();
SAFE_RELEASE(std::get<2>(tmp));
m_constantsBufferDescriptorsHeap->Release();
m_scaleOffsetDescriptorHeap->Release();