ClGenerators.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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/cl.hpp>
  9. #endif
  10. namespace mnd
  11. {
  12. class ClGenerator;
  13. class ClGeneratorFloat;
  14. class ClGeneratorDouble;
  15. class ClGeneratorDoubleDouble;
  16. class ClGeneratorQuadDouble;
  17. class ClGenerator128;
  18. }
  19. class mnd::ClGenerator : public Generator
  20. {
  21. protected:
  22. cl::Device device;
  23. cl::Context context;
  24. cl::Program program;
  25. cl::CommandQueue queue;
  26. public:
  27. ClGenerator(cl::Device device);
  28. virtual ~ClGenerator(void);
  29. virtual void generate(const MandelInfo& info, float* data);
  30. protected:
  31. virtual std::string getKernelCode(bool smooth) const = 0;
  32. };
  33. class mnd::ClGeneratorFloat : public ClGenerator
  34. {
  35. public:
  36. ClGeneratorFloat(cl::Device device);
  37. virtual ~ClGeneratorFloat(void) = default;
  38. protected:
  39. virtual std::string getKernelCode(bool smooth) const;
  40. };
  41. class mnd::ClGeneratorDouble : public ClGenerator
  42. {
  43. public:
  44. ClGeneratorDouble(cl::Device device);
  45. virtual ~ClGeneratorDouble(void) = default;
  46. virtual void generate(const MandelInfo& info, float* data);
  47. protected:
  48. virtual std::string getKernelCode(bool smooth) const;
  49. };
  50. class mnd::ClGeneratorDoubleDouble : public ClGenerator
  51. {
  52. bool smooth;
  53. public:
  54. ClGeneratorDoubleDouble(cl::Device device);
  55. virtual ~ClGeneratorDoubleDouble(void) = default;
  56. virtual void generate(const MandelInfo& info, float* data);
  57. protected:
  58. virtual std::string getKernelCode(bool smooth) const;
  59. };
  60. class mnd::ClGeneratorQuadDouble : public ClGenerator
  61. {
  62. bool smooth;
  63. public:
  64. ClGeneratorQuadDouble(cl::Device device);
  65. virtual ~ClGeneratorQuadDouble(void) = default;
  66. virtual void generate(const MandelInfo& info, float* data);
  67. protected:
  68. virtual std::string getKernelCode(bool smooth) const;
  69. };
  70. class mnd::ClGenerator128 : public ClGenerator
  71. {
  72. public:
  73. ClGenerator128(cl::Device device);
  74. virtual ~ClGenerator128(void) = default;
  75. virtual void generate(const MandelInfo& info, float* data);
  76. protected:
  77. virtual std::string getKernelCode(bool smooth) const;
  78. };
  79. #endif // WITH_OPENCL
  80. #endif // MANDEL_CLGENERATORS_H