diff --git a/plugins/GSdx/GLState.cpp b/plugins/GSdx/GLState.cpp index c333ed7eab..b08d7cb371 100644 --- a/plugins/GSdx/GLState.cpp +++ b/plugins/GSdx/GLState.cpp @@ -106,10 +106,10 @@ namespace GLState { rt = 0; ds = 0; - for (int i = 0; i < 4; i++) { + for (size_t i = 0; i < countof(tex_unit); i++) tex_unit[i] = 0; + for (size_t i = 0; i < countof(tex_handle); i++) tex_handle[i] = 0; - } ps = 0; gs = 0; diff --git a/plugins/GSdx/GSTextureOGL.cpp b/plugins/GSdx/GSTextureOGL.cpp index 0cdf99b4d9..3440984f9a 100644 --- a/plugins/GSdx/GSTextureOGL.cpp +++ b/plugins/GSdx/GSTextureOGL.cpp @@ -263,10 +263,10 @@ GSTextureOGL::~GSTextureOGL() GLState::rt = 0; if (m_texture_id == GLState::ds) GLState::ds = 0; - if (m_texture_id == GLState::tex_unit[0]) - GLState::tex_unit[0] = 0; - if (m_texture_id == GLState::tex_unit[1]) - GLState::tex_unit[1] = 0; + for (size_t i = 0; i < countof(GLState::tex_unit); i++) { + if (m_texture_id == GLState::tex_unit[i]) + GLState::tex_unit[i] = 0; + } gl_DeleteBuffers(1, &m_pbo_id); glDeleteTextures(1, &m_texture_id);