Skip to content

Commit

Permalink
gpu: cache: fix possible segfault on image invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Oct 17, 2024
1 parent fa60280 commit 9394b6c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rpcsx/gpu/Cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,7 @@ Cache::Buffer Cache::Tag::getBuffer(rx::AddressRange range, Access access) {
}

auto cached = static_cast<CachedHostVisibleBuffer *>(it->get());
mStorage->mAcquiredMemoryResources.push_back(it.get());

cached->acquire(this, access);
auto addressRange = it.get()->addressRange;
Expand All @@ -1203,7 +1204,6 @@ Cache::Buffer Cache::Tag::getBuffer(rx::AddressRange range, Access access) {
}

auto offset = range.beginAddress() - addressRange.beginAddress();
mStorage->mAcquiredMemoryResources.push_back(it.get());
return {
.handle = cached->buffer.getHandle(),
.offset = offset,
Expand Down Expand Up @@ -2178,8 +2178,10 @@ Cache::Cache(Device *device, int vmId) : mDevice(device), mVmId(vmId) {

VkDescriptorPoolCreateInfo info{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
.maxSets = static_cast<uint32_t>(std::size(mGraphicsDescriptorSets) * mGraphicsDescriptorSetLayouts.size() +
std::size(mComputeDescriptorSets) + 1),
.maxSets =
static_cast<uint32_t>(std::size(mGraphicsDescriptorSets) *
mGraphicsDescriptorSetLayouts.size() +
std::size(mComputeDescriptorSets) + 1),
.poolSizeCount = static_cast<uint32_t>(std::size(descriptorPoolSizes)),
.pPoolSizes = descriptorPoolSizes,
};
Expand Down

0 comments on commit 9394b6c

Please sign in to comment.