ConfettiFX / The-Forge

The Forge Cross-Platform Rendering Framework PC Windows, Steamdeck (native), Ray Tracing, macOS / iOS, Android, XBOX, PS4, PS5, Switch, Quest 2
Apache License 2.0
4.75k stars 497 forks source link

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

Closed Manamongods closed 8 months ago

Manamongods commented 9 months ago

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.

Manamongods commented 9 months ago

I created a pull request for this: https://github.com/ConfettiFX/The-Forge/pull/294

manas-kulkarni commented 8 months ago

Fixed with latest release