| 346 | } |
| 347 | |
| 348 | void GL46Engine::EnableCBuffers(Shader const* shader, GLuint program) |
| 349 | { |
| 350 | int32_t const index = ConstantBuffer::shaderDataLookup; |
| 351 | for (auto const& cb : shader->GetData(index)) |
| 352 | { |
| 353 | if (cb.object) |
| 354 | { |
| 355 | auto gl4CB = static_cast<GL46ConstantBuffer*>(Bind(cb.object)); |
| 356 | if (gl4CB) |
| 357 | { |
| 358 | auto const blockIndex = cb.bindPoint; |
| 359 | if (GL_INVALID_INDEX != static_cast<uint32_t>(blockIndex)) |
| 360 | { |
| 361 | auto const unit = mUniformUnitMap.AcquireUnit(program, blockIndex); |
| 362 | glUniformBlockBinding(program, blockIndex, unit); |
| 363 | gl4CB->AttachToUnit(unit); |
| 364 | } |
| 365 | } |
| 366 | else |
| 367 | { |
| 368 | LogError("Failed to bind constant buffer."); |
| 369 | } |
| 370 | } |
| 371 | else |
| 372 | { |
| 373 | LogError(cb.name + " is null constant buffer."); |
| 374 | } |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | void GL46Engine::DisableCBuffers(Shader const* shader, GLuint program) |
| 379 | { |
nothing calls this directly
no test coverage detected