1e5c31af7Sopenharmony_ci# AmberScript
2e5c31af7Sopenharmony_ci * DRAFT
3e5c31af7Sopenharmony_ci
4e5c31af7Sopenharmony_ciThis document defines the script input language for the Amber system. The format
5e5c31af7Sopenharmony_ciis based on the Talvos format, VkRunner format, and VkScript proposed format.
6e5c31af7Sopenharmony_ci
7e5c31af7Sopenharmony_ci## Specification
8e5c31af7Sopenharmony_ciAll amber scripts must start with `#!amber` as the first line. Comments are
9e5c31af7Sopenharmony_cispecified by a # character and continue to the end of the line, except in
10e5c31af7Sopenharmony_ciinlined shader source code, where AmberScript comments are not
11e5c31af7Sopenharmony_cipossible. Keywords are case sensitive. All names are made up of ASCII
12e5c31af7Sopenharmony_cicharacters, and delimited by whitespace.
13e5c31af7Sopenharmony_ci
14e5c31af7Sopenharmony_ciTODO(dneto): What characters are valid in a name?
15e5c31af7Sopenharmony_ci
16e5c31af7Sopenharmony_ci### Number literals
17e5c31af7Sopenharmony_ci
18e5c31af7Sopenharmony_ciLiteral numbers are normally presented in decimal form.  They are interpreted
19e5c31af7Sopenharmony_cias integers or floating point depending on context: a command parameter is
20e5c31af7Sopenharmony_cipredefined as either integral or floating point, or the data type is
21e5c31af7Sopenharmony_ciuser-specified (such as for buffer data).
22e5c31af7Sopenharmony_ci
23e5c31af7Sopenharmony_ciHex values: Whenever an integer is expected, you may use a hexadecimal number,
24e5c31af7Sopenharmony_ciwhich is the characters `0x` followed by hexadecimal digits.
25e5c31af7Sopenharmony_ci
26e5c31af7Sopenharmony_ci### Requesting features
27e5c31af7Sopenharmony_ci
28e5c31af7Sopenharmony_ciIf specific device features are required you can use the `DEVICE_FEATURE`
29e5c31af7Sopenharmony_cicommand to enable them.
30e5c31af7Sopenharmony_ci
31e5c31af7Sopenharmony_ci```groovy
32e5c31af7Sopenharmony_ciDEVICE_FEATURE vertexPipelineStoresAndAtomics
33e5c31af7Sopenharmony_ciDEVICE_FEATURE VariablePointerFeatures.variablePointersStorageBuffer
34e5c31af7Sopenharmony_ci```
35e5c31af7Sopenharmony_ci
36e5c31af7Sopenharmony_ciCurrently each of the items in `VkPhysicalDeviceFeatures` are recognized along
37e5c31af7Sopenharmony_ciwith:
38e5c31af7Sopenharmony_ci * `VariablePointerFeatures.variablePointers`
39e5c31af7Sopenharmony_ci * `VariablePointerFeatures.variablePointersStorageBuffer`
40e5c31af7Sopenharmony_ci * `Float16Int8Features.shaderFloat16`
41e5c31af7Sopenharmony_ci * `Float16Int8Features.shaderInt8`
42e5c31af7Sopenharmony_ci * `Storage8BitFeatures.storageBuffer8BitAccess`
43e5c31af7Sopenharmony_ci * `Storage8BitFeatures.uniformAndStorageBuffer8BitAccess`
44e5c31af7Sopenharmony_ci * `Storage8BitFeatures.storagePushConstant8`
45e5c31af7Sopenharmony_ci * `Storage16BitFeatures.storageBuffer16BitAccess`
46e5c31af7Sopenharmony_ci * `Storage16BitFeatures.uniformAndStorageBuffer16BitAccess`
47e5c31af7Sopenharmony_ci * `Storage16BitFeatures.storagePushConstant16`
48e5c31af7Sopenharmony_ci * `Storage16BitFeatures.storageInputOutput16`
49e5c31af7Sopenharmony_ci * `SubgroupSizeControl.subgroupSizeControl`
50e5c31af7Sopenharmony_ci * `SubgroupSizeControl.computeFullSubgroups`
51e5c31af7Sopenharmony_ci * `SubgroupSupportedOperations.basic`
52e5c31af7Sopenharmony_ci * `SubgroupSupportedOperations.vote`
53e5c31af7Sopenharmony_ci * `SubgroupSupportedOperations.arithmetic`
54e5c31af7Sopenharmony_ci * `SubgroupSupportedOperations.ballot`
55e5c31af7Sopenharmony_ci * `SubgroupSupportedOperations.shuffle`
56e5c31af7Sopenharmony_ci * `SubgroupSupportedOperations.shuffleRelative`
57e5c31af7Sopenharmony_ci * `SubgroupSupportedOperations.clustered`
58e5c31af7Sopenharmony_ci * `SubgroupSupportedOperations.quad`
59e5c31af7Sopenharmony_ci * `SubgroupSupportedStages.vertex`
60e5c31af7Sopenharmony_ci * `SubgroupSupportedStages.tessellationControl`
61e5c31af7Sopenharmony_ci * `SubgroupSupportedStages.tessellationEvaluation`
62e5c31af7Sopenharmony_ci * `SubgroupSupportedStages.geometry`
63e5c31af7Sopenharmony_ci * `SubgroupSupportedStages.fragment`
64e5c31af7Sopenharmony_ci * `SubgroupSupportedStages.compute`
65e5c31af7Sopenharmony_ci
66e5c31af7Sopenharmony_ci
67e5c31af7Sopenharmony_ciExtensions can be enabled with the `DEVICE_EXTENSION` and `INSTANCE_EXTENSION`
68e5c31af7Sopenharmony_cicommands.
69e5c31af7Sopenharmony_ci
70e5c31af7Sopenharmony_ci```groovy
71e5c31af7Sopenharmony_ciDEVICE_EXTENSION VK_KHR_get_physical_device_properties2
72e5c31af7Sopenharmony_ciINSTANCE_EXTENSION VK_KHR_storage_buffer_storage_class
73e5c31af7Sopenharmony_ci```
74e5c31af7Sopenharmony_ci
75e5c31af7Sopenharmony_ci### Setting Engine Configuration
76e5c31af7Sopenharmony_ci
77e5c31af7Sopenharmony_ciIn some instances there is extra data we want to provide to an engine for
78e5c31af7Sopenharmony_ciconfiguration purposes. The `SET ENGINE_DATA` command allows that for the given
79e5c31af7Sopenharmony_ciset of data types.
80e5c31af7Sopenharmony_ci
81e5c31af7Sopenharmony_ci#### Engine Data Variables
82e5c31af7Sopenharmony_ci  * `fence_timeout_ms`  - value must be a single uint32 in milliseconds.
83e5c31af7Sopenharmony_ci
84e5c31af7Sopenharmony_ci```groovy
85e5c31af7Sopenharmony_ciSET ENGINE_DATA {engine data variable} {value}*
86e5c31af7Sopenharmony_ci```
87e5c31af7Sopenharmony_ci
88e5c31af7Sopenharmony_ci### Virtual File Store
89e5c31af7Sopenharmony_ci
90e5c31af7Sopenharmony_ciEach amber script contains a virtual file system that can store files of textual
91e5c31af7Sopenharmony_cidata. This lets you bundle multiple source files into a single, hermetic amber
92e5c31af7Sopenharmony_ciscript file.
93e5c31af7Sopenharmony_ci
94e5c31af7Sopenharmony_ciVirtual files are declared using the `VIRTUAL_FILE` command:
95e5c31af7Sopenharmony_ci
96e5c31af7Sopenharmony_ci```groovy
97e5c31af7Sopenharmony_ciVIRTUAL_FILE {path}
98e5c31af7Sopenharmony_ci {file-content}
99e5c31af7Sopenharmony_ciEND
100e5c31af7Sopenharmony_ci```
101e5c31af7Sopenharmony_ci
102e5c31af7Sopenharmony_ciPaths must be unique.
103e5c31af7Sopenharmony_ci
104e5c31af7Sopenharmony_ciShaders can directly reference these virtual files for their source. \
105e5c31af7Sopenharmony_ciHLSL shaders that `#include` other `.hlsl` files will first check the virtual
106e5c31af7Sopenharmony_cifile system, before falling back to the standard file system.
107e5c31af7Sopenharmony_ci
108e5c31af7Sopenharmony_ci### Shaders
109e5c31af7Sopenharmony_ci
110e5c31af7Sopenharmony_ciShader programs are declared using the `SHADER` command. \
111e5c31af7Sopenharmony_ciShaders can be declared as `PASSTHROUGH`, with inlined source or using source
112e5c31af7Sopenharmony_cifrom a `VIRTUAL_FILE`.
113e5c31af7Sopenharmony_ci
114e5c31af7Sopenharmony_ciPass-through shader:
115e5c31af7Sopenharmony_ci
116e5c31af7Sopenharmony_ci```groovy
117e5c31af7Sopenharmony_ci# Creates a passthrough vertex shader. The shader passes the vec4 at input
118e5c31af7Sopenharmony_ci# location 0 through to the `gl_Position`.
119e5c31af7Sopenharmony_ciSHADER vertex {shader_name} PASSTHROUGH
120e5c31af7Sopenharmony_ci```
121e5c31af7Sopenharmony_ci
122e5c31af7Sopenharmony_ciShader using inlined source:
123e5c31af7Sopenharmony_ci
124e5c31af7Sopenharmony_ci```groovy
125e5c31af7Sopenharmony_ci# Creates a shader of |shader_type| with the given |shader_name|. The shader
126e5c31af7Sopenharmony_ci# will be of |shader_format|. The shader source then follows and is terminated
127e5c31af7Sopenharmony_ci# with the |END| tag.
128e5c31af7Sopenharmony_ciSHADER {shader_type} {shader_name} {shader_format} [ TARGET_ENV {target_env} ]
129e5c31af7Sopenharmony_ci{shader_source}
130e5c31af7Sopenharmony_ciEND
131e5c31af7Sopenharmony_ci```
132e5c31af7Sopenharmony_ci
133e5c31af7Sopenharmony_ciShader using source from `VIRTUAL_FILE`:
134e5c31af7Sopenharmony_ci
135e5c31af7Sopenharmony_ci```groovy
136e5c31af7Sopenharmony_ci# Creates a shader of |shader_type| with the given |shader_name|. The shader
137e5c31af7Sopenharmony_ci# will be of |shader_format|. The shader will use the virtual file with |path|.
138e5c31af7Sopenharmony_ciSHADER {shader_type} {shader_name} {shader_format} [ TARGET_ENV {target_env} ] VIRTUAL_FILE {path}
139e5c31af7Sopenharmony_ci```
140e5c31af7Sopenharmony_ci
141e5c31af7Sopenharmony_ci`{shader_name}` is used to identify the shader to attach to `PIPELINE`s,
142e5c31af7Sopenharmony_ci
143e5c31af7Sopenharmony_ci`{shader_type}` and `{shader_format}` are described below:
144e5c31af7Sopenharmony_ci
145e5c31af7Sopenharmony_ci#### Shader Type
146e5c31af7Sopenharmony_ci * `vertex`
147e5c31af7Sopenharmony_ci * `fragment`
148e5c31af7Sopenharmony_ci * `geometry`
149e5c31af7Sopenharmony_ci * `tessellation_evaluation`
150e5c31af7Sopenharmony_ci * `tessellation_control`
151e5c31af7Sopenharmony_ci * `compute`
152e5c31af7Sopenharmony_ci * `multi`
153e5c31af7Sopenharmony_ci
154e5c31af7Sopenharmony_ciThe compute pipeline can only contain compute shaders. The graphics pipeline
155e5c31af7Sopenharmony_cican not contain compute shaders, and must contain a vertex shader and a fragment
156e5c31af7Sopenharmony_cishader.
157e5c31af7Sopenharmony_ci
158e5c31af7Sopenharmony_ciThe provided `multi` shader can only be used with `SPIRV-ASM` and `SPIRV-HEX`
159e5c31af7Sopenharmony_ciand allows for providing multiple shaders in a single module (so the `vertex`
160e5c31af7Sopenharmony_ciand `fragment` shaders can be provided together.)
161e5c31af7Sopenharmony_ci
162e5c31af7Sopenharmony_ciNote, `SPIRV-ASM` and `SPIRV-HEX` can also be used with each of the other shader
163e5c31af7Sopenharmony_citypes, but in that case must only provide a single shader type in the module.
164e5c31af7Sopenharmony_ci
165e5c31af7Sopenharmony_ci#### Shader Format
166e5c31af7Sopenharmony_ci * `GLSL`  (with glslang)
167e5c31af7Sopenharmony_ci * `HLSL`  (with dxc or glslang if dxc disabled)
168e5c31af7Sopenharmony_ci * `SPIRV-ASM` (with spirv-as; specifying `TARGET_ENV` is _highly recommended_
169e5c31af7Sopenharmony_ci    in this case, as explained below)
170e5c31af7Sopenharmony_ci * `SPIRV-HEX` (decoded straight to SPIR-V)
171e5c31af7Sopenharmony_ci * `OPENCL-C` (with clspv)
172e5c31af7Sopenharmony_ci
173e5c31af7Sopenharmony_ci### Target environment
174e5c31af7Sopenharmony_ci
175e5c31af7Sopenharmony_ciSpecifying `TARGET_ENV` is optional and can be used to select a target
176e5c31af7Sopenharmony_ciSPIR-V environment. For example:
177e5c31af7Sopenharmony_ci
178e5c31af7Sopenharmony_ci * `spv1.0`
179e5c31af7Sopenharmony_ci * `spv1.5`
180e5c31af7Sopenharmony_ci * `vulkan1.0`
181e5c31af7Sopenharmony_ci * `vulkan1.2`
182e5c31af7Sopenharmony_ci
183e5c31af7Sopenharmony_ciCheck the help text of the corresponding tool (e.g. spirv-as, glslangValidator)
184e5c31af7Sopenharmony_cifor the full list. The `SPIRV-HEX` shader format is not affected by the target
185e5c31af7Sopenharmony_cienvironment.
186e5c31af7Sopenharmony_ci
187e5c31af7Sopenharmony_ciThe specified target environment for the shader overrides the default (`spv1.0`)
188e5c31af7Sopenharmony_cior the one specified on the command line.
189e5c31af7Sopenharmony_ci
190e5c31af7Sopenharmony_ciSpecifying the target environment when using the `SPIRV-ASM` shader format
191e5c31af7Sopenharmony_ciis _highly recommended_, otherwise the SPIR-V version of the final SPIR-V binary
192e5c31af7Sopenharmony_cishader passed to the graphics device might not be what you expect.
193e5c31af7Sopenharmony_ciTypically, SPIR-V assembly text will contain a comment near the beginning similar
194e5c31af7Sopenharmony_cito `; Version: 1.0` but this is _ignored_ by the spirv-as assembler.
195e5c31af7Sopenharmony_ciThus, you should specify the equivalent target environment (e.g. `spv1.0`)
196e5c31af7Sopenharmony_ciin the `SHADER` command.
197e5c31af7Sopenharmony_ci
198e5c31af7Sopenharmony_ciSpecifying the target environment for other shader formats depends on whether
199e5c31af7Sopenharmony_ciyou want to vary the final SPIR-V shader binary based on the target environment
200e5c31af7Sopenharmony_cispecified on the command line. For example, you could write one AmberScript file
201e5c31af7Sopenharmony_cithat contains a GLSL shader without specifying a target environment.
202e5c31af7Sopenharmony_ciYou could then run the AmberScript file several times with different
203e5c31af7Sopenharmony_citarget environments specified on the command line
204e5c31af7Sopenharmony_ci(`spv1.0`, `spv1.1`, `spv1.2`, etc.) to test the different SPIR-V shader variants.
205e5c31af7Sopenharmony_ci
206e5c31af7Sopenharmony_ci### Buffers
207e5c31af7Sopenharmony_ci
208e5c31af7Sopenharmony_ciAn AmberScript buffer represents a set of contiguous bits. This can be used for
209e5c31af7Sopenharmony_cieither image buffers or, what the target API would refer to as a buffer.
210e5c31af7Sopenharmony_ci
211e5c31af7Sopenharmony_ci#### Data Types
212e5c31af7Sopenharmony_ci * `int8`
213e5c31af7Sopenharmony_ci * `int16`
214e5c31af7Sopenharmony_ci * `int32`
215e5c31af7Sopenharmony_ci * `int64`
216e5c31af7Sopenharmony_ci * `uint8`
217e5c31af7Sopenharmony_ci * `uint16`
218e5c31af7Sopenharmony_ci * `uint32`
219e5c31af7Sopenharmony_ci * `uint64`
220e5c31af7Sopenharmony_ci * `float16`
221e5c31af7Sopenharmony_ci * `float`
222e5c31af7Sopenharmony_ci * `double`
223e5c31af7Sopenharmony_ci * vec[2,3,4]{type}
224e5c31af7Sopenharmony_ci * mat[2,3,4]x[2,3,4]{type}  (mat<columns>x<rows>)
225e5c31af7Sopenharmony_ci * Any of the `Image Formats` listed below.
226e5c31af7Sopenharmony_ci * For any of the non-Image Formats types above appending '[]' will treat the
227e5c31af7Sopenharmony_ci    data as an array. e.g. int8[], vec2<float>[]
228e5c31af7Sopenharmony_ci
229e5c31af7Sopenharmony_ciSized arrays and structures are not currently representable.
230e5c31af7Sopenharmony_ci
231e5c31af7Sopenharmony_ci```groovy
232e5c31af7Sopenharmony_ci# Filling the buffer with a given initializer. Initializer data must be
233e5c31af7Sopenharmony_ci# of |type|. Buffers are STD430 by default.
234e5c31af7Sopenharmony_ciBUFFER {name} DATA_TYPE {type} {STD140 | STD430} {initializer}
235e5c31af7Sopenharmony_ci
236e5c31af7Sopenharmony_ci# Defines a buffer which is filled with data as specified by the `initializer`.
237e5c31af7Sopenharmony_ciBUFFER {name} DATA_TYPE {type} {STD140 | STD430} SIZE _size_in_items_ \
238e5c31af7Sopenharmony_ci    {initializer}
239e5c31af7Sopenharmony_ci
240e5c31af7Sopenharmony_ci# Deprecated
241e5c31af7Sopenharmony_ci# Defines a buffer with width and height and filled by data as specified by the
242e5c31af7Sopenharmony_ci# `initializer`.
243e5c31af7Sopenharmony_ciBUFFER {name} DATA_TYPE {type} {STD140 | STD430} WIDTH {w} HEIGHT {h} \
244e5c31af7Sopenharmony_ci  {initializer}
245e5c31af7Sopenharmony_ci
246e5c31af7Sopenharmony_ci# Defines a buffer which is filled with binary data from a file specified
247e5c31af7Sopenharmony_ci# by `FILE`.
248e5c31af7Sopenharmony_ciBUFFER {name} DATA_TYPE {type} {STD140 | STD430} SIZE _size_in_items_ \
249e5c31af7Sopenharmony_ci    FILE BINARY {file_name}
250e5c31af7Sopenharmony_ci
251e5c31af7Sopenharmony_ci# Defines a buffer which is filled with text data parsed from a file specified
252e5c31af7Sopenharmony_ci# by `FILE`.
253e5c31af7Sopenharmony_ciBUFFER {name} DATA_TYPE {type} {STD140 | STD430} SIZE _size_in_items_ \
254e5c31af7Sopenharmony_ci    FILE TEXT {file_name}
255e5c31af7Sopenharmony_ci
256e5c31af7Sopenharmony_ci# Creates a buffer which will store the given `FORMAT` of data. These
257e5c31af7Sopenharmony_ci# buffers are used as image and depth buffers in the `PIPELINE` commands.
258e5c31af7Sopenharmony_ci# The buffer will be sized based on the `RENDER_SIZE` of the `PIPELINE`.
259e5c31af7Sopenharmony_ci# For multisampled images use value greater than one for `SAMPLES`. Allowed
260e5c31af7Sopenharmony_ci# sample counts are 1, 2, 4, 8, 16, 32, and 64. Note that Amber doesn't
261e5c31af7Sopenharmony_ci# preserve multisampled images across pipelines.
262e5c31af7Sopenharmony_ciBUFFER {name} FORMAT {format_string} \
263e5c31af7Sopenharmony_ci    [ MIP_LEVELS _mip_levels_ (default 1) ] \
264e5c31af7Sopenharmony_ci    [ SAMPLES _samples_ (default 1) ]
265e5c31af7Sopenharmony_ci
266e5c31af7Sopenharmony_ci# Load buffer data from a PNG image with file name specified by `FILE`.
267e5c31af7Sopenharmony_ci# The file path is relative to the script file being run. Format specified
268e5c31af7Sopenharmony_ci# by `FORMAT` must match the image format.
269e5c31af7Sopenharmony_ciBUFFER {name} FORMAT {format_string} FILE PNG {file_name.png}
270e5c31af7Sopenharmony_ci```
271e5c31af7Sopenharmony_ci
272e5c31af7Sopenharmony_ci#### Images
273e5c31af7Sopenharmony_ci
274e5c31af7Sopenharmony_ciAn AmberScript image is a specialized buffer that specifies image-specific
275e5c31af7Sopenharmony_ciattributes.
276e5c31af7Sopenharmony_ci
277e5c31af7Sopenharmony_ci##### Dimensionality
278e5c31af7Sopenharmony_ci * `DIM_1D` -- A 1-dimensional image
279e5c31af7Sopenharmony_ci * `DIM_2D` -- A 2-dimensional image
280e5c31af7Sopenharmony_ci * `DIM_3D` -- A 3-dimensional image
281e5c31af7Sopenharmony_ci
282e5c31af7Sopenharmony_ci```groovy
283e5c31af7Sopenharmony_ci# Specify an image buffer with a format. HEIGHT is necessary for DIM_2D and
284e5c31af7Sopenharmony_ci# DIM_3D. DEPTH is necessary for DIM_3D.
285e5c31af7Sopenharmony_ciIMAGE {name} FORMAT {format_string} [ MIP_LEVELS _mip_levels_ (default 1) ] \
286e5c31af7Sopenharmony_ci    [ SAMPLES _samples_ (default 1) ] \
287e5c31af7Sopenharmony_ci    {dimensionality} \
288e5c31af7Sopenharmony_ci    WIDTH {w} [ HEIGHT {h} [ DEPTH {d} ] ] \
289e5c31af7Sopenharmony_ci    {initializer}
290e5c31af7Sopenharmony_ci
291e5c31af7Sopenharmony_ci# Specify an image buffer with a data type. HEIGHT is necessary for DIM_2D and
292e5c31af7Sopenharmony_ci# DIM_3D. DEPTH is necessary for DIM_3D.
293e5c31af7Sopenharmony_ciIMAGE {name} DATA_TYPE {type} {dimensionality} \
294e5c31af7Sopenharmony_ci    WIDTH {w} [ HEIGHT {h} [ DEPTH {d} ] ] \
295e5c31af7Sopenharmony_ci    {intializer}
296e5c31af7Sopenharmony_ci```
297e5c31af7Sopenharmony_ci
298e5c31af7Sopenharmony_ci#### Buffer Initializers
299e5c31af7Sopenharmony_ci
300e5c31af7Sopenharmony_ci```groovy
301e5c31af7Sopenharmony_ci# Filling the buffer with a given set of data. The values must be
302e5c31af7Sopenharmony_ci# of the correct type. The data can be provided as the type or as a hex
303e5c31af7Sopenharmony_ci# value.
304e5c31af7Sopenharmony_ciDATA
305e5c31af7Sopenharmony_ci_value_+
306e5c31af7Sopenharmony_ciEND
307e5c31af7Sopenharmony_ci
308e5c31af7Sopenharmony_ci```groovy
309e5c31af7Sopenharmony_ci# Fill the buffer with a single value.
310e5c31af7Sopenharmony_ciFILL _value_
311e5c31af7Sopenharmony_ci
312e5c31af7Sopenharmony_ci# Fill the buffer with an increasing value from |start| increasing by |inc|.
313e5c31af7Sopenharmony_ci# Floating point data uses floating point addition to generate increasing
314e5c31af7Sopenharmony_ci# values. Likewise, integer data uses integer addition to generate increasing
315e5c31af7Sopenharmony_ci# values.
316e5c31af7Sopenharmony_ciSERIES_FROM _start_ INC_BY _inc_
317e5c31af7Sopenharmony_ci```
318e5c31af7Sopenharmony_ci
319e5c31af7Sopenharmony_ci#### Buffer Copy
320e5c31af7Sopenharmony_ci
321e5c31af7Sopenharmony_ci```groovy
322e5c31af7Sopenharmony_ci# Copies all data, values and memory from |buffer_from| to |buffer_to|.
323e5c31af7Sopenharmony_ci# Both buffers must be declared, and of the same data type.
324e5c31af7Sopenharmony_ci# Buffers used as copy destination can be used only as copy destination, and as
325e5c31af7Sopenharmony_ci# argument to an EXPECT command.
326e5c31af7Sopenharmony_ciCOPY {buffer_from} TO {buffer_to}
327e5c31af7Sopenharmony_ci```
328e5c31af7Sopenharmony_ci
329e5c31af7Sopenharmony_ci### Samplers
330e5c31af7Sopenharmony_ci
331e5c31af7Sopenharmony_ciSamplers are used for sampling buffers that are bound to a pipeline as
332e5c31af7Sopenharmony_cisampled image or combined image sampler.
333e5c31af7Sopenharmony_ci
334e5c31af7Sopenharmony_ci#### Filter types
335e5c31af7Sopenharmony_ci * `nearest`
336e5c31af7Sopenharmony_ci * `linear`
337e5c31af7Sopenharmony_ci
338e5c31af7Sopenharmony_ci#### Address modes
339e5c31af7Sopenharmony_ci * `repeat`
340e5c31af7Sopenharmony_ci * `mirrored_repeat`
341e5c31af7Sopenharmony_ci * `clamp_to_edge`
342e5c31af7Sopenharmony_ci * `clamp_to_border`
343e5c31af7Sopenharmony_ci * `mirrored_clamp_to_edge`
344e5c31af7Sopenharmony_ci
345e5c31af7Sopenharmony_ci#### Border colors
346e5c31af7Sopenharmony_ci * `float_transparent_black`
347e5c31af7Sopenharmony_ci * `int_transparent_black`
348e5c31af7Sopenharmony_ci * `float_opaque_black`
349e5c31af7Sopenharmony_ci * `int_opaque_black`
350e5c31af7Sopenharmony_ci * `float_opaque_white`
351e5c31af7Sopenharmony_ci * `int_opaque_white`
352e5c31af7Sopenharmony_ci
353e5c31af7Sopenharmony_ci#### Compare operations
354e5c31af7Sopenharmony_ci* `never`
355e5c31af7Sopenharmony_ci* `less`
356e5c31af7Sopenharmony_ci* `equal`
357e5c31af7Sopenharmony_ci* `less_or_equal`
358e5c31af7Sopenharmony_ci* `greater`
359e5c31af7Sopenharmony_ci* `not_equal`
360e5c31af7Sopenharmony_ci* `greater_or_equal`
361e5c31af7Sopenharmony_ci* `always`
362e5c31af7Sopenharmony_ci
363e5c31af7Sopenharmony_ci```groovy
364e5c31af7Sopenharmony_ci
365e5c31af7Sopenharmony_ci# Creates a sampler with |name|. |compare_enable| is either on or off.
366e5c31af7Sopenharmony_ciSAMPLER {name} \
367e5c31af7Sopenharmony_ci    [ MAG_FILTER {filter_type} (default nearest) ] \
368e5c31af7Sopenharmony_ci    [ MIN_FILTER {filter_type} (default nearest) ] \
369e5c31af7Sopenharmony_ci    [ ADDRESS_MODE_U {address_mode} (default repeat) ] \
370e5c31af7Sopenharmony_ci    [ ADDRESS_MODE_V {address_mode} (default repeat) ] \
371e5c31af7Sopenharmony_ci    [ ADDRESS_MODE_W {address_mode} (default repeat) ] \
372e5c31af7Sopenharmony_ci    [ BORDER_COLOR {border_color} (default float_transparent_black) ] \
373e5c31af7Sopenharmony_ci    [ MIN_LOD _val_ (default 0.0) ] \
374e5c31af7Sopenharmony_ci    [ MAX_LOD _val_ (default 1.0) ] \
375e5c31af7Sopenharmony_ci    [ NORMALIZED_COORDS | UNNORMALIZED_COORDS (default NORMALIZED_COORDS) ] \
376e5c31af7Sopenharmony_ci    [ COMPARE _compare_enable_ (default off) ] \
377e5c31af7Sopenharmony_ci    [ COMPARE_OP _compare_op_ (default never) ]
378e5c31af7Sopenharmony_ci```
379e5c31af7Sopenharmony_ci
380e5c31af7Sopenharmony_ciNote: unnormalized coordinates will override MIN\_LOD and MAX\_LOD to 0.0.
381e5c31af7Sopenharmony_ci
382e5c31af7Sopenharmony_ci#### OpenCL Literal Samplers
383e5c31af7Sopenharmony_ci
384e5c31af7Sopenharmony_ciLiteral constant samplers defined in the OpenCL program are automatically
385e5c31af7Sopenharmony_cigenerated and bound to the pipeline in Amber.
386e5c31af7Sopenharmony_ci
387e5c31af7Sopenharmony_ciNote: currently the border color is always transparent black.
388e5c31af7Sopenharmony_ci
389e5c31af7Sopenharmony_ciNote: the addressing mode is used for all coordinates currently. Arrayed images
390e5c31af7Sopenharmony_cishould use `clamp_to_edge` for the array index.
391e5c31af7Sopenharmony_ci
392e5c31af7Sopenharmony_ci### Pipelines
393e5c31af7Sopenharmony_ci
394e5c31af7Sopenharmony_ci#### Pipeline type
395e5c31af7Sopenharmony_ci * `compute`
396e5c31af7Sopenharmony_ci * `graphics`
397e5c31af7Sopenharmony_ci
398e5c31af7Sopenharmony_ci```groovy
399e5c31af7Sopenharmony_ci# The PIPELINE command creates a pipeline. This can be either compute or
400e5c31af7Sopenharmony_ci# graphics. Shaders are attached to the pipeline at pipeline creation time.
401e5c31af7Sopenharmony_ciPIPELINE {pipeline_type} {pipeline_name}
402e5c31af7Sopenharmony_ci...
403e5c31af7Sopenharmony_ciEND
404e5c31af7Sopenharmony_ci
405e5c31af7Sopenharmony_ci# Create a pipeline and inherit from a previously declared pipeline.
406e5c31af7Sopenharmony_ciDERIVE_PIPELINE {pipeline_name} FROM {parent_pipeline}
407e5c31af7Sopenharmony_ci...
408e5c31af7Sopenharmony_ciEND
409e5c31af7Sopenharmony_ci```
410e5c31af7Sopenharmony_ci
411e5c31af7Sopenharmony_ci### Pipeline Content
412e5c31af7Sopenharmony_ci
413e5c31af7Sopenharmony_ciThe following commands are all specified within the `PIPELINE` command.
414e5c31af7Sopenharmony_ci```groovy
415e5c31af7Sopenharmony_ci  # Attach the shader provided by |name_of_shader| to the pipeline with an
416e5c31af7Sopenharmony_ci  # entry point name of |name|. The provided shader for ATTACH must _not_ be
417e5c31af7Sopenharmony_ci  # a 'multi' shader.
418e5c31af7Sopenharmony_ci  ATTACH {name_of_shader} \
419e5c31af7Sopenharmony_ci      [ ENTRY_POINT {name} (default "main") ]
420e5c31af7Sopenharmony_ci
421e5c31af7Sopenharmony_ci  # Attach a 'multi' shader to the pipeline of |shader_type| and use the entry
422e5c31af7Sopenharmony_ci  # point with |name|. The provided shader _must_ be a 'multi' shader.
423e5c31af7Sopenharmony_ci  ATTACH {name_of_multi_shader} TYPE {shader_type} ENTRY_POINT {name}
424e5c31af7Sopenharmony_ci
425e5c31af7Sopenharmony_ci  # Attach specialized shader. Specialization can be specified multiple times.
426e5c31af7Sopenharmony_ci  # Specialization values must be a 32-bit type. Shader type and entry point
427e5c31af7Sopenharmony_ci  # must be specified prior to specializing the shader.
428e5c31af7Sopenharmony_ci  ATTACH {name_of_shader} SPECIALIZE _id_ AS uint32 _value_
429e5c31af7Sopenharmony_ci  ATTACH {name_of_shader} \
430e5c31af7Sopenharmony_ci      SPECIALIZE _id_ AS uint32 _value_ \
431e5c31af7Sopenharmony_ci      SPECIALIZE _id_ AS float _value_
432e5c31af7Sopenharmony_ci```
433e5c31af7Sopenharmony_ci
434e5c31af7Sopenharmony_ci```groovy
435e5c31af7Sopenharmony_ci  # Set the SPIRV-Tools optimization passes to use for a given shader. The
436e5c31af7Sopenharmony_ci  # default is to run no optimization passes.
437e5c31af7Sopenharmony_ci  SHADER_OPTIMIZATION {shader_name}
438e5c31af7Sopenharmony_ci    {optimization_name}+
439e5c31af7Sopenharmony_ci  END
440e5c31af7Sopenharmony_ci```
441e5c31af7Sopenharmony_ci
442e5c31af7Sopenharmony_ci```groovy
443e5c31af7Sopenharmony_ci  # Set the compile options used to compile the given shader. Options are parsed
444e5c31af7Sopenharmony_ci  # the same as on the command line. Currently, only supported for OPENCL-C shaders.
445e5c31af7Sopenharmony_ci  COMPILE_OPTIONS {shader_name}
446e5c31af7Sopenharmony_ci    {option}+
447e5c31af7Sopenharmony_ci  END
448e5c31af7Sopenharmony_ci```
449e5c31af7Sopenharmony_ci
450e5c31af7Sopenharmony_ci```groovy
451e5c31af7Sopenharmony_ci  # Set the polygon mode used for all drawing with the pipeline.
452e5c31af7Sopenharmony_ci  # |mode| is fill, line, or point and it defaults to fill.
453e5c31af7Sopenharmony_ci  POLYGON_MODE {mode}
454e5c31af7Sopenharmony_ci```
455e5c31af7Sopenharmony_ci
456e5c31af7Sopenharmony_ci```groovy
457e5c31af7Sopenharmony_ci  # Set the number of patch control points used by tessellation. The default value is 3.
458e5c31af7Sopenharmony_ci  PATCH_CONTROL_POINTS {control_points}
459e5c31af7Sopenharmony_ci```
460e5c31af7Sopenharmony_ci
461e5c31af7Sopenharmony_ci#### Compare operations
462e5c31af7Sopenharmony_ci * `never`
463e5c31af7Sopenharmony_ci * `less`
464e5c31af7Sopenharmony_ci * `equal`
465e5c31af7Sopenharmony_ci * `less_or_equal`
466e5c31af7Sopenharmony_ci * `greater`
467e5c31af7Sopenharmony_ci * `not_equal`
468e5c31af7Sopenharmony_ci * `greater_or_equal`
469e5c31af7Sopenharmony_ci * `always`
470e5c31af7Sopenharmony_ci
471e5c31af7Sopenharmony_ci```groovy
472e5c31af7Sopenharmony_ci  # Set depth test settings. All enable options are specified with keywords on and off.
473e5c31af7Sopenharmony_ci  # BOUNDS and BIAS values are specified with decimal numbers. |compare_op| is selected
474e5c31af7Sopenharmony_ci  # from the list of compare operations above.
475e5c31af7Sopenharmony_ci  DEPTH
476e5c31af7Sopenharmony_ci    TEST {test_enable}
477e5c31af7Sopenharmony_ci    WRITE {write_enable}
478e5c31af7Sopenharmony_ci    COMPARE_OP {compare_op}
479e5c31af7Sopenharmony_ci    CLAMP {clamp_enable}
480e5c31af7Sopenharmony_ci    BOUNDS min {bound_min} max {bounds_max}
481e5c31af7Sopenharmony_ci    BIAS constant {bias_constant} clamp {bias_clamp} slope {bias_slope}
482e5c31af7Sopenharmony_ci  END
483e5c31af7Sopenharmony_ci```
484e5c31af7Sopenharmony_ci
485e5c31af7Sopenharmony_ci#### Stencil operations
486e5c31af7Sopenharmony_ci * `keep`
487e5c31af7Sopenharmony_ci * `replace`
488e5c31af7Sopenharmony_ci * `increment_and_clamp`
489e5c31af7Sopenharmony_ci * `decrement_and_clamp`
490e5c31af7Sopenharmony_ci * `invert`
491e5c31af7Sopenharmony_ci * `increment_and_wrap`
492e5c31af7Sopenharmony_ci * `decrement_and_wrap`
493e5c31af7Sopenharmony_ci
494e5c31af7Sopenharmony_ci```groovy
495e5c31af7Sopenharmony_ci  # Set stencil test settings. |face| can be front, back, or front_and_back.
496e5c31af7Sopenharmony_ci  # |test_enable| is either on or off and affects both faces. |fail_op|, |pass_op|,
497e5c31af7Sopenharmony_ci  # and |depth_fail_op| are selected from the stencil operations table above,
498e5c31af7Sopenharmony_ci  # and |compare_op| from the compare operations table. |compare_mask|, |write_mask|,
499e5c31af7Sopenharmony_ci  # and |reference| are 8bit unsigned integer values (range 0..255).
500e5c31af7Sopenharmony_ci  STENCIL {face}
501e5c31af7Sopenharmony_ci    TEST {test_enable}
502e5c31af7Sopenharmony_ci    FAIL_OP {fail_op}
503e5c31af7Sopenharmony_ci    PASS_OP {pass_op}
504e5c31af7Sopenharmony_ci    DEPTH_FAIL_OP {depth_fail_op}
505e5c31af7Sopenharmony_ci    COMPARE_OP {compare_op}
506e5c31af7Sopenharmony_ci    COMPARE_MASK {compare_mask}
507e5c31af7Sopenharmony_ci    WRITE_MASK {write_mask}
508e5c31af7Sopenharmony_ci    REFERENCE {reference}
509e5c31af7Sopenharmony_ci  END
510e5c31af7Sopenharmony_ci```
511e5c31af7Sopenharmony_ci
512e5c31af7Sopenharmony_ci#### Blend factors
513e5c31af7Sopenharmony_ci* `zero`
514e5c31af7Sopenharmony_ci* `one`
515e5c31af7Sopenharmony_ci* `src_color`
516e5c31af7Sopenharmony_ci* `one_minus_src_color`
517e5c31af7Sopenharmony_ci* `dst_color`
518e5c31af7Sopenharmony_ci* `one_minus_dst_color`
519e5c31af7Sopenharmony_ci* `src_alpha`
520e5c31af7Sopenharmony_ci* `one_minus_src_alpha`
521e5c31af7Sopenharmony_ci* `dst_alpha`
522e5c31af7Sopenharmony_ci* `one_minus_dst_alpha`
523e5c31af7Sopenharmony_ci* `constant_color`
524e5c31af7Sopenharmony_ci* `one_minus_constant_color`
525e5c31af7Sopenharmony_ci* `constant_alpha`
526e5c31af7Sopenharmony_ci* `one_minus_constant_alpha`
527e5c31af7Sopenharmony_ci* `src_alpha_saturate`
528e5c31af7Sopenharmony_ci* `src1_color`
529e5c31af7Sopenharmony_ci* `one_minus_src1_color`
530e5c31af7Sopenharmony_ci* `src1_alpha`
531e5c31af7Sopenharmony_ci* `one_minus_src1_alpha`
532e5c31af7Sopenharmony_ci
533e5c31af7Sopenharmony_ci#### Blend operations
534e5c31af7Sopenharmony_ci* `add`
535e5c31af7Sopenharmony_ci* `substract`
536e5c31af7Sopenharmony_ci* `reverse_substract`
537e5c31af7Sopenharmony_ci* `min`
538e5c31af7Sopenharmony_ci* `max`
539e5c31af7Sopenharmony_ci
540e5c31af7Sopenharmony_ciThe following operations also require VK_EXT_blend_operation_advanced
541e5c31af7Sopenharmony_ciwhen using a Vulkan backend.
542e5c31af7Sopenharmony_ci* `zero`
543e5c31af7Sopenharmony_ci* `src`
544e5c31af7Sopenharmony_ci* `dst`
545e5c31af7Sopenharmony_ci* `src_over`
546e5c31af7Sopenharmony_ci* `dst_over`
547e5c31af7Sopenharmony_ci* `src_in`
548e5c31af7Sopenharmony_ci* `dst_in`
549e5c31af7Sopenharmony_ci* `src_out`
550e5c31af7Sopenharmony_ci* `dst_out`
551e5c31af7Sopenharmony_ci* `src_atop`
552e5c31af7Sopenharmony_ci* `dst_atop`
553e5c31af7Sopenharmony_ci* `xor`
554e5c31af7Sopenharmony_ci* `multiply`
555e5c31af7Sopenharmony_ci* `screen`
556e5c31af7Sopenharmony_ci* `overlay`
557e5c31af7Sopenharmony_ci* `darken`
558e5c31af7Sopenharmony_ci* `lighten`
559e5c31af7Sopenharmony_ci* `color_dodge`
560e5c31af7Sopenharmony_ci* `color_burn`
561e5c31af7Sopenharmony_ci* `hard_light`
562e5c31af7Sopenharmony_ci* `soft_light`
563e5c31af7Sopenharmony_ci* `difference`
564e5c31af7Sopenharmony_ci* `exclusion`
565e5c31af7Sopenharmony_ci* `invert`
566e5c31af7Sopenharmony_ci* `invert_rgb`
567e5c31af7Sopenharmony_ci* `linear_dodge`
568e5c31af7Sopenharmony_ci* `linear_burn`
569e5c31af7Sopenharmony_ci* `vivid_light`
570e5c31af7Sopenharmony_ci* `linear_light`
571e5c31af7Sopenharmony_ci* `pin_light`
572e5c31af7Sopenharmony_ci* `hard_mix`
573e5c31af7Sopenharmony_ci* `hsl_hue`
574e5c31af7Sopenharmony_ci* `hsl_saturation`
575e5c31af7Sopenharmony_ci* `hsl_color`
576e5c31af7Sopenharmony_ci* `hsl_luminosity`
577e5c31af7Sopenharmony_ci* `plus`
578e5c31af7Sopenharmony_ci* `plus_clamped`
579e5c31af7Sopenharmony_ci* `plus_clamped_alpha`
580e5c31af7Sopenharmony_ci* `plus_darker`
581e5c31af7Sopenharmony_ci* `minus`
582e5c31af7Sopenharmony_ci* `minus_clamped`
583e5c31af7Sopenharmony_ci* `contrast`
584e5c31af7Sopenharmony_ci* `invert_org`
585e5c31af7Sopenharmony_ci* `red`
586e5c31af7Sopenharmony_ci* `green`
587e5c31af7Sopenharmony_ci* `blue`
588e5c31af7Sopenharmony_ci
589e5c31af7Sopenharmony_ci```groovy
590e5c31af7Sopenharmony_ci  # Enable alpha blending and set blend factors and operations. Available
591e5c31af7Sopenharmony_ci  # blend factors and operations are listed above.
592e5c31af7Sopenharmony_ci  BLEND
593e5c31af7Sopenharmony_ci    SRC_COLOR_FACTOR {src_color_factor}
594e5c31af7Sopenharmony_ci    DST_COLOR_FACTOR {dst_color_factor}
595e5c31af7Sopenharmony_ci    COLOR_OP {color_op}
596e5c31af7Sopenharmony_ci    SRC_ALPHA_FACTOR {src_alpha_factor}
597e5c31af7Sopenharmony_ci    DST_ALPHA_FACTOR {dst_alpha_factor}
598e5c31af7Sopenharmony_ci    ALPHA_OP {alpha_op}
599e5c31af7Sopenharmony_ci  END
600e5c31af7Sopenharmony_ci```
601e5c31af7Sopenharmony_ci
602e5c31af7Sopenharmony_ci```groovy
603e5c31af7Sopenharmony_ci  # Set the size of the render buffers. |width| and |height| are integers and
604e5c31af7Sopenharmony_ci  # default to 250x250.
605e5c31af7Sopenharmony_ci  FRAMEBUFFER_SIZE _width_ _height_
606e5c31af7Sopenharmony_ci```
607e5c31af7Sopenharmony_ci
608e5c31af7Sopenharmony_ci```groovy
609e5c31af7Sopenharmony_ci  # Set the viewport size. If no viewport is provided then it defaults to the
610e5c31af7Sopenharmony_ci  # whole framebuffer size. Depth range defaults to 0 to 1.
611e5c31af7Sopenharmony_ci  VIEWPORT {x} {y} SIZE {width} {height} [MIN_DEPTH {mind}] [MAX_DEPTH {maxd}]
612e5c31af7Sopenharmony_ci```
613e5c31af7Sopenharmony_ci
614e5c31af7Sopenharmony_ci```groovy
615e5c31af7Sopenharmony_ci  # Set subgroup size control setting. Require that subgroups must be launched
616e5c31af7Sopenharmony_ci  # with all invocations active for given shader. Allow SubgroupSize to vary
617e5c31af7Sopenharmony_ci  # for given shader. Require a specific SubgroupSize the for given shader.
618e5c31af7Sopenharmony_ci  # |fully_populated_enable| and |varying_size_enable| can be on or off.
619e5c31af7Sopenharmony_ci  # |subgroup_size| can be set one of the values below:
620e5c31af7Sopenharmony_ci  #  - a power-of-two integer that _must_ be greater or equal to minSubgroupSize
621e5c31af7Sopenharmony_ci  #    and be less than or equal to maxSubgroupSize
622e5c31af7Sopenharmony_ci  # - MIN to set the required subgroup size to the minSubgroupSize
623e5c31af7Sopenharmony_ci  # - MAX to set the required subgroup size to the maxSubgroupSize
624e5c31af7Sopenharmony_ci  SUBGROUP {name_of_shader}
625e5c31af7Sopenharmony_ci    FULLY_POPULATED {fully_populated_enable}
626e5c31af7Sopenharmony_ci    VARYING_SIZE {varying_size_enable}
627e5c31af7Sopenharmony_ci    REQUIRED_SIZE {subgroup_size}
628e5c31af7Sopenharmony_ci  END
629e5c31af7Sopenharmony_ci```
630e5c31af7Sopenharmony_ci
631e5c31af7Sopenharmony_ci### Pipeline Buffers
632e5c31af7Sopenharmony_ci
633e5c31af7Sopenharmony_ci#### Buffer Types
634e5c31af7Sopenharmony_ci * `uniform`
635e5c31af7Sopenharmony_ci * `storage`
636e5c31af7Sopenharmony_ci * `uniform_dynamic`
637e5c31af7Sopenharmony_ci * `storage_dynamic`
638e5c31af7Sopenharmony_ci * `uniform_texel_buffer`
639e5c31af7Sopenharmony_ci * `storage_texel_buffer`
640e5c31af7Sopenharmony_ci
641e5c31af7Sopenharmony_ciTODO(dsinclair): Sync the BufferTypes with the list of Vulkan Descriptor types.
642e5c31af7Sopenharmony_ci
643e5c31af7Sopenharmony_ciA `pipeline` can have buffers or samplers bound. This includes buffers to
644e5c31af7Sopenharmony_cicontain image attachment content, depth/stencil content, uniform buffers, etc.
645e5c31af7Sopenharmony_ci
646e5c31af7Sopenharmony_ci```groovy
647e5c31af7Sopenharmony_ci  # Attach |buffer_name| as an output color attachment at location |idx|.
648e5c31af7Sopenharmony_ci  # The provided buffer must be a `FORMAT` buffer. If no color attachments are
649e5c31af7Sopenharmony_ci  # provided a single attachment with format `B8G8R8A8_UNORM` will be created
650e5c31af7Sopenharmony_ci  # for graphics pipelines. The MIP level will have a base of |level|.
651e5c31af7Sopenharmony_ci  BIND BUFFER {buffer_name} AS color LOCATION _idx_ \
652e5c31af7Sopenharmony_ci      [ BASE_MIP_LEVEL _level_ (default 0) ]
653e5c31af7Sopenharmony_ci
654e5c31af7Sopenharmony_ci  # Attach |buffer_name| as the depth/stencil buffer. The provided buffer must
655e5c31af7Sopenharmony_ci  # be a `FORMAT` buffer. If no depth/stencil buffer is specified a default
656e5c31af7Sopenharmony_ci  # buffer of format `D32_SFLOAT_S8_UINT` will be created for graphics
657e5c31af7Sopenharmony_ci  # pipelines.
658e5c31af7Sopenharmony_ci  BIND BUFFER {buffer_name} AS depth_stencil
659e5c31af7Sopenharmony_ci
660e5c31af7Sopenharmony_ci  # Attach |buffer_name| as a multisample resolve target. The order of resolve
661e5c31af7Sopenharmony_ci  # target images match with the order of color attachments that have more than
662e5c31af7Sopenharmony_ci  # one sample.
663e5c31af7Sopenharmony_ci  BIND BUFFER {buffer_name} AS resolve
664e5c31af7Sopenharmony_ci
665e5c31af7Sopenharmony_ci  # Attach |buffer_name| as the push_constant buffer. There can be only one
666e5c31af7Sopenharmony_ci  # push constant buffer attached to a pipeline.
667e5c31af7Sopenharmony_ci  BIND BUFFER {buffer_name} AS push_constant
668e5c31af7Sopenharmony_ci
669e5c31af7Sopenharmony_ci  # Bind OpenCL argument buffer by name. Specifying the buffer type is optional.
670e5c31af7Sopenharmony_ci  # Amber will set the type as appropriate for the argument buffer. All uses
671e5c31af7Sopenharmony_ci  # of the buffer must have a consistent |buffer_type| across all pipelines.
672e5c31af7Sopenharmony_ci  BIND BUFFER {buffer_name} [ AS {buffer_type} (default computed)] \
673e5c31af7Sopenharmony_ci      KERNEL ARG_NAME _name_
674e5c31af7Sopenharmony_ci
675e5c31af7Sopenharmony_ci  # Bind OpenCL argument buffer by argument ordinal. Arguments use 0-based
676e5c31af7Sopenharmony_ci  # numbering. Specifying the buffer type is optional. Amber will set the
677e5c31af7Sopenharmony_ci  # type as appropriate for the argument buffer. All uses of the buffer
678e5c31af7Sopenharmony_ci  # must have a consistent |buffer_type| across all pipelines.
679e5c31af7Sopenharmony_ci  BIND BUFFER {buffer_name} [ AS {buffer_type} (default computed)] \
680e5c31af7Sopenharmony_ci      KERNEL ARG_NUMBER _number_
681e5c31af7Sopenharmony_ci
682e5c31af7Sopenharmony_ci  # Bind OpenCL argument sampler by argument name.
683e5c31af7Sopenharmony_ci  BIND SAMPLER {sampler_name} KERNEL ARG_NAME _name_
684e5c31af7Sopenharmony_ci
685e5c31af7Sopenharmony_ci  # Bind OpenCL argument sampler by argument ordinal. Arguments use 0-based
686e5c31af7Sopenharmony_ci  # numbering.
687e5c31af7Sopenharmony_ci  BIND SAMPLER {sampler_name} KERNEL ARG_NUMBER _number_
688e5c31af7Sopenharmony_ci```
689e5c31af7Sopenharmony_ci
690e5c31af7Sopenharmony_ciAll BIND BUFFER and BIND SAMPLER commands below define a descriptor set and binding ID.
691e5c31af7Sopenharmony_ciThese commands can be replaced with BIND BUFFER_ARRAY and BIND SAMPLER_ARRAY commands.
692e5c31af7Sopenharmony_ciIn these cases multiple buffer or sampler names need to be provided, separated by spaces.
693e5c31af7Sopenharmony_ciThis creates a descriptor array of buffers or samplers bound to the same descriptor set
694e5c31af7Sopenharmony_ciand binding ID. An array of dynamic offsets should be provided via `OFFSET offset1 offset2 ...`
695e5c31af7Sopenharmony_ciwhen using dynamic buffers with BUFFER_ARRAY. Optional descriptor binding offset(s) and range(s)
696e5c31af7Sopenharmony_cican be defined via `DESCRIPTOR_OFFSET offset1 offset2 ...` and 
697e5c31af7Sopenharmony_ci`DESCRIPTOR_RANGE range1 range2 ...` when using uniform or storage buffers. Offsets and 
698e5c31af7Sopenharmony_ciranges can be used also with dynamic buffers.
699e5c31af7Sopenharmony_ci```groovy
700e5c31af7Sopenharmony_ci  # Bind the buffer of the given |buffer_type| at the given descriptor set
701e5c31af7Sopenharmony_ci  # and binding. The buffer will use a byte offset |descriptor_offset| 
702e5c31af7Sopenharmony_ci  # with range |range|.
703e5c31af7Sopenharmony_ci  BIND {BUFFER | BUFFER_ARRAY} {buffer_name} AS {buffer_type} DESCRIPTOR_SET _id_ \
704e5c31af7Sopenharmony_ci       BINDING _id_ [ DESCRIPTOR_OFFSET _descriptor_offset_ (default 0) ] \ 
705e5c31af7Sopenharmony_ci       [ DESCRIPTOR_RANGE _range_ (default -1 == VK_WHOLE_SIZE) ]
706e5c31af7Sopenharmony_ci
707e5c31af7Sopenharmony_ci  # Attach |buffer_name| as a storage image. The MIP level will have a base
708e5c31af7Sopenharmony_ci  # value of |level|.
709e5c31af7Sopenharmony_ci  BIND {BUFFER | BUFFER_ARRAY} {buffer_name} AS storage_image \
710e5c31af7Sopenharmony_ci      DESCRIPTOR_SET _id_ BINDING _id_ [ BASE_MIP_LEVEL _level_ (default 0) ]
711e5c31af7Sopenharmony_ci
712e5c31af7Sopenharmony_ci  # Attach |buffer_name| as a sampled image.  The MIP level will have a base
713e5c31af7Sopenharmony_ci  # value of |level|.
714e5c31af7Sopenharmony_ci  BIND {BUFFER | BUFFER_ARRAY} {buffer_name} AS sampled_image \
715e5c31af7Sopenharmony_ci      DESCRIPTOR_SET _id_ BINDING _id_ [ BASE_MIP_LEVEL _level_ (default 0) ]
716e5c31af7Sopenharmony_ci
717e5c31af7Sopenharmony_ci  # Attach |buffer_name| as a combined image sampler. A sampler |sampler_name|
718e5c31af7Sopenharmony_ci  # must also be specified. The MIP level will have a base value of 0.
719e5c31af7Sopenharmony_ci  BIND {BUFFER | BUFFER_ARRAY} {buffer_name} AS combined_image_sampler SAMPLER {sampler_name} \
720e5c31af7Sopenharmony_ci      DESCRIPTOR_SET _id_ BINDING _id_ [ BASE_MIP_LEVEL _level_ (default 0) ]
721e5c31af7Sopenharmony_ci
722e5c31af7Sopenharmony_ci  # Bind the sampler at the given descriptor set and binding.
723e5c31af7Sopenharmony_ci  BIND {SAMPLER | SAMPLER_ARRAY} {sampler_name} DESCRIPTOR_SET _id_ BINDING _id_
724e5c31af7Sopenharmony_ci
725e5c31af7Sopenharmony_ci  # Bind |buffer_name| as dynamic uniform/storage buffer at the given descriptor set
726e5c31af7Sopenharmony_ci  # and binding. The buffer will use a byte offset |offset| + |descriptor_offset|
727e5c31af7Sopenharmony_ci  # with range |range|.
728e5c31af7Sopenharmony_ci  BIND {BUFFER | BUFFER_ARRAY} {buffer_name} AS {uniform_dynamic | storage_dynamic} \
729e5c31af7Sopenharmony_ci       DESCRIPTOR_SET _id_ BINDING _id_ OFFSET _offset_ \
730e5c31af7Sopenharmony_ci       [ DESCRIPTOR_OFFSET _descriptor_offset_ (default 0) ] \ 
731e5c31af7Sopenharmony_ci       [ DESCRIPTOR_RANGE _range_ (default -1 == VK_WHOLE_SIZE) ]
732e5c31af7Sopenharmony_ci```
733e5c31af7Sopenharmony_ci
734e5c31af7Sopenharmony_ci```groovy
735e5c31af7Sopenharmony_ci  # Set |buffer_name| as the vertex data at location |val|. RATE defines the
736e5c31af7Sopenharmony_ci  # input rate for vertex attribute reading. OFFSET sets the byte offset for the
737e5c31af7Sopenharmony_ci  # vertex data within the buffer |buffer_name|, which by default is 0. FORMAT
738e5c31af7Sopenharmony_ci  # sets the vertex buffer format, which by default is the format of the buffer
739e5c31af7Sopenharmony_ci  # |buffer_name|. STRIDE sets the byte stride, which by default is the stride
740e5c31af7Sopenharmony_ci  # of the format (set explicitly via FORMAT or from the format of the buffer
741e5c31af7Sopenharmony_ci  # |buffer_name|).
742e5c31af7Sopenharmony_ci  VERTEX_DATA {buffer_name} LOCATION _val_ [ RATE { vertex | instance } (default vertex) ] \
743e5c31af7Sopenharmony_ci        [ FORMAT {format} ] [ OFFSET {offset} ] [ STRIDE {stride} ]
744e5c31af7Sopenharmony_ci
745e5c31af7Sopenharmony_ci  # Set |buffer_name| as the index data to use for `INDEXED` draw commands.
746e5c31af7Sopenharmony_ci  INDEX_DATA {buffer_name}
747e5c31af7Sopenharmony_ci```
748e5c31af7Sopenharmony_ci
749e5c31af7Sopenharmony_ci#### OpenCL Plain-Old-Data Arguments
750e5c31af7Sopenharmony_ciOpenCL kernels can have plain-old-data (pod or pod_ubo in the desriptor map)
751e5c31af7Sopenharmony_ciarguments set their data via this command. Amber will generate the appropriate
752e5c31af7Sopenharmony_cibuffers for the pipeline populated with the specified data.
753e5c31af7Sopenharmony_ci
754e5c31af7Sopenharmony_ci```groovy
755e5c31af7Sopenharmony_ci  # Set argument |name| to |data_type| with value |val|.
756e5c31af7Sopenharmony_ci  SET KERNEL ARG_NAME _name_ AS {data_type} _val_
757e5c31af7Sopenharmony_ci
758e5c31af7Sopenharmony_ci  # Set argument |number| to |data_type| with value |val|.
759e5c31af7Sopenharmony_ci  # Arguments use 0-based numbering.
760e5c31af7Sopenharmony_ci  SET KERNEL ARG_NUMBER _number_ AS {data_type} _val_
761e5c31af7Sopenharmony_ci```
762e5c31af7Sopenharmony_ci
763e5c31af7Sopenharmony_ci#### Topologies
764e5c31af7Sopenharmony_ci * `POINT_LIST`
765e5c31af7Sopenharmony_ci * `LINE_LIST`
766e5c31af7Sopenharmony_ci * `LINE_LIST_WITH_ADJACENCY`
767e5c31af7Sopenharmony_ci * `LINE_STRIP`
768e5c31af7Sopenharmony_ci * `LINE_STRIP_WITH_ADJACENCY`
769e5c31af7Sopenharmony_ci * `TRIANGLE_LIST`
770e5c31af7Sopenharmony_ci * `TRIANGLE_LIST_WITH_ADJACENCY`
771e5c31af7Sopenharmony_ci * `TRIANGLE_STRIP`
772e5c31af7Sopenharmony_ci * `TRIANGLE_STRIP_WITH_ADJACENCY`
773e5c31af7Sopenharmony_ci * `TRIANGLE_fan`
774e5c31af7Sopenharmony_ci * `PATCH_LIST`
775e5c31af7Sopenharmony_ci
776e5c31af7Sopenharmony_ci### Run a pipeline.
777e5c31af7Sopenharmony_ci
778e5c31af7Sopenharmony_ciWhen running a `DRAW_ARRAY` command, you must attach the vertex data to the
779e5c31af7Sopenharmony_ci`PIPELINE` with the `VERTEX_DATA` command.
780e5c31af7Sopenharmony_ci
781e5c31af7Sopenharmony_ciTo run an indexed draw, attach the index data to the `PIPELINE` with an
782e5c31af7Sopenharmony_ci`INDEX_DATA` command.
783e5c31af7Sopenharmony_ci
784e5c31af7Sopenharmony_ciFor the commands which take a `START_IDX` and a `COUNT` they can be left off the
785e5c31af7Sopenharmony_cicommand (although, `START_IDX` is required if `COUNT` is provided). The default
786e5c31af7Sopenharmony_civalue for `START_IDX` is 0. The default value for `COUNT` is the item count of
787e5c31af7Sopenharmony_civertex buffer minus the `START_IDX`. The same applies to `START_INSTANCE`
788e5c31af7Sopenharmony_ci(default 0) and `INSTANCE_COUNT` (default 1).
789e5c31af7Sopenharmony_ci
790e5c31af7Sopenharmony_ci```groovy
791e5c31af7Sopenharmony_ci# Run the given |pipeline_name| which must be a `compute` pipeline. The
792e5c31af7Sopenharmony_ci# pipeline will be run with the given number of workgroups in the |x|, |y|, |z|
793e5c31af7Sopenharmony_ci# dimensions. Each of the x, y and z values must be a uint32.
794e5c31af7Sopenharmony_ciRUN {pipeline_name} _x_ _y_ _z_
795e5c31af7Sopenharmony_ci```
796e5c31af7Sopenharmony_ci
797e5c31af7Sopenharmony_ci```groovy
798e5c31af7Sopenharmony_ci# Run the given |pipeline_name| which must be a `graphics` pipeline. The
799e5c31af7Sopenharmony_ci# rectangle at |x|, |y|, |width|x|height| will be rendered. Ignores VERTEX_DATA
800e5c31af7Sopenharmony_ci# and INDEX_DATA on the given pipeline.
801e5c31af7Sopenharmony_ciRUN {pipeline_name} \
802e5c31af7Sopenharmony_ci  DRAW_RECT POS _x_in_pixels_ _y_in_pixels_ \
803e5c31af7Sopenharmony_ci  SIZE _width_in_pixels_ _height_in_pixels_
804e5c31af7Sopenharmony_ci```
805e5c31af7Sopenharmony_ci
806e5c31af7Sopenharmony_ci```groovy
807e5c31af7Sopenharmony_ci# Run the given |pipeline_name| which must be a `graphics` pipeline. The
808e5c31af7Sopenharmony_ci# grid at |x|, |y|, |width|x|height|, |columns|x|rows| will be rendered.
809e5c31af7Sopenharmony_ci# Ignores VERTEX_DATA and INDEX_DATA on the given pipeline.
810e5c31af7Sopenharmony_ci# For columns, rows of (5, 4) a total of 5*4=20 rectangles will be drawn.
811e5c31af7Sopenharmony_ciRUN {pipeline_name} \
812e5c31af7Sopenharmony_ci  DRAW_GRID POS _x_in_pixels_ _y_in_pixels_ \
813e5c31af7Sopenharmony_ci  SIZE _width_in_pixels_ _height_in_pixels_ \
814e5c31af7Sopenharmony_ci  CELLS _columns_of_cells_ _rows_of_cells_
815e5c31af7Sopenharmony_ci```
816e5c31af7Sopenharmony_ci
817e5c31af7Sopenharmony_ci```groovy
818e5c31af7Sopenharmony_ci# Run the |pipeline_name| which must be a `graphics` pipeline. The vertex
819e5c31af7Sopenharmony_ci# data must be attached to the pipeline.
820e5c31af7Sopenharmony_ci
821e5c31af7Sopenharmony_ci# A start index of |value| will be used and the count of |count_value| items
822e5c31af7Sopenharmony_ci# will be processed. The draw is instanced if |inst_count_value| is greater
823e5c31af7Sopenharmony_ci# than one. In case of instanced draw |inst_value| controls the starting
824e5c31af7Sopenharmony_ci# instance ID.
825e5c31af7Sopenharmony_ciRUN {pipeline_name} DRAW_ARRAY AS {topology} \
826e5c31af7Sopenharmony_ci    [ START_IDX _value_ (default 0) ] \
827e5c31af7Sopenharmony_ci    [ COUNT _count_value_ (default vertex_buffer size - start_idx) ] \
828e5c31af7Sopenharmony_ci    [ START_INSTANCE _inst_value_ (default 0) ] \
829e5c31af7Sopenharmony_ci    [ INSTANCE_COUNT _inst_count_value_ (default 1) ]
830e5c31af7Sopenharmony_ci```
831e5c31af7Sopenharmony_ci
832e5c31af7Sopenharmony_ci```groovy
833e5c31af7Sopenharmony_ci# Run the |pipeline_name| which must be a `graphics` pipeline. The vertex
834e5c31af7Sopenharmony_ci# data and  index data must be attached to the pipeline. The vertices will be
835e5c31af7Sopenharmony_ci# drawn using the given |topology|.
836e5c31af7Sopenharmony_ci#
837e5c31af7Sopenharmony_ci# A start index of |value| will be used and the count of |count_value| items
838e5c31af7Sopenharmony_ci# will be processed. The draw is instanced if |inst_count_value| is greater
839e5c31af7Sopenharmony_ci# than one. In case of instanced draw |inst_value| controls the starting
840e5c31af7Sopenharmony_ci# instance ID.
841e5c31af7Sopenharmony_ciRUN {pipeline_name} DRAW_ARRAY AS {topology} INDEXED \
842e5c31af7Sopenharmony_ci    [ START_IDX _value_ (default 0) ] \
843e5c31af7Sopenharmony_ci    [ COUNT _count_value_ (default index_buffer size - start_idx) ] \
844e5c31af7Sopenharmony_ci    [ START_INSTANCE _inst_value_ (default 0) ] \
845e5c31af7Sopenharmony_ci    [ INSTANCE_COUNT _inst_count_value_ (default 1) ]
846e5c31af7Sopenharmony_ci```
847e5c31af7Sopenharmony_ci
848e5c31af7Sopenharmony_ci### Repeating commands
849e5c31af7Sopenharmony_ci
850e5c31af7Sopenharmony_ci```groovy
851e5c31af7Sopenharmony_ci# It is sometimes useful to run a given draw command multiple times. This can be
852e5c31af7Sopenharmony_ci# to detect deterministic rendering or other features.
853e5c31af7Sopenharmony_ciREPEAT {count}
854e5c31af7Sopenharmony_ci{command}+
855e5c31af7Sopenharmony_ciEND
856e5c31af7Sopenharmony_ci```
857e5c31af7Sopenharmony_ci
858e5c31af7Sopenharmony_ciThe commands which can be used inside a `REPEAT` block are:
859e5c31af7Sopenharmony_ci  * `CLEAR`
860e5c31af7Sopenharmony_ci  * `CLEAR_COLOR`
861e5c31af7Sopenharmony_ci  * `CLEAR_DEPTH`
862e5c31af7Sopenharmony_ci  * `CLEAR_STENCIL`
863e5c31af7Sopenharmony_ci  * `COPY`
864e5c31af7Sopenharmony_ci  * `EXPECT`
865e5c31af7Sopenharmony_ci  * `RUN`
866e5c31af7Sopenharmony_ci
867e5c31af7Sopenharmony_ci### Commands
868e5c31af7Sopenharmony_ci
869e5c31af7Sopenharmony_ci```groovy
870e5c31af7Sopenharmony_ci# Sets the clear color to use for |pipeline| which must be a graphics
871e5c31af7Sopenharmony_ci# pipeline. The colors are integers from 0 - 255.  Defaults to (0, 0, 0, 0)
872e5c31af7Sopenharmony_ciCLEAR_COLOR {pipeline} _r (0 - 255)_ _g (0 - 255)_ _b (0 - 255)_ _a (0 - 255)_
873e5c31af7Sopenharmony_ci
874e5c31af7Sopenharmony_ci# Sets the depth clear value to use for |pipeline| which must be a graphics
875e5c31af7Sopenharmony_ci# pipeline. |value| must be a decimal number.
876e5c31af7Sopenharmony_ciCLEAR_DEPTH {pipeline} _value_
877e5c31af7Sopenharmony_ci
878e5c31af7Sopenharmony_ci# Sets the stencil clear value to use for |pipeline| which must be a graphics
879e5c31af7Sopenharmony_ci# pipeline. |value| must be an integer from 0 - 255.
880e5c31af7Sopenharmony_ciCLEAR_STENCIL {pipeline} _value_
881e5c31af7Sopenharmony_ci
882e5c31af7Sopenharmony_ci# Instructs the |pipeline| which must be a graphics pipeline to execute the
883e5c31af7Sopenharmony_ci# clear command.
884e5c31af7Sopenharmony_ciCLEAR {pipeline}
885e5c31af7Sopenharmony_ci```
886e5c31af7Sopenharmony_ci
887e5c31af7Sopenharmony_ci### Expectations
888e5c31af7Sopenharmony_ci
889e5c31af7Sopenharmony_ci#### Comparators
890e5c31af7Sopenharmony_ci * `EQ`
891e5c31af7Sopenharmony_ci * `NE`
892e5c31af7Sopenharmony_ci * `LT`
893e5c31af7Sopenharmony_ci * `LE`
894e5c31af7Sopenharmony_ci * `GT`
895e5c31af7Sopenharmony_ci * `GE`
896e5c31af7Sopenharmony_ci * `EQ_RGB`
897e5c31af7Sopenharmony_ci * `EQ_RGBA`
898e5c31af7Sopenharmony_ci * `EQ_BUFFER`
899e5c31af7Sopenharmony_ci * `RMSE_BUFFER`
900e5c31af7Sopenharmony_ci * `EQ_HISTOGRAM_EMD_BUFFER`
901e5c31af7Sopenharmony_ci
902e5c31af7Sopenharmony_ci```groovy
903e5c31af7Sopenharmony_ci# Checks that |buffer_name| at |x| has the given |value|s when compared
904e5c31af7Sopenharmony_ci# with the given |comparator|.
905e5c31af7Sopenharmony_ciEXPECT {buffer_name} IDX _x_ {comparator} _value_+
906e5c31af7Sopenharmony_ci
907e5c31af7Sopenharmony_ci# Checks that |buffer_name| at |x| has values within |tolerance| of |value|
908e5c31af7Sopenharmony_ci# The |tolerance| can be specified as 1-4 float values separated by spaces.
909e5c31af7Sopenharmony_ci# The tolerances may be given as a percentage by placing a '%' symbol after
910e5c31af7Sopenharmony_ci# the value. If less tolerance values are provided then are needed for a given
911e5c31af7Sopenharmony_ci# data component the default tolerance will be applied.
912e5c31af7Sopenharmony_ciEXPECT {buffer_name} IDX _x_ TOLERANCE _tolerance_{1,4} EQ _value_+
913e5c31af7Sopenharmony_ci
914e5c31af7Sopenharmony_ci# Checks that |buffer_name| at |x|, |y| for |width|x|height| pixels has the
915e5c31af7Sopenharmony_ci# given |r|, |g|, |b| values. Each r, g, b value is an integer from 0-255.
916e5c31af7Sopenharmony_ciEXPECT {buffer_name} IDX _x_in_pixels_ _y_in_pixels_ \
917e5c31af7Sopenharmony_ci  SIZE _width_in_pixels_ _height_in_pixels_ \
918e5c31af7Sopenharmony_ci  EQ_RGB _r (0 - 255)_ _g (0 - 255)_ _b (0 - 255)_
919e5c31af7Sopenharmony_ci
920e5c31af7Sopenharmony_ci# Checks that |buffer_name| at |x|, |y| for |width|x|height| pixels has the
921e5c31af7Sopenharmony_ci# given |r|, |g|, |b|, |a| values. Each r, g, b, a value is an integer
922e5c31af7Sopenharmony_ci# from 0-255.
923e5c31af7Sopenharmony_ciEXPECT {buffer_name} IDX _x_in_pixels_ _y_in_pixels_ \
924e5c31af7Sopenharmony_ci  SIZE _width_in_pixels_ _height_in_pixels_ \
925e5c31af7Sopenharmony_ci  EQ_RGBA _r (0 - 255)_ _g (0 - 255)_ _b (0 - 255)_ _a (0 - 255)_
926e5c31af7Sopenharmony_ci
927e5c31af7Sopenharmony_ci# Checks that |buffer_1| contents are equal to those of |buffer_2|
928e5c31af7Sopenharmony_ciEXPECT {buffer_1} EQ_BUFFER {buffer_2}
929e5c31af7Sopenharmony_ci
930e5c31af7Sopenharmony_ci# Checks that the Root Mean Square Error when comparing |buffer_1| to
931e5c31af7Sopenharmony_ci# |buffer_2| is less than or equal to |tolerance|. Note, |tolerance| is a
932e5c31af7Sopenharmony_ci# unit-less number.
933e5c31af7Sopenharmony_ciEXPECT {buffer_1} RMSE_BUFFER {buffer_2} TOLERANCE _value_
934e5c31af7Sopenharmony_ci
935e5c31af7Sopenharmony_ci# Checks that the Earth Mover's Distance when comparing histograms of
936e5c31af7Sopenharmony_ci# |buffer_1| to |buffer_2| is less than or equal to |tolerance|.
937e5c31af7Sopenharmony_ci# Note, |tolerance| is a unit-less number.
938e5c31af7Sopenharmony_ciEXPECT {buffer_1} EQ_HISTOGRAM_EMD_BUFFER {buffer_2} TOLERANCE _value_
939e5c31af7Sopenharmony_ci```
940e5c31af7Sopenharmony_ci
941e5c31af7Sopenharmony_ci## Examples
942e5c31af7Sopenharmony_ci
943e5c31af7Sopenharmony_ci### Compute Shader
944e5c31af7Sopenharmony_ci
945e5c31af7Sopenharmony_ci```groovy
946e5c31af7Sopenharmony_ci#!amber
947e5c31af7Sopenharmony_ci# Simple amber compute shader.
948e5c31af7Sopenharmony_ci
949e5c31af7Sopenharmony_ciSHADER compute kComputeShader GLSL
950e5c31af7Sopenharmony_ci#version 450
951e5c31af7Sopenharmony_ci
952e5c31af7Sopenharmony_cilayout(binding = 3) buffer block {
953e5c31af7Sopenharmony_ci  vec2 values[];
954e5c31af7Sopenharmony_ci};
955e5c31af7Sopenharmony_ci
956e5c31af7Sopenharmony_civoid main() {
957e5c31af7Sopenharmony_ci  values[gl_WorkGroupID.x + gl_WorkGroupID.y * gl_NumWorkGroups.x] =
958e5c31af7Sopenharmony_ci                gl_WorkGroupID.xy;
959e5c31af7Sopenharmony_ci}
960e5c31af7Sopenharmony_ciEND  # shader
961e5c31af7Sopenharmony_ci
962e5c31af7Sopenharmony_ciBUFFER kComputeBuffer DATA_TYPE vec2<int32> SIZE 524288 FILL 0
963e5c31af7Sopenharmony_ci
964e5c31af7Sopenharmony_ciPIPELINE compute kComputePipeline
965e5c31af7Sopenharmony_ci  ATTACH kComputeShader
966e5c31af7Sopenharmony_ci  BIND BUFFER kComputeBuffer AS storage DESCRIPTOR_SET 0 BINDING 3
967e5c31af7Sopenharmony_ciEND  # pipeline
968e5c31af7Sopenharmony_ci
969e5c31af7Sopenharmony_ciRUN kComputePipeline 256 256 1
970e5c31af7Sopenharmony_ci
971e5c31af7Sopenharmony_ci# Four corners
972e5c31af7Sopenharmony_ciEXPECT kComputeBuffer IDX 0 EQ 0 0
973e5c31af7Sopenharmony_ciEXPECT kComputeBuffer IDX 2040 EQ 255 0
974e5c31af7Sopenharmony_ciEXPECT kComputeBuffer IDX 522240 EQ 0 255
975e5c31af7Sopenharmony_ciEXPECT kComputeBuffer IDX 524280 EQ 255 255
976e5c31af7Sopenharmony_ci
977e5c31af7Sopenharmony_ci# Center
978e5c31af7Sopenharmony_ciEXPECT kComputeBuffer IDX 263168 EQ 128 128
979e5c31af7Sopenharmony_ci```
980e5c31af7Sopenharmony_ci
981e5c31af7Sopenharmony_ci### Entry Points
982e5c31af7Sopenharmony_ci
983e5c31af7Sopenharmony_ci```groovy
984e5c31af7Sopenharmony_ci#!amber
985e5c31af7Sopenharmony_ci
986e5c31af7Sopenharmony_ciSHADER vertex kVertexShader PASSTHROUGH
987e5c31af7Sopenharmony_ci
988e5c31af7Sopenharmony_ciSHADER fragment kFragmentShader SPIRV-ASM
989e5c31af7Sopenharmony_ci              OpCapability Shader
990e5c31af7Sopenharmony_ci          %1 = OpExtInstImport "GLSL.std.450"
991e5c31af7Sopenharmony_ci               OpMemoryModel Logical GLSL450
992e5c31af7Sopenharmony_ci
993e5c31af7Sopenharmony_ci; two entrypoints
994e5c31af7Sopenharmony_ci               OpEntryPoint Fragment %red "red" %color
995e5c31af7Sopenharmony_ci               OpEntryPoint Fragment %green "green" %color
996e5c31af7Sopenharmony_ci
997e5c31af7Sopenharmony_ci               OpExecutionMode %red OriginUpperLeft
998e5c31af7Sopenharmony_ci               OpExecutionMode %green OriginUpperLeft
999e5c31af7Sopenharmony_ci               OpSource GLSL 430
1000e5c31af7Sopenharmony_ci               OpName %red "red"
1001e5c31af7Sopenharmony_ci               OpDecorate %color Location 0
1002e5c31af7Sopenharmony_ci       %void = OpTypeVoid
1003e5c31af7Sopenharmony_ci          %3 = OpTypeFunction %void
1004e5c31af7Sopenharmony_ci      %float = OpTypeFloat 32
1005e5c31af7Sopenharmony_ci    %v4float = OpTypeVector %float 4
1006e5c31af7Sopenharmony_ci%_ptr_Output_v4float = OpTypePointer Output %v4float
1007e5c31af7Sopenharmony_ci      %color = OpVariable %_ptr_Output_v4float Output
1008e5c31af7Sopenharmony_ci    %float_1 = OpConstant %float 1
1009e5c31af7Sopenharmony_ci    %float_0 = OpConstant %float 0
1010e5c31af7Sopenharmony_ci  %red_color = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
1011e5c31af7Sopenharmony_ci%green_color = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
1012e5c31af7Sopenharmony_ci
1013e5c31af7Sopenharmony_ci; this entrypoint outputs a red color
1014e5c31af7Sopenharmony_ci        %red = OpFunction %void None %3
1015e5c31af7Sopenharmony_ci          %5 = OpLabel
1016e5c31af7Sopenharmony_ci               OpStore %color %red_color
1017e5c31af7Sopenharmony_ci               OpReturn
1018e5c31af7Sopenharmony_ci               OpFunctionEnd
1019e5c31af7Sopenharmony_ci
1020e5c31af7Sopenharmony_ci; this entrypoint outputs a green color
1021e5c31af7Sopenharmony_ci      %green = OpFunction %void None %3
1022e5c31af7Sopenharmony_ci          %6 = OpLabel
1023e5c31af7Sopenharmony_ci               OpStore %color %green_color
1024e5c31af7Sopenharmony_ci               OpReturn
1025e5c31af7Sopenharmony_ci               OpFunctionEnd
1026e5c31af7Sopenharmony_ciEND  # shader
1027e5c31af7Sopenharmony_ci
1028e5c31af7Sopenharmony_ciBUFFER kImgBuffer FORMAT R8G8B8A8_UINT
1029e5c31af7Sopenharmony_ci
1030e5c31af7Sopenharmony_ciPIPELINE graphics kRedPipeline
1031e5c31af7Sopenharmony_ci  ATTACH kVertexShader ENTRY_POINT main
1032e5c31af7Sopenharmony_ci  SHADER_OPTIMIZATION kVertexShader
1033e5c31af7Sopenharmony_ci    --eliminate-dead-branches
1034e5c31af7Sopenharmony_ci    --merge-return
1035e5c31af7Sopenharmony_ci    --eliminate-dead-code-aggressive
1036e5c31af7Sopenharmony_ci  END
1037e5c31af7Sopenharmony_ci  ATTACH kFragmentShader ENTRY_POINT red
1038e5c31af7Sopenharmony_ci
1039e5c31af7Sopenharmony_ci  FRAMEBUFFER_SIZE 256 256
1040e5c31af7Sopenharmony_ci  BIND BUFFER kImgBuffer AS color LOCATION 0
1041e5c31af7Sopenharmony_ciEND  # pipeline
1042e5c31af7Sopenharmony_ci
1043e5c31af7Sopenharmony_ciPIPELINE graphics kGreenPipeline
1044e5c31af7Sopenharmony_ci  ATTACH kVertexShader
1045e5c31af7Sopenharmony_ci  ATTACH kFragmentShader ENTRY_POINT green
1046e5c31af7Sopenharmony_ci
1047e5c31af7Sopenharmony_ci  FRAMEBUFFER_SIZE 256 256
1048e5c31af7Sopenharmony_ci  BIND BUFFER kImgBuffer AS color LOCATION 0
1049e5c31af7Sopenharmony_ciEND  # pipeline
1050e5c31af7Sopenharmony_ci
1051e5c31af7Sopenharmony_ciRUN kRedPipeline DRAW_RECT POS 0 0 SIZE 256 256
1052e5c31af7Sopenharmony_ciRUN kGreenPipeline DRAW_RECT POS 128 128 SIZE 256 256
1053e5c31af7Sopenharmony_ci
1054e5c31af7Sopenharmony_ciEXPECT kImgBuffer IDX 0 0 SIZE 127 127 EQ_RGB 255 0 0
1055e5c31af7Sopenharmony_ciEXPECT kImgBuffer IDX 128 128 SIZE 128 128 EQ_RGB 0 255 0
1056e5c31af7Sopenharmony_ci```
1057e5c31af7Sopenharmony_ci
1058e5c31af7Sopenharmony_ci### Buffers
1059e5c31af7Sopenharmony_ci
1060e5c31af7Sopenharmony_ci```groovy
1061e5c31af7Sopenharmony_ci#!amber
1062e5c31af7Sopenharmony_ci
1063e5c31af7Sopenharmony_ciSHADER vertex kVertexShader GLSL
1064e5c31af7Sopenharmony_ci  #version 430
1065e5c31af7Sopenharmony_ci
1066e5c31af7Sopenharmony_ci  layout(location = 0) in vec4 position;
1067e5c31af7Sopenharmony_ci  layout(location = 1) in vec4 color_in;
1068e5c31af7Sopenharmony_ci  layout(location = 0) out vec4 color_out;
1069e5c31af7Sopenharmony_ci
1070e5c31af7Sopenharmony_ci  void main() {
1071e5c31af7Sopenharmony_ci    gl_Position = position;
1072e5c31af7Sopenharmony_ci    color_out = color_in;
1073e5c31af7Sopenharmony_ci  }
1074e5c31af7Sopenharmony_ciEND  # shader
1075e5c31af7Sopenharmony_ci
1076e5c31af7Sopenharmony_ciSHADER fragment kFragmentShader GLSL
1077e5c31af7Sopenharmony_ci  #version 430
1078e5c31af7Sopenharmony_ci
1079e5c31af7Sopenharmony_ci  layout(location = 0) in vec4 color_in;
1080e5c31af7Sopenharmony_ci  layout(location = 0) out vec4 color_out;
1081e5c31af7Sopenharmony_ci
1082e5c31af7Sopenharmony_ci  void main() {
1083e5c31af7Sopenharmony_ci    color_out = color_in;
1084e5c31af7Sopenharmony_ci  }
1085e5c31af7Sopenharmony_ciEND  # shader
1086e5c31af7Sopenharmony_ci
1087e5c31af7Sopenharmony_ciBUFFER kPosData DATA_TYPE vec2<int32> DATA
1088e5c31af7Sopenharmony_ci# Top-left
1089e5c31af7Sopenharmony_ci-1 -1  
1090e5c31af7Sopenharmony_ci 0 -1  
1091e5c31af7Sopenharmony_ci-1  0
1092e5c31af7Sopenharmony_ci 0  0
1093e5c31af7Sopenharmony_ci# Top-right
1094e5c31af7Sopenharmony_ci 0 -1  
1095e5c31af7Sopenharmony_ci 1 -1  
1096e5c31af7Sopenharmony_ci 0  0
1097e5c31af7Sopenharmony_ci 1  0
1098e5c31af7Sopenharmony_ci# Bottom-left
1099e5c31af7Sopenharmony_ci-1  0
1100e5c31af7Sopenharmony_ci 0  0
1101e5c31af7Sopenharmony_ci-1  1
1102e5c31af7Sopenharmony_ci 0  1
1103e5c31af7Sopenharmony_ci# Bottom-right
1104e5c31af7Sopenharmony_ci 0  0
1105e5c31af7Sopenharmony_ci 1  0
1106e5c31af7Sopenharmony_ci 0  1
1107e5c31af7Sopenharmony_ci 1  1
1108e5c31af7Sopenharmony_ciEND
1109e5c31af7Sopenharmony_ci
1110e5c31af7Sopenharmony_ciBUFFER kColorData DATA_TYPE uint32 DATA
1111e5c31af7Sopenharmony_ci# red
1112e5c31af7Sopenharmony_ci0xff0000ff
1113e5c31af7Sopenharmony_ci0xff0000ff
1114e5c31af7Sopenharmony_ci0xff0000ff
1115e5c31af7Sopenharmony_ci0xff0000ff
1116e5c31af7Sopenharmony_ci
1117e5c31af7Sopenharmony_ci# green
1118e5c31af7Sopenharmony_ci0xff00ff00
1119e5c31af7Sopenharmony_ci0xff00ff00
1120e5c31af7Sopenharmony_ci0xff00ff00
1121e5c31af7Sopenharmony_ci0xff00ff00
1122e5c31af7Sopenharmony_ci
1123e5c31af7Sopenharmony_ci# blue
1124e5c31af7Sopenharmony_ci0xffff0000
1125e5c31af7Sopenharmony_ci0xffff0000
1126e5c31af7Sopenharmony_ci0xffff0000
1127e5c31af7Sopenharmony_ci0xffff0000
1128e5c31af7Sopenharmony_ci
1129e5c31af7Sopenharmony_ci# purple
1130e5c31af7Sopenharmony_ci0xff800080
1131e5c31af7Sopenharmony_ci0xff800080
1132e5c31af7Sopenharmony_ci0xff800080
1133e5c31af7Sopenharmony_ci0xff800080
1134e5c31af7Sopenharmony_ciEND
1135e5c31af7Sopenharmony_ci
1136e5c31af7Sopenharmony_ciBUFFER kIndices DATA_TYPE int32 DATA
1137e5c31af7Sopenharmony_ci0  1  2    2  1  3
1138e5c31af7Sopenharmony_ci4  5  6    6  5  7
1139e5c31af7Sopenharmony_ci8  9  10   10 9  11
1140e5c31af7Sopenharmony_ci12 13 14   14 13 15
1141e5c31af7Sopenharmony_ciEND
1142e5c31af7Sopenharmony_ci
1143e5c31af7Sopenharmony_ciPIPELINE graphics kGraphicsPipeline
1144e5c31af7Sopenharmony_ci  ATTACH kVertexShader
1145e5c31af7Sopenharmony_ci  ATTACH kFragmentShader
1146e5c31af7Sopenharmony_ci
1147e5c31af7Sopenharmony_ci  VERTEX_DATA kPosData LOCATION 0
1148e5c31af7Sopenharmony_ci  VERTEX_DATA kColorData LOCATION 1
1149e5c31af7Sopenharmony_ci  INDEX_DATA kIndices
1150e5c31af7Sopenharmony_ciEND  # pipeline
1151e5c31af7Sopenharmony_ci
1152e5c31af7Sopenharmony_ciCLEAR_COLOR kGraphicsPipeline 255 0 0 255
1153e5c31af7Sopenharmony_ciCLEAR kGraphicsPipeline
1154e5c31af7Sopenharmony_ci
1155e5c31af7Sopenharmony_ciRUN kGraphicsPipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 24
1156e5c31af7Sopenharmony_ci```
1157e5c31af7Sopenharmony_ci
1158e5c31af7Sopenharmony_ci### OpenCL-C Shaders
1159e5c31af7Sopenharmony_ci
1160e5c31af7Sopenharmony_ci```groovy
1161e5c31af7Sopenharmony_ciSHADER compute my_shader OPENCL-C
1162e5c31af7Sopenharmony_cikernel void line(const int* in, global int* out, int m, int b) {
1163e5c31af7Sopenharmony_ci  *out = *in * m + b;
1164e5c31af7Sopenharmony_ci}
1165e5c31af7Sopenharmony_ciEND
1166e5c31af7Sopenharmony_ci
1167e5c31af7Sopenharmony_ciBUFFER in_buf DATA_TYPE int32 DATA 4 END
1168e5c31af7Sopenharmony_ciBUFFER out_buf DATA_TYPE int32 DATA 0 END
1169e5c31af7Sopenharmony_ci
1170e5c31af7Sopenharmony_ciPIPELINE compute my_pipeline
1171e5c31af7Sopenharmony_ci  ATTACH my_shader ENTRY_POINT line
1172e5c31af7Sopenharmony_ci  COMPILE_OPTIONS
1173e5c31af7Sopenharmony_ci    -cluster-pod-kernel-args
1174e5c31af7Sopenharmony_ci    -pod-ubo
1175e5c31af7Sopenharmony_ci    -constant-args-ubo
1176e5c31af7Sopenharmony_ci    -max-ubo-size=128
1177e5c31af7Sopenharmony_ci  END
1178e5c31af7Sopenharmony_ci  BIND BUFFER in_buf KERNEL ARG_NAME in
1179e5c31af7Sopenharmony_ci  BIND BUFFER out_buf KERNEL ARG_NAME out
1180e5c31af7Sopenharmony_ci  SET KERNEL ARG_NAME m AS int32 3
1181e5c31af7Sopenharmony_ci  SET KERNEL ARG_NAME b AS int32 1
1182e5c31af7Sopenharmony_ciEND
1183e5c31af7Sopenharmony_ci
1184e5c31af7Sopenharmony_ciRUN my_pipeline 1 1 1
1185e5c31af7Sopenharmony_ci
1186e5c31af7Sopenharmony_ciEXPECT out_buf EQ IDX 0 EQ 13
1187e5c31af7Sopenharmony_ci```
1188e5c31af7Sopenharmony_ci
1189e5c31af7Sopenharmony_ci### Image Formats
1190e5c31af7Sopenharmony_ci  * `A1R5G5B5_UNORM_PACK16`
1191e5c31af7Sopenharmony_ci  * `A2B10G10R10_SINT_PACK32`
1192e5c31af7Sopenharmony_ci  * `A2B10G10R10_SNORM_PACK32`
1193e5c31af7Sopenharmony_ci  * `A2B10G10R10_SSCALED_PACK32`
1194e5c31af7Sopenharmony_ci  * `A2B10G10R10_UINT_PACK32`
1195e5c31af7Sopenharmony_ci  * `A2B10G10R10_UNORM_PACK32`
1196e5c31af7Sopenharmony_ci  * `A2B10G10R10_USCALED_PACK32`
1197e5c31af7Sopenharmony_ci  * `A2R10G10B10_SINT_PACK32`
1198e5c31af7Sopenharmony_ci  * `A2R10G10B10_SNORM_PACK32`
1199e5c31af7Sopenharmony_ci  * `A2R10G10B10_SSCALED_PACK32`
1200e5c31af7Sopenharmony_ci  * `A2R10G10B10_UINT_PACK32`
1201e5c31af7Sopenharmony_ci  * `A2R10G10B10_UNORM_PACK32`
1202e5c31af7Sopenharmony_ci  * `A2R10G10B10_USCALED_PACK32`
1203e5c31af7Sopenharmony_ci  * `A8B8G8R8_SINT_PACK32`
1204e5c31af7Sopenharmony_ci  * `A8B8G8R8_SNORM_PACK32`
1205e5c31af7Sopenharmony_ci  * `A8B8G8R8_SRGB_PACK32`
1206e5c31af7Sopenharmony_ci  * `A8B8G8R8_SSCALED_PACK32`
1207e5c31af7Sopenharmony_ci  * `A8B8G8R8_UINT_PACK32`
1208e5c31af7Sopenharmony_ci  * `A8B8G8R8_UNORM_PACK32`
1209e5c31af7Sopenharmony_ci  * `A8B8G8R8_USCALED_PACK32`
1210e5c31af7Sopenharmony_ci  * `B10G11R11_UFLOAT_PACK32`
1211e5c31af7Sopenharmony_ci  * `B4G4R4A4_UNORM_PACK16`
1212e5c31af7Sopenharmony_ci  * `B5G5R5A1_UNORM_PACK16`
1213e5c31af7Sopenharmony_ci  * `B5G6R5_UNORM_PACK16`
1214e5c31af7Sopenharmony_ci  * `B8G8R8A8_SINT`
1215e5c31af7Sopenharmony_ci  * `B8G8R8A8_SNORM`
1216e5c31af7Sopenharmony_ci  * `B8G8R8A8_SRGB`
1217e5c31af7Sopenharmony_ci  * `B8G8R8A8_SSCALED`
1218e5c31af7Sopenharmony_ci  * `B8G8R8A8_UINT`
1219e5c31af7Sopenharmony_ci  * `B8G8R8A8_UNORM`
1220e5c31af7Sopenharmony_ci  * `B8G8R8A8_USCALED`
1221e5c31af7Sopenharmony_ci  * `B8G8R8_SINT`
1222e5c31af7Sopenharmony_ci  * `B8G8R8_SNORM`
1223e5c31af7Sopenharmony_ci  * `B8G8R8_SRGB`
1224e5c31af7Sopenharmony_ci  * `B8G8R8_SSCALED`
1225e5c31af7Sopenharmony_ci  * `B8G8R8_UINT`
1226e5c31af7Sopenharmony_ci  * `B8G8R8_UNORM`
1227e5c31af7Sopenharmony_ci  * `B8G8R8_USCALED`
1228e5c31af7Sopenharmony_ci  * `D16_UNORM`
1229e5c31af7Sopenharmony_ci  * `D16_UNORM_S8_UINT`
1230e5c31af7Sopenharmony_ci  * `D24_UNORM_S8_UINT`
1231e5c31af7Sopenharmony_ci  * `D32_SFLOAT`
1232e5c31af7Sopenharmony_ci  * `D32_SFLOAT_S8_UINT`
1233e5c31af7Sopenharmony_ci  * `R16G16B16A16_SFLOAT`
1234e5c31af7Sopenharmony_ci  * `R16G16B16A16_SINT`
1235e5c31af7Sopenharmony_ci  * `R16G16B16A16_SNORM`
1236e5c31af7Sopenharmony_ci  * `R16G16B16A16_SSCALED`
1237e5c31af7Sopenharmony_ci  * `R16G16B16A16_UINT`
1238e5c31af7Sopenharmony_ci  * `R16G16B16A16_UNORM`
1239e5c31af7Sopenharmony_ci  * `R16G16B16A16_USCALED`
1240e5c31af7Sopenharmony_ci  * `R16G16B16_SFLOAT`
1241e5c31af7Sopenharmony_ci  * `R16G16B16_SINT`
1242e5c31af7Sopenharmony_ci  * `R16G16B16_SNORM`
1243e5c31af7Sopenharmony_ci  * `R16G16B16_SSCALED`
1244e5c31af7Sopenharmony_ci  * `R16G16B16_UINT`
1245e5c31af7Sopenharmony_ci  * `R16G16B16_UNORM`
1246e5c31af7Sopenharmony_ci  * `R16G16B16_USCALED`
1247e5c31af7Sopenharmony_ci  * `R16G16_SFLOAT`
1248e5c31af7Sopenharmony_ci  * `R16G16_SINT`
1249e5c31af7Sopenharmony_ci  * `R16G16_SNORM`
1250e5c31af7Sopenharmony_ci  * `R16G16_SSCALED`
1251e5c31af7Sopenharmony_ci  * `R16G16_UINT`
1252e5c31af7Sopenharmony_ci  * `R16G16_UNORM`
1253e5c31af7Sopenharmony_ci  * `R16G16_USCALED`
1254e5c31af7Sopenharmony_ci  * `R16_SFLOAT`
1255e5c31af7Sopenharmony_ci  * `R16_SINT`
1256e5c31af7Sopenharmony_ci  * `R16_SNORM`
1257e5c31af7Sopenharmony_ci  * `R16_SSCALED`
1258e5c31af7Sopenharmony_ci  * `R16_UINT`
1259e5c31af7Sopenharmony_ci  * `R16_UNORM`
1260e5c31af7Sopenharmony_ci  * `R16_USCALED`
1261e5c31af7Sopenharmony_ci  * `R32G32B32A32_SFLOAT`
1262e5c31af7Sopenharmony_ci  * `R32G32B32A32_SINT`
1263e5c31af7Sopenharmony_ci  * `R32G32B32A32_UINT`
1264e5c31af7Sopenharmony_ci  * `R32G32B32_SFLOAT`
1265e5c31af7Sopenharmony_ci  * `R32G32B32_SINT`
1266e5c31af7Sopenharmony_ci  * `R32G32B32_UINT`
1267e5c31af7Sopenharmony_ci  * `R32G32_SFLOAT`
1268e5c31af7Sopenharmony_ci  * `R32G32_SINT`
1269e5c31af7Sopenharmony_ci  * `R32G32_UINT`
1270e5c31af7Sopenharmony_ci  * `R32_SFLOAT`
1271e5c31af7Sopenharmony_ci  * `R32_SINT`
1272e5c31af7Sopenharmony_ci  * `R32_UINT`
1273e5c31af7Sopenharmony_ci  * `R4G4B4A4_UNORM_PACK16`
1274e5c31af7Sopenharmony_ci  * `R4G4_UNORM_PACK8`
1275e5c31af7Sopenharmony_ci  * `R5G5B5A1_UNORM_PACK16`
1276e5c31af7Sopenharmony_ci  * `R5G6B5_UNORM_PACK16`
1277e5c31af7Sopenharmony_ci  * `R64G64B64A64_SFLOAT`
1278e5c31af7Sopenharmony_ci  * `R64G64B64A64_SINT`
1279e5c31af7Sopenharmony_ci  * `R64G64B64A64_UINT`
1280e5c31af7Sopenharmony_ci  * `R64G64B64_SFLOAT`
1281e5c31af7Sopenharmony_ci  * `R64G64B64_SINT`
1282e5c31af7Sopenharmony_ci  * `R64G64B64_UINT`
1283e5c31af7Sopenharmony_ci  * `R64G64_SFLOAT`
1284e5c31af7Sopenharmony_ci  * `R64G64_SINT`
1285e5c31af7Sopenharmony_ci  * `R64G64_UINT`
1286e5c31af7Sopenharmony_ci  * `R64_SFLOAT`
1287e5c31af7Sopenharmony_ci  * `R64_SINT`
1288e5c31af7Sopenharmony_ci  * `R64_UINT`
1289e5c31af7Sopenharmony_ci  * `R8G8B8A8_SINT`
1290e5c31af7Sopenharmony_ci  * `R8G8B8A8_SNORM`
1291e5c31af7Sopenharmony_ci  * `R8G8B8A8_SRGB`
1292e5c31af7Sopenharmony_ci  * `R8G8B8A8_SSCALED`
1293e5c31af7Sopenharmony_ci  * `R8G8B8A8_UINT`
1294e5c31af7Sopenharmony_ci  * `R8G8B8A8_UNORM`
1295e5c31af7Sopenharmony_ci  * `R8G8B8A8_USCALED`
1296e5c31af7Sopenharmony_ci  * `R8G8B8_SINT`
1297e5c31af7Sopenharmony_ci  * `R8G8B8_SNORM`
1298e5c31af7Sopenharmony_ci  * `R8G8B8_SRGB`
1299e5c31af7Sopenharmony_ci  * `R8G8B8_SSCALED`
1300e5c31af7Sopenharmony_ci  * `R8G8B8_UINT`
1301e5c31af7Sopenharmony_ci  * `R8G8B8_UNORM`
1302e5c31af7Sopenharmony_ci  * `R8G8B8_USCALED`
1303e5c31af7Sopenharmony_ci  * `R8G8_SINT`
1304e5c31af7Sopenharmony_ci  * `R8G8_SNORM`
1305e5c31af7Sopenharmony_ci  * `R8G8_SRGB`
1306e5c31af7Sopenharmony_ci  * `R8G8_SSCALED`
1307e5c31af7Sopenharmony_ci  * `R8G8_UINT`
1308e5c31af7Sopenharmony_ci  * `R8G8_UNORM`
1309e5c31af7Sopenharmony_ci  * `R8G8_USCALED`
1310e5c31af7Sopenharmony_ci  * `R8_SINT`
1311e5c31af7Sopenharmony_ci  * `R8_SNORM`
1312e5c31af7Sopenharmony_ci  * `R8_SRGB`
1313e5c31af7Sopenharmony_ci  * `R8_SSCALED`
1314e5c31af7Sopenharmony_ci  * `R8_UINT`
1315e5c31af7Sopenharmony_ci  * `R8_UNORM`
1316e5c31af7Sopenharmony_ci  * `R8_USCALED`
1317e5c31af7Sopenharmony_ci  * `S8_UINT`
1318e5c31af7Sopenharmony_ci  * `X8_D24_UNORM_PACK32`
1319