Slow D3D buffer creation

Joe MM

Newcomer
Hi,

I'm finding that creating 15000 d3d buffers is taking around 15 seconds (on a respectable PC set-up). So I was wondering if I must be doing something stupid? I know 15000 is a lot but don't see how this could take anywhere near this long. It feels like maybe I've got into a CPU/GPU sync issue but I don't see how.

The buffers are for CPU-write-only and GPU-read-only and I'm creating them thus:

D3D11_BUFFER_DESC bufferDesc;
ZeroMemory(&bufferDesc, sizeof(bufferDesc));
bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
bufferDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
bufferDesc.ByteWidth = 36864;
bufferDesc.StructureByteStride = 288;
bufferDesc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;

HRESULT hr = GxpKernel::Get()->m_pd3dDevice->CreateBuffer(&bufferDesc, NULL, &m_pD3D11Buffer);


I could refactor the code to use less buffers but it's a bit of a fiddly issue so it would take a while, and the PC version of our game is not our release version so I don't want to spend too long on it (performance here is not a problem at all for the target console).

So I'm hoping I'm missing something? Or does it really just take that long?

Cheers,
Joe
 
Why do you need 15000 dynamic vertex buffers? Are you really updating that data after you wrote it once?
 
Correct. 0.5GB of buffers. I don't write to them all every frame but I do regularly update them from the CPU. The runtime performance is fine, it's just this initialisation step that's unexpectedly slow.
 
It might. But to be honest your usage pattern is just really uncommon. I don't think drivers optimize for that.
 
Cool - thanks.
Such usage patterns are increasingly common on next-gen, but I guess I'll have to wait for DX12 or do a special-case for our non-shipping version... :(
Cheers,
Joe
 
Back
Top