clover: Move device extensions definitions to core/device.cpp
authorPierre Moreau <pierre.morrow@free.fr>
Sun, 21 Jan 2018 17:49:00 +0000 (18:49 +0100)
committerKarol Herbst <kherbst@redhat.com>
Tue, 26 Feb 2019 20:02:07 +0000 (21:02 +0100)
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Aaron Watry <awatry@gmail.com>
src/gallium/state_trackers/clover/api/device.cpp
src/gallium/state_trackers/clover/core/device.cpp
src/gallium/state_trackers/clover/core/device.hpp

index 5a4f94c114143a4d1dc0b7ca652fcbf78ffee239..ca6b90ba271c07047672d778780ba29e71745539 100644 (file)
@@ -326,16 +326,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
       break;
 
    case CL_DEVICE_EXTENSIONS:
-      buf.as_string() =
-         "cl_khr_byte_addressable_store"
-         " cl_khr_global_int32_base_atomics"
-         " cl_khr_global_int32_extended_atomics"
-         " cl_khr_local_int32_base_atomics"
-         " cl_khr_local_int32_extended_atomics"
-         + std::string(dev.has_int64_atomics() ? " cl_khr_int64_base_atomics" : "")
-         + std::string(dev.has_int64_atomics() ? " cl_khr_int64_extended_atomics" : "")
-         + std::string(dev.has_doubles() ? " cl_khr_fp64" : "")
-         + std::string(dev.has_halves() ? " cl_khr_fp16" : "");
+      buf.as_string() = dev.supported_extensions();
       break;
 
    case CL_DEVICE_PLATFORM:
index 010bae81403213798e790bdc0635ee113534ba73..0c02039eba7695c1cceb6ad07d9eeac48334caac 100644 (file)
@@ -278,3 +278,17 @@ device::supports_ir(enum pipe_shader_ir ir) const {
    return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE,
                                  PIPE_SHADER_CAP_SUPPORTED_IRS) & (1 << ir);
 }
+
+std::string
+device::supported_extensions() const {
+   return
+      "cl_khr_byte_addressable_store"
+      " cl_khr_global_int32_base_atomics"
+      " cl_khr_global_int32_extended_atomics"
+      " cl_khr_local_int32_base_atomics"
+      " cl_khr_local_int32_extended_atomics"
+      + std::string(has_int64_atomics() ? " cl_khr_int64_base_atomics" : "")
+      + std::string(has_int64_atomics() ? " cl_khr_int64_extended_atomics" : "")
+      + std::string(has_doubles() ? " cl_khr_fp64" : "")
+      + std::string(has_halves() ? " cl_khr_fp16" : "");
+}
index ebe15f28e93acbffdcb76856787d785f6419fc73..a7084e863f49b2ce3f9d734cb43f1b3c3607dd29 100644 (file)
@@ -83,6 +83,7 @@ namespace clover {
       std::string ir_target() const;
       enum pipe_endian endianness() const;
       bool supports_ir(enum pipe_shader_ir ir) const;
+      std::string supported_extensions() const;
 
       friend class command_queue;
       friend class root_resource;