summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2018-01-21 23:13:25 +1000
committerStenzek <stenzek@gmail.com>2018-01-22 13:22:09 +1000
commit38e0b6e2ab53374e7335fee94209bb90cb3e9ed2 (patch)
treea64d1b48bc9f7fedc5c9d83475d58b1118cb1057 /Source/Core/VideoCommon
parentfca56d532a4da844c324d7a4ea05252e72d89fcf (diff)
AbstractTexture: Move Bind() method to Renderer
This makes state tracking simpler, and enables easier porting to command lists later on.
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/AbstractTexture.cpp5
-rw-r--r--Source/Core/VideoCommon/AbstractTexture.h2
-rw-r--r--Source/Core/VideoCommon/RenderBase.h2
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp6
4 files changed, 9 insertions, 6 deletions
diff --git a/Source/Core/VideoCommon/AbstractTexture.cpp b/Source/Core/VideoCommon/AbstractTexture.cpp
index 896d75feb8..c3df347e48 100644
--- a/Source/Core/VideoCommon/AbstractTexture.cpp
+++ b/Source/Core/VideoCommon/AbstractTexture.cpp
@@ -15,7 +15,10 @@ AbstractTexture::AbstractTexture(const TextureConfig& c) : m_config(c)
{
}
-AbstractTexture::~AbstractTexture() = default;
+AbstractTexture::~AbstractTexture()
+{
+ g_renderer->UnbindTexture(this);
+}
bool AbstractTexture::Save(const std::string& filename, unsigned int level)
{
diff --git a/Source/Core/VideoCommon/AbstractTexture.h b/Source/Core/VideoCommon/AbstractTexture.h
index 3e6937b3df..1ba316aaa8 100644
--- a/Source/Core/VideoCommon/AbstractTexture.h
+++ b/Source/Core/VideoCommon/AbstractTexture.h
@@ -17,8 +17,6 @@ public:
explicit AbstractTexture(const TextureConfig& c);
virtual ~AbstractTexture();
- virtual void Bind(unsigned int stage) = 0;
-
virtual void CopyRectangleFromTexture(const AbstractTexture* src,
const MathUtil::Rectangle<int>& src_rect, u32 src_layer,
u32 src_level, const MathUtil::Rectangle<int>& dst_rect,
diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h
index 90fe3ca3c9..819d6aae88 100644
--- a/Source/Core/VideoCommon/RenderBase.h
+++ b/Source/Core/VideoCommon/RenderBase.h
@@ -73,7 +73,9 @@ public:
virtual void SetScissorRect(const EFBRectangle& rc) {}
virtual void SetRasterizationState(const RasterizationState& state) {}
virtual void SetDepthState(const DepthState& state) {}
+ virtual void SetTexture(u32 index, const AbstractTexture* texture) {}
virtual void SetSamplerState(u32 index, const SamplerState& state) {}
+ virtual void UnbindTexture(const AbstractTexture* texture) {}
virtual void SetInterlacingMode() {}
virtual void SetViewport() {}
virtual void SetFullscreen(bool enable_fullscreen) {}
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 444076aad4..a2c42d4e68 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -470,10 +470,10 @@ static u32 CalculateLevelSize(u32 level_0_size, u32 level)
void TextureCacheBase::BindTextures()
{
- for (size_t i = 0; i < bound_textures.size(); ++i)
+ for (u32 i = 0; i < bound_textures.size(); i++)
{
- if (IsValidBindPoint(static_cast<u32>(i)) && bound_textures[i])
- bound_textures[i]->texture->Bind(static_cast<u32>(i));
+ if (IsValidBindPoint(i) && bound_textures[i])
+ g_renderer->SetTexture(i, bound_textures[i]->texture.get());
}
}