Wayverb
program_wrapper.h
1 #pragma once
2 
3 #include "core/cl/common.h"
4 
5 namespace wayverb {
6 namespace core {
7 
8 class program_wrapper final {
9 public:
10  program_wrapper(const compute_context& cc, const std::string& source);
12  const std::pair<const char*, size_t>& source);
14  const std::vector<std::string>& sources);
16  const std::vector<std::pair<const char*, size_t>>& sources);
17 
18  program_wrapper(const program_wrapper&) = default;
19  program_wrapper& operator=(const program_wrapper&) = default;
20 
21  program_wrapper(program_wrapper&&) noexcept = delete;
22  program_wrapper& operator=(program_wrapper&&) noexcept = delete;
23 
24  template <cl_program_info T>
25  auto get_info() const {
26  return program.getInfo<T>();
27  }
28 
29  cl::Device get_device() const;
30 
31  template <typename... Ts>
32  auto get_kernel(const char* kernel_name) const {
33  int error;
34  return cl::make_kernel<Ts...>(program, kernel_name, &error);
35  }
36 
37 private:
38  void build(const cl::Device& device) const;
39 
40  cl::Device device;
41  cl::Program program;
42 };
43 
44 } // namespace core
45 } // namespace wayverb
Definition: traits.cpp:2
Definition: program_wrapper.h:8
Definition: capsule_base.h:9
Definition: gpu_geometry_tests.cpp:24
invariant: device is a valid device for the context
Definition: common.h:13