mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Move most backend functionality to VideoCommon
This commit is contained in:
@ -34,13 +34,19 @@ enum class StagingTextureType
|
||||
Mutable // Optimize for CPU reads, GPU writes, allow slow CPU reads
|
||||
};
|
||||
|
||||
enum AbstractTextureFlag : u32
|
||||
{
|
||||
AbstractTextureFlag_RenderTarget = (1 << 0), // Texture is used as a framebuffer.
|
||||
AbstractTextureFlag_ComputeImage = (1 << 1), // Texture is used as a compute image.
|
||||
};
|
||||
|
||||
struct TextureConfig
|
||||
{
|
||||
constexpr TextureConfig() = default;
|
||||
constexpr TextureConfig(u32 width_, u32 height_, u32 levels_, u32 layers_, u32 samples_,
|
||||
AbstractTextureFormat format_, bool rendertarget_)
|
||||
AbstractTextureFormat format_, u32 flags_)
|
||||
: width(width_), height(height_), levels(levels_), layers(layers_), samples(samples_),
|
||||
format(format_), rendertarget(rendertarget_)
|
||||
format(format_), flags(flags_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -50,7 +56,10 @@ struct TextureConfig
|
||||
MathUtil::Rectangle<int> GetMipRect(u32 level) const;
|
||||
size_t GetStride() const;
|
||||
size_t GetMipStride(u32 level) const;
|
||||
bool IsMultisampled() const;
|
||||
|
||||
bool IsMultisampled() const { return samples > 1; }
|
||||
bool IsRenderTarget() const { return (flags & AbstractTextureFlag_RenderTarget) != 0; }
|
||||
bool IsComputeImage() const { return (flags & AbstractTextureFlag_ComputeImage) != 0; }
|
||||
|
||||
u32 width = 0;
|
||||
u32 height = 0;
|
||||
@ -58,7 +67,7 @@ struct TextureConfig
|
||||
u32 layers = 1;
|
||||
u32 samples = 1;
|
||||
AbstractTextureFormat format = AbstractTextureFormat::RGBA8;
|
||||
bool rendertarget = false;
|
||||
u32 flags = 0;
|
||||
};
|
||||
|
||||
namespace std
|
||||
@ -71,7 +80,7 @@ struct hash<TextureConfig>
|
||||
|
||||
result_type operator()(const argument_type& c) const noexcept
|
||||
{
|
||||
const u64 id = static_cast<u64>(c.rendertarget) << 63 | static_cast<u64>(c.format) << 50 |
|
||||
const u64 id = static_cast<u64>(c.flags) << 58 | static_cast<u64>(c.format) << 50 |
|
||||
static_cast<u64>(c.layers) << 48 | static_cast<u64>(c.levels) << 32 |
|
||||
static_cast<u64>(c.height) << 16 | static_cast<u64>(c.width);
|
||||
return std::hash<u64>{}(id);
|
||||
|
Reference in New Issue
Block a user