clover/il: return IL only for spirv and correct length
authorDave Airlie <airlied@redhat.com>
Wed, 14 Jul 2021 01:32:54 +0000 (11:32 +1000)
committerMarge Bot <eric+marge@anholt.net>
Tue, 20 Jul 2021 00:38:39 +0000 (00:38 +0000)
This is specified as  char[] and I don't think requires null termination,
Also we should only return IL based programs.

Fixes CTS spirv_new get_program_il

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11868>

src/gallium/frontends/clover/api/program.cpp

index e97705b..d67613f 100644 (file)
@@ -534,8 +534,8 @@ clGetProgramInfo(cl_program d_prog, cl_program_info param,
       break;
 
    case CL_PROGRAM_IL:
-      if (prog.il_type() != program::il_type::none)
-         buf.as_string() = prog.source();
+      if (prog.il_type() == program::il_type::spirv)
+         buf.as_vector<char>() = prog.source();
       else if (r_size)
          *r_size = 0u;
       break;