diff --git a/src/d3d9/d3d9_state.h b/src/d3d9/d3d9_state.h index 6f68495f8..e895f5dbe 100644 --- a/src/d3d9/d3d9_state.h +++ b/src/d3d9/d3d9_state.h @@ -245,19 +245,21 @@ namespace dxvk { bool FloatEmu) { auto UpdateHelper = [&] (auto& set) { if constexpr (ConstantType == D3D9ConstantType::Float) { - auto begin = reinterpret_cast(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(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++) {