mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-07 11:13:15 +00:00
renderer_vulkan: Introduce shader HLE system with copy shader implementation. (#1683)
* renderer_vulkan: Introduce shader HLE system with copy shader implementation. Co-authored-by: TheTurtle <47210458+raphaelthegreat@users.noreply.github.com> * buffer_cache: Handle obtaining buffer views partially within buffers. * vk_shader_hle: Make more efficient --------- Co-authored-by: TheTurtle <47210458+raphaelthegreat@users.noreply.github.com>
This commit is contained in:
parent
41fd1c84cf
commit
e5e1aba241
9 changed files with 195 additions and 5 deletions
|
@ -466,6 +466,9 @@ void TextureCache::RefreshImage(Image& image, Vulkan::Scheduler* custom_schedule
|
|||
const auto& num_mips = image.info.resources.levels;
|
||||
ASSERT(num_mips == image.info.mips_layout.size());
|
||||
|
||||
const bool is_gpu_modified = True(image.flags & ImageFlagBits::GpuModified);
|
||||
const bool is_gpu_dirty = True(image.flags & ImageFlagBits::GpuDirty);
|
||||
|
||||
boost::container::small_vector<vk::BufferImageCopy, 14> image_copy{};
|
||||
for (u32 m = 0; m < num_mips; m++) {
|
||||
const u32 width = std::max(image.info.size.width >> m, 1u);
|
||||
|
@ -475,8 +478,6 @@ void TextureCache::RefreshImage(Image& image, Vulkan::Scheduler* custom_schedule
|
|||
const auto& mip = image.info.mips_layout[m];
|
||||
|
||||
// Protect GPU modified resources from accidental CPU reuploads.
|
||||
const bool is_gpu_modified = True(image.flags & ImageFlagBits::GpuModified);
|
||||
const bool is_gpu_dirty = True(image.flags & ImageFlagBits::GpuDirty);
|
||||
if (is_gpu_modified && !is_gpu_dirty) {
|
||||
const u8* addr = std::bit_cast<u8*>(image.info.guest_address);
|
||||
const u64 hash = XXH3_64bits(addr + mip.offset, mip.size);
|
||||
|
@ -515,7 +516,8 @@ void TextureCache::RefreshImage(Image& image, Vulkan::Scheduler* custom_schedule
|
|||
|
||||
const VAddr image_addr = image.info.guest_address;
|
||||
const size_t image_size = image.info.guest_size_bytes;
|
||||
const auto [vk_buffer, buf_offset] = buffer_cache.ObtainViewBuffer(image_addr, image_size);
|
||||
const auto [vk_buffer, buf_offset] =
|
||||
buffer_cache.ObtainViewBuffer(image_addr, image_size, is_gpu_dirty);
|
||||
// The obtained buffer may be written by a shader so we need to emit a barrier to prevent RAW
|
||||
// hazard
|
||||
if (auto barrier = vk_buffer->GetBarrier(vk::AccessFlagBits2::eTransferRead,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue