diff options
Diffstat (limited to 'src/video_core/texture_cache')
| -rw-r--r-- | src/video_core/texture_cache/descriptor_table.h | 12 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 8 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/video_core/texture_cache/descriptor_table.h b/src/video_core/texture_cache/descriptor_table.h index a441e572de..2c768b72fc 100644 --- a/src/video_core/texture_cache/descriptor_table.h +++ b/src/video_core/texture_cache/descriptor_table.h @@ -7,12 +7,14 @@ #pragma once #include <algorithm> +#include <cstring> #include <vector> #include "common/alignment.h" #include "common/common_types.h" #include "common/div_ceil.h" #include "common/assert.h" +#include "core/memory.h" #include "video_core/memory_manager.h" #include "video_core/rasterizer_interface.h" @@ -44,7 +46,15 @@ public: } const GPUVAddr gpu_addr = current_gpu_addr + index * sizeof(T); std::pair<T, bool> result; - gpu_memory.ReadBlockUnsafe(gpu_addr, std::addressof(result.first), sizeof(T)); + // This runs for every texture and sampler of every draw. An entry within one page is + // contiguous in host memory, so a single page lookup replaces the generic block read. + const bool one_page = + (gpu_addr & Core::Memory::YUZU_PAGEMASK) + sizeof(T) <= Core::Memory::YUZU_PAGESIZE; + if (const u8* const host = one_page ? gpu_memory.GetPointer(gpu_addr) : nullptr) { + std::memcpy(std::addressof(result.first), host, sizeof(T)); + } else { + gpu_memory.ReadBlockUnsafe(gpu_addr, std::addressof(result.first), sizeof(T)); + } if ((read_descriptors[index / 64] & (1ULL << (index % 64))) != 0) { result.second = result.first != descriptors[index]; } else { diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index abb22b9bfb..a34c591aca 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -580,7 +580,7 @@ template <class P> SamplerId TextureCache<P>::GetSamplerId(u32 index, bool compute) { auto& table = compute ? channel_state->compute_sampler_table : channel_state->graphics_sampler_table; if (index > table.current_limit) { - LOG_DEBUG(HW_GPU, "Invalid sampler index={}", index); + LOG_TRACE(HW_GPU, "Invalid sampler index={}", index); return NULL_SAMPLER_ID; } auto const map_index = index | (compute ? Common::SlotId::TAGGED_VALUE : 0); @@ -812,7 +812,7 @@ ImageViewId TextureCache<P>::VisitImageView(u32 index, bool compute) { index = Tegra::Texture::TextureHeaderIndex(index, table.current_limit, gpu_memory->UsesNativeTiling()); if (index > table.current_limit) { - LOG_DEBUG(HW_GPU, "Invalid image view index={}", index); + LOG_TRACE(HW_GPU, "Invalid image view index={}", index); return NULL_IMAGE_VIEW_ID; } auto const map_index = index | (compute ? Common::SlotId::TAGGED_VALUE : 0); @@ -1124,8 +1124,8 @@ bool TextureCache<P>::TemporalUpscale(const Tegra::Engines::Fermi2D::Surface& ds has_deleted_images = false; const ImageId motion_id = FindOrInsertImage(motion_info, motion_vectors.Address(), RelaxedOptions{}); - // The depth only feeds FSR 3.1 (looked up only when FSR can run); without it the stand-in - // runs. + // The depth only feeds NVIDIA DLSS and FSR 3.1 (looked up only when they can run); without + // it the stand-in runs. ImageId depth_id{}; if (depth && motion_id && runtime.WantsTemporalUpscaleDepth()) { depth_id = FindOrInsertImage(ImageInfo(*depth), depth->Address(), RelaxedOptions{}); |
