1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 02:52:10 +01:00

[d3d9] respect Vector4 alignment in UpdateStateConstants

This commit is contained in:
Georg Lehmann 2021-04-03 18:05:46 +02:00 committed by Joshie
parent 1ed6edf096
commit 77d80acf75

View File

@ -245,19 +245,21 @@ namespace dxvk {
bool FloatEmu) {
auto UpdateHelper = [&] (auto& set) {
if constexpr (ConstantType == D3D9ConstantType::Float) {
auto begin = reinterpret_cast<const Vector4*>(pConstantData);
auto end = begin + Count;
if (!FloatEmu)
std::copy(begin, end, &set.fConsts[StartRegister]);
else
std::transform(begin, end, &set.fConsts[StartRegister], replaceNaN);
if (!FloatEmu) {
size_t size = Count * sizeof(Vector4);
std::memcpy(set.fConsts[StartRegister].data, pConstantData, size);
}
else {
for (UINT i = 0; i < Count; i++)
set.fConsts[StartRegister + i] = replaceNaN(pConstantData + (i * 4));
}
}
else if constexpr (ConstantType == D3D9ConstantType::Int) {
auto begin = reinterpret_cast<const Vector4i*>(pConstantData);
auto end = begin + Count;
size_t size = Count * sizeof(Vector4i);
std::copy(begin, end, &set.iConsts[StartRegister]);
std::memcpy(set.iConsts[StartRegister].data, pConstantData, size);
}
else {
for (uint32_t i = 0; i < Count; i++) {