Skip to content

Commit d8199a4

Browse files
refactor context creation
- createContextOsProperties is not needed anymore - replace invalid context property value 0x200D as invalid context property value should not be used, as it can be use in future as valid property Change-Id: I569433b0f37bbce083f0d64ecf1dc80ff83bfb46
1 parent 125fce8 commit d8199a4

File tree

5 files changed

+7
-16
lines changed

5 files changed

+7
-16
lines changed

runtime/context/context.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (c) 2017 - 2018, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -131,7 +131,7 @@ bool Context::createImpl(const cl_context_properties *properties,
131131
break;
132132
default:
133133
if (!sharingBuilder->processProperties(propertyType, propertyValue, errcodeRet)) {
134-
errcodeRet = createContextOsProperties(propertyType, propertyValue);
134+
errcodeRet = CL_INVALID_PROPERTY;
135135
}
136136
break;
137137
}

runtime/context/context.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (c) 2017 - 2018, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -128,7 +128,6 @@ class Context : public BaseObject<_cl_context> {
128128
void *userData = nullptr);
129129

130130
// OS specific implementation
131-
cl_int createContextOsProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue);
132131
void *getOsContextInfo(cl_context_info &paramName, size_t *srcParamSize);
133132

134133
const cl_context_properties *properties;

runtime/os_interface/linux/api.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (c) 2017 - 2018, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -52,10 +52,6 @@ void OCLRT::Image::getOsSpecificImageInfo(const cl_image_info &paramName, size_t
5252
}
5353
}
5454

55-
cl_int OCLRT::Context::createContextOsProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) {
56-
return CL_INVALID_PROPERTY;
57-
}
58-
5955
void *OCLRT::Context::getOsContextInfo(cl_context_info &paramName, size_t *srcParamSize) {
6056
return nullptr;
6157
}

runtime/os_interface/windows/api.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (c) 2017 - 2018, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -81,10 +81,6 @@ void OCLRT::Image::getOsSpecificImageInfo(const cl_mem_info &paramName, size_t *
8181
}
8282
}
8383

84-
cl_int OCLRT::Context::createContextOsProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) {
85-
return CL_INVALID_PROPERTY;
86-
}
87-
8884
void *OCLRT::Context::getOsContextInfo(cl_context_info &paramName, size_t *srcParamSize) {
8985
switch (paramName) {
9086
case CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR:

unit_tests/context/context_negative_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (c) 2017 - 2018, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -65,7 +65,7 @@ TEST(InvalidPropertyContextTest, GivenInvalidPropertiesWhenContextIsCreatedThenE
6565
cl_platform_id pid[1];
6666
pid[0] = pPlatform;
6767
cl_context_properties invalidProperties[5] = {CL_CONTEXT_PLATFORM, (cl_context_properties)pid[0], CL_CGL_SHAREGROUP_KHR, 0x10000, 0};
68-
cl_context_properties invalidProperties2[5] = {CL_CONTEXT_PLATFORM, (cl_context_properties)pid[0], 0x200D, 0x10000, 0};
68+
cl_context_properties invalidProperties2[5] = {CL_CONTEXT_PLATFORM, (cl_context_properties)pid[0], (cl_context_properties)0xdeadbeef, 0x10000, 0};
6969

7070
cl_int retVal = 0;
7171
auto context = Context::create<Context>(invalidProperties, DeviceVector(&deviceID, 1), nullptr,

0 commit comments

Comments
 (0)