Memory management for vertex buffer data

Suppose I need to display a static image (100 stars). I generate stellar data (position, color, size) to std :: vector stars;

Then I create a class for rendering D3D, which consists of a buffer:

CGalaxyMapRenderer
{
   CComPtr<ID3D11Buffer> m_spStarBuffer;
}

In ctor, initialize it as follows:

CGalaxyMapRenderer::CGalaxyMapRenderer(const std::vector<SStarData>& vecData)
{
   const CD3D11_BUFFER_DESC vertexBuffDescr((UINT)(sizeof(SStarData)*stars.size()), D3D11_BIND_VERTEX_BUFFER); //Constant buffer?
   D3D11_SUBRESOURCE_DATA initVertexData = {0};
   initVertexData.pSysMem = &stars[0];
   spDevice->CreateBuffer(&vertexBuffDescr, &initVertexData, &m_spStarBuffer);
}

After that, I can destroy std :: vector since it is no longer needed.

Questions:

  • spDevice->CreateBuffer(&vertexBuffDescr, &initVertexData, &m_spStarBuffer)); Where will the memory allocation be allocated for this world of code? Will it be graphic memory or current process memory?

  • (, , ), CGalaxyMapRenderer. m_spStarBuffer dtor. , ? , ?

+3

All Articles