DPC++ Runtime
Runtime libraries for oneAPI DPC++
sampler_impl.hpp
Go to the documentation of this file.
1 //==----------------- sampler_impl.hpp - SYCL standard header file ---------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
12 #include <sycl/context.hpp>
13 #include <sycl/detail/export.hpp>
14 #include <sycl/property_list.hpp>
15 
16 #include <unordered_map>
17 
18 namespace sycl {
20 
21 enum class addressing_mode : unsigned int;
22 enum class filtering_mode : unsigned int;
23 enum class coordinate_normalization_mode : unsigned int;
24 
25 namespace detail {
26 class __SYCL_EXPORT sampler_impl {
27 public:
29  addressing_mode addressingMode, filtering_mode filteringMode,
30  const property_list &propList);
31 
32  sampler_impl(cl_sampler clSampler, const context &syclContext);
33 
34  addressing_mode get_addressing_mode() const;
35 
36  filtering_mode get_filtering_mode() const;
37 
38  coordinate_normalization_mode get_coordinate_normalization_mode() const;
39 
40  RT::PiSampler getOrCreateSampler(const context &Context);
41 
45  template <typename propertyT> bool has_property() const noexcept {
46  return MPropList.has_property<propertyT>();
47  }
48 
55  template <typename propertyT> propertyT get_property() const {
56  return MPropList.get_property<propertyT>();
57  }
58 
59  ~sampler_impl();
60 
61 private:
63  std::mutex MMutex;
64 
65  std::unordered_map<context, RT::PiSampler> MContextToSampler;
66 
67  coordinate_normalization_mode MCoordNormMode;
68  addressing_mode MAddrMode;
69  filtering_mode MFiltMode;
70  property_list MPropList;
71 };
72 
73 } // namespace detail
74 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
75 } // namespace sycl
sycl::_V1::property_list
Objects of the property_list class are containers for the SYCL properties.
Definition: property_list.hpp:24
property_list.hpp
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:11
sycl::_V1::detail::sampler_impl::has_property
bool has_property() const noexcept
Checks if this sampler_impl has a property of type propertyT.
Definition: sampler_impl.hpp:45
context.hpp
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14
sycl::_V1::detail::pi::PiSampler
::pi_sampler PiSampler
Definition: pi.hpp:139
export.hpp
sycl::_V1::addressing_mode
addressing_mode
Definition: sampler.hpp:20
sycl::_V1::coordinate_normalization_mode
coordinate_normalization_mode
Definition: sampler.hpp:33
sycl::_V1::filtering_mode
filtering_mode
Definition: sampler.hpp:28
sycl::_V1::detail::sampler_impl::get_property
propertyT get_property() const
Gets the specified property of this sampler_impl.
Definition: sampler_impl.hpp:55
sycl::_V1::detail::sampler_impl
Definition: sampler_impl.hpp:26
sycl::_V1::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:41
spirv_types.hpp