mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Add check if device support Images.
Related-To: NEO-4675 Change-Id: I0c2b6e04536e45e70748983521e8469dd3dad697
This commit is contained in:
committed by
sys_ocldev
parent
d635eb6300
commit
fa3cb35fde
@@ -1453,4 +1453,19 @@ bool Image::hasValidParentImageFormat(const cl_image_format &imageFormat) const
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
cl_int Image::checkIfDeviceSupportsImages(cl_context context) {
|
||||
auto pContext = castToObject<Context>(context);
|
||||
if (pContext != nullptr) {
|
||||
auto capabilityTable = pContext->getDevice(0)->getHardwareInfo().capabilityTable;
|
||||
if (!capabilityTable.supportsImages) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
return CL_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -197,6 +197,8 @@ class Image : public MemObj {
|
||||
bool isImageFromBuffer() const { return castToObject<Buffer>(static_cast<cl_mem>(associatedMemObject)) ? true : false; }
|
||||
bool isImageFromImage() const { return castToObject<Image>(static_cast<cl_mem>(associatedMemObject)) ? true : false; }
|
||||
|
||||
static cl_int checkIfDeviceSupportsImages(cl_context context);
|
||||
|
||||
protected:
|
||||
Image(Context *context,
|
||||
const MemoryProperties &memoryProperties,
|
||||
|
||||
Reference in New Issue
Block a user