Skip to content

Commit

Permalink
GLContextState: fixed texture binding tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Nov 12, 2023
1 parent a803763 commit b39d548
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
1 change: 0 additions & 1 deletion Graphics/GraphicsEngineOpenGL/include/GLContextState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ class GLContextState
}
};

std::vector<UniqueIdentifier> m_BoundTextures;
std::vector<UniqueIdentifier> m_BoundSamplers;
std::vector<BoundBufferInfo> m_BoundUniformBuffers;
std::vector<BoundImageInfo> m_BoundImages;
Expand Down
12 changes: 4 additions & 8 deletions Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ GLContextState::GLContextState(RenderDeviceGLImpl* pDeviceGL)
VERIFY_EXPR(m_Caps.MaxUniformBufferBindings > 0);
}

m_BoundTextures.reserve(m_Caps.MaxCombinedTexUnits);
m_BoundSamplers.reserve(32);
m_BoundImages.reserve(32);
m_BoundUniformBuffers.reserve(m_Caps.MaxUniformBufferBindings);
Expand Down Expand Up @@ -102,7 +101,6 @@ void GLContextState::Invalidate()
m_VAOId = -1;
m_FBOId = -1;

m_BoundTextures.clear();
m_BoundSamplers.clear();
m_BoundImages.clear();
m_BoundUniformBuffers.clear();
Expand Down Expand Up @@ -231,12 +229,10 @@ void GLContextState::BindTexture(Int32 Index, GLenum BindTarget, const GLObjectW
// Always update active texture unit
SetActiveTexture(Index);

GLuint GLTexHandle = 0;
if (UpdateBoundObjectsArr(m_BoundTextures, Index, Tex, GLTexHandle))
{
glBindTexture(BindTarget, GLTexHandle);
DEV_CHECK_GL_ERROR("Failed to bind texture to slot ", Index);
}
// Note that each bind target is tracked seprately in OpenGL, so that different

Check failure on line 232 in Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp

View workflow job for this annotation

GitHub Actions / Linux -> Pre-checks

seprately ==> separately
// textures can be bound to different targets of the same texture unit.
glBindTexture(BindTarget, Tex);
DEV_CHECK_GL_ERROR("Failed to bind texture to slot ", Index);
}

void GLContextState::BindSampler(Uint32 Index, const GLObjectWrappers::GLSamplerObj& GLSampler)
Expand Down

0 comments on commit b39d548

Please sign in to comment.