diff options
| author | Markus Wick <degasus@users.noreply.github.com> | 2018-01-24 12:19:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-24 12:19:53 +0100 |
| commit | c66156148dd6ced799f10313cfe6c60e5189ac89 (patch) | |
| tree | 594a3ade77c1484e9b4b899493ffeac0a6a7b358 /Source/Core/VideoBackends/OGL/Render.cpp | |
| parent | c3dc8bf1c0fd8151fed6557a90a72040361ae394 (diff) | |
| parent | 38e0b6e2ab53374e7335fee94209bb90cb3e9ed2 (diff) | |
Merge pull request #6317 from stenzek/renderer-bind
AbstractTexture: Move Bind() method to Renderer
Diffstat (limited to 'Source/Core/VideoBackends/OGL/Render.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/Render.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 9ee96bb724..d3cfa4136d 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1571,8 +1571,6 @@ void Renderer::RestoreAPIState() ProgramShaderCache::BindLastVertexFormat(); const VertexManager* const vm = static_cast<VertexManager*>(g_vertex_manager.get()); glBindBuffer(GL_ARRAY_BUFFER, vm->GetVertexBufferHandle()); - - OGLTexture::SetStage(); } void Renderer::SetRasterizationState(const RasterizationState& state) @@ -1611,11 +1609,34 @@ void Renderer::SetDepthState(const DepthState& state) } } +void Renderer::SetTexture(u32 index, const AbstractTexture* texture) +{ + if (m_bound_textures[index] == texture) + return; + + glActiveTexture(GL_TEXTURE0 + index); + glBindTexture(GL_TEXTURE_2D_ARRAY, + texture ? static_cast<const OGLTexture*>(texture)->GetRawTexIdentifier() : 0); + m_bound_textures[index] = texture; +} + void Renderer::SetSamplerState(u32 index, const SamplerState& state) { g_sampler_cache->SetSamplerState(index, state); } +void Renderer::UnbindTexture(const AbstractTexture* texture) +{ + for (size_t i = 0; i < m_bound_textures.size(); i++) + { + if (m_bound_textures[i] != texture) + continue; + + glActiveTexture(static_cast<GLenum>(GL_TEXTURE0 + i)); + glBindTexture(GL_TEXTURE_2D_ARRAY, 0); + } +} + void Renderer::SetInterlacingMode() { // TODO |
