mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 10:51:50 -05:00
Texture cache: reverse inmediate flush changes
This commit is contained in:
parent
36c302fa32
commit
016c6feb49
3 changed files with 14 additions and 28 deletions
|
@ -4,6 +4,7 @@
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/settings.h"
|
||||||
#include "video_core/surface.h"
|
#include "video_core/surface.h"
|
||||||
#include "video_core/texture_cache/format_lookup_table.h"
|
#include "video_core/texture_cache/format_lookup_table.h"
|
||||||
#include "video_core/texture_cache/image_info.h"
|
#include "video_core/texture_cache/image_info.h"
|
||||||
|
@ -22,6 +23,8 @@ using VideoCore::Surface::PixelFormat;
|
||||||
using VideoCore::Surface::SurfaceType;
|
using VideoCore::Surface::SurfaceType;
|
||||||
|
|
||||||
ImageInfo::ImageInfo(const TICEntry& config) noexcept {
|
ImageInfo::ImageInfo(const TICEntry& config) noexcept {
|
||||||
|
forced_flushed = config.IsPitchLinear() && !Settings::values.use_reactive_flushing.GetValue();
|
||||||
|
dma_downloaded = forced_flushed;
|
||||||
format = PixelFormatFromTextureInfo(config.format, config.r_type, config.g_type, config.b_type,
|
format = PixelFormatFromTextureInfo(config.format, config.r_type, config.g_type, config.b_type,
|
||||||
config.a_type, config.srgb_conversion);
|
config.a_type, config.srgb_conversion);
|
||||||
num_samples = NumSamples(config.msaa_mode);
|
num_samples = NumSamples(config.msaa_mode);
|
||||||
|
@ -117,6 +120,9 @@ ImageInfo::ImageInfo(const TICEntry& config) noexcept {
|
||||||
|
|
||||||
ImageInfo::ImageInfo(const Maxwell3D::Regs::RenderTargetConfig& ct,
|
ImageInfo::ImageInfo(const Maxwell3D::Regs::RenderTargetConfig& ct,
|
||||||
Tegra::Texture::MsaaMode msaa_mode) noexcept {
|
Tegra::Texture::MsaaMode msaa_mode) noexcept {
|
||||||
|
forced_flushed =
|
||||||
|
ct.tile_mode.is_pitch_linear && !Settings::values.use_reactive_flushing.GetValue();
|
||||||
|
dma_downloaded = forced_flushed;
|
||||||
format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(ct.format);
|
format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(ct.format);
|
||||||
rescaleable = false;
|
rescaleable = false;
|
||||||
if (ct.tile_mode.is_pitch_linear) {
|
if (ct.tile_mode.is_pitch_linear) {
|
||||||
|
@ -155,6 +161,9 @@ ImageInfo::ImageInfo(const Maxwell3D::Regs::RenderTargetConfig& ct,
|
||||||
|
|
||||||
ImageInfo::ImageInfo(const Maxwell3D::Regs::Zeta& zt, const Maxwell3D::Regs::ZetaSize& zt_size,
|
ImageInfo::ImageInfo(const Maxwell3D::Regs::Zeta& zt, const Maxwell3D::Regs::ZetaSize& zt_size,
|
||||||
Tegra::Texture::MsaaMode msaa_mode) noexcept {
|
Tegra::Texture::MsaaMode msaa_mode) noexcept {
|
||||||
|
forced_flushed =
|
||||||
|
zt.tile_mode.is_pitch_linear && !Settings::values.use_reactive_flushing.GetValue();
|
||||||
|
dma_downloaded = forced_flushed;
|
||||||
format = VideoCore::Surface::PixelFormatFromDepthFormat(zt.format);
|
format = VideoCore::Surface::PixelFormatFromDepthFormat(zt.format);
|
||||||
size.width = zt_size.width;
|
size.width = zt_size.width;
|
||||||
size.height = zt_size.height;
|
size.height = zt_size.height;
|
||||||
|
@ -195,6 +204,9 @@ ImageInfo::ImageInfo(const Maxwell3D::Regs::Zeta& zt, const Maxwell3D::Regs::Zet
|
||||||
|
|
||||||
ImageInfo::ImageInfo(const Fermi2D::Surface& config) noexcept {
|
ImageInfo::ImageInfo(const Fermi2D::Surface& config) noexcept {
|
||||||
UNIMPLEMENTED_IF_MSG(config.layer != 0, "Surface layer is not zero");
|
UNIMPLEMENTED_IF_MSG(config.layer != 0, "Surface layer is not zero");
|
||||||
|
forced_flushed = config.linear == Fermi2D::MemoryLayout::Pitch &&
|
||||||
|
!Settings::values.use_reactive_flushing.GetValue();
|
||||||
|
dma_downloaded = forced_flushed;
|
||||||
format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(config.format);
|
format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(config.format);
|
||||||
rescaleable = false;
|
rescaleable = false;
|
||||||
if (config.linear == Fermi2D::MemoryLayout::Pitch) {
|
if (config.linear == Fermi2D::MemoryLayout::Pitch) {
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/settings.h"
|
|
||||||
#include "video_core/compatible_formats.h"
|
#include "video_core/compatible_formats.h"
|
||||||
#include "video_core/surface.h"
|
#include "video_core/surface.h"
|
||||||
#include "video_core/texture_cache/formatter.h"
|
#include "video_core/texture_cache/formatter.h"
|
||||||
|
@ -26,9 +25,7 @@ ImageViewBase::ImageViewBase(const ImageViewInfo& info, const ImageInfo& image_i
|
||||||
ASSERT_MSG(VideoCore::Surface::IsViewCompatible(image_info.format, info.format, false, true),
|
ASSERT_MSG(VideoCore::Surface::IsViewCompatible(image_info.format, info.format, false, true),
|
||||||
"Image view format {} is incompatible with image format {}", info.format,
|
"Image view format {} is incompatible with image format {}", info.format,
|
||||||
image_info.format);
|
image_info.format);
|
||||||
const bool preemptive =
|
if (image_info.forced_flushed) {
|
||||||
!Settings::values.use_reactive_flushing.GetValue() && image_info.type == ImageType::Linear;
|
|
||||||
if (image_info.forced_flushed || preemptive) {
|
|
||||||
flags |= ImageViewFlagBits::PreemtiveDownload;
|
flags |= ImageViewFlagBits::PreemtiveDownload;
|
||||||
}
|
}
|
||||||
if (image_info.type == ImageType::e3D && info.type != ImageViewType::e3D) {
|
if (image_info.type == ImageType::e3D && info.type != ImageViewType::e3D) {
|
||||||
|
|
|
@ -711,39 +711,16 @@ void TextureCache<P>::CommitAsyncFlushes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (any_none_dma) {
|
if (any_none_dma) {
|
||||||
bool all_pre_sync = true;
|
|
||||||
auto download_map = runtime.DownloadStagingBuffer(total_size_bytes, true);
|
auto download_map = runtime.DownloadStagingBuffer(total_size_bytes, true);
|
||||||
for (const PendingDownload& download_info : download_ids) {
|
for (const PendingDownload& download_info : download_ids) {
|
||||||
if (download_info.is_swizzle) {
|
if (download_info.is_swizzle) {
|
||||||
Image& image = slot_images[download_info.object_id];
|
Image& image = slot_images[download_info.object_id];
|
||||||
all_pre_sync &= image.info.dma_downloaded;
|
|
||||||
image.info.dma_downloaded = true;
|
|
||||||
const auto copies = FullDownloadCopies(image.info);
|
const auto copies = FullDownloadCopies(image.info);
|
||||||
image.DownloadMemory(download_map, copies);
|
image.DownloadMemory(download_map, copies);
|
||||||
download_map.offset += Common::AlignUp(image.unswizzled_size_bytes, 64);
|
download_map.offset += Common::AlignUp(image.unswizzled_size_bytes, 64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!all_pre_sync) {
|
uncommitted_async_buffers.emplace_back(download_map);
|
||||||
runtime.Finish();
|
|
||||||
auto it = download_ids.begin();
|
|
||||||
while (it != download_ids.end()) {
|
|
||||||
const PendingDownload& download_info = *it;
|
|
||||||
if (download_info.is_swizzle) {
|
|
||||||
const ImageBase& image = slot_images[download_info.object_id];
|
|
||||||
const auto copies = FullDownloadCopies(image.info);
|
|
||||||
download_map.offset -= Common::AlignUp(image.unswizzled_size_bytes, 64);
|
|
||||||
std::span<u8> download_span =
|
|
||||||
download_map.mapped_span.subspan(download_map.offset);
|
|
||||||
SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, download_span,
|
|
||||||
swizzle_data_buffer);
|
|
||||||
it = download_ids.erase(it);
|
|
||||||
} else {
|
|
||||||
it++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
uncommitted_async_buffers.emplace_back(download_map);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async_buffers.emplace_back(std::move(uncommitted_async_buffers));
|
async_buffers.emplace_back(std::move(uncommitted_async_buffers));
|
||||||
|
|
Loading…
Reference in a new issue