2017-04-23 04:44:34 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2017-06-19 03:28:28 +00:00
|
|
|
#include <cstddef>
|
|
|
|
#include <string>
|
|
|
|
|
2017-04-23 04:44:34 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
#include "Common/MathUtil.h"
|
|
|
|
#include "VideoCommon/TextureConfig.h"
|
|
|
|
|
|
|
|
class AbstractTexture
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit AbstractTexture(const TextureConfig& c);
|
2018-01-26 08:32:33 +00:00
|
|
|
virtual ~AbstractTexture() = default;
|
2017-10-30 12:00:15 +00:00
|
|
|
|
2017-10-30 11:51:42 +00:00
|
|
|
virtual void CopyRectangleFromTexture(const AbstractTexture* src,
|
|
|
|
const MathUtil::Rectangle<int>& src_rect, u32 src_layer,
|
|
|
|
u32 src_level, const MathUtil::Rectangle<int>& dst_rect,
|
|
|
|
u32 dst_layer, u32 dst_level) = 0;
|
|
|
|
virtual void ScaleRectangleFromTexture(const AbstractTexture* source,
|
|
|
|
const MathUtil::Rectangle<int>& srcrect,
|
|
|
|
const MathUtil::Rectangle<int>& dstrect) = 0;
|
2017-04-23 04:44:34 +00:00
|
|
|
virtual void Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer,
|
|
|
|
size_t buffer_size) = 0;
|
|
|
|
|
2017-10-30 12:00:15 +00:00
|
|
|
bool Save(const std::string& filename, unsigned int level);
|
|
|
|
|
2017-10-21 14:49:40 +00:00
|
|
|
static bool IsCompressedFormat(AbstractTextureFormat format);
|
|
|
|
static size_t CalculateStrideForFormat(AbstractTextureFormat format, u32 row_length);
|
|
|
|
static size_t GetTexelSizeForFormat(AbstractTextureFormat format);
|
2017-04-23 04:44:34 +00:00
|
|
|
|
2017-06-19 03:33:15 +00:00
|
|
|
const TextureConfig& GetConfig() const;
|
2017-04-23 04:44:34 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
const TextureConfig m_config;
|
|
|
|
};
|