vk_rasterizer: Restore image copy fast path (#5272)

This commit is contained in:
TheTurtle authored and GitHub committed 2026-10-05 12:39:12 +03:00
1 parent b5ce969003
commit dade3afda7
1 file changed
+11 -2
@@ -5,6 +5,7 @@
#include "core/debug_state.h"
#include "core/emulator_settings.h"
#include "core/memory.h"
#include "shader_recompiler/resource.h"
#include "shader_recompiler/runtime_info.h"
#include "video_core/amdgpu/liverpool.h"
#include "video_core/buffer_cache/buffer.h"
@@ -618,7 +619,8 @@ bool Rasterizer::IsComputeImageCopy(const Pipeline* pipeline) {
// Ensure shader only has 2 bound buffers
const auto& cs_pgm = liverpool->GetCsRegs();
const auto& info = pipeline->GetStage(Shader::SwStage::Compute);
if (cs_pgm.num_thread_x.full != 64 || info.buffers.size() != 2 || !info.images.empty()) {
if (cs_pgm.num_thread_x.full != 64 || info.buffers.size() < 2 || info.buffers.size() > 3 ||
!info.images.empty()) {
return false;
}
@@ -628,6 +630,9 @@ bool Rasterizer::IsComputeImageCopy(const Pipeline* pipeline) {
if (!desc0.is_formatted || !desc1.is_formatted || desc0.is_written == desc1.is_written) {
return false;
}
if (info.buffers.size() == 3 && info.buffers[2].buffer_type != Shader::BufferType::Flatbuf) {
return false;
}
// Buffers must have the same size and each thread of the dispatch must copy 1 dword of data
const AmdGpu::Buffer buf0 = desc0.GetSharp(info);
@@ -671,7 +676,8 @@ bool Rasterizer::IsComputeImageClear(const Pipeline* pipeline) {
// Ensure shader only has 2 bound buffers
const auto& cs_pgm = liverpool->GetCsRegs();
const auto& info = pipeline->GetStage(Shader::SwStage::Compute);
if (cs_pgm.num_thread_x.full != 64 || info.buffers.size() != 2 || !info.images.empty()) {
if (cs_pgm.num_thread_x.full != 64 || info.buffers.size() < 2 || info.buffers.size() > 3 ||
!info.images.empty()) {
return false;
}
@@ -681,6 +687,9 @@ bool Rasterizer::IsComputeImageClear(const Pipeline* pipeline) {
if (desc0.is_formatted || !desc1.is_formatted || desc0.is_written || !desc1.is_written) {
return false;
}
if (info.buffers.size() == 3 && info.buffers[2].buffer_type != Shader::BufferType::Flatbuf) {
return false;
}
// First buffer must have size of vec4 and second the size of a single layer
const AmdGpu::Buffer buf0 = desc0.GetSharp(info);