mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-03 11:29:58 +00:00
texture_cache: move some large methods to cpp files
This commit is contained in:
parent
3809041c24
commit
9f755218a1
4 changed files with 135 additions and 139 deletions
|
@ -42,6 +42,109 @@ SurfaceBaseImpl::SurfaceBaseImpl(GPUVAddr gpu_addr, const SurfaceParams& params)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MatchTopologyResult SurfaceBaseImpl::MatchesTopology(const SurfaceParams& rhs) const {
|
||||||
|
const u32 src_bpp{params.GetBytesPerPixel()};
|
||||||
|
const u32 dst_bpp{rhs.GetBytesPerPixel()};
|
||||||
|
const bool ib1 = params.IsBuffer();
|
||||||
|
const bool ib2 = rhs.IsBuffer();
|
||||||
|
if (std::tie(src_bpp, params.is_tiled, ib1) == std::tie(dst_bpp, rhs.is_tiled, ib2)) {
|
||||||
|
const bool cb1 = params.IsCompressed();
|
||||||
|
const bool cb2 = rhs.IsCompressed();
|
||||||
|
if (cb1 == cb2) {
|
||||||
|
return MatchTopologyResult::FullMatch;
|
||||||
|
}
|
||||||
|
return MatchTopologyResult::CompressUnmatch;
|
||||||
|
}
|
||||||
|
return MatchTopologyResult::None;
|
||||||
|
}
|
||||||
|
|
||||||
|
MatchStructureResult SurfaceBaseImpl::MatchesStructure(const SurfaceParams& rhs) const {
|
||||||
|
// Buffer surface Check
|
||||||
|
if (params.IsBuffer()) {
|
||||||
|
const std::size_t wd1 = params.width * params.GetBytesPerPixel();
|
||||||
|
const std::size_t wd2 = rhs.width * rhs.GetBytesPerPixel();
|
||||||
|
if (wd1 == wd2) {
|
||||||
|
return MatchStructureResult::FullMatch;
|
||||||
|
}
|
||||||
|
return MatchStructureResult::None;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Linear Surface check
|
||||||
|
if (!params.is_tiled) {
|
||||||
|
if (std::tie(params.width, params.height, params.pitch) ==
|
||||||
|
std::tie(rhs.width, rhs.height, rhs.pitch)) {
|
||||||
|
return MatchStructureResult::FullMatch;
|
||||||
|
}
|
||||||
|
return MatchStructureResult::None;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tiled Surface check
|
||||||
|
if (std::tie(params.depth, params.block_width, params.block_height, params.block_depth,
|
||||||
|
params.tile_width_spacing, params.num_levels) ==
|
||||||
|
std::tie(rhs.depth, rhs.block_width, rhs.block_height, rhs.block_depth,
|
||||||
|
rhs.tile_width_spacing, rhs.num_levels)) {
|
||||||
|
if (std::tie(params.width, params.height) == std::tie(rhs.width, rhs.height)) {
|
||||||
|
return MatchStructureResult::FullMatch;
|
||||||
|
}
|
||||||
|
const u32 ws = SurfaceParams::ConvertWidth(rhs.GetBlockAlignedWidth(), params.pixel_format,
|
||||||
|
rhs.pixel_format);
|
||||||
|
const u32 hs =
|
||||||
|
SurfaceParams::ConvertHeight(rhs.height, params.pixel_format, rhs.pixel_format);
|
||||||
|
const u32 w1 = params.GetBlockAlignedWidth();
|
||||||
|
if (std::tie(w1, params.height) == std::tie(ws, hs)) {
|
||||||
|
return MatchStructureResult::SemiMatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MatchStructureResult::None;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::pair<u32, u32>> SurfaceBaseImpl::GetLayerMipmap(
|
||||||
|
const GPUVAddr candidate_gpu_addr) const {
|
||||||
|
if (candidate_gpu_addr < gpu_addr) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
const auto relative_address{static_cast<GPUVAddr>(candidate_gpu_addr - gpu_addr)};
|
||||||
|
const auto layer{static_cast<u32>(relative_address / layer_size)};
|
||||||
|
const GPUVAddr mipmap_address = relative_address - layer_size * layer;
|
||||||
|
const auto mipmap_it =
|
||||||
|
Common::BinaryFind(mipmap_offsets.begin(), mipmap_offsets.end(), mipmap_address);
|
||||||
|
if (mipmap_it == mipmap_offsets.end()) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
const auto level{static_cast<u32>(std::distance(mipmap_offsets.begin(), mipmap_it))};
|
||||||
|
return std::make_pair(layer, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CopyParams> SurfaceBaseImpl::BreakDownLayered(const SurfaceParams& in_params) const {
|
||||||
|
const u32 layers{params.depth};
|
||||||
|
const u32 mipmaps{params.num_levels};
|
||||||
|
std::vector<CopyParams> result;
|
||||||
|
result.reserve(static_cast<std::size_t>(layers) * static_cast<std::size_t>(mipmaps));
|
||||||
|
|
||||||
|
for (u32 layer = 0; layer < layers; layer++) {
|
||||||
|
for (u32 level = 0; level < mipmaps; level++) {
|
||||||
|
const u32 width = SurfaceParams::IntersectWidth(params, in_params, level, level);
|
||||||
|
const u32 height = SurfaceParams::IntersectHeight(params, in_params, level, level);
|
||||||
|
result.emplace_back(width, height, layer, level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CopyParams> SurfaceBaseImpl::BreakDownNonLayered(const SurfaceParams& in_params) const {
|
||||||
|
const u32 mipmaps{params.num_levels};
|
||||||
|
std::vector<CopyParams> result;
|
||||||
|
result.reserve(mipmaps);
|
||||||
|
|
||||||
|
for (u32 level = 0; level < mipmaps; level++) {
|
||||||
|
const u32 width = SurfaceParams::IntersectWidth(params, in_params, level, level);
|
||||||
|
const u32 height = SurfaceParams::IntersectHeight(params, in_params, level, level);
|
||||||
|
const u32 depth{std::min(params.GetMipDepth(level), in_params.GetMipDepth(level))};
|
||||||
|
result.emplace_back(width, height, depth, level);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void SurfaceBaseImpl::SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& params,
|
void SurfaceBaseImpl::SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& params,
|
||||||
u8* buffer, u32 level) {
|
u8* buffer, u32 level) {
|
||||||
const u32 width{params.GetMipWidth(level)};
|
const u32 width{params.GetMipWidth(level)};
|
||||||
|
|
|
@ -136,83 +136,17 @@ public:
|
||||||
return params.target == target;
|
return params.target == target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MatchTopologyResult MatchesTopology(const SurfaceParams& rhs) const;
|
||||||
|
|
||||||
|
MatchStructureResult MatchesStructure(const SurfaceParams& rhs) const;
|
||||||
|
|
||||||
bool MatchesSubTexture(const SurfaceParams& rhs, const GPUVAddr other_gpu_addr) const {
|
bool MatchesSubTexture(const SurfaceParams& rhs, const GPUVAddr other_gpu_addr) const {
|
||||||
return std::tie(gpu_addr, params.target, params.num_levels) ==
|
return std::tie(gpu_addr, params.target, params.num_levels) ==
|
||||||
std::tie(other_gpu_addr, rhs.target, rhs.num_levels) &&
|
std::tie(other_gpu_addr, rhs.target, rhs.num_levels) &&
|
||||||
params.target == SurfaceTarget::Texture2D && params.num_levels == 1;
|
params.target == SurfaceTarget::Texture2D && params.num_levels == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
MatchTopologyResult MatchesTopology(const SurfaceParams& rhs) const {
|
std::optional<std::pair<u32, u32>> GetLayerMipmap(const GPUVAddr candidate_gpu_addr) const;
|
||||||
const u32 src_bpp{params.GetBytesPerPixel()};
|
|
||||||
const u32 dst_bpp{rhs.GetBytesPerPixel()};
|
|
||||||
const bool ib1 = params.IsBuffer();
|
|
||||||
const bool ib2 = rhs.IsBuffer();
|
|
||||||
if (std::tie(src_bpp, params.is_tiled, ib1) == std::tie(dst_bpp, rhs.is_tiled, ib2)) {
|
|
||||||
const bool cb1 = params.IsCompressed();
|
|
||||||
const bool cb2 = rhs.IsCompressed();
|
|
||||||
if (cb1 == cb2) {
|
|
||||||
return MatchTopologyResult::FullMatch;
|
|
||||||
}
|
|
||||||
return MatchTopologyResult::CompressUnmatch;
|
|
||||||
}
|
|
||||||
return MatchTopologyResult::None;
|
|
||||||
}
|
|
||||||
|
|
||||||
MatchStructureResult MatchesStructure(const SurfaceParams& rhs) const {
|
|
||||||
// Buffer surface Check
|
|
||||||
if (params.IsBuffer()) {
|
|
||||||
const std::size_t wd1 = params.width * params.GetBytesPerPixel();
|
|
||||||
const std::size_t wd2 = rhs.width * rhs.GetBytesPerPixel();
|
|
||||||
if (wd1 == wd2) {
|
|
||||||
return MatchStructureResult::FullMatch;
|
|
||||||
}
|
|
||||||
return MatchStructureResult::None;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Linear Surface check
|
|
||||||
if (!params.is_tiled) {
|
|
||||||
if (std::tie(params.width, params.height, params.pitch) ==
|
|
||||||
std::tie(rhs.width, rhs.height, rhs.pitch)) {
|
|
||||||
return MatchStructureResult::FullMatch;
|
|
||||||
}
|
|
||||||
return MatchStructureResult::None;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tiled Surface check
|
|
||||||
if (std::tie(params.depth, params.block_width, params.block_height, params.block_depth,
|
|
||||||
params.tile_width_spacing, params.num_levels) ==
|
|
||||||
std::tie(rhs.depth, rhs.block_width, rhs.block_height, rhs.block_depth,
|
|
||||||
rhs.tile_width_spacing, rhs.num_levels)) {
|
|
||||||
if (std::tie(params.width, params.height) == std::tie(rhs.width, rhs.height)) {
|
|
||||||
return MatchStructureResult::FullMatch;
|
|
||||||
}
|
|
||||||
const u32 ws = SurfaceParams::ConvertWidth(rhs.GetBlockAlignedWidth(),
|
|
||||||
params.pixel_format, rhs.pixel_format);
|
|
||||||
const u32 hs =
|
|
||||||
SurfaceParams::ConvertHeight(rhs.height, params.pixel_format, rhs.pixel_format);
|
|
||||||
const u32 w1 = params.GetBlockAlignedWidth();
|
|
||||||
if (std::tie(w1, params.height) == std::tie(ws, hs)) {
|
|
||||||
return MatchStructureResult::SemiMatch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return MatchStructureResult::None;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<std::pair<u32, u32>> GetLayerMipmap(const GPUVAddr candidate_gpu_addr) const {
|
|
||||||
if (candidate_gpu_addr < gpu_addr) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
const auto relative_address{static_cast<GPUVAddr>(candidate_gpu_addr - gpu_addr)};
|
|
||||||
const auto layer{static_cast<u32>(relative_address / layer_size)};
|
|
||||||
const GPUVAddr mipmap_address = relative_address - layer_size * layer;
|
|
||||||
const auto mipmap_it =
|
|
||||||
Common::BinaryFind(mipmap_offsets.begin(), mipmap_offsets.end(), mipmap_address);
|
|
||||||
if (mipmap_it == mipmap_offsets.end()) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
const auto level{static_cast<u32>(std::distance(mipmap_offsets.begin(), mipmap_it))};
|
|
||||||
return std::make_pair(layer, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<CopyParams> BreakDown(const SurfaceParams& in_params) const {
|
std::vector<CopyParams> BreakDown(const SurfaceParams& in_params) const {
|
||||||
return params.is_layered ? BreakDownLayered(in_params) : BreakDownNonLayered(in_params);
|
return params.is_layered ? BreakDownLayered(in_params) : BreakDownNonLayered(in_params);
|
||||||
|
@ -241,35 +175,9 @@ private:
|
||||||
void SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& params, u8* buffer,
|
void SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& params, u8* buffer,
|
||||||
u32 level);
|
u32 level);
|
||||||
|
|
||||||
std::vector<CopyParams> BreakDownLayered(const SurfaceParams& in_params) const {
|
std::vector<CopyParams> BreakDownLayered(const SurfaceParams& in_params) const;
|
||||||
const u32 layers{params.depth};
|
|
||||||
const u32 mipmaps{params.num_levels};
|
|
||||||
std::vector<CopyParams> result;
|
|
||||||
result.reserve(static_cast<std::size_t>(layers) * static_cast<std::size_t>(mipmaps));
|
|
||||||
|
|
||||||
for (u32 layer = 0; layer < layers; layer++) {
|
std::vector<CopyParams> BreakDownNonLayered(const SurfaceParams& in_params) const;
|
||||||
for (u32 level = 0; level < mipmaps; level++) {
|
|
||||||
const u32 width = SurfaceParams::IntersectWidth(params, in_params, level, level);
|
|
||||||
const u32 height = SurfaceParams::IntersectHeight(params, in_params, level, level);
|
|
||||||
result.emplace_back(width, height, layer, level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<CopyParams> BreakDownNonLayered(const SurfaceParams& in_params) const {
|
|
||||||
const u32 mipmaps{params.num_levels};
|
|
||||||
std::vector<CopyParams> result;
|
|
||||||
result.reserve(mipmaps);
|
|
||||||
|
|
||||||
for (u32 level = 0; level < mipmaps; level++) {
|
|
||||||
const u32 width = SurfaceParams::IntersectWidth(params, in_params, level, level);
|
|
||||||
const u32 height = SurfaceParams::IntersectHeight(params, in_params, level, level);
|
|
||||||
const u32 depth{std::min(params.GetMipDepth(level), in_params.GetMipDepth(level))};
|
|
||||||
result.emplace_back(width, height, depth, level);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename TView>
|
template <typename TView>
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
#include "common/bit_util.h"
|
#include "common/bit_util.h"
|
||||||
#include "common/cityhash.h"
|
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "video_core/engines/shader_bytecode.h"
|
#include "video_core/engines/shader_bytecode.h"
|
||||||
#include "video_core/surface.h"
|
#include "video_core/surface.h"
|
||||||
|
@ -237,14 +236,6 @@ std::size_t SurfaceParams::GetConvertedMipmapOffset(u32 level) const {
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t SurfaceParams::GetGuestMipmapSize(u32 level) const {
|
|
||||||
return GetInnerMipmapMemorySize(level, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t SurfaceParams::GetHostMipmapSize(u32 level) const {
|
|
||||||
return GetInnerMipmapMemorySize(level, true, false) * GetNumLayers();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t SurfaceParams::GetConvertedMipmapSize(u32 level) const {
|
std::size_t SurfaceParams::GetConvertedMipmapSize(u32 level) const {
|
||||||
constexpr std::size_t rgb8_bpp = 4ULL;
|
constexpr std::size_t rgb8_bpp = 4ULL;
|
||||||
const std::size_t width_t = GetMipWidth(level);
|
const std::size_t width_t = GetMipWidth(level);
|
||||||
|
@ -253,10 +244,6 @@ std::size_t SurfaceParams::GetConvertedMipmapSize(u32 level) const {
|
||||||
return width_t * height_t * depth_t * rgb8_bpp;
|
return width_t * height_t * depth_t * rgb8_bpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t SurfaceParams::GetGuestLayerSize() const {
|
|
||||||
return GetLayerSize(false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t SurfaceParams::GetLayerSize(bool as_host_size, bool uncompressed) const {
|
std::size_t SurfaceParams::GetLayerSize(bool as_host_size, bool uncompressed) const {
|
||||||
std::size_t size = 0;
|
std::size_t size = 0;
|
||||||
for (u32 level = 0; level < num_levels; ++level) {
|
for (u32 level = 0; level < num_levels; ++level) {
|
||||||
|
@ -269,16 +256,6 @@ std::size_t SurfaceParams::GetLayerSize(bool as_host_size, bool uncompressed) co
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t SurfaceParams::GetHostLayerSize(u32 level) const {
|
|
||||||
ASSERT(target != SurfaceTarget::Texture3D);
|
|
||||||
return GetInnerMipmapMemorySize(level, true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SurfaceParams::IsPixelFormatZeta() const {
|
|
||||||
return pixel_format >= VideoCore::Surface::PixelFormat::MaxColorFormat &&
|
|
||||||
pixel_format < VideoCore::Surface::PixelFormat::MaxDepthStencilFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t SurfaceParams::GetInnerMipmapMemorySize(u32 level, bool as_host_size,
|
std::size_t SurfaceParams::GetInnerMipmapMemorySize(u32 level, bool as_host_size,
|
||||||
bool uncompressed) const {
|
bool uncompressed) const {
|
||||||
const bool tiled{as_host_size ? false : is_tiled};
|
const bool tiled{as_host_size ? false : is_tiled};
|
||||||
|
@ -289,16 +266,6 @@ std::size_t SurfaceParams::GetInnerMipmapMemorySize(u32 level, bool as_host_size
|
||||||
GetMipBlockHeight(level), GetMipBlockDepth(level));
|
GetMipBlockHeight(level), GetMipBlockDepth(level));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t SurfaceParams::GetInnerMemorySize(bool as_host_size, bool layer_only,
|
|
||||||
bool uncompressed) const {
|
|
||||||
return GetLayerSize(as_host_size, uncompressed) * (layer_only ? 1U : depth);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t SurfaceParams::Hash() const {
|
|
||||||
return static_cast<std::size_t>(
|
|
||||||
Common::CityHash64(reinterpret_cast<const char*>(this), sizeof(*this)));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SurfaceParams::operator==(const SurfaceParams& rhs) const {
|
bool SurfaceParams::operator==(const SurfaceParams& rhs) const {
|
||||||
return std::tie(is_tiled, block_width, block_height, block_depth, tile_width_spacing, width,
|
return std::tie(is_tiled, block_width, block_height, block_depth, tile_width_spacing, width,
|
||||||
height, depth, pitch, num_levels, pixel_format, component_type, type, target) ==
|
height, depth, pitch, num_levels, pixel_format, component_type, type, target) ==
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
#include "common/bit_util.h"
|
#include "common/bit_util.h"
|
||||||
|
#include "common/cityhash.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "video_core/engines/fermi_2d.h"
|
#include "video_core/engines/fermi_2d.h"
|
||||||
#include "video_core/engines/maxwell_3d.h"
|
#include "video_core/engines/maxwell_3d.h"
|
||||||
|
@ -39,7 +40,10 @@ public:
|
||||||
static SurfaceParams CreateForFermiCopySurface(
|
static SurfaceParams CreateForFermiCopySurface(
|
||||||
const Tegra::Engines::Fermi2D::Regs::Surface& config);
|
const Tegra::Engines::Fermi2D::Regs::Surface& config);
|
||||||
|
|
||||||
std::size_t Hash() const;
|
std::size_t Hash() const {
|
||||||
|
return static_cast<std::size_t>(
|
||||||
|
Common::CityHash64(reinterpret_cast<const char*>(this), sizeof(*this)));
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(const SurfaceParams& rhs) const;
|
bool operator==(const SurfaceParams& rhs) const;
|
||||||
|
|
||||||
|
@ -113,18 +117,27 @@ public:
|
||||||
std::size_t GetConvertedMipmapOffset(u32 level) const;
|
std::size_t GetConvertedMipmapOffset(u32 level) const;
|
||||||
|
|
||||||
/// Returns the size in bytes in guest memory of a given mipmap level.
|
/// Returns the size in bytes in guest memory of a given mipmap level.
|
||||||
std::size_t GetGuestMipmapSize(u32 level) const;
|
std::size_t GetGuestMipmapSize(u32 level) const {
|
||||||
|
return GetInnerMipmapMemorySize(level, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the size in bytes in host memory (linear) of a given mipmap level.
|
/// Returns the size in bytes in host memory (linear) of a given mipmap level.
|
||||||
std::size_t GetHostMipmapSize(u32 level) const;
|
std::size_t GetHostMipmapSize(u32 level) const {
|
||||||
|
return GetInnerMipmapMemorySize(level, true, false) * GetNumLayers();
|
||||||
|
}
|
||||||
|
|
||||||
std::size_t GetConvertedMipmapSize(u32 level) const;
|
std::size_t GetConvertedMipmapSize(u32 level) const;
|
||||||
|
|
||||||
/// Returns the size of a layer in bytes in guest memory.
|
/// Returns the size of a layer in bytes in guest memory.
|
||||||
std::size_t GetGuestLayerSize() const;
|
std::size_t GetGuestLayerSize() const {
|
||||||
|
return GetLayerSize(false, false);
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the size of a layer in bytes in host memory for a given mipmap level.
|
/// Returns the size of a layer in bytes in host memory for a given mipmap level.
|
||||||
std::size_t GetHostLayerSize(u32 level) const;
|
std::size_t GetHostLayerSize(u32 level) const {
|
||||||
|
ASSERT(target != VideoCore::Surface::SurfaceTarget::Texture3D);
|
||||||
|
return GetInnerMipmapMemorySize(level, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
static u32 ConvertWidth(u32 width, VideoCore::Surface::PixelFormat pixel_format_from,
|
static u32 ConvertWidth(u32 width, VideoCore::Surface::PixelFormat pixel_format_from,
|
||||||
VideoCore::Surface::PixelFormat pixel_format_to) {
|
VideoCore::Surface::PixelFormat pixel_format_to) {
|
||||||
|
@ -194,7 +207,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if the pixel format is a depth and/or stencil format.
|
/// Returns true if the pixel format is a depth and/or stencil format.
|
||||||
bool IsPixelFormatZeta() const;
|
bool IsPixelFormatZeta() const {
|
||||||
|
return pixel_format >= VideoCore::Surface::PixelFormat::MaxColorFormat &&
|
||||||
|
pixel_format < VideoCore::Surface::PixelFormat::MaxDepthStencilFormat;
|
||||||
|
}
|
||||||
|
|
||||||
SurfaceCompression GetCompressionType() const {
|
SurfaceCompression GetCompressionType() const {
|
||||||
return VideoCore::Surface::GetFormatCompressionType(pixel_format);
|
return VideoCore::Surface::GetFormatCompressionType(pixel_format);
|
||||||
|
@ -229,7 +245,9 @@ private:
|
||||||
std::size_t GetInnerMipmapMemorySize(u32 level, bool as_host_size, bool uncompressed) const;
|
std::size_t GetInnerMipmapMemorySize(u32 level, bool as_host_size, bool uncompressed) const;
|
||||||
|
|
||||||
/// Returns the size of all mipmap levels and aligns as needed.
|
/// Returns the size of all mipmap levels and aligns as needed.
|
||||||
std::size_t GetInnerMemorySize(bool as_host_size, bool layer_only, bool uncompressed) const;
|
std::size_t GetInnerMemorySize(bool as_host_size, bool layer_only, bool uncompressed) const {
|
||||||
|
return GetLayerSize(as_host_size, uncompressed) * (layer_only ? 1U : depth);
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the size of a layer
|
/// Returns the size of a layer
|
||||||
std::size_t GetLayerSize(bool as_host_size, bool uncompressed) const;
|
std::size_t GetLayerSize(bool as_host_size, bool uncompressed) const;
|
||||||
|
|
Loading…
Reference in a new issue