mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-29 17:13:29 +08:00
Improve error handling for unsupported image creation
Change-Id: I4aeec25f32164b8cf71a78d742b7de254e97aed2 Signed-off-by: Jim Snow <jim.m.snow@intel.com>
This commit is contained in:
@@ -35,6 +35,10 @@ bool ImageCoreFamily<gfxCoreFamily>::initialize(Device *device, const ze_image_d
|
||||
UNRECOVERABLE_IF(device == nullptr);
|
||||
this->device = device;
|
||||
|
||||
if (imgInfo.surfaceFormat->GMMSurfaceFormat == GMM_FORMAT_INVALID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
typename RENDER_SURFACE_STATE::SURFACE_TYPE surfaceType;
|
||||
switch (desc->type) {
|
||||
case ZE_IMAGE_TYPE_1D:
|
||||
|
||||
@@ -16,7 +16,9 @@ namespace L0 {
|
||||
ImageAllocatorFn imageFactory[IGFX_MAX_PRODUCT] = {};
|
||||
|
||||
ImageImp::~ImageImp() {
|
||||
this->device->getNEODevice()->getMemoryManager()->freeGraphicsMemory(this->allocation);
|
||||
if (this->device != nullptr) {
|
||||
this->device->getNEODevice()->getMemoryManager()->freeGraphicsMemory(this->allocation);
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t ImageImp::destroy() {
|
||||
@@ -33,7 +35,10 @@ Image *Image::create(uint32_t productFamily, Device *device, const ze_image_desc
|
||||
ImageImp *image = nullptr;
|
||||
if (allocator) {
|
||||
image = static_cast<ImageImp *>((*allocator)());
|
||||
image->initialize(device, desc);
|
||||
if (!image->initialize(device, desc)) {
|
||||
image->destroy();
|
||||
image = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
|
||||
Reference in New Issue
Block a user