From: guoyejun Date: Tue, 13 Sep 2016 14:52:48 +0000 (+0800) Subject: correct the case that properties is NULL for clCreateContextFromType (#8) X-Git-Tag: upstream/v2022.01.04~78 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb4acb99df3441e147bd859c20d9c3533ec95ce8;p=platform%2Fupstream%2FOpenCL-ICD-Loader.git correct the case that properties is NULL for clCreateContextFromType (#8) Handle properties==NULL in clCreateContextFromType According to spec, for function clCreateContextFromType, properties can also be NULL in which case the platform that is selected is implementation-defined, while the current code returns CL_INVALID_PLATFORM. --- diff --git a/icd.c b/icd.c index b060479..c32a784 100644 --- a/icd.c +++ b/icd.c @@ -198,6 +198,12 @@ Done: void khrIcdContextPropertiesGetPlatform(const cl_context_properties *properties, cl_platform_id *outPlatform) { + if (properties == NULL && khrIcdVendors != NULL) + { + *outPlatform = khrIcdVendors[0].platform; + return; + } + const cl_context_properties *property = (cl_context_properties *)NULL; *outPlatform = NULL; for (property = properties; property && property[0]; property += 2)