mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 17:58:37 +12:00
d3d12: Some fixes to avoid running out of constant spaces
This commit is contained in:
parent
e0cff6b0b4
commit
59aca7566e
2 changed files with 11 additions and 6 deletions
|
@ -29,7 +29,7 @@ void DataHeap::Init(ID3D12Device *device, size_t heapSize, D3D12_HEAP_TYPE type)
|
||||||
|
|
||||||
bool DataHeap::canAlloc(size_t size)
|
bool DataHeap::canAlloc(size_t size)
|
||||||
{
|
{
|
||||||
size_t putPos = m_putPos.load(), getPos = m_getPos.load();
|
size_t putPos = m_putPos, getPos = m_getPos;
|
||||||
size_t allocSize = powerOf2Align(size, 65536);
|
size_t allocSize = powerOf2Align(size, 65536);
|
||||||
if (putPos + allocSize < m_size)
|
if (putPos + allocSize < m_size)
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ bool DataHeap::canAlloc(size_t size)
|
||||||
size_t DataHeap::alloc(size_t size)
|
size_t DataHeap::alloc(size_t size)
|
||||||
{
|
{
|
||||||
assert(canAlloc(size));
|
assert(canAlloc(size));
|
||||||
size_t putPos = m_putPos.load();
|
size_t putPos = m_putPos;
|
||||||
if (putPos + size < m_size)
|
if (putPos + size < m_size)
|
||||||
{
|
{
|
||||||
m_putPos += powerOf2Align(size, 65536);
|
m_putPos += powerOf2Align(size, 65536);
|
||||||
|
@ -65,13 +65,18 @@ size_t DataHeap::alloc(size_t size)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_putPos.store(powerOf2Align(size, 65536));
|
m_putPos = powerOf2Align(size, 65536);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataHeap::Release()
|
void DataHeap::Release()
|
||||||
{
|
{
|
||||||
|
m_heap->Release();
|
||||||
|
for (auto tmp : m_resourceStoredSinceLastSync)
|
||||||
|
{
|
||||||
|
std::get<2>(tmp)->Release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void D3D12GSRender::ResourceStorage::Reset()
|
void D3D12GSRender::ResourceStorage::Reset()
|
||||||
|
@ -395,7 +400,7 @@ D3D12GSRender::D3D12GSRender()
|
||||||
|
|
||||||
m_rtts.Init(m_device);
|
m_rtts.Init(m_device);
|
||||||
|
|
||||||
m_constantsData.Init(m_device, 1024 * 1024, D3D12_HEAP_TYPE_UPLOAD);
|
m_constantsData.Init(m_device, 1024 * 1024 * 128, D3D12_HEAP_TYPE_UPLOAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
D3D12GSRender::~D3D12GSRender()
|
D3D12GSRender::~D3D12GSRender()
|
||||||
|
@ -936,7 +941,7 @@ void D3D12GSRender::Flip()
|
||||||
for (auto tmp : m_constantsData.m_resourceStoredSinceLastSync)
|
for (auto tmp : m_constantsData.m_resourceStoredSinceLastSync)
|
||||||
{
|
{
|
||||||
std::get<2>(tmp)->Release();
|
std::get<2>(tmp)->Release();
|
||||||
m_constantsData.m_getPos.store(std::get<0>(tmp));
|
m_constantsData.m_getPos = std::get<0>(tmp);
|
||||||
}
|
}
|
||||||
m_constantsData.m_resourceStoredSinceLastSync.clear();
|
m_constantsData.m_resourceStoredSinceLastSync.clear();
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ struct DataHeap
|
||||||
{
|
{
|
||||||
ID3D12Heap *m_heap;
|
ID3D12Heap *m_heap;
|
||||||
size_t m_size;
|
size_t m_size;
|
||||||
std::atomic<size_t> m_putPos, // Start of free space
|
size_t m_putPos, // Start of free space
|
||||||
m_getPos; // End of free space
|
m_getPos; // End of free space
|
||||||
std::vector<std::tuple<size_t, size_t, ID3D12Resource *> > m_resourceStoredSinceLastSync;
|
std::vector<std::tuple<size_t, size_t, ID3D12Resource *> > m_resourceStoredSinceLastSync;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue