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

Method DisableTextures

GTE/Graphics/GL46/GL46Engine.cpp:625–662  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

623}
624
625void GL46Engine::DisableTextures(Shader const* shader, GLuint program)
626{
627 int32_t const index = TextureSingle::shaderDataLookup;
628 for (auto const& ts : shader->GetData(index))
629 {
630 if (!ts.object)
631 {
632 LogError(ts.name + " is null texture.");
633 }
634
635 auto texture = static_cast<GL46TextureSingle*>(Get(ts.object));
636 if (!texture)
637 {
638 LogError("Failed to get texture.");
639 }
640
641 // By convension, ts.isGpuWritable is true for "image*" and false
642 // for "sampler*".
643 if (ts.isGpuWritable)
644 {
645 // For "image*" objects in the shader, use "readonly" or
646 // "writeonly" attributes in the layout to control R/W/RW access
647 // using shader compiler and then connect as GL_READ_WRITE here.
648 // Always bind level 0 and all layers. TODO: Decide whether
649 // unbinding the texture from the image unit is necessary.
650 // glBindImageTexture(unit, 0, 0, 0, 0, 0, 0);
651 GLint unit = mTextureImageUnitMap.GetUnit(program, ts.bindPoint);
652 mTextureImageUnitMap.ReleaseUnit(unit);
653 }
654 else
655 {
656 GLint unit = mTextureSamplerUnitMap.GetUnit(program, ts.bindPoint);
657 glActiveTexture(GL_TEXTURE0 + unit);
658 glBindTexture(texture->GetTarget(), 0);
659 mTextureSamplerUnitMap.ReleaseUnit(unit);
660 }
661 }
662}
663
664void GL46Engine::EnableTextureArrays(Shader const* shader, GLuint program)
665{

Callers

nothing calls this directly

Calls 6

glActiveTextureFunction · 0.85
glBindTextureFunction · 0.85
GetUnitMethod · 0.80
ReleaseUnitMethod · 0.80
GetTargetMethod · 0.80
GetDataMethod · 0.45

Tested by

no test coverage detected