To create the depth/stencil resource, you are creating a ID3D11Texture2D resource object, so you should use D3D11_TEXTURE2D_DESC.
D3D11_TEXTURE2D_DESC depthStencilDesc = {};
depthStencilDesc.Width = backBufferWidth;
depthStencilDesc.Height = backBufferHeight;
depthStencilDesc.MipLevels = depthStencilDesc.ArraySize = 1;
depthStencilDesc.Format = depthBufferFormat;
depthStencilDesc.SampleDesc.Count = 1;
depthStencilDesc.Usage = D3D11_BIND_DEPTH_STENCIL;
or with the C++ helpers:
CD3D11_TEXTURE2D_DESC depthStencilDesc(depthBufferFormat,
backBufferWidth, backBufferHeight, 1, 1,
D3D11_BIND_DEPTH_STENCIL);
Then you use depthStencilDesc with the method CreateTexture2D:
hr = d3dDevice->CreateTexture2D(&depthStencilDesc,
nullptr,
&depthStencil);
if (FAILED(hr))
...
You then use D3D11_DEPTH_STENCIL_VIEW_DESCwith the CreateDepthStencilView method to create the view which you use to bind the resource as a depth/stencil buffer to the render pipeline (or you can pass nullptr for the desc as well):
hr = d3dDevice->CreateDepthStencilView(depthStencil,
&depthStencilViewDesc,
&m_depthStencilView);
if (FAILED(hr))
...
The time when you use a D3D11_DEPTH_STENCIL_DESC is when you are creating the ID3D11DepthStencilState state object with the CreateDepthStencilState method which controls how the depth/stencil buffer is used when rendering:
D3D11_DEPTH_STENCIL_DESC desc = {};
desc.DepthEnable = TRUE;
desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
desc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL;
desc.StencilEnable = FALSE;
desc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
desc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
desc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
desc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
desc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
desc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
desc.BackFace = desc.FrontFace;
hr = d3dDevice->CreateDepthStencilState(&desc, &depthStencilState);
if (FAILED(hr))
...