| 517 | } |
| 518 | |
| 519 | void GL46Engine::DisableSBuffers(Shader const* shader, GLuint program) |
| 520 | { |
| 521 | // Unbind any atomic counter buffers. |
| 522 | auto const& atomicCounters = shader->GetData(Shader::AtomicCounterShaderDataLookup); |
| 523 | auto const& atomicCounterBuffers = shader->GetData(Shader::AtomicCounterBufferShaderDataLookup); |
| 524 | for (uint32_t acbIndex = 0; acbIndex < atomicCounterBuffers.size(); ++acbIndex) |
| 525 | { |
| 526 | auto const& acb = atomicCounterBuffers[acbIndex]; |
| 527 | glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, acb.bindPoint, 0); |
| 528 | } |
| 529 | |
| 530 | int32_t const index = StructuredBuffer::shaderDataLookup; |
| 531 | for (auto const& sb : shader->GetData(index)) |
| 532 | { |
| 533 | if (sb.object) |
| 534 | { |
| 535 | auto gl4SB = static_cast<GL46StructuredBuffer*>(Get(sb.object)); |
| 536 | |
| 537 | if (gl4SB) |
| 538 | { |
| 539 | auto const blockIndex = sb.bindPoint; |
| 540 | if (GL_INVALID_INDEX != static_cast<uint32_t>(blockIndex)) |
| 541 | { |
| 542 | auto const unit = mShaderStorageUnitMap.GetUnit(program, blockIndex); |
| 543 | glBindBufferBase(GL_SHADER_STORAGE_BUFFER, unit, 0); |
| 544 | mShaderStorageUnitMap.ReleaseUnit(unit); |
| 545 | |
| 546 | // The sb.isGpuWritable flag is used to indicate whether |
| 547 | // or not there is atomic counter associated with this |
| 548 | // structured buffer. |
| 549 | if (sb.isGpuWritable) |
| 550 | { |
| 551 | // This structured buffer has index to associated |
| 552 | // atomic counter table entry. |
| 553 | auto const acIndex = sb.extra; |
| 554 | |
| 555 | // Where does the associated counter exist in the |
| 556 | // shader? |
| 557 | auto const acbIndex = atomicCounters[acIndex].bindPoint; |
| 558 | auto const acbOffset = atomicCounters[acIndex].extra; |
| 559 | |
| 560 | // Retrieve the GL4 atomic counter buffer object. |
| 561 | auto gl4ACB = static_cast<GL46AtomicCounterBuffer*>(Get(mAtomicCounterRawBuffers[acbIndex])); |
| 562 | |
| 563 | // Copy the counter value from the appropriate place |
| 564 | // in the atomic counter buffer to the structured |
| 565 | // buffer object. |
| 566 | gl4SB->CopyCounterValueFromBuffer(gl4ACB, acbOffset); |
| 567 | } |
| 568 | } |
| 569 | } |
| 570 | } |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | void GL46Engine::EnableRBuffers(Shader const*, GLuint) |
| 575 | { |
nothing calls this directly
no test coverage detected