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;
|
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
|
* \brief Marks a binding as active
|
||||||
*
|
*
|
||||||
@ -42,15 +62,9 @@ namespace dxvk {
|
|||||||
* \returns \c true if the state has changed
|
* \returns \c true if the state has changed
|
||||||
*/
|
*/
|
||||||
bool set(uint32_t slot) {
|
bool set(uint32_t slot) {
|
||||||
const uint32_t intId = slot / BitCount;
|
return set(slot, true);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Marks a binding as inactive
|
* \brief Marks a binding as inactive
|
||||||
*
|
*
|
||||||
@ -58,13 +72,7 @@ namespace dxvk {
|
|||||||
* \returns \c true if the state has changed
|
* \returns \c true if the state has changed
|
||||||
*/
|
*/
|
||||||
bool clr(uint32_t slot) {
|
bool clr(uint32_t slot) {
|
||||||
const uint32_t intId = slot / BitCount;
|
return set(slot, false);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user