Game Development Reference
In-Depth Information
will be shared across multiple effects. Only global variables can be
prefixed with the shared keyword.
volatile —If a variable is prefixed with the volatile keyword,
it hints to the effects framework (see Chapter 19) that the variable
will be modified often. Only global variables can be prefixed with
the volatile keyword.
const —The const keyword in HLSL has the same meaning it
has in C++. That is, if a variable is prefixed with the const key-
word, then that variable is constant and cannot be changed.
const float pi = 3.14f;
16.4 Keywords, Statements, and Casting
16.4.1 Keywords
For reference, here is a list of the keywords that HLSL defines:
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
This next set displays identifiers that are reserved and unused but may
become keywords in the future:
auto
break
case
catch
char
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
16.4.2 Basic Program Flow
HLSL supports many familiar C++ statements for selection, repeti-
tion, and general program flow. The syntax of these statements is
exactly like C++.
Search WWH ::




Custom Search