ConfettiFX / The-Forge

The Forge Cross-Platform Rendering Framework PC Windows, Steamdeck (native), Ray Tracing, macOS / iOS, Android, XBOX, PS4, PS5, Switch, Quest 2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Direct3D12.cpp is missing "pRenderTarget->mDescriptors = pDesc->mDescriptors;"

Manamongods opened this issue · comments

After these lines:
pRenderTarget->mWidth = pDesc->mWidth;
pRenderTarget->mHeight = pDesc->mHeight;
pRenderTarget->mArraySize = pDesc->mArraySize;
pRenderTarget->mDepth = pDesc->mDepth;
pRenderTarget->mMipLevels = pDesc->mMipLevels;
pRenderTarget->mSampleCount = pDesc->mSampleCount;
pRenderTarget->mSampleQuality = pDesc->mSampleQuality;
pRenderTarget->mFormat = pDesc->mFormat;
pRenderTarget->mClearValue = pDesc->mClearValue;

There should be this line (at line 3560):
pRenderTarget->mDescriptors = pDesc->mDescriptors;

Without this line, when removing an array/3d render target, d3d12_removeRenderTarget will calculate an incorrect handleCount without multiplying by depthOrArraySize (because these flags don't exist even though they maybe should: DESCRIPTOR_TYPE_RENDER_TARGET_ARRAY_SLICES or DESCRIPTOR_TYPE_RENDER_TARGET_DEPTH_SLICES). And over time the maximum RTV descriptor count of 512 can be used up and cause a crash.

The same seems to be a problem in Direct3D11.cpp at line 1732, and possibly Vulkan etc.

I created a pull request for this:
#294

Fixed with latest release