Ejemplo n.º 1
0
   std::set<cl_image_format>
   supported_formats(const context &ctx, cl_mem_object_type type) {
      std::set<cl_image_format> s;
      pipe_texture_target target = translate_target(type);
      unsigned bindings = (PIPE_BIND_SAMPLER_VIEW |
                           PIPE_BIND_COMPUTE_RESOURCE |
                           PIPE_BIND_TRANSFER_READ |
                           PIPE_BIND_TRANSFER_WRITE);

      for (auto f : formats) {
         if (all_of([=](const device &dev) {
                  return dev.pipe->is_format_supported(
                     dev.pipe, f.second, target, 1, bindings);
               }, ctx.devices()))
            s.insert(f.first);
      }

      return s;
   }