MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / EnableCBuffers

Method EnableCBuffers

GTE/Graphics/GL46/GL46Engine.cpp:348–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348void 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
378void GL46Engine::DisableCBuffers(Shader const* shader, GLuint program)
379{

Callers

nothing calls this directly

Calls 4

glUniformBlockBindingFunction · 0.85
AcquireUnitMethod · 0.80
GetDataMethod · 0.45
AttachToUnitMethod · 0.45

Tested by

no test coverage detected