VideoCommon: Move abstract texture creation function to Renderer

This commit is contained in:
Stenzek
2017-09-30 16:25:36 +10:00
parent 5860c97144
commit 49a9c33bd7
24 changed files with 49 additions and 36 deletions

View File

@ -731,7 +731,7 @@ void Renderer::UpdateFrameDumpTexture()
config.width = target_width;
config.height = target_height;
config.rendertarget = true;
m_dump_texture = g_texture_cache->CreateTexture(config);
m_dump_texture = CreateTexture(config);
}
m_dump_texture->CopyRectangleFromTexture(m_last_xfb_texture, m_last_xfb_region,
EFBRectangle{0, 0, target_width, target_height});

View File

@ -35,6 +35,7 @@
class AbstractRawTexture;
class AbstractTexture;
class PostProcessingShaderImplementation;
struct TextureConfig;
enum class EFBAccessType;
struct EfbPokeData
@ -79,6 +80,8 @@ public:
virtual void RestoreState() {}
virtual void ResetAPIState() {}
virtual void RestoreAPIState() {}
virtual std::unique_ptr<AbstractTexture> CreateTexture(const TextureConfig& config) = 0;
// Ideal internal resolution - multiple of the native EFB resolution
int GetTargetWidth() const { return m_target_width; }
int GetTargetHeight() const { return m_target_height; }

View File

@ -2090,7 +2090,7 @@ std::unique_ptr<AbstractTexture> TextureCacheBase::AllocateTexture(const Texture
}
else
{
entry = CreateTexture(config);
entry = g_renderer->CreateTexture(config);
if (!entry)
return nullptr;

View File

@ -273,8 +273,6 @@ public:
void ScaleTextureCacheEntryTo(TCacheEntry* entry, u32 new_width, u32 new_height);
virtual std::unique_ptr<AbstractTexture> CreateTexture(const TextureConfig& config) = 0;
protected:
TextureCacheBase();

View File

@ -22,6 +22,13 @@ enum class AbstractTextureFormat : u32
struct TextureConfig
{
constexpr TextureConfig() = default;
constexpr TextureConfig(u32 width_, u32 height_, u32 levels_, u32 layers_,
AbstractTextureFormat format_, bool rendertarget_)
: width(width_), height(height_), levels(levels_), layers(layers_), format(format_),
rendertarget(rendertarget_)
{
}
bool operator==(const TextureConfig& o) const;
MathUtil::Rectangle<int> GetRect() const;