mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-11 10:24:10 +01:00
[dxvk] Add function to set bind mask bit to a given value
This commit is contained in:
parent
e7b71926e3
commit
d2d19b0dec
@ -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,13 +62,7 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user