microsoft / D3D12TranslationLayer

A library containing utilities for mapping higher-level graphics work to D3D12
MIT License
327 stars 47 forks source link

Fix Dirty Flag Issue in SetConstantBuffers #89

Closed colta95 closed 1 year ago

colta95 commented 1 year ago

SetConstantBuffers() was previously setting the dirty flag unconditionally, even when the states aren't actually dirty, which likely caused PreDraw() to do lots of unnecessary work.

However, it still needs to set the flag if the offset to the buffer changes or if the number of constants change. If the buffer itself changes, UpdateBinding() will set the dirty flag.

I've tested the change on an RTX 3070 with a map in CS:GO, and the FPS increased by about around 35%.