Add required descriptor to avoid crash when creating a new RTV CreateRenderTargetView doesn't allow a NULL descriptor when the target texture is typeless. This change adds a descriptor (with the assumption that the texture in question is a 2D texture in R8G8B8A8_UNORM format). Authored-by: Elliot Colp <elliot.colp@gmail.com> Diffs= cd35e613d Add required descriptor to avoid crash when creating a new RTV (#7234) Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com> Co-authored-by: Elliot Colp <elliot.colp@gmail.com>
diff --git a/.rive_head b/.rive_head index 17e0166..89472af 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -8700c736576bf50e591a4ba61c005907c398a908 +cd35e613d258ba2e0e8698ce7a1b826977a13ec7
diff --git a/renderer/d3d/pls_render_context_d3d_impl.cpp b/renderer/d3d/pls_render_context_d3d_impl.cpp index 94cedd6..f68ed0c 100644 --- a/renderer/d3d/pls_render_context_d3d_impl.cpp +++ b/renderer/d3d/pls_render_context_d3d_impl.cpp
@@ -716,8 +716,25 @@ { if (m_targetRTV == nullptr && m_targetTexture != nullptr) { + D3D11_RENDER_TARGET_VIEW_DESC desc{}; + desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + + switch (m_targetFormat) + { + case DXGI_FORMAT_R8G8B8A8_UNORM: + case DXGI_FORMAT_B8G8R8A8_UNORM: + desc.Format = m_targetFormat; + + case DXGI_FORMAT_R8G8B8A8_TYPELESS: + desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + break; + + default: + RIVE_UNREACHABLE(); + } + VERIFY_OK(m_gpu->CreateRenderTargetView(m_targetTexture.Get(), - NULL, + &desc, m_targetRTV.ReleaseAndGetAddressOf())); } return m_targetRTV.Get();