Skip to content

RenderTargetState

Chuck Walbourn edited this page Aug 7, 2016 · 11 revisions

When creating Pipeline State Objects (PSO), DirectX 12 requires knowing the render target format, the depth/stencil buffer format, number of render targets, etc. This information is wrapped up by this helper structure which is used by Effects and SpriteBatch.

Related tutorial: Sprites and textures

Header

#include "RenderTargetState.h"

Initialization

Typically used during resource creation, with a simple initialization case such as the following (assuming your render target's format is DXGI_FORMAT_B8G8R8A8_UNORM and the depth/stencil buffer is DXGI_FORMAT_D32_FLOAT):

RenderTargetState rtState(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_D32_FLOAT);

If using the DeviceResources abstraction, it should be:

RenderTargetState rtState(m_deviceResources->GetBackBufferFormat(),
    m_deviceResources->GetDepthBufferFormat());

MSAA

If you use an MSAA render target, be sure to set the matching sample count:

rtState.sampleDesc.Count = 4; // <--- 4x MSAA

For Use

  • Universal Windows Platform apps
  • Windows desktop apps
  • Windows 11
  • Windows 10
  • Xbox One
  • Xbox Series X|S

Architecture

  • x86
  • x64
  • ARM64

For Development

  • Visual Studio 2022
  • Visual Studio 2019 (16.11)
  • clang/LLVM v12 - v18
  • MinGW 12.2, 13.2
  • CMake 3.20

Related Projects

DirectX Tool Kit for DirectX 11

DirectXMesh

DirectXTex

DirectXMath

Tools

Test Suite

Model Viewer

Content Exporter

DxCapsViewer

See also

DirectX Landing Page

Clone this wiki locally