STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
xxamp_inl.h
Go to the documentation of this file.
1 /***
2 * ==++==
3 *
4 * Copyright (c) Microsoft Corporation. All rights reserved.
5 *
6 * ==--==
7 * =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
8 *
9 * xxamp_inl.h
10 *
11 * C++ AMP Library helper classes implementations.
12 *
13 * This file contains the bodies of medthods declared in xxamp which rely on
14 * amp.h class defintions.
15 *
16 * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
17 ****/
18 
19 #pragma once
20 
21 #include <xxamp.h>
22 
23 
24 namespace Concurrency
25 {
26 namespace details
27 {
28 
29 // Projection Helpers
30 
31 template <typename _T, int _R>
32 /*static*/ inline typename _Projection_result_type<_T,_R>::_Const_result_type
34 {
36  _Arr_view->_Project0(_I, _Projected_view);
37  return _Projected_view;
38 }
39 
40 template <typename _T, int _R>
41 /*static*/ inline typename _Projection_result_type<_T,_R>::_Result_type
43 {
44  typename _Projection_result_type<_T,_R>::_Result_type _Projected_view;
45  _Arr_view->_Project0(_I, _Projected_view);
46  return _Projected_view;
47 }
48 
49 template <typename _T>
52 {
53  return _Arr_view->operator[](index<1>(_I));
54 }
55 
56 template <typename _T>
57 /*static*/ inline typename _Projection_result_type<_T,1>::_Result_type
59 {
60  return _Arr_view->operator[](index<1>(_I));
61 }
62 
63 template <typename _T, int _R>
66 {
67  array_view<const _T,_R> _Temp(*_Array);
69 }
70 
71 template <typename _T, int _R>
72 /*static*/ inline typename _Projection_result_type<_T,_R>::_Result_type
74 {
75  array_view<_T,_R> _Temp(*_Array);
77 }
78 
79 template <typename _T>
82 {
83  return _Array->operator[](index<1>(_I));
84 }
85 
86 template <typename _T>
87 /*static*/ inline typename _Projection_result_type<_T,1>::_Result_type
89 {
90  return _Array->operator[](index<1>(_I));
91 }
92 
93 // Calculate the extent dimensions at selected mipmap level given base exent
94 template<int _Rank>
95 inline extent<_Rank> _Get_extent_at_level_unsafe(const extent<_Rank> &_Base_extent, unsigned int _Level) __GPU
96 {
97  static_assert(_Rank >= 3, "_Rank >= 3");
98 }
99 
100 template<>
101 inline extent<1> _Get_extent_at_level_unsafe<1>(const extent<1> &_Base_extent, unsigned int _Level) __GPU
102 {
103  extent<1> _Extent_at_level(_Base_extent);
104 
105  _Extent_at_level[0] >>= _Level;
106  _Extent_at_level[0] = _Extent_at_level[0] ? _Extent_at_level[0] : 1;
107 
108  return _Extent_at_level;
109 }
110 
111 template<>
112 inline extent<2> _Get_extent_at_level_unsafe<2>(const extent<2> &_Base_extent, unsigned int _Level) __GPU
113 {
114  extent<2> _Extent_at_level(_Base_extent);
115 
116  _Extent_at_level[0] >>= _Level;
117  _Extent_at_level[1] >>= _Level;
118  _Extent_at_level[0] = _Extent_at_level[0] ? _Extent_at_level[0] : 1;
119  _Extent_at_level[1] = _Extent_at_level[1] ? _Extent_at_level[1] : 1;
120 
121  return _Extent_at_level;
122 }
123 
124 template<>
125 inline extent<3> _Get_extent_at_level_unsafe<3>(const extent<3> &_Base_extent, unsigned int _Level) __GPU
126 {
127  extent<3> _Extent_at_level(_Base_extent);
128 
129  _Extent_at_level[0] >>= _Level;
130  _Extent_at_level[1] >>= _Level;
131  _Extent_at_level[2] >>= _Level;
132  _Extent_at_level[0] = _Extent_at_level[0] ? _Extent_at_level[0] : 1;
133  _Extent_at_level[1] = _Extent_at_level[1] ? _Extent_at_level[1] : 1;
134  _Extent_at_level[2] = _Extent_at_level[2] ? _Extent_at_level[2] : 1;
135 
136  return _Extent_at_level;
137 }
138 
139 // Calculate the extent dimensions at selected mipmap level given base exent
140 template<int _Rank>
141 inline extent<_Rank> _Get_extent_at_level(const extent<_Rank> &_Base_extent, unsigned int _Level)
142 {
144  return _Get_extent_at_level_unsafe(_Base_extent, _Level);
145 }
146 
147 } // namespace details
148 } // namespace concurrency
static _Projection_result_type< _T, _R >::_Result_type _Project0(const array_view< _T, _R > *_Arr_view, int _I) __GPU
Definition: xxamp_inl.h:42
extent< _Rank > _Get_extent_at_level(const extent< _Rank > &_Base_extent, unsigned int _Level)
Definition: xxamp_inl.h:141
#define __GPU
Definition: amprt.h:45
The Concurrency namespace provides classes and functions that provide access to the Concurrency Runti...
Definition: agents.h:43
void _Project0(int _I, array_view< _Value_type, _Rank-1 > &_Projected_view) const __GPU
Definition: amp.h:2988
void _Are_valid_mipmap_parameters(unsigned int _Most_detailed_mipmap_level, unsigned int _Mipmap_levels=0)
Definition: xxamp.h:1246
extent< 1 > _Get_extent_at_level_unsafe< 1 >(const extent< 1 > &_Base_extent, unsigned int _Level) __GPU
Definition: xxamp_inl.h:101
#define _In_
Definition: sal.h:305
extent< _Rank > _Get_extent_at_level_unsafe(const extent< _Rank > &_Base_extent, unsigned int _Level) __GPU
Definition: xxamp_inl.h:95
The extent type represents an N-dimensional vector of int which specifies the bounds of an N-dimen...
Definition: amp.h:383
An array is a multi-dimensional data aggregate on a accelerator_view.
Definition: amp.h:3865
extent< 3 > _Get_extent_at_level_unsafe< 3 >(const extent< 3 > &_Base_extent, unsigned int _Level) __GPU
Definition: xxamp_inl.h:125
static _Projection_result_type< _T, _R >::_Result_type _Project0(_In_ array< _T, _R > *_Array, int _I) __GPU
Definition: xxamp_inl.h:73
Define an N-dimensional index point; which may also be viewed as a vector based at the origin in N-sp...
Definition: amp.h:53
static _Projection_result_type< _T, _R >::_Const_result_type _Project0(const array_view< const _T, _R > *_Arr_view, int _I) __GPU
Definition: xxamp_inl.h:33
extent< 2 > _Get_extent_at_level_unsafe< 2 >(const extent< 2 > &_Base_extent, unsigned int _Level) __GPU
Definition: xxamp_inl.h:112
An array_view is an N-dimensional view over data held in another container (such as array
Definition: amp.h:2236
static _Projection_result_type< _T, _R >::_Const_result_type _Project0(const array< _T, _R > *_Array, int _I) __GPU
Definition: xxamp_inl.h:65