| 674 | } |
| 675 | |
| 676 | bool BufferedQueryPoolVulkan::AcquireQuery(CmdBufferVulkan* cmdBuffer, uint32& resultIndex) |
| 677 | { |
| 678 | const uint64 allUsedMask = MAX_uint64; |
| 679 | for (int32 wordIndex = _lastBeginIndex / 64; wordIndex < _usedQueryBits.Count(); wordIndex++) |
| 680 | { |
| 681 | uint64 beginQueryWord = _usedQueryBits[wordIndex]; |
| 682 | if (beginQueryWord != allUsedMask) |
| 683 | { |
| 684 | resultIndex = 0; |
| 685 | while ((beginQueryWord & 1) == 1) |
| 686 | { |
| 687 | resultIndex++; |
| 688 | beginQueryWord >>= 1; |
| 689 | } |
| 690 | resultIndex += wordIndex * 64; |
| 691 | const uint64 bit = (uint64)1 << (uint64)(resultIndex % 64); |
| 692 | _usedQueryBits[wordIndex] = _usedQueryBits[wordIndex] | bit; |
| 693 | _readResultsBits[wordIndex] &= ~bit; |
| 694 | _lastBeginIndex = resultIndex + 1; |
| 695 | if (ResetBeforeUse) |
| 696 | Reset(cmdBuffer); |
| 697 | return true; |
| 698 | } |
| 699 | } |
| 700 | return false; |
| 701 | } |
| 702 | |
| 703 | void BufferedQueryPoolVulkan::ReleaseQuery(uint32 queryIndex) |
| 704 | { |
no test coverage detected