| 623 | } |
| 624 | |
| 625 | void 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 | |
| 664 | void GL46Engine::EnableTextureArrays(Shader const* shader, GLuint program) |
| 665 | { |
nothing calls this directly
no test coverage detected