From 57c21b9576aa5e7f840fa77e275cbeaa5ac97716 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 25 Mar 2017 14:45:55 -0400 Subject: [PATCH] TextureCacheBase: Convert bound_textures from a C array to a std::array Prevents array-to-pointer decay and simplifies some code. --- Source/Core/VideoCommon/TextureCacheBase.cpp | 6 +++--- Source/Core/VideoCommon/TextureCacheBase.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 966b30ee39..eabb005600 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -472,16 +472,16 @@ TextureCacheBase::TCacheEntryBase* TextureCacheBase::ReturnEntry(unsigned int st void TextureCacheBase::BindTextures() { - for (int i = 0; i < 8; ++i) + for (size_t i = 0; i < bound_textures.size(); ++i) { if (bound_textures[i]) - bound_textures[i]->Bind(i); + bound_textures[i]->Bind(static_cast(i)); } } void TextureCacheBase::UnbindTextures() { - std::fill(std::begin(bound_textures), std::end(bound_textures), nullptr); + bound_textures.fill(nullptr); } TextureCacheBase::TCacheEntryBase* TextureCacheBase::Load(const u32 stage) diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index bffeb2aad7..3adec5ed47 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include #include @@ -176,7 +177,7 @@ protected: alignas(16) u8* temp = nullptr; size_t temp_size = 0; - TCacheEntryBase* bound_textures[8] = {}; + std::array bound_textures{}; private: typedef std::multimap TexAddrCache;