| 80 | } |
| 81 | |
| 82 | bool GL46StructuredBuffer::GetNumActiveElements() |
| 83 | { |
| 84 | auto buffer = GetStructuredBuffer(); |
| 85 | if (StructuredBuffer::CounterType::NONE == buffer->GetCounterType()) |
| 86 | { |
| 87 | return false; |
| 88 | } |
| 89 | |
| 90 | // Read the count from the location in the buffer past the structured |
| 91 | // buffer data. |
| 92 | GLint count; |
| 93 | glBindBuffer(mType, mGLHandle); |
| 94 | glGetBufferSubData(mType, mCounterOffset, 4, &count); |
| 95 | glBindBuffer(mType, 0); |
| 96 | |
| 97 | count = (std::max)(0, count); |
| 98 | buffer->SetNumActiveElements(count); |
| 99 | |
| 100 | return true; |
| 101 | } |
| 102 | |
| 103 | bool GL46StructuredBuffer::SetNumActiveElements() |
| 104 | { |
no test coverage detected