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

[d3d9] respect Vector4 alignment in GetShaderConstants

This commit is contained in:
Georg Lehmann 2021-04-03 17:25:04 +02:00 committed by Joshie
parent d682ab0402
commit 1ed6edf096

View File

@ -1152,16 +1152,16 @@ namespace dxvk {
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
if constexpr (ConstantType == D3D9ConstantType::Float) { if constexpr (ConstantType == D3D9ConstantType::Float) {
auto begin = &set.fConsts[StartRegister]; const float* source = set.fConsts[StartRegister].data;
auto end = &begin[Count]; const size_t size = Count * sizeof(Vector4);
std::copy(begin, end, reinterpret_cast<Vector4*>(pConstantData)); std::memcpy(pConstantData, source, size);
} }
else if constexpr (ConstantType == D3D9ConstantType::Int) { else if constexpr (ConstantType == D3D9ConstantType::Int) {
auto begin = &set.iConsts[StartRegister]; const int* source = set.iConsts[StartRegister].data;
auto end = &begin[Count]; const size_t size = Count * sizeof(Vector4i);
std::copy(begin, end, reinterpret_cast<Vector4i*>(pConstantData)); std::memcpy(pConstantData, source, size);
} }
else { else {
for (uint32_t i = 0; i < Count; i++) { for (uint32_t i = 0; i < Count; i++) {