source.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //---------------------------------------------------------------------------//
  2. // Copyright (c) 2013-2014 Kyle Lutz <[email protected]>
  3. //
  4. // Distributed under the Boost Software License, Version 1.0
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. //
  8. // See http://boostorg.github.com/compute for more information.
  9. //---------------------------------------------------------------------------//
  10. #ifndef BOOST_COMPUTE_UTILITY_SOURCE_HPP
  11. #define BOOST_COMPUTE_UTILITY_SOURCE_HPP
  12. /// Stringizes OpenCL source code.
  13. ///
  14. /// For example, to create a simple kernel which squares each input value:
  15. /// \code
  16. /// const char source[] = BOOST_COMPUTE_STRINGIZE_SOURCE(
  17. /// __kernel void square(const float *input, float *output)
  18. /// {
  19. /// const uint i = get_global_id(0);
  20. /// const float x = input[i];
  21. /// output[i] = x * x;
  22. /// }
  23. /// );
  24. ///
  25. /// // create and build square program
  26. /// program square_program = program::build_with_source(source, context);
  27. ///
  28. /// // create square kernel
  29. /// kernel square_kernel(square_program, "square");
  30. /// \endcode
  31. #ifdef BOOST_COMPUTE_DOXYGEN_INVOKED
  32. #define BOOST_COMPUTE_STRINGIZE_SOURCE(source)
  33. #else
  34. #define BOOST_COMPUTE_STRINGIZE_SOURCE(...) #__VA_ARGS__
  35. #endif
  36. #endif // BOOST_COMPUTE_UTILITY_SOURCE_HPP