DX12: set the heap size based on available vram (#1786)
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
|
#include <cmath>
|
||||||
#include "d3dx12.h"
|
#include "d3dx12.h"
|
||||||
#include <d3d11on12.h>
|
#include <d3d11on12.h>
|
||||||
#include "D3D12Formats.h"
|
#include "D3D12Formats.h"
|
||||||
@@ -166,6 +167,7 @@ D3D12GSRender::D3D12GSRender()
|
|||||||
// Adapter with specified name
|
// Adapter with specified name
|
||||||
if (adapter_name == desc.Description)
|
if (adapter_name == desc.Description)
|
||||||
{
|
{
|
||||||
|
vram_size = desc.DedicatedVideoMemory != 0 ? desc.DedicatedVideoMemory : desc.DedicatedSystemMemory;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +245,7 @@ D3D12GSRender::D3D12GSRender()
|
|||||||
|
|
||||||
m_rtts.init(m_device.Get());
|
m_rtts.init(m_device.Get());
|
||||||
m_readback_resources.init(m_device.Get(), 1024 * 1024 * 128, D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_STATE_COPY_DEST);
|
m_readback_resources.init(m_device.Get(), 1024 * 1024 * 128, D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||||
m_buffer_data.init(m_device.Get(), 1024 * 1024 * 896, D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_STATE_GENERIC_READ);
|
m_buffer_data.init(m_device.Get(), std::min((size_t)(1024 * 1024 * 896), (size_t)(vram_size - (1024 * 1024 * 128))), D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_STATE_GENERIC_READ);
|
||||||
|
|
||||||
CHECK_HRESULT(
|
CHECK_HRESULT(
|
||||||
m_device->CreateCommittedResource(
|
m_device->CreateCommittedResource(
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ private:
|
|||||||
u32 m_current_transform_constants_buffer_descriptor_id;
|
u32 m_current_transform_constants_buffer_descriptor_id;
|
||||||
ComPtr<ID3D12DescriptorHeap> m_current_texture_descriptors;
|
ComPtr<ID3D12DescriptorHeap> m_current_texture_descriptors;
|
||||||
ComPtr<ID3D12DescriptorHeap> m_current_sampler_descriptors;
|
ComPtr<ID3D12DescriptorHeap> m_current_sampler_descriptors;
|
||||||
|
size_t vram_size;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
D3D12GSRender();
|
D3D12GSRender();
|
||||||
virtual ~D3D12GSRender();
|
virtual ~D3D12GSRender();
|
||||||
|
|||||||
Reference in New Issue
Block a user