mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
Rasterizer: Refactor inlineToMemory.
This commit is contained in:
parent
d0a5a48948
commit
8a6e6465a7
9 changed files with 16 additions and 15 deletions
|
@ -1661,6 +1661,7 @@ bool BufferCache<P>::InlineMemory(VAddr dest_address, size_t copy_size,
|
||||||
|
|
||||||
const IntervalType subtract_interval{dest_address, dest_address + copy_size};
|
const IntervalType subtract_interval{dest_address, dest_address + copy_size};
|
||||||
ClearDownload(subtract_interval);
|
ClearDownload(subtract_interval);
|
||||||
|
common_ranges.subtract(subtract_interval);
|
||||||
|
|
||||||
BufferId buffer_id = FindBuffer(dest_address, static_cast<u32>(copy_size));
|
BufferId buffer_id = FindBuffer(dest_address, static_cast<u32>(copy_size));
|
||||||
auto& buffer = slot_buffers[buffer_id];
|
auto& buffer = slot_buffers[buffer_id];
|
||||||
|
@ -1677,7 +1678,7 @@ bool BufferCache<P>::InlineMemory(VAddr dest_address, size_t copy_size,
|
||||||
std::memcpy(src_pointer, inlined_buffer.data(), copy_size);
|
std::memcpy(src_pointer, inlined_buffer.data(), copy_size);
|
||||||
runtime.CopyBuffer(buffer, upload_staging.buffer, copies);
|
runtime.CopyBuffer(buffer, upload_staging.buffer, copies);
|
||||||
} else {
|
} else {
|
||||||
buffer.ImmediateUpload(buffer.Offset(dest_address), inlined_buffer);
|
buffer.ImmediateUpload(buffer.Offset(dest_address), inlined_buffer.first(copy_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -37,7 +37,7 @@ void State::ProcessData(const u32 data, const bool is_last_call) {
|
||||||
}
|
}
|
||||||
const GPUVAddr address{regs.dest.Address()};
|
const GPUVAddr address{regs.dest.Address()};
|
||||||
if (is_linear) {
|
if (is_linear) {
|
||||||
rasterizer->AccelerateInline2Memory(address, copy_size, inner_buffer);
|
rasterizer->AccelerateInlineToMemory(address, copy_size, inner_buffer);
|
||||||
} else {
|
} else {
|
||||||
UNIMPLEMENTED_IF(regs.dest.z != 0);
|
UNIMPLEMENTED_IF(regs.dest.z != 0);
|
||||||
UNIMPLEMENTED_IF(regs.dest.depth != 1);
|
UNIMPLEMENTED_IF(regs.dest.depth != 1);
|
||||||
|
|
|
@ -1557,7 +1557,7 @@ private:
|
||||||
|
|
||||||
static constexpr u32 null_cb_data = 0xFFFFFFFF;
|
static constexpr u32 null_cb_data = 0xFFFFFFFF;
|
||||||
struct CBDataState {
|
struct CBDataState {
|
||||||
static constexpr size_t inline_size = 0x8000;
|
static constexpr size_t inline_size = 0x4000;
|
||||||
std::array<std::array<u32, inline_size>, 16> buffer;
|
std::array<std::array<u32, inline_size>, 16> buffer;
|
||||||
u32 current{null_cb_data};
|
u32 current{null_cb_data};
|
||||||
u32 id{null_cb_data};
|
u32 id{null_cb_data};
|
||||||
|
|
|
@ -504,14 +504,12 @@ struct GPU::Impl {
|
||||||
case BufferMethods::SemaphoreAddressLow:
|
case BufferMethods::SemaphoreAddressLow:
|
||||||
case BufferMethods::SemaphoreSequence:
|
case BufferMethods::SemaphoreSequence:
|
||||||
break;
|
break;
|
||||||
case BufferMethods::UnkCacheFlush: {
|
case BufferMethods::UnkCacheFlush:
|
||||||
rasterizer->SyncGuestHost();
|
rasterizer->SyncGuestHost();
|
||||||
break;
|
break;
|
||||||
}
|
case BufferMethods::WrcacheFlush:
|
||||||
case BufferMethods::WrcacheFlush: {
|
|
||||||
rasterizer->SignalReference();
|
rasterizer->SignalReference();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case BufferMethods::FenceValue:
|
case BufferMethods::FenceValue:
|
||||||
break;
|
break;
|
||||||
case BufferMethods::RefCnt:
|
case BufferMethods::RefCnt:
|
||||||
|
|
|
@ -123,8 +123,8 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] virtual Tegra::Engines::AccelerateDMAInterface& AccessAccelerateDMA() = 0;
|
[[nodiscard]] virtual Tegra::Engines::AccelerateDMAInterface& AccessAccelerateDMA() = 0;
|
||||||
|
|
||||||
virtual void AccelerateInline2Memory(GPUVAddr address, size_t copy_size,
|
virtual void AccelerateInlineToMemory(GPUVAddr address, size_t copy_size,
|
||||||
std::span<u8> memory) = 0;
|
std::span<u8> memory) = 0;
|
||||||
|
|
||||||
/// Attempt to use a faster method to display the framebuffer to screen
|
/// Attempt to use a faster method to display the framebuffer to screen
|
||||||
[[nodiscard]] virtual bool AccelerateDisplay(const Tegra::FramebufferConfig& config,
|
[[nodiscard]] virtual bool AccelerateDisplay(const Tegra::FramebufferConfig& config,
|
||||||
|
|
|
@ -484,8 +484,8 @@ Tegra::Engines::AccelerateDMAInterface& RasterizerOpenGL::AccessAccelerateDMA()
|
||||||
return accelerate_dma;
|
return accelerate_dma;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::AccelerateInline2Memory(GPUVAddr address, size_t copy_size,
|
void RasterizerOpenGL::AccelerateInlineToMemory(GPUVAddr address, size_t copy_size,
|
||||||
std::span<u8> memory) {
|
std::span<u8> memory) {
|
||||||
auto cpu_addr = gpu_memory.GpuToCpuAddress(address);
|
auto cpu_addr = gpu_memory.GpuToCpuAddress(address);
|
||||||
if (!cpu_addr) [[unlikely]] {
|
if (!cpu_addr) [[unlikely]] {
|
||||||
gpu_memory.WriteBlock(address, memory.data(), copy_size);
|
gpu_memory.WriteBlock(address, memory.data(), copy_size);
|
||||||
|
|
|
@ -106,7 +106,8 @@ public:
|
||||||
const Tegra::Engines::Fermi2D::Surface& dst,
|
const Tegra::Engines::Fermi2D::Surface& dst,
|
||||||
const Tegra::Engines::Fermi2D::Config& copy_config) override;
|
const Tegra::Engines::Fermi2D::Config& copy_config) override;
|
||||||
Tegra::Engines::AccelerateDMAInterface& AccessAccelerateDMA() override;
|
Tegra::Engines::AccelerateDMAInterface& AccessAccelerateDMA() override;
|
||||||
void AccelerateInline2Memory(GPUVAddr address, size_t copy_size, std::span<u8> memory) override;
|
void AccelerateInlineToMemory(GPUVAddr address, size_t copy_size,
|
||||||
|
std::span<u8> memory) override;
|
||||||
bool AccelerateDisplay(const Tegra::FramebufferConfig& config, VAddr framebuffer_addr,
|
bool AccelerateDisplay(const Tegra::FramebufferConfig& config, VAddr framebuffer_addr,
|
||||||
u32 pixel_stride) override;
|
u32 pixel_stride) override;
|
||||||
void LoadDiskResources(u64 title_id, std::stop_token stop_loading,
|
void LoadDiskResources(u64 title_id, std::stop_token stop_loading,
|
||||||
|
|
|
@ -548,8 +548,8 @@ Tegra::Engines::AccelerateDMAInterface& RasterizerVulkan::AccessAccelerateDMA()
|
||||||
return accelerate_dma;
|
return accelerate_dma;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::AccelerateInline2Memory(GPUVAddr address, size_t copy_size,
|
void RasterizerVulkan::AccelerateInlineToMemory(GPUVAddr address, size_t copy_size,
|
||||||
std::span<u8> memory) {
|
std::span<u8> memory) {
|
||||||
auto cpu_addr = gpu_memory.GpuToCpuAddress(address);
|
auto cpu_addr = gpu_memory.GpuToCpuAddress(address);
|
||||||
if (!cpu_addr) [[unlikely]] {
|
if (!cpu_addr) [[unlikely]] {
|
||||||
gpu_memory.WriteBlock(address, memory.data(), copy_size);
|
gpu_memory.WriteBlock(address, memory.data(), copy_size);
|
||||||
|
|
|
@ -99,7 +99,8 @@ public:
|
||||||
const Tegra::Engines::Fermi2D::Surface& dst,
|
const Tegra::Engines::Fermi2D::Surface& dst,
|
||||||
const Tegra::Engines::Fermi2D::Config& copy_config) override;
|
const Tegra::Engines::Fermi2D::Config& copy_config) override;
|
||||||
Tegra::Engines::AccelerateDMAInterface& AccessAccelerateDMA() override;
|
Tegra::Engines::AccelerateDMAInterface& AccessAccelerateDMA() override;
|
||||||
void AccelerateInline2Memory(GPUVAddr address, size_t copy_size, std::span<u8> memory) override;
|
void AccelerateInlineToMemory(GPUVAddr address, size_t copy_size,
|
||||||
|
std::span<u8> memory) override;
|
||||||
bool AccelerateDisplay(const Tegra::FramebufferConfig& config, VAddr framebuffer_addr,
|
bool AccelerateDisplay(const Tegra::FramebufferConfig& config, VAddr framebuffer_addr,
|
||||||
u32 pixel_stride) override;
|
u32 pixel_stride) override;
|
||||||
void LoadDiskResources(u64 title_id, std::stop_token stop_loading,
|
void LoadDiskResources(u64 title_id, std::stop_token stop_loading,
|
||||||
|
|
Loading…
Reference in a new issue