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

Method DisableTextureArrays

GTE/Graphics/GL46/GL46Engine.cpp:705–744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

703}
704
705void GL46Engine::DisableTextureArrays(Shader const* shader, GLuint program)
706{
707 int32_t const index = TextureArray::shaderDataLookup;
708 for (auto const& ta : shader->GetData(index))
709 {
710 if (!ta.object)
711 {
712 LogError(ta.name + " is null texture array.");
713 continue;
714 }
715
716 auto texture = static_cast<GL46TextureArray*>(Get(ta.object));
717 if (!texture)
718 {
719 LogError("Failed to get texture array.");
720 continue;
721 }
722
723 // By convension, ta.isGpuWritable is true for "image*" and false
724 // for "sampler*".
725 if (ta.isGpuWritable)
726 {
727 // For "image*" objects in the shader, use "readonly" or
728 // "writeonly" attributes in the layout to control R/W/RW access
729 // using shader compiler and then connect as GL_READ_WRITE here.
730 // Always bind level 0 and all layers. TODO: Decide whether
731 // unbinding the texture from the image unit is necessary.
732 // glBindImageTexture(unit, 0, 0, 0, 0, 0, 0);
733 GLint unit = mTextureImageUnitMap.GetUnit(program, ta.bindPoint);
734 mTextureImageUnitMap.ReleaseUnit(unit);
735 }
736 else
737 {
738 GLint unit = mTextureSamplerUnitMap.GetUnit(program, ta.bindPoint);
739 glActiveTexture(GL_TEXTURE0 + unit);
740 glBindTexture(texture->GetTarget(), 0);
741 mTextureSamplerUnitMap.ReleaseUnit(unit);
742 }
743 }
744}
745
746void GL46Engine::EnableSamplers(Shader const* shader, GLuint program)
747{

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