R16_SNORM, R8_SNORM pixel write code updated to round instead of truncate

This commit is contained in:
Chuck Walbourn 2020-09-30 13:37:40 -07:00
parent b68c0df6d5
commit 7823346987

View File

@ -1889,7 +1889,7 @@ bool DirectX::_StoreScanline(
if (sPtr >= ePtr) break; if (sPtr >= ePtr) break;
float v = XMVectorGetX(*sPtr++); float v = XMVectorGetX(*sPtr++);
v = std::max<float>(std::min<float>(v, 1.f), -1.f); v = std::max<float>(std::min<float>(v, 1.f), -1.f);
*(dPtr++) = static_cast<int16_t>(v * 32767.f); *(dPtr++) = static_cast<int16_t>(lroundf(v * 32767.f));
} }
return true; return true;
} }
@ -1949,7 +1949,7 @@ bool DirectX::_StoreScanline(
if (sPtr >= ePtr) break; if (sPtr >= ePtr) break;
float v = XMVectorGetX(*sPtr++); float v = XMVectorGetX(*sPtr++);
v = std::max<float>(std::min<float>(v, 1.f), -1.f); v = std::max<float>(std::min<float>(v, 1.f), -1.f);
*(dPtr++) = static_cast<int8_t>(v * 127.f); *(dPtr++) = static_cast<int8_t>(lroundf(v * 127.f));
} }
return true; return true;
} }