0
\$\begingroup\$

Every time my constant buffer helper creates the "Constant buffer view" with the CreateConstantBufferView method i get an error which states:

D3D12 ERROR: ID3D12Device::CreateConstantBufferView: pDesc->BufferLocation 0x00000000a9df6000 does not belong to any existing Resource or Heap. [ STATE_CREATION ERROR #649: CREATE_CONSTANT_BUFFER_VIEW_INVALID_RESOURCE]

this makes no sense as the resource is created and used (just like in the previous working usages of this method) the only thing that is different is the descriptor heap and obviously the instance of the constant buffer helper.

Also it is used by a different command list and Pipeline state object (PSO), this may be the problem but I am unsure.

here is the relevant code for the creation of the constant buffer view:

D3D12_CONSTANT_BUFFER_VIEW_DESC desc = {};
desc.BufferLocation = cbvGpuAddress;
desc.SizeInBytes = size;
m_deviceResources->GetD3DDevice()->CreateConstantBufferView(&desc, cbvCpuHandle);
sizeInBytes = desc.SizeInBytes;

Below is for the creation of the descriptor heap and constant buffer helper:

 m_cbvSrvHeapManager = std::make_shared<DescriptorHeapManager>(DX::c_frameCount + 1, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, m_deviceResources);
    m_cbvDescriptorSize = m_cbvSrvHeapManager->GetDescriptorSize();

m_mvpConstantBufferManager = std::make_unique<ConstantBufferManager<Structures::ModelViewProjectionConstantBuffer>>(DX::c_frameCount, m_mvpConstantBufferManager->GetAlignedSize(), m_deviceResources, m_commandListManager);
    for (int n = 0; n < DX::c_frameCount; n++)
    {
        m_mvpConstantBufferManager->CreateBufferDesc(m_mvpConstantBufferManager->GetAlignedSize(), n, m_cbvSrvHeapManager, m_cbvDescriptorSize);

    }

Below is for the previous working usage of the creation of the descriptor heap and and constant buffer helper:

m_cbvSrvHeapManager = std::make_shared<DescriptorHeapManager>(DX::c_frameCount + 2, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, m_deviceResources);

m_cbvDescriptorSize = m_cbvSrvHeapManager->GetDescriptorSize();
    m_mvpConstantBufferManager = std::make_unique<ConstantBufferManager<Structures::ModelViewProjectionConstantBuffer>>(DX::c_frameCount, m_mvpConstantBufferManager->GetAlignedSize(), m_deviceResources, m_commandListManager);
for (int n = 0; n < DX::c_frameCount; n++)
{
    m_mvpConstantBufferManager->CreateBufferDesc(m_mvpConstantBufferManager->GetAlignedSize(), n + 2, m_cbvSrvHeapManager, m_cbvDescriptorSize);
}
\$\endgroup\$
  • \$\begingroup\$ You've got a lot of bespoke classes/methods being used here, so I don't think we can debug your problem for you from this. Note that you should take a look at DirectX Tool Kit for DX12, and in particular the GraphicsMemory and LinearAllocator classes. \$\endgroup\$ – Chuck Walbourn Mar 1 '18 at 17:28
0
\$\begingroup\$

Some how i fixed it, i created the vertex and index buffers after the constant buffers.

\$\endgroup\$
  • \$\begingroup\$ Don't forget to come back here in a couple of days and mark this as answered :) \$\endgroup\$ – Vaillancourt Mar 1 '18 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.