|
1 | 1 | #pragma once |
2 | 2 |
|
3 | 3 | #include <sycl/accessor.hpp> |
| 4 | +#include <sycl/accessor_image_base.hpp> |
4 | 5 | #include <sycl/detail/image_accessor_util.hpp> |
5 | 6 | #include <sycl/device.hpp> |
6 | 7 | #include <sycl/image.hpp> |
@@ -61,156 +62,11 @@ void __SYCL_EXPORT sampledImageConstructorNotification( |
61 | 62 | const std::optional<image_target> &Target, const void *Type, |
62 | 63 | uint32_t ElemSize, const code_location &CodeLoc); |
63 | 64 |
|
64 | | -class UnsampledImageAccessorImplHost; |
65 | | -class SampledImageAccessorImplHost; |
66 | | -using UnsampledImageAccessorImplPtr = |
67 | | - std::shared_ptr<UnsampledImageAccessorImplHost>; |
68 | | -using SampledImageAccessorImplPtr = |
69 | | - std::shared_ptr<SampledImageAccessorImplHost>; |
70 | | - |
71 | 65 | void __SYCL_EXPORT |
72 | 66 | addHostUnsampledImageAccessorAndWait(UnsampledImageAccessorImplHost *Req); |
73 | 67 | void __SYCL_EXPORT |
74 | 68 | addHostSampledImageAccessorAndWait(SampledImageAccessorImplHost *Req); |
75 | 69 |
|
76 | | -class __SYCL_EXPORT UnsampledImageAccessorBaseHost { |
77 | | -protected: |
78 | | - UnsampledImageAccessorBaseHost(const UnsampledImageAccessorImplPtr &Impl) |
79 | | - : impl{Impl} {} |
80 | | - |
81 | | -public: |
82 | | - UnsampledImageAccessorBaseHost(sycl::range<3> Size, access_mode AccessMode, |
83 | | - void *SYCLMemObject, int Dims, int ElemSize, |
84 | | - id<3> Pitch, image_channel_type ChannelType, |
85 | | - image_channel_order ChannelOrder, |
86 | | - const property_list &PropertyList = {}); |
87 | | - const sycl::range<3> &getSize() const; |
88 | | - void *getMemoryObject() const; |
89 | | - detail::AccHostDataT &getAccData(); |
90 | | - void *getPtr(); |
91 | | - void *getPtr() const; |
92 | | - int getNumOfDims() const; |
93 | | - int getElementSize() const; |
94 | | - id<3> getPitch() const; |
95 | | - image_channel_type getChannelType() const; |
96 | | - image_channel_order getChannelOrder() const; |
97 | | - const property_list &getPropList() const; |
98 | | - |
99 | | -protected: |
100 | | - template <class Obj> |
101 | | - friend const decltype(Obj::impl) & |
102 | | - detail::getSyclObjImpl(const Obj &SyclObject); |
103 | | - |
104 | | - template <class T> |
105 | | - friend T detail::createSyclObjFromImpl( |
106 | | - std::add_rvalue_reference_t<decltype(T::impl)> ImplObj); |
107 | | - |
108 | | - template <class T> |
109 | | - friend T detail::createSyclObjFromImpl( |
110 | | - std::add_lvalue_reference_t<const decltype(T::impl)> ImplObj); |
111 | | - |
112 | | - UnsampledImageAccessorImplPtr impl; |
113 | | - |
114 | | - // The function references helper methods required by GDB pretty-printers |
115 | | - void GDBMethodsAnchor() { |
116 | | -#ifndef NDEBUG |
117 | | - const auto *this_const = this; |
118 | | - (void)getSize(); |
119 | | - (void)this_const->getSize(); |
120 | | - (void)getPtr(); |
121 | | - (void)this_const->getPtr(); |
122 | | -#endif |
123 | | - } |
124 | | - |
125 | | -#ifndef __SYCL_DEVICE_ONLY__ |
126 | | - // Reads a pixel of the underlying image at the specified coordinate. It is |
127 | | - // the responsibility of the caller to ensure that the coordinate type is |
128 | | - // valid. |
129 | | - template <typename DataT, typename CoordT> |
130 | | - DataT read(const CoordT &Coords) const noexcept { |
131 | | - image_sampler Smpl{addressing_mode::none, |
132 | | - coordinate_normalization_mode::unnormalized, |
133 | | - filtering_mode::nearest}; |
134 | | - return imageReadSamplerHostImpl<CoordT, DataT>( |
135 | | - Coords, Smpl, getSize(), getPitch(), getChannelType(), |
136 | | - getChannelOrder(), getPtr(), getElementSize()); |
137 | | - } |
138 | | - |
139 | | - // Writes to a pixel of the underlying image at the specified coordinate. It |
140 | | - // is the responsibility of the caller to ensure that the coordinate type is |
141 | | - // valid. |
142 | | - template <typename DataT, typename CoordT> |
143 | | - void write(const CoordT &Coords, const DataT &Color) const { |
144 | | - imageWriteHostImpl(Coords, Color, getPitch(), getElementSize(), |
145 | | - getChannelType(), getChannelOrder(), getPtr()); |
146 | | - } |
147 | | -#endif |
148 | | -}; |
149 | | - |
150 | | -class __SYCL_EXPORT SampledImageAccessorBaseHost { |
151 | | -protected: |
152 | | - SampledImageAccessorBaseHost(const SampledImageAccessorImplPtr &Impl) |
153 | | - : impl{Impl} {} |
154 | | - |
155 | | -public: |
156 | | - SampledImageAccessorBaseHost(sycl::range<3> Size, void *SYCLMemObject, |
157 | | - int Dims, int ElemSize, id<3> Pitch, |
158 | | - image_channel_type ChannelType, |
159 | | - image_channel_order ChannelOrder, |
160 | | - image_sampler Sampler, |
161 | | - const property_list &PropertyList = {}); |
162 | | - const sycl::range<3> &getSize() const; |
163 | | - void *getMemoryObject() const; |
164 | | - detail::AccHostDataT &getAccData(); |
165 | | - void *getPtr(); |
166 | | - void *getPtr() const; |
167 | | - int getNumOfDims() const; |
168 | | - int getElementSize() const; |
169 | | - id<3> getPitch() const; |
170 | | - image_channel_type getChannelType() const; |
171 | | - image_channel_order getChannelOrder() const; |
172 | | - image_sampler getSampler() const; |
173 | | - const property_list &getPropList() const; |
174 | | - |
175 | | -protected: |
176 | | - template <class Obj> |
177 | | - friend const decltype(Obj::impl) & |
178 | | - detail::getSyclObjImpl(const Obj &SyclObject); |
179 | | - |
180 | | - template <class T> |
181 | | - friend T detail::createSyclObjFromImpl( |
182 | | - std::add_rvalue_reference_t<decltype(T::impl)> ImplObj); |
183 | | - |
184 | | - template <class T> |
185 | | - friend T detail::createSyclObjFromImpl( |
186 | | - std::add_lvalue_reference_t<const decltype(T::impl)> ImplObj); |
187 | | - |
188 | | - SampledImageAccessorImplPtr impl; |
189 | | - |
190 | | - // The function references helper methods required by GDB pretty-printers |
191 | | - void GDBMethodsAnchor() { |
192 | | -#ifndef NDEBUG |
193 | | - const auto *this_const = this; |
194 | | - (void)getSize(); |
195 | | - (void)this_const->getSize(); |
196 | | - (void)getPtr(); |
197 | | - (void)this_const->getPtr(); |
198 | | -#endif |
199 | | - } |
200 | | - |
201 | | -#ifndef __SYCL_DEVICE_ONLY__ |
202 | | - // Reads a pixel of the underlying image at the specified coordinate. It is |
203 | | - // the responsibility of the caller to ensure that the coordinate type is |
204 | | - // valid. |
205 | | - template <typename DataT, typename CoordT> |
206 | | - DataT read(const CoordT &Coords) const { |
207 | | - return imageReadSamplerHostImpl<CoordT, DataT>( |
208 | | - Coords, getSampler(), getSize(), getPitch(), getChannelType(), |
209 | | - getChannelOrder(), getPtr(), getElementSize()); |
210 | | - } |
211 | | -#endif |
212 | | -}; |
213 | | - |
214 | 70 | template <typename DataT, int Dimensions, access::mode AccessMode, |
215 | 71 | access::placeholder IsPlaceholder> |
216 | 72 | class __image_array_slice__; |
|
0 commit comments