Skip to content

Commit 5ba8711

Browse files
author
devsh
committed
add some more invalid usage validation so we don't crash as often
1 parent 2922244 commit 5ba8711

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

include/nbl/video/ILogicalDevice.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,11 @@ class NBL_API2 ILogicalDevice : public core::IReferenceCounted, public IDeviceMe
366366
// Create an ImageView that can actually be used by shaders (@see ICPUImageView)
367367
inline core::smart_refctd_ptr<IGPUImageView> createImageView(IGPUImageView::SCreationParams&& params)
368368
{
369+
if (!params.image)
370+
{
371+
NBL_LOG_ERROR("The image is null");
372+
return nullptr;
373+
}
369374
if (!params.image->wasCreatedBy(this))
370375
{
371376
NBL_LOG_ERROR("The image was not created by this device");

src/nbl/video/IPhysicalDevice.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,9 @@ asset::E_FORMAT IPhysicalDevice::promoteBufferFormat(const SBufferFormatPromotio
417417

418418
asset::E_FORMAT IPhysicalDevice::promoteImageFormat(const SImageFormatPromotionRequest req, const IGPUImage::TILING tiling) const
419419
{
420+
if (req.originalFormat==asset::EF_UNKNOWN)
421+
return req.originalFormat;
422+
420423
format_image_cache_t& cache = tiling==IGPUImage::TILING::LINEAR
421424
? this->m_formatPromotionCache.linearTilingImages
422425
: this->m_formatPromotionCache.optimalTilingImages;

0 commit comments

Comments
 (0)