[Vulkan] Handle AllocateTextureRegion failures

This commit is contained in:
DrChat 2017-12-23 22:41:51 -06:00
parent 80fb0ba71a
commit ecbdebb43b
1 changed files with 6 additions and 1 deletions

View File

@ -355,6 +355,11 @@ TextureCache::Texture* TextureCache::AllocateTexture(
TextureRegion* base_region = AllocateTextureRegion(
texture, region_offset, region_extent, required_flags);
if (!base_region) {
delete texture;
return nullptr;
}
texture->base_region = base_region;
return texture;
}
@ -514,7 +519,7 @@ TextureCache::TextureRegion* TextureCache::DemandRegion(
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT);
}
if (command_buffer && !region->region_contents_valid) {
if (command_buffer && region && !region->region_contents_valid) {
// Region content is out-of-date, recreate it by blitting from the base
// region.