clover: clGetProgramInfo support for OpenCL 1.2.
authorEdB <edb+mesa@sigluy.net>
Tue, 5 Aug 2014 17:09:38 +0000 (19:09 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Sun, 17 Aug 2014 20:34:11 +0000 (23:34 +0300)
[ Francisco Jerez: Rework using fold() for conciseness. ]

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: EdB <edb+mesa@sigluy.net>
src/gallium/state_trackers/clover/api/program.cpp

index b81ce69652f995ffe64decb2e10a14b08784dcc1..8d9d3ac62d5d7e56f1ade15485dafc1c3e507a89 100644 (file)
@@ -232,6 +232,17 @@ clGetProgramInfo(cl_program d_prog, cl_program_info param,
          prog.devices());
       break;
 
+   case CL_PROGRAM_NUM_KERNELS:
+      buf.as_scalar<cl_uint>() = prog.symbols().size();
+      break;
+
+   case CL_PROGRAM_KERNEL_NAMES:
+      buf.as_string() = fold([](const std::string &a, const module::symbol &s) {
+            return ((a.empty() ? "" : a + ";") +
+                    std::string(s.name.begin(), s.name.size()));
+         }, std::string(), prog.symbols());
+      break;
+
    default:
       throw error(CL_INVALID_VALUE);
    }