From b7769759f2aefb9d49381702cbf20ec1154fa748 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 23 Jun 2019 23:41:46 +0200 Subject: [PATCH] [dxvk] Implement comparison and setting multiple bits for DxvkBindingSet --- src/dxvk/dxvk_bind_mask.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/dxvk/dxvk_bind_mask.h b/src/dxvk/dxvk_bind_mask.h index 46d5ab29..f60c60c9 100644 --- a/src/dxvk/dxvk_bind_mask.h +++ b/src/dxvk/dxvk_bind_mask.h @@ -77,6 +77,28 @@ namespace dxvk { for (uint32_t i = 0; i < IntCount; i++) m_slots[i] = 0; } + + /** + * \brief Enables multiple bindings + * \param [in] n Number of bindings + */ + void setFirst(uint32_t n) { + for (uint32_t i = 0; i < IntCount; i++) { + m_slots[i] = n >= BitCount ? ~0u : ~(~0u << n); + n = n >= BitCount ? n - BitCount : 0; + } + } + + bool operator == (const DxvkBindingSet& other) const { + bool eq = true; + for (uint32_t i = 0; i < IntCount; i++) + eq &= m_slots[i] == other.m_slots[i]; + return eq; + } + + bool operator != (const DxvkBindingSet& other) const { + return !this->operator == (other); + } private: