1.4 Keywords, statements and mandatory conversion
Read this article shows that you have agreed to the statement
1.4.1 keyword
To facilitate the reference, here is given a list of keywords defined by HLSL:
ASM
Bool
Compile
Const
Decl
DO
Double
Else
Extern
False
Float
for
Half
IF
in
inline
inout
int
Matrix
OUT
PASS
Pixelshader
Return
Sampler
shared
Static
String
Struct
TECHNIQUE
TEXTURE
True
Typedef
Uniform
Vector
Vertexshader
Void
Volatile
While
The following set shows the identifier that is reserved and not used but will become a keyword in the future:
Auto
Break
Case
Catch
charr
Class
Const_cast
Continue
DEFAULT
Delete
Dynamic Cast
ENUM
Explicit
Friend
goto
Long
Mutable
Namespace
New
Operator
Private
protected
public
Register
Reinterpret_cast
Short
Signed
Sizeof
STATIC_CAST
Switch
Template
THIS
Throw
Try
Typename
union
unsigned
Using
Virtual
1.4.2 Basic Process Process
HLSL supports many options, repetitions, and general procedures in which C are similar, repeated, and general procedures. The syntax and C of these statements are extremely similar.
RETURN statement:
Return (Expression);
IF and IF ... ELSE statement:
IF (condition)
{
STATEMENT (S);
}
IF (condition)
{
STATEMENT (S);
}
Else
{
STATEMENT (S);
}
FOR statement:
For (Initial; Condition; Increment)
{
STATEMENT (S);
}
While statement:
WHILE (CONDition)
{
STATEMENT (S);
}
Do ... while statement:
DO
{
STATEMENT (S);
WHILE (condition);
1.4.3 Forced Conversion (CASTING)
HLSL supports a very free forced conversion design. The syntax in HLSL is forced to convert the syntax and the C program language. For example, put Float to Matrix, we write:
Float f = 5.0f;
Matrix m = (matrix) f;
From the example of this book, you can infer the meaning of this conversion syntax. However, if you want to get more detailed supported conversion information, then in the DirectX SDK, under the Content (Content) tab, see DirectX Graphics / Reference / Shader Reference / High Level Shading Language / Type is OK.