Skip to content

Commit fac5fa8

Browse files
authored
document valid coordinate types when reading from or writing to images (#1242)
1 parent f912fe0 commit fac5fa8

2 files changed

Lines changed: 128 additions & 2 deletions

File tree

env/common_properties.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ OpenCL environments:
128128
| `0`
129129
| A 2D depth image.
130130

131-
// image1d_array_t
131+
// image2d_array_t
132132
| *2D*
133133
| `0`
134134
| `1`
135135
| A 2D image array.
136136

137-
// image1d_array_depth_t
137+
// image2d_array_depth_t
138138
| *2D*
139139
| `1`
140140
| `1`

env/image_addressing_and_filtering.asciidoc

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,132 @@ layer = v
956956

957957
(since v is already an integer) and the result is undefined if v is not one of the integers 0, 1, ... `h~t~` - 1.
958958

959+
=== Coordinate Format for Reading and Writing Images
960+
961+
This section describes valid types for the _Coordinate_ operand used by image
962+
read instructions (such as *OpImageRead*) or image write instructions (such as
963+
*OpImageWrite*).
964+
The valid operand types are determined by the *OpImageType* for the image and
965+
whether the image is being read from or written to.
966+
967+
The following table describes the valid types for the _Coordinate_ operand when
968+
reading from the specified image type.
969+
The integer types for the _Coordinate_ operand are only valid when the image is
970+
read without a sampler (such as *OpImageRead*), or with a sampler using
971+
non-normalized texel coordinates, *Nearest* filtering, and either the *None*,
972+
*ClampToEdge*, or *Clamp* addressing mode.
973+
974+
._Mapping Image Types to Coordinate Types for Reading_
975+
[cols="1,1,1,6",options="header"]
976+
|====
977+
| _Dim_ | _Depth_ | _Arrayed_
978+
| *Supported Coordinate Type*
979+
980+
// image1d_t
981+
| *1D* | `0` | `0`
982+
| *OpTypeInt* with _Width_ equal to 32 +
983+
*OpTypeFloat* with _Width_ equal to 32
984+
985+
// image1d_array_t
986+
| *1D* | `0` | `1`
987+
| *OpTypeVector* with 2 components of *OpTypeInt* with _Width_ equal to 32 +
988+
*OpTypeVector* with 2 components of *OpTypeFloat* with _Width_ equal to 32
989+
990+
The array index is provided by the second component of the _Coordinate_.
991+
992+
// image2d_t
993+
| *2D* | `0` | `0`
994+
| *OpTypeVector* with 2 components of *OpTypeInt* with _Width_ equal to 32 +
995+
*OpTypeVector* with 2 components of *OpTypeFloat* with _Width_ equal to 32
996+
997+
// image2d_depth_t
998+
| *2D* | `1` | `0`
999+
| *OpTypeVector* with 2 components of *OpTypeInt* with _Width_ equal to 32 +
1000+
*OpTypeVector* with 2 components of *OpTypeFloat* with _Width_ equal to 32
1001+
1002+
// image2d_array_t
1003+
| *2D* | `0` | `1`
1004+
| *OpTypeVector* with 4 components of *OpTypeInt* with _Width_ equal to 32 +
1005+
*OpTypeVector* with 4 components of *OpTypeFloat* with _Width_ equal to 32
1006+
1007+
The array index is provided by the third component of the _Coordinate_.
1008+
The fourth component of the _Coordinate_ is ignored.
1009+
1010+
// image2d_array_depth_t
1011+
| *2D* | `1` | `1`
1012+
| *OpTypeVector* with 4 components of *OpTypeInt* with _Width_ equal to 32 +
1013+
*OpTypeVector* with 4 components of *OpTypeFloat* with _Width_ equal to 32
1014+
1015+
The array index is provided by the third component of the _Coordinate_.
1016+
The fourth component of the _Coordinate_ is ignored.
1017+
1018+
// image3d_t
1019+
| *3D* | `0` | `0`
1020+
| *OpTypeVector* with 4 components of *OpTypeInt* with _Width_ equal to 32 +
1021+
*OpTypeVector* with 4 components of *OpTypeFloat* with _Width_ equal to 32
1022+
1023+
The fourth component of the _Coordinate_ is ignored.
1024+
1025+
// image1d_buffer_t
1026+
| *Buffer* | `0` | `0`
1027+
| *OpTypeInt* with _Width_ equal to 32 +
1028+
*OpTypeFloat* with _Width_ equal to 32
1029+
1030+
|====
1031+
1032+
The following table describes the valid types for the _Coordinate_ operand when
1033+
writing to the specified image type.
1034+
1035+
._Mapping Image Types to Coordinate Types for Writing_
1036+
[cols="1,1,1,6",options="header"]
1037+
|====
1038+
| _Dim_ | _Depth_ | _Arrayed_
1039+
| *Supported Coordinate Type*
1040+
1041+
// image1d_t
1042+
| *1D* | `0` | `0`
1043+
| *OpTypeInt* with _Width_ equal to 32
1044+
1045+
// image1d_array_t
1046+
| *1D* | `0` | `1`
1047+
| *OpTypeVector* with 2 components of *OpTypeInt* with _Width_ equal to 32
1048+
1049+
The array index is provided by the second component of the _Coordinate_.
1050+
1051+
// image2d_t
1052+
| *2D* | `0` | `0`
1053+
| *OpTypeVector* with 2 components of *OpTypeInt* with _Width_ equal to 32
1054+
1055+
// image2d_depth_t
1056+
| *2D* | `1` | `0`
1057+
| *OpTypeVector* with 2 components of *OpTypeInt* with _Width_ equal to 32
1058+
1059+
// image2d_array_t
1060+
| *2D* | `0` | `1`
1061+
| *OpTypeVector* with 4 components of *OpTypeInt* with _Width_ equal to 32
1062+
1063+
The array index is provided by the third component of the _Coordinate_.
1064+
The fourth component of the _Coordinate_ is ignored.
1065+
1066+
// image2d_array_depth_t
1067+
| *2D* | `1` | `1`
1068+
| *OpTypeVector* with 4 components of *OpTypeInt* with _Width_ equal to 32
1069+
1070+
The array index is provided by the third component of the _Coordinate_.
1071+
The fourth component of the _Coordinate_ is ignored.
1072+
1073+
// image3d_t
1074+
| *3D* | `0` | `0`
1075+
| *OpTypeVector* with 4 components of *OpTypeInt* with _Width_ equal to 32
1076+
1077+
The fourth component of the _Coordinate_ is ignored.
1078+
1079+
// image1d_buffer_t
1080+
| *Buffer* | `0` | `0`
1081+
| *OpTypeInt* with _Width_ equal to 32
1082+
1083+
|====
1084+
9591085
=== Data Format for Reading and Writing Images
9601086

9611087
This section describes how image element data is returned by an

0 commit comments

Comments
 (0)