Merge pull request #6529 from ReinUsesLisp/reaper-fixups

buffer_cache,texture_cache: Misc fixups from the memory reaper
This commit is contained in:
Morph 2021-06-27 09:33:58 -04:00 committed by GitHub
commit 4df04ad48a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 42 additions and 14 deletions

View file

@ -293,6 +293,7 @@ endif()
if (MSVC) if (MSVC)
target_compile_options(video_core PRIVATE target_compile_options(video_core PRIVATE
/we4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data /we4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
/we4244 # 'var' : conversion from integer to 'type', possible loss of data
/we4456 # Declaration of 'identifier' hides previous local declaration /we4456 # Declaration of 'identifier' hides previous local declaration
/we4457 # Declaration of 'identifier' hides function parameter /we4457 # Declaration of 'identifier' hides function parameter
/we4458 # Declaration of 'identifier' hides class member /we4458 # Declaration of 'identifier' hides class member

View file

@ -99,7 +99,7 @@ class BufferCache {
}; };
public: public:
static constexpr u32 DEFAULT_SKIP_CACHE_SIZE = 4_KiB; static constexpr u32 DEFAULT_SKIP_CACHE_SIZE = static_cast<u32>(4_KiB);
explicit BufferCache(VideoCore::RasterizerInterface& rasterizer_, explicit BufferCache(VideoCore::RasterizerInterface& rasterizer_,
Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::Engines::Maxwell3D& maxwell3d_,
@ -109,8 +109,6 @@ public:
void TickFrame(); void TickFrame();
void RunGarbageCollector();
void WriteMemory(VAddr cpu_addr, u64 size); void WriteMemory(VAddr cpu_addr, u64 size);
void CachedWriteMemory(VAddr cpu_addr, u64 size); void CachedWriteMemory(VAddr cpu_addr, u64 size);
@ -197,6 +195,8 @@ private:
((cpu_addr + size) & ~Core::Memory::PAGE_MASK); ((cpu_addr + size) & ~Core::Memory::PAGE_MASK);
} }
void RunGarbageCollector();
void BindHostIndexBuffer(); void BindHostIndexBuffer();
void BindHostVertexBuffers(); void BindHostVertexBuffers();
@ -416,8 +416,9 @@ void BufferCache<P>::CachedWriteMemory(VAddr cpu_addr, u64 size) {
template <class P> template <class P>
void BufferCache<P>::DownloadMemory(VAddr cpu_addr, u64 size) { void BufferCache<P>::DownloadMemory(VAddr cpu_addr, u64 size) {
ForEachBufferInRange(cpu_addr, size, ForEachBufferInRange(cpu_addr, size, [&](BufferId, Buffer& buffer) {
[&](BufferId, Buffer& buffer) { DownloadBufferMemory(buffer); }); DownloadBufferMemory(buffer, cpu_addr, size);
});
} }
template <class P> template <class P>

View file

@ -14,10 +14,18 @@ extern "C" {
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wconversion"
#endif #endif
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4242) // conversion from 'type' to 'type', possible loss of data
#pragma warning(disable : 4244) // conversion from 'type' to 'type', possible loss of data
#endif
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#if defined(__GNUC__) || defined(__clang__) #if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
} }
namespace Tegra { namespace Tegra {

View file

@ -3,7 +3,28 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <array> #include <array>
extern "C" {
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4244) // conversion from 'type' to 'type', possible loss of data
#pragma warning(push)
#endif
#include <libswscale/swscale.h>
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
}
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h"
#include "video_core/command_classes/nvdec.h" #include "video_core/command_classes/nvdec.h"
#include "video_core/command_classes/vic.h" #include "video_core/command_classes/vic.h"
#include "video_core/engines/maxwell_3d.h" #include "video_core/engines/maxwell_3d.h"
@ -11,10 +32,6 @@
#include "video_core/memory_manager.h" #include "video_core/memory_manager.h"
#include "video_core/textures/decoders.h" #include "video_core/textures/decoders.h"
extern "C" {
#include <libswscale/swscale.h>
}
namespace Tegra { namespace Tegra {
Vic::Vic(GPU& gpu_, std::shared_ptr<Nvdec> nvdec_processor_) Vic::Vic(GPU& gpu_, std::shared_ptr<Nvdec> nvdec_processor_)

View file

@ -55,8 +55,9 @@ size_t BytesPerIndex(VkIndexType index_type) {
template <typename T> template <typename T>
std::array<T, 6> MakeQuadIndices(u32 quad, u32 first) { std::array<T, 6> MakeQuadIndices(u32 quad, u32 first) {
std::array<T, 6> indices{0, 1, 2, 0, 2, 3}; std::array<T, 6> indices{0, 1, 2, 0, 2, 3};
std::ranges::transform(indices, indices.begin(), for (T& index : indices) {
[quad, first](u32 index) { return first + index + quad * 4; }); index = static_cast<T>(first + index + quad * 4);
}
return indices; return indices;
} }
} // Anonymous namespace } // Anonymous namespace

View file

@ -110,9 +110,6 @@ public:
/// Notify the cache that a new frame has been queued /// Notify the cache that a new frame has been queued
void TickFrame(); void TickFrame();
/// Runs the Garbage Collector.
void RunGarbageCollector();
/// Return a constant reference to the given image view id /// Return a constant reference to the given image view id
[[nodiscard]] const ImageView& GetImageView(ImageViewId id) const noexcept; [[nodiscard]] const ImageView& GetImageView(ImageViewId id) const noexcept;
@ -207,6 +204,9 @@ private:
} }
} }
/// Runs the Garbage Collector.
void RunGarbageCollector();
/// Fills image_view_ids in the image views in indices /// Fills image_view_ids in the image views in indices
void FillImageViews(DescriptorTable<TICEntry>& table, void FillImageViews(DescriptorTable<TICEntry>& table,
std::span<ImageViewId> cached_image_view_ids, std::span<const u32> indices, std::span<ImageViewId> cached_image_view_ids, std::span<const u32> indices,