# D3D12 UniformBuffer Read After Free When FastGeo Is Enabled 

**URL:** <https://forums.unrealengine.com/t/d3d12-uniformbuffer-read-after-free-when-fastgeo-is-enabled/2662409>\
**Category:** Rendering\
**Tags:** unreal-engine, Epic-Pro-Support, question\
**Created:** [September 5, 2025, 12:44pm UTC](https://forums.unrealengine.com/t/d3d12-uniformbuffer-read-after-free-when-fastgeo-is-enabled/2662409 "2025-09-05T12:44:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [September 5, 2025, 12:44pm UTC](https://forums.unrealengine.com/t/d3d12-uniformbuffer-read-after-free-when-fastgeo-is-enabled/2662409/1 "2025-09-05T12:44:46Z")

</div>

Hey,

So recently we enabled FastGeoStreaming and I’ve observed a crash when changing `r.MaterialQualityLevel` during the depth pre-pass, in a cooked build.

It occurs in ValidateUniformBuffer (does not occur when the plugin is disabled).

```auto
inline void ValidateBoundUniformBuffer(FD3D12UniformBuffer* InUniformBuffer, FRHIShader* InShaderRHI, uint32 InBufferIndex)
{
#if DO_CHECK
	auto const& LayoutHashes = InShaderRHI->GetShaderResourceTable().ResourceTableLayoutHashes;

	if (InBufferIndex < (uint32)LayoutHashes.Num())
	{
		uint32 UniformBufferHash = InUniformBuffer->GetLayout().GetHash(); <-------------- here
		uint32 ShaderTableHash = LayoutHashes[InBufferIndex];
		ensureMsgf(ShaderTableHash == 0 || UniformBufferHash == ShaderTableHash,
			TEXT("Invalid uniform buffer %s bound on %sShader at index %d."),
			*(InUniformBuffer->GetLayout().GetDebugName()),
			GetShaderFrequencyString(InShaderRHI->GetFrequency(), false),
			InBufferIndex);
	}
#endif
}

```

The UB in question is the materials `Material` uniform buffer and is effectively pointing at the UB from before the quality level changed, which was since freed during:

```auto
FMaterialRenderProxy::InvalidateUniformExpressionCache(bool bRecreateUniformBuffer)

```

But re-allocated in:

```auto
FMaterialRenderProxy::EvaluateUniformExpressions(FRHICommandListBase& RHICmdList, FUniformExpressionCache& OutUniformExpressionCache, const FMaterialRenderContext& Context, FUniformExpressionCacheAsyncUpdater* Updater) const

```

I added some sketchy logging around `FMaterialShader::GetShaderBindings` to keep track of what pointer was currently stashed in `UniformExpressionCache.UniformBuffer`, using the callstack up until `FScene::Update()` as a way to book keep it and each pass _ **appeared** _ to have the most up to date uniform buffer pointer.

I was wondering if you had ever encountered something like this before / had tips on debugging it further?

Many thanks,

Alister

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [September 5, 2025, 2:54pm UTC](https://forums.unrealengine.com/t/d3d12-uniformbuffer-read-after-free-when-fastgeo-is-enabled/2662409/2 "2025-09-05T14:54:41Z")

</div>

After testing, this happens on vanilla Lyra.

Enable FastGeoStreaming, add the FastGeo transformer in the world setting (L\_Expanse was what I testing on).

After changing material quality level (might need to move around a bit) and it crashes in basically the same way.

---

<div class="post-metadata">

**Author:** ![Petrockets](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/petrockets/32/1142518_2.png) [@Petrockets](https://forums.unrealengine.com/u/Petrockets)\
**Post date:** [September 5, 2025, 10:28pm UTC](https://forums.unrealengine.com/t/d3d12-uniformbuffer-read-after-free-when-fastgeo-is-enabled/2662409/3 "2025-09-05T22:28:16Z")

</div>

Hello!

Thanks for reporting this issue. I was able to reproduce the crash in a cooked build (not in PIE) and created the following internal issue which should be visible soon [Unreal Engine Issues and Bug Tracker (UE\-318822\)](https://issues.unrealengine.com/issue/UE%5C-318822%5C).

This issue was also reported in this ticket [Content removed] however we didn’t have a repro case or details for a workaround.
