mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-14 00:48:44 +01:00
[dxvk] Add setRange method to DxvkBindingSet
This commit is contained in:
parent
ec5ea71174
commit
038ee0416d
@ -88,12 +88,31 @@ namespace dxvk {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Enables multiple bindings
|
* \brief Enables multiple bindings
|
||||||
* \param [in] n Number of bindings
|
*
|
||||||
|
* Leaves bindings outside of this range unaffected.
|
||||||
|
* \param [in] first First binding to enable
|
||||||
|
* \param [in] count Number of bindings to enable
|
||||||
*/
|
*/
|
||||||
void setFirst(uint32_t n) {
|
void setRange(uint32_t first, uint32_t count) {
|
||||||
for (uint32_t i = 0; i < IntCount; i++) {
|
if (!count)
|
||||||
m_slots[i] = n >= BitCount ? ~0u : ~(~0u << n);
|
return;
|
||||||
n = n >= BitCount ? n - BitCount : 0;
|
|
||||||
|
uint32_t firstInt = first / BitCount;
|
||||||
|
uint32_t firstBit = first % BitCount;
|
||||||
|
|
||||||
|
uint32_t lastInt = (first + count - 1) / BitCount;
|
||||||
|
uint32_t lastBit = (first + count - 1) % BitCount + 1;
|
||||||
|
|
||||||
|
if (firstInt == lastInt) {
|
||||||
|
m_slots[firstInt] |= (count < BitCount)
|
||||||
|
? ((1u << count) - 1) << firstBit
|
||||||
|
: ~0u;
|
||||||
|
} else {
|
||||||
|
m_slots[firstInt] |= ~0u << firstBit;
|
||||||
|
m_slots[lastInt] |= ~0u >> (BitCount - lastBit);
|
||||||
|
|
||||||
|
for (uint32_t i = firstInt + 1; i < lastInt; i++)
|
||||||
|
m_slots[i] = ~0u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4187,7 +4187,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
// Assume that all bindings are active as a fast path
|
// Assume that all bindings are active as a fast path
|
||||||
DxvkBindingMask bindMask;
|
DxvkBindingMask bindMask;
|
||||||
bindMask.setFirst(layout->bindingCount());
|
bindMask.clear();
|
||||||
|
bindMask.setRange(0, layout->bindingCount());
|
||||||
|
|
||||||
for (uint32_t i = 0; i < layout->bindingCount(); i++) {
|
for (uint32_t i = 0; i < layout->bindingCount(); i++) {
|
||||||
const auto& binding = layout->binding(i);
|
const auto& binding = layout->binding(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user