@@ -46,11 +46,8 @@ TextureCache::~TextureCache() = default;
46
46
void TextureCache::InvalidateMemory (VAddr addr, VAddr addr_aligned, size_t size) {
47
47
std::scoped_lock lock{mutex};
48
48
ForEachImageInRegion (addr_aligned, size, [&](ImageId image_id, Image& image) {
49
- const auto addr_begin = addr;
50
- const auto addr_end = addr + size;
51
- const auto image_begin = image.info .guest_address ;
52
49
const auto image_end = image.info .guest_address + image.info .guest_size_bytes ;
53
- if (addr_begin < image_end && image_begin < addr_end ) {
50
+ if (addr < image_end) {
54
51
// Ensure image is reuploaded when accessed again.
55
52
image.flags |= ImageFlagBits::CpuDirty;
56
53
}
@@ -396,24 +393,11 @@ void TextureCache::RefreshImage(Image& image, Vulkan::Scheduler* custom_schedule
396
393
const u32 height = std::max (image.info .size .height >> m, 1u );
397
394
const u32 depth =
398
395
image.info .props .is_volume ? std::max (image.info .size .depth >> m, 1u ) : 1u ;
399
- const auto & [mip_size, mip_pitch, mip_height, mip_ofs] = image.info .mips_layout [m];
400
-
401
- // Protect GPU modified resources from accidental CPU reuploads.
402
- const bool is_gpu_modified = True (image.flags & ImageFlagBits::GpuModified);
403
- const bool is_gpu_dirty = True (image.flags & ImageFlagBits::GpuDirty);
404
- if (is_gpu_modified && !is_gpu_dirty) {
405
- const u8 * addr = std::bit_cast<u8 *>(image.info .guest_address );
406
- const u64 hash = XXH3_64bits (addr + mip_ofs, mip_size);
407
- if (image.mip_hashes [m] == hash) {
408
- continue ;
409
- }
410
- image.mip_hashes [m] = hash;
411
- }
412
-
396
+ const auto & mip = image.info .mips_layout [m];
413
397
image_copy.push_back ({
414
- .bufferOffset = mip_ofs * num_layers,
415
- .bufferRowLength = static_cast <u32 >(mip_pitch ),
416
- .bufferImageHeight = static_cast <u32 >(mip_height ),
398
+ .bufferOffset = mip. offset * num_layers,
399
+ .bufferRowLength = static_cast <u32 >(mip. pitch ),
400
+ .bufferImageHeight = static_cast <u32 >(mip. height ),
417
401
.imageSubresource {
418
402
.aspectMask = image.aspect_mask & ~vk::ImageAspectFlagBits::eStencil,
419
403
.mipLevel = m,
0 commit comments