1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[d3d9] Fix render target null pointer deref

This commit is contained in:
Robin Kertels 2024-10-15 10:20:24 +02:00 committed by Philip Rebohle
parent 35ead85929
commit 763b82b1e4
2 changed files with 6 additions and 3 deletions

View File

@ -1841,9 +1841,9 @@ namespace dxvk {
// Clear render targets if we need to.
if (Flags & D3DCLEAR_TARGET) {
for (uint32_t rt = 0u; rt < m_state.renderTargets.size(); rt++) {
const auto& rts = m_state.renderTargets[rt];
if (rts == nullptr)
if (!HasRenderTargetBound(rt))
continue;
const auto& rts = m_state.renderTargets[rt];
const auto& rtv = rts->GetRenderTargetView(srgb);
if (likely(rtv != nullptr)) {
@ -6329,7 +6329,7 @@ namespace dxvk {
uint32_t limitsRenderAreaMask = 0u;
VkExtent2D renderArea = { ~0u, ~0u };
for (uint32_t i = 0u; i < m_state.renderTargets.size(); i++) {
if (m_state.renderTargets[i] == nullptr)
if (!HasRenderTargetBound(i))
continue;
const DxvkImageCreateInfo& rtImageInfo = m_state.renderTargets[i]->GetCommonTexture()->GetImage()->info();

View File

@ -1300,6 +1300,9 @@ namespace dxvk {
bool IsTextureBoundAsAttachment(const D3D9CommonTexture* pTexture) const {
if (unlikely(pTexture->IsRenderTarget())) {
for (uint32_t i = 0u; i < m_state.renderTargets.size(); i++) {
if (m_state.renderTargets[i] == nullptr)
continue;
auto texInfo = m_state.renderTargets[i]->GetCommonTexture();
if (unlikely(texInfo == pTexture)) {
return true;