gpu: cache: fix possible segfault on image invalidation

This commit is contained in:
DH 2024-10-17 03:50:31 +03:00
parent fa602802da
commit 9394b6c481

View file

@ -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;
@ -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,
@ -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,
};