Fix integer overflow in custom shader Time calculation (#20360)

This PR removes an unnecessary 32-bit integer truncation in shader time
computation and preserves the original modulo-based architecture while
improving precision in the tick-to-seconds conversion.

(cherry picked from commit 27da3bce62)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zg6CoUY
Service-Version: 1.25
This commit is contained in:
Shivam Kumar
2026-07-10 06:32:29 +05:30
committed by Dustin L. Howett
parent f86d9e4df5
commit de9c19e0c8

View File

@@ -2329,7 +2329,7 @@ void BackendD3D::_executeCustomShader(RenderingPayload& p)
{
// See the comment in _recreateCustomShader() which initializes the two members below and explains what they do.
const auto now = queryPerfCount();
const auto time = static_cast<int>(now % _customShaderPerfTickMod) * _customShaderSecsPerPerfTick;
const auto time = (now % _customShaderPerfTickMod) * _customShaderSecsPerPerfTick;
const CustomConstBuffer data{
.time = time,