[RESOLVED] Setting up depth buffer in RenderPlugin Prepar3D

antox
Posts: 3
Joined: Mon Dec 18, 2017 11:23 pm

[RESOLVED] Setting up depth buffer in RenderPlugin Prepar3D

Postby antox » Thu Apr 19, 2018 9:22 am

Render target view comes from PDK::IRenderData, but how do you configure a suitable depth stencil view?

In a stand-alone application I had control over both of those, and also, parameter mismatch was easy to diagnose with D3D debug layer (D3D11_CREATE_DEVICE_DEBUG). Now in a plugin DLL, I am lost and only can tell something is wrong because nothing is rendered after the OMSetRenderTargets() call. Any hint would be much appreciated.

Here is the essence of what I am doing:
UINT width, height;
ID3D11RenderTargetView* targetView;
ID3D11Texture2D* depthTex;
ID3D11DepthStencilView* depthView;

width = (UINT)pRenderData->GetTextureWidth();
height = (UINT)pRenderData->GetTextureHeight();

targetView = pRenderData->GetOutputColor();

D3D11_TEXTURE2D_DESC texDesc = // <--
    CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_D32_FLOAT, width, height, 1, 1, D3D11_BIND_DEPTH_STENCIL);
D3D11_DEPTH_STENCIL_VIEW_DESC viewDesc =
    CD3D11_DEPTH_STENCIL_VIEW_DESC(D3D11_DSV_DIMENSION_TEXTURE2D);
dev->CreateTexture2D(&texDesc, nullptr, &depthTex);
dev->CreateDepthStencilView(depthTex, &viewDesc, &depthView);
ctx->ClearDepthStencilView(depthView, D3D11_CLEAR_DEPTH, 1.0f, 0);

ctx->OMSetRenderTargets(1, &targetView, depthView); // <--

Thanks,
Antons

JB3DG
Posts: 287
Joined: Mon Jan 09, 2012 6:44 pm

Re: Setting up depth buffer in RenderPlugin

Postby JB3DG » Thu Apr 19, 2018 10:55 am

You can force debugging on via the DirectX control panel in your VS2015.
Jonathan Bleeker
Milviz systems dev

Formerly known as Naruto-kun

antox
Posts: 3
Joined: Mon Dec 18, 2017 11:23 pm

Re: Setting up depth buffer in RenderPlugin

Postby antox » Thu Apr 19, 2018 11:34 pm

Thank you! This has helped a lot.


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 1 guest