ClGenerators.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef MANDEL_CLGENERATORS_H
  2. #define MANDEL_CLGENERATORS_H
  3. #ifdef WITH_OPENCL
  4. #include "Generators.h"
  5. #ifdef __APPLE__
  6. #include <OpenCL/cl.hpp>
  7. #else
  8. #include <CL/cl2.hpp>
  9. #endif
  10. namespace mnd
  11. {
  12. class ClGenerator;
  13. class ClGeneratorFloat;
  14. class ClGeneratorDouble;
  15. class ClGenerator128;
  16. }
  17. class mnd::ClGenerator : public Generator
  18. {
  19. protected:
  20. cl::Device device;
  21. cl::Context context;
  22. cl::Program program;
  23. cl::CommandQueue queue;
  24. public:
  25. ClGenerator(cl::Device device);
  26. virtual ~ClGenerator(void);
  27. virtual void generate(const MandelInfo& info, float* data);
  28. protected:
  29. virtual std::string getKernelCode(bool smooth) const = 0;
  30. };
  31. class mnd::ClGeneratorFloat : public ClGenerator
  32. {
  33. public:
  34. ClGeneratorFloat(cl::Device device, bool smooth);
  35. virtual ~ClGeneratorFloat(void) = default;
  36. protected:
  37. virtual std::string getKernelCode(bool smooth) const;
  38. };
  39. class mnd::ClGeneratorDouble : public ClGenerator
  40. {
  41. public:
  42. ClGeneratorDouble(cl::Device device, bool smooth);
  43. virtual ~ClGeneratorDouble(void) = default;
  44. virtual void generate(const MandelInfo& info, float* data);
  45. protected:
  46. virtual std::string getKernelCode(bool smooth) const;
  47. };
  48. class mnd::ClGeneratorDoubleDouble : public ClGenerator
  49. {
  50. public:
  51. ClGeneratorDoubleDouble(cl::Device device, bool smooth);
  52. virtual ~ClGeneratorDouble(void) = default;
  53. virtual void generate(const MandelInfo& info, float* data);
  54. protected:
  55. virtual std::string getKernelCode(bool smooth) const;
  56. };
  57. class mnd::ClGenerator128 : public ClGenerator
  58. {
  59. public:
  60. ClGenerator128(cl::Device device, bool smooth);
  61. virtual ~ClGenerator128(void) = default;
  62. virtual void generate(const MandelInfo& info, float* data);
  63. protected:
  64. virtual std::string getKernelCode(bool smooth) const;
  65. };
  66. #endif // WITH_OPENCL
  67. #endif // MANDEL_CLGENERATORS_H