I would like to draw reference frame to see how my camera moves around scene. I want these arrows to always be on the top of other geometry. How can I achieve it?

I think I need to disable depth test for this draw calls. Should I use just another PSO with changed DepthStencilState?

EDIT: Well, it works for me like that.

// opaquePsoDesc defined somewhere above    
D3D12_GRAPHICS_PIPELINE_STATE_DESC opaqueHudPsoDesc = opaquePsoDesc;
opaqueHudPsoDesc.DepthStencilState.DepthEnable = false;
THROW_IF_FAILED(g_device->CreateGraphicsPipelineState(&opaqueHudPsoDesc, IID_PPV_ARGS(&psos_["opaque_HUD"])));

And then before drawing your HUD you can:


I'll leave this answer here, in case someone will need it.

Well, that works fine if you don't want depth test for the HUD objects.

  • 1
    \$\begingroup\$ You can actually post an answer to your own question and close it yourself. That way it doesn't stay open and unanswered :) \$\endgroup\$
    – Honeybunch
    Commented Dec 31, 2016 at 19:46

1 Answer 1


The DirectX 12 state model is that you create distinct Pipeline State Objects (PSOs) for every combination of state, render target configuration, and shaders you use in your application. You can share root signatures or change them as well. While creating PSOs and root signatures is expensive, setting them is very fast.

Generally for HUDs you draw the background and scene, and then draw the text over the top of that. The choice of color is important to ensure the HUD is visible. Such text ignores the depth test.

  • For MSAA or post-processing, you render the scene to an offscreen render target fully, resolve/post-process it to the render target and then draw the HUD before presenting--often at this point you don't even have a depth/stencil buffer.

  • With HDR rendering on 4K UHD displays, you typically use double the nits of the scene for the text.

See DirectX Tool Kit for DirectX 12 and in particular the SpriteFont and SpriteBatch classes.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .