mirror of
https://github.com/microsoft/DirectXTex.git
synced 2025-07-09 11:40:14 +02:00
R16_SNORM, R8_SNORM pixel write code updated to round instead of truncate
This commit is contained in:
parent
b68c0df6d5
commit
7823346987
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user