shader: rely on the saturating float-to-int conversion instead of re-saturating in the translator

This commit is contained in:
nmzik
2026-10-22 00:26:40 +02:00
parent 3bb09ed2a4
commit 2d00e13bf3
3 changed files with 18 additions and 58 deletions
@@ -837,12 +837,11 @@ bool SrtWalker::EvaluateInst(const Inst& inst, uint64_t& result) {
return false;
case ValueOpcode::ConvertU32F32:
if (Arg(inst, 0, a)) {
// The conversion saturates and maps NaN to zero.
const auto value = Float32(a);
if (!std::isfinite(value) || value < 0.0f ||
static_cast<double>(value) > UINT32_MAX) {
return false;
}
result = static_cast<uint32_t>(value);
result = std::isnan(value) || value <= 0.0f ? 0u
: value >= 4294967296.0f ? UINT32_MAX
: static_cast<uint32_t>(value);
return true;
}
return false;