gl_state: Skip null texture binds

glBindTextureUnit doesn't support null textures. Skip binding these.
This commit is contained in:
ReinUsesLisp 2019-11-22 21:17:29 -03:00
parent 919ac2c4d3
commit e3d7334be9
No known key found for this signature in database
GPG key ID: 2DFC508897B39CFE

View file

@ -420,9 +420,13 @@ void OpenGLState::ApplyTextures() {
const std::size_t size = std::size(textures); const std::size_t size = std::size(textures);
for (std::size_t i = 0; i < size; ++i) { for (std::size_t i = 0; i < size; ++i) {
if (UpdateValue(cur_state.textures[i], textures[i])) { if (UpdateValue(cur_state.textures[i], textures[i])) {
// BindTextureUnit doesn't support binding null textures, skip those binds.
// TODO(Rodrigo): Stop using null textures
if (textures[i] != 0) {
glBindTextureUnit(static_cast<GLuint>(i), textures[i]); glBindTextureUnit(static_cast<GLuint>(i), textures[i]);
} }
} }
}
} }
void OpenGLState::ApplySamplers() { void OpenGLState::ApplySamplers() {