Skip to content

Commit

Permalink
Fix for saving vertex shader constants with a StateBlock, part doitsu…
Browse files Browse the repository at this point in the history
  • Loading branch information
aroztkow authored and adamjer committed Oct 31, 2022
1 parent 9ab5241 commit e5edc5d
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/util/util_bit.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,14 @@ namespace dxvk::bit {
}

constexpr void setN(uint32_t bits) {
uint32_t dwords = align(bits, 32) / 32;
uint32_t fullDwords = bits / 32;
uint32_t offset = bits % 32;
if (offset == 0) {
for (size_t i = 0; i < dwords; i++)
m_dwords[i] = std::numeric_limits<uint32_t>::max();
}
else {
for (size_t i = 0; i < dwords - 1; i++)
m_dwords[i] = std::numeric_limits<uint32_t>::max();

m_dwords[dwords - 1] = (1u << offset) - 1;
}
for (size_t i = 0; i < fullDwords; i++)
m_dwords[i] = std::numeric_limits<uint32_t>::max();

if (offset > 0)
m_dwords[fullDwords] = (1u << offset) - 1;
}

private:
Expand Down

0 comments on commit e5edc5d

Please sign in to comment.