Metal Shading Language
Specification
Version 2.0
Developer
1 Introduction
8
...............................................................................................
1.1
Audience
8
............................................................................................................................
1.2
Organization of this Specification
8
......................................................................................
1.3
References
8
.........................................................................................................................
1.4
Metal and C++14
9
...............................................................................................................
1.4.1
Overloading
9
..................................................................................................................
1.4.2
Templates
9
.....................................................................................................................
1.4.3
Preprocessing Directives
9
.............................................................................................
1.4.4
Restrictions
9
..................................................................................................................
1.5
Metal Pixel Coordinate System
10
.........................................................................................
2 Data Types
11
................................................................................................
2.1
Scalar Data Types
11
.............................................................................................................
2.2
Vector Data Types
12
............................................................................................................
2.2.1
Accessing Vector Components
14
..................................................................................
2.2.2
Vector Constructors
16
...................................................................................................
2.2.3
Packed Vector Types
18
..................................................................................................
2.3
Matrix Data Types
19
.............................................................................................................
2.3.1
Accessing Matrix Components
20
..................................................................................
2.3.2
Matrix Constructors
21
....................................................................................................
2.4
Alignment of Data Types
22
..................................................................................................
2.5
Atomic Data Types
22
...........................................................................................................
2.6
Pixel Data Types
23
...............................................................................................................
2.7
Buffers
24
.............................................................................................................................
2.8
Textures
25
...........................................................................................................................
2.9
Samplers
27
..........................................................................................................................
2.10 Imageblocks
30
.....................................................................................................................
2.10.1
Imageblocks in Fragment Functions
32
.........................................................................
2.10.1.1
Implicit Imageblock Layout for Fragment Functions
32
.................................................
2.10.1.2
Explicit Imageblock Layout for Fragment Functions
32
.................................................
2.10.2
Imageblocks in Kernel Functions
34
..............................................................................
2.11
Aggregate Types
35
.............................................................................................................
2.11.1
Arrays of Textures and Samplers
35
...............................................................................
2.11.1.1
Element Access
36
.........................................................................................................
2017-9-12 | Copyright © 2017 Apple Inc. All Rights Reserved.
Page of
2
174
2.11.1.2
Capacity
36
.....................................................................................................................
2.11.1.3
Constructors for Templated Arrays
37
............................................................................
2.12 Argument Buffers
38
.............................................................................................................
2.12.1
Tier 2 Hardware Support for Argument Buffers
40
.........................................................
2.13 Uniform Type
41
....................................................................................................................
2.13.1
The Need for a Uniform Type
41
.....................................................................................
2.13.2
Behavior of the Uniform Type
43
....................................................................................
2.13.3 Uniform Control Flow
44
.......................................................................................................
2.14 Type Conversions and Re-interpreting Data
44
....................................................................
2.15 Implicit Type Conversions
45
................................................................................................
3 Operators
46
.................................................................................................
3.1
Scalar and Vector Operators
46
............................................................................................
3.2
Matrix Operators
49
..............................................................................................................
4 Function and Variable Declarations
52
............................................................
4.1
Function Specifiers
52
..........................................................................................................
4.1.1
Post-Tessellation Vertex Functions
52
............................................................................
4.1.1.1
Patch Type and Number of Control Points Per-Patch
53
................................................
4.1.2
Tile Functions
53
.............................................................................................................
4.1.3
Fragment Function Specifier
54
......................................................................................
4.2
Address Space Attributes for Variables and Arguments
54
..................................................
4.2.1
device Address Space
55
...............................................................................................
4.2.2
threadgroup Address Space
56
......................................................................................
4.2.2.1
SIMD-groups and Quad-groups
56
...............................................................................
4.2.3
threadgroup_imageblock Address Space
57
.................................................................
4.2.4
constant Address Space
57
............................................................................................
4.2.5
thread Address Space
58
................................................................................................
4.3
Function Arguments and Variables
58
..................................................................................
4.3.1
Attributes to Locate Buffers, Textures and Samplers
59
................................................
4.3.1.1
Vertex Function Example with Resources and Outputs to Device Memory
61
...............
4.3.1.2
Raster Order Groups
62
..................................................................................................
4.3.2
Struct of Buffers and Textures
63
..................................................................................
4.3.3
Attributes to Locate Per-Vertex Inputs
64
......................................................................
4.3.4
Attributes for Built-in Variables
67
..................................................................................
2017-9-12 | Copyright © 2017 Apple Inc. All Rights Reserved.
Page of
3
174
Dostları ilə paylaş: |