From a91d3fc6397560fc6294a24faeed73d45abd1753 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Mon, 22 Apr 2019 18:50:56 -0400 Subject: Revamp Kepler Memory to use a subegine to manage uploads --- src/video_core/engines/engine_upload.h | 74 ++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/video_core/engines/engine_upload.h (limited to 'src/video_core/engines/engine_upload.h') diff --git a/src/video_core/engines/engine_upload.h b/src/video_core/engines/engine_upload.h new file mode 100644 index 000000000..3a817140a --- /dev/null +++ b/src/video_core/engines/engine_upload.h @@ -0,0 +1,74 @@ +// Copyright 2019 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include +#include "common/bit_field.h" +#include "common/common_funcs.h" +#include "common/common_types.h" + +namespace Tegra { +class MemoryManager; +} + +namespace Tegra::Engines::Upload { + +struct Data { + u32 line_length_in; + u32 line_count; + + struct { + u32 address_high; + u32 address_low; + u32 pitch; + union { + BitField<0, 4, u32> block_width; + BitField<4, 4, u32> block_height; + BitField<8, 4, u32> block_depth; + }; + u32 width; + u32 height; + u32 depth; + u32 z; + u32 x; + u32 y; + + GPUVAddr Address() const { + return static_cast((static_cast(address_high) << 32) | address_low); + } + + u32 BlockWidth() const { + return 1U << block_width.Value(); + } + + u32 BlockHeight() const { + return 1U << block_height.Value(); + } + + u32 BlockDepth() const { + return 1U << block_depth.Value(); + } + } dest; +}; + +class State { +public: + State(MemoryManager& memory_manager, Data& regs) : memory_manager(memory_manager), regs(regs) {} + ~State() = default; + + void ProcessExec(const bool is_linear); + void ProcessData(const u32 data, const bool is_last_call); + +private: + u32 write_offset = 0; + u32 copy_size = 0; + std::vector inner_buffer; + bool linear; + Data& regs; + MemoryManager& memory_manager; +}; + +} // namespace Tegra::Engines::Upload -- cgit v1.2.3