diff --git a/src/dxvk/dxvk_bind_mask.h b/src/dxvk/dxvk_bind_mask.h index f60c60c9f..7f17b50ff 100644 --- a/src/dxvk/dxvk_bind_mask.h +++ b/src/dxvk/dxvk_bind_mask.h @@ -35,6 +35,26 @@ namespace dxvk { return (m_slots[intId] & bitMask) != 0; } + /** + * \brief Changes a single binding + * + * \param [in] slot The binding ID + * \param [in] value New binding state + * \returns \c true if the state has changed + */ + bool set(uint32_t slot, bool value) { + const uint32_t intId = slot / BitCount; + const uint32_t bitId = slot % BitCount; + const uint32_t bitMask = 1u << bitId; + + const uint32_t prev = m_slots[intId]; + const uint32_t next = value + ? prev | bitMask + : prev & ~bitMask; + m_slots[intId] = next; + return prev != next; + } + /** * \brief Marks a binding as active * @@ -42,15 +62,9 @@ namespace dxvk { * \returns \c true if the state has changed */ bool set(uint32_t slot) { - const uint32_t intId = slot / BitCount; - const uint32_t bitId = slot % BitCount; - const uint32_t bitMask = 1u << bitId; - - const uint32_t prev = m_slots[intId]; - m_slots[intId] = prev | bitMask; - return (prev & bitMask) == 0; + return set(slot, true); } - + /** * \brief Marks a binding as inactive * @@ -58,13 +72,7 @@ namespace dxvk { * \returns \c true if the state has changed */ bool clr(uint32_t slot) { - const uint32_t intId = slot / BitCount; - const uint32_t bitId = slot % BitCount; - const uint32_t bitMask = 1u << bitId; - - const uint32_t prev = m_slots[intId]; - m_slots[intId] = prev & ~bitMask; - return (prev & bitMask) != 0; + return set(slot, false); } /**