Skip to content

Commit 0099cff

Browse files
committed
Simplified return code
1 parent 84dce08 commit 0099cff

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

src/vsg/state/Image.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,7 @@ VkResult Image::compile(Device* device)
228228

229229
VkResult Image::compile(Context& context)
230230
{
231-
try
232-
{
233-
return compile(*context.deviceMemoryBufferPools);
234-
}
235-
catch (...)
236-
{
237-
vsg::info("Image::compile(Context& context)");
238-
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
239-
}
231+
return compile(*context.deviceMemoryBufferPools);
240232
}
241233

242234
VkResult Image::compile(MemoryBufferPools& memoryBufferPools)
@@ -255,13 +247,10 @@ VkResult Image::compile(MemoryBufferPools& memoryBufferPools)
255247
if (deviceMemory)
256248
{
257249
vd.requiresDataCopy = data.valid();
258-
bind(deviceMemory, offset);
250+
return bind(deviceMemory, offset);
259251
}
260252
else
261253
{
262-
// throw Exception{"Error: Image failed to reserve slot from deviceMemoryBufferPools.", VK_ERROR_OUT_OF_DEVICE_MEMORY};
263-
result = VK_ERROR_OUT_OF_DEVICE_MEMORY;
254+
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
264255
}
265-
266-
return result;
267256
}

src/vsg/state/ImageInfo.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,6 @@ VkDeviceSize ImageInfo::computeDataSize() const
420420
if (imageView && imageView->image)
421421
{
422422
auto& image = imageView->image;
423-
424-
// VkExtent3D extent = {0, 0, 0};
425-
// uint32_t mipLevels = 0;
426-
// uint32_t arrayLayers = 0;
427-
428423
if (image->data) return image->data->computeValueCountIncludingMipmaps();
429424
}
430425
return 0;

src/vsg/vk/Device.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,12 @@ VkDeviceSize Device::availableMemory(bool includeMemoryPools) const
233233
}
234234
}
235235

236-
VkDeviceSize minimumMargin = 0; //1024*1024*1024;
237-
238236
for (auto& heapIndex : compatibleHeaps)
239237
{
240238
VkDeviceSize heapAvailable = memoryBudget.heapBudget[heapIndex] - memoryBudget.heapUsage[heapIndex];
241239
if (heapAvailable > minimumMargin)
242240
{
243-
available += (heapAvailable - minimumMargin);
241+
available += heapAvailable;
244242
}
245243
}
246244

0 commit comments

Comments
 (0)