Skip to content

Commit d516cd6

Browse files
committed
Don't expose mipmaps on 1.2 devices
Change-Id: Id7949266f29ef06ae71c88725298822055ca7c13
1 parent 1504d89 commit d516cd6

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

runtime/device/device_caps.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ void Device::initializeCaps() {
123123
deviceInfo.independentForwardProgress = false;
124124
}
125125

126+
if (enabledClVersion >= 20) {
127+
deviceExtensions += "cl_khr_mipmap_image cl_khr_mipmap_image_writes ";
128+
}
129+
126130
if (hwInfo.capabilityTable.ftrSupportsFP64) {
127131
deviceExtensions += "cl_khr_fp64 ";
128132
}

runtime/platform/extensions.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ const char *deviceExtensionsList = "cl_khr_3d_image_writes "
4646
"cl_intel_device_side_avc_motion_estimation "
4747
"cl_khr_priority_hints "
4848
"cl_khr_throttle_hints "
49-
"cl_khr_create_command_queue "
50-
"cl_khr_mipmap_image "
51-
"cl_khr_mipmap_image_writes ";
49+
"cl_khr_create_command_queue ";
5250

5351
std::string getExtensionsList(const HardwareInfo &hwInfo) {
5452
std::string allExtensionsList;

unit_tests/device/device_caps_tests.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,28 @@ TEST(Device_GetCaps, deviceReportsThrottleHintsExtension) {
544544
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_throttle_hints")));
545545
}
546546

547-
TEST(Device_GetCaps, deviceReportsMipmapImageExtensions) {
547+
TEST(Device_GetCaps, givenAtleastOCL2DeviceThenExposesMipmapImageExtensions) {
548+
DebugManagerStateRestore dbgRestorer;
549+
DebugManager.flags.ForceOCLVersion.set(20);
550+
548551
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0]));
549552
const auto &caps = device->getDeviceInfo();
550553

551554
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_mipmap_image")));
552555
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_mipmap_image_writes")));
553556
}
554557

558+
TEST(Device_GetCaps, givenOCL12DeviceThenDoesNotExposeMipmapImageExtensions) {
559+
DebugManagerStateRestore dbgRestorer;
560+
DebugManager.flags.ForceOCLVersion.set(12);
561+
562+
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0]));
563+
const auto &caps = device->getDeviceInfo();
564+
565+
EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_khr_mipmap_image"))));
566+
EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_khr_mipmap_image_writes"))));
567+
}
568+
555569
TEST(Device_GetCaps, givenDeviceThatDoesntHaveFp64ThenExtensionIsNotReported) {
556570
HardwareInfo nonFp64Device = *platformDevices[0];
557571
nonFp64Device.capabilityTable.ftrSupportsFP64 = false;

0 commit comments

Comments
 (0)