Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. //
  2. // Copyright 2012 Francisco Jerez
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a
  5. // copy of this software and associated documentation files (the "Software"),
  6. // to deal in the Software without restriction, including without limitation
  7. // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. // and/or sell copies of the Software, and to permit persons to whom the
  9. // Software is furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  17. // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. // OTHER DEALINGS IN THE SOFTWARE.
  21. //
  22.  
  23. #ifndef __CORE_DEVICE_HPP__
  24. #define __CORE_DEVICE_HPP__
  25.  
  26. #include <set>
  27. #include <vector>
  28.  
  29. #include "core/base.hpp"
  30. #include "core/format.hpp"
  31. #include "pipe-loader/pipe_loader.h"
  32.  
  33. namespace clover {
  34.    typedef struct _cl_device_id device;
  35.    typedef struct _cl_platform_id platform;
  36.    class root_resource;
  37.    class hard_event;
  38. }
  39.  
  40. struct _cl_device_id {
  41. public:
  42.    _cl_device_id(clover::platform &platform, pipe_loader_device *ldev);
  43.    _cl_device_id(_cl_device_id &&dev);
  44.    _cl_device_id(const _cl_device_id &dev) = delete;
  45.    ~_cl_device_id();
  46.  
  47.    _cl_device_id &operator=(_cl_device_id dev);
  48.  
  49.    cl_device_type type() const;
  50.    cl_uint vendor_id() const;
  51.    size_t max_images_read() const;
  52.    size_t max_images_write() const;
  53.    cl_uint max_image_levels_2d() const;
  54.    cl_uint max_image_levels_3d() const;
  55.    cl_uint max_samplers() const;
  56.    cl_ulong max_mem_global() const;
  57.    cl_ulong max_mem_local() const;
  58.    cl_ulong max_mem_input() const;
  59.    cl_ulong max_const_buffer_size() const;
  60.    cl_uint max_const_buffers() const;
  61.    size_t max_threads_per_block() const;
  62.    cl_ulong max_mem_alloc_size() const;
  63.  
  64.    std::vector<size_t> max_block_size() const;
  65.    std::string device_name() const;
  66.    std::string vendor_name() const;
  67.    enum pipe_shader_ir ir_format() const;
  68.    std::string ir_target() const;
  69.    enum pipe_endian endianness() const;
  70.  
  71.    friend struct _cl_command_queue;
  72.    friend class clover::root_resource;
  73.    friend class clover::hard_event;
  74.    friend std::set<cl_image_format>
  75.    clover::supported_formats(cl_context, cl_mem_object_type);
  76.  
  77.    clover::platform &platform;
  78.  
  79. private:
  80.    pipe_screen *pipe;
  81.    pipe_loader_device *ldev;
  82. };
  83.  
  84. #endif
  85.