Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid argument for DX12 CreateHeap #8

Merged
merged 3 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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