From 00e62919c5b928b954dcf441dfb2800378d554fa Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sat, 25 Apr 2015 13:06:02 +0200 Subject: [PATCH] gsdx-ogl: use countof macro instead to hardcode the size --- plugins/GSdx/GLState.cpp | 4 ++-- plugins/GSdx/GSTextureOGL.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) 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);