Skip to content

Commit

Permalink
Merged pull request "Fix invalid argument for DX12 CreateHeap": #8
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenap07 authored Jan 6, 2022
1 parent 0d977d0 commit ff226c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/d3d12/d3d12-backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,7 @@ namespace nvrhi::d3d12
bool m_MeshletsSupported = false;
bool m_VariableRateShadingSupported = false;

D3D12_FEATURE_DATA_D3D12_OPTIONS m_Options = {};
D3D12_FEATURE_DATA_D3D12_OPTIONS5 m_Options5 = {};
D3D12_FEATURE_DATA_D3D12_OPTIONS6 m_Options6 = {};
D3D12_FEATURE_DATA_D3D12_OPTIONS7 m_Options7 = {};
Expand Down
7 changes: 6 additions & 1 deletion src/d3d12/d3d12-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ namespace nvrhi::d3d12
m_Resources.shaderResourceViewHeap.allocateResources(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, desc.shaderResourceViewHeapSize, true);
m_Resources.samplerHeap.allocateResources(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, desc.samplerHeapSize, true);

m_Context.device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &m_Options, sizeof(m_Options));
bool hasOptions5 = SUCCEEDED(m_Context.device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS5, &m_Options5, sizeof(m_Options5)));
bool hasOptions6 = SUCCEEDED(m_Context.device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS6, &m_Options6, sizeof(m_Options6)));
bool hasOptions7 = SUCCEEDED(m_Context.device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS7, &m_Options7, sizeof(m_Options7)));
Expand Down Expand Up @@ -505,13 +506,17 @@ namespace nvrhi::d3d12
{
D3D12_HEAP_DESC heapDesc;
heapDesc.SizeInBytes = d.capacity;
heapDesc.Flags = D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES;
heapDesc.Alignment = D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT;
heapDesc.Properties.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
heapDesc.Properties.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
heapDesc.Properties.CreationNodeMask = 1; // no mGPU support in nvrhi so far
heapDesc.Properties.VisibleNodeMask = 1;

if (m_Options.ResourceHeapTier == D3D12_RESOURCE_HEAP_TIER_1)
heapDesc.Flags = D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES;
else
heapDesc.Flags = D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES;

switch (d.type)
{
case HeapType::DeviceLocal:
Expand Down

0 comments on commit ff226c6

Please sign in to comment.