mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2024-12-25 21:01:22 -08:00
texture_cache: Address feedback
This commit is contained in:
parent
223ca80753
commit
3f3c3ca5f9
@ -236,10 +236,7 @@ CachedSurface::CachedSurface(const GPUVAddr gpu_addr, const SurfaceParams& param
|
|||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
CachedSurface::~CachedSurface() {
|
CachedSurface::~CachedSurface() = default;
|
||||||
views.clear();
|
|
||||||
main_view = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) {
|
void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) {
|
||||||
MICROPROFILE_SCOPE(OpenGL_Texture_Download);
|
MICROPROFILE_SCOPE(OpenGL_Texture_Download);
|
||||||
|
@ -89,21 +89,6 @@ public:
|
|||||||
return surface.GetSurfaceParams();
|
return surface.GetSurfaceParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetWidth() const {
|
|
||||||
const auto& owner_params = GetSurfaceParams();
|
|
||||||
return owner_params.GetMipWidth(params.base_level);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 GetHeight() const {
|
|
||||||
const auto& owner_params = GetSurfaceParams();
|
|
||||||
return owner_params.GetMipHeight(params.base_level);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 GetDepth() const {
|
|
||||||
const auto& owner_params = GetSurfaceParams();
|
|
||||||
return owner_params.GetMipDepth(params.base_level);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ApplySwizzle(Tegra::Texture::SwizzleSource x_source,
|
void ApplySwizzle(Tegra::Texture::SwizzleSource x_source,
|
||||||
Tegra::Texture::SwizzleSource y_source,
|
Tegra::Texture::SwizzleSource y_source,
|
||||||
Tegra::Texture::SwizzleSource z_source,
|
Tegra::Texture::SwizzleSource z_source,
|
||||||
|
@ -294,8 +294,8 @@ protected:
|
|||||||
|
|
||||||
virtual TView CreateView(const ViewParams& view_key) = 0;
|
virtual TView CreateView(const ViewParams& view_key) = 0;
|
||||||
|
|
||||||
std::unordered_map<ViewParams, TView> views;
|
|
||||||
TView main_view;
|
TView main_view;
|
||||||
|
std::unordered_map<ViewParams, TView> views;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TView GetView(const ViewParams& key) {
|
TView GetView(const ViewParams& key) {
|
||||||
|
@ -79,10 +79,9 @@ public:
|
|||||||
if (surfaces.empty()) {
|
if (surfaces.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::sort(surfaces.begin(), surfaces.end(),
|
std::sort(surfaces.begin(), surfaces.end(), [](const TSurface& a, const TSurface& b) {
|
||||||
[](const TSurface& a, const TSurface& b) -> bool {
|
return a->GetModificationTick() < b->GetModificationTick();
|
||||||
return a->GetModificationTick() < b->GetModificationTick();
|
});
|
||||||
});
|
|
||||||
for (const auto& surface : surfaces) {
|
for (const auto& surface : surfaces) {
|
||||||
FlushSurface(surface);
|
FlushSurface(surface);
|
||||||
}
|
}
|
||||||
@ -181,13 +180,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MarkColorBufferInUse(std::size_t index) {
|
void MarkColorBufferInUse(std::size_t index) {
|
||||||
if (render_targets[index].target)
|
if (auto& render_target = render_targets[index].target) {
|
||||||
render_targets[index].target->MarkAsModified(true, Tick());
|
render_target->MarkAsModified(true, Tick());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkDepthBufferInUse() {
|
void MarkDepthBufferInUse() {
|
||||||
if (depth_buffer.target)
|
if (depth_buffer.target) {
|
||||||
depth_buffer.target->MarkAsModified(true, Tick());
|
depth_buffer.target->MarkAsModified(true, Tick());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetEmptyDepthBuffer() {
|
void SetEmptyDepthBuffer() {
|
||||||
@ -245,11 +246,11 @@ protected:
|
|||||||
}
|
}
|
||||||
SetEmptyDepthBuffer();
|
SetEmptyDepthBuffer();
|
||||||
staging_cache.SetSize(2);
|
staging_cache.SetSize(2);
|
||||||
auto make_siblings = ([this](PixelFormat a, PixelFormat b) {
|
const auto make_siblings = [this](PixelFormat a, PixelFormat b) {
|
||||||
siblings_table[a] = b;
|
siblings_table[a] = b;
|
||||||
siblings_table[b] = a;
|
siblings_table[b] = a;
|
||||||
});
|
};
|
||||||
const u32 max_formats = static_cast<u32>(PixelFormat::Max);
|
const auto max_formats = static_cast<u32>(PixelFormat::Max);
|
||||||
siblings_table.reserve(max_formats);
|
siblings_table.reserve(max_formats);
|
||||||
for (u32 i = 0; i < max_formats; i++) {
|
for (u32 i = 0; i < max_formats; i++) {
|
||||||
siblings_table[static_cast<PixelFormat>(i)] = PixelFormat::Invalid;
|
siblings_table[static_cast<PixelFormat>(i)] = PixelFormat::Invalid;
|
||||||
|
Loading…
Reference in New Issue
Block a user