A4 9200ddr B2 Zh

  



警告:條目可能具有冒犯性、恐怖、淫褻、粗言穢語或其他未成年人不良的內容。使用或閱讀本條目可能違反當地的法律,詳情請參看香港網絡大典:內容聲明,並自行考慮應否閱讀這些內容。Warning: Some coarse language(s),offensive and obscene content(s) may included in this article. Using or reading this article may violate the. 5D 德福花園 ↺ 紅磡(黃埔花園) 5M 啟德 ( 德朗邨 ) ↺ 九龍灣站 20 啟德 ( 沐安街 ) ⇄ 大角咀(維港灣) 22 啟德郵輪碼頭 ⇄ 九龍塘(又一城) 22M 啟德郵輪碼頭 ↺ 九龍城 ( 富豪東方酒店 ) 24 啟業 ↺ 旺角 過海隧道巴士 108 九龍灣(啟業) ⇄ 寶馬山 九龍專線小巴 88 啟德 ( 啟晴邨. Status Publisher Keeper From To Updated Extent of archive; Archived. American Psychological Association.

-->

Expressions are sequences of variables and literals punctuated by operators. Operators determine how the variables and literals are combined, compared, selected, and so on. The operators include:

Operator NameOperators
Additive and Multiplicative Operators+, -, *, /, %
Array Operator[i]
Assignment Operators=, +=, -=, *=, /=, %=
Binary CastsC rules for float and int, C rules or HLSL intrinsics for bool
Bitwise Operators~, <<, >>, &, |, ^, <<=, >>=, &=, |=, ^=
Boolean Math Operators& &, ||, ?:
Cast Operator(type)
Comma Operator,
Comparison Operators<, >, , !=, <=, >=
Prefix or Postfix Operators++, --
Structure Operator.
Unary Operators!, -, +

Many of the operators are per-component, which means that the operation is performed independently for each component of each variable. For example, a single component variable has one operation performed. On the other hand, a four-component variable has four operations performed, one for each component.

All of the operators that do something to the value, such as + and *, work per component.

The comparison operators require a single component to work unless you use the all or any intrinsic function with a multiple-component variable. The following operation fails because the if statement requires a single bool but receives a bool4:

The following operations succeed:

The binary cast operators asfloat, asint, and so on work per component except for asdouble whose special rules are documented.

Selection operators like period, comma, and array brackets do not work per component.

Cast operators change the number of components. The following cast operations show their equivalence:

Additive and Multiplicative Operators

The additive and multiplicative operators are: +, -, *, /, %

The modulus operator returns the remainder of a division. This produces different results when using integers and floating-point numbers. Integer remainders that are fractional will be truncated.

The modulus operator truncates a fractional remainder when using integers.

The % operator is defined only in cases where either both sides are positive or both sides are negative. Unlike C, it also operates on floating-point data types, as well as integers.

Array Operator

A4 9200ddr B2 Zhen

The array member selection operator '[i]' selects one or more components in an array. It is a set of square brackets that contain a zero-based index.

The array operator can also be used to access a vector.

By adding an additional index, the array operator can also access a matrix.

The first index is the zero-based row index. The second index is the zero-based column index.

Assignment Operators

The assignment operators are: =, +=, -=, *=, /=

Variables can be assigned literal values:

Variables can also be assigned the result of a mathematical operation:

A variable can be used on either side of the equals sign:

Division for floating-point variables is as expected because decimal remainders are not a problem.

Be careful if you are using integers that may get divided, especially when truncation affects the result. This example is identical to the previous example, except for the data type. The truncation causes a very different result.

Binary Casts

Casting operation between int and float will convert the numeric value into the appropriate representations following C rules for truncating an int type. Casting a value from a float to an int and back to a float will result in a lossy conversion based on the precision of the target.

Binary casts may also be performed using Intrinsic Functions (DirectX HLSL), which reinterpret the bit representation of a number into the target data type.

Bitwise Operators

HLSL supports the following bitwise operators, which follow the same precedence as C with regard to other operators. The following table describes the operators.

Note

Bitwise operators require Shader Model 4_0 with Direct3D 10 and higher hardware.

OperatorFunction
~Logical Not
<<Left Shift
>>Right Shift
&Logical And
|Logical Or
^Logical Xor
<<=Left Shift Equal
>>=Right Shift Equal
&=And Equal
|=Or Equal
^=Xor Equal

Bitwise operators are defined to operate only on int and uint data types. Attempting to use bitwise operators on float, or struct data types will result in an error.

Boolean Math Operators

The Boolean math operators are: &&, ||, ?:

A4-9200 Ddr-b2-zh

Unlike short-circuit evaluation of &&, ||, and ?: in C, HLSL expressions never short-circuit an evaluation because they are vector operations. All sides of the expression are always evaluated.

Boolean operators function on a per-component basis. This means that if you compare two vectors, the result is a vector containing the Boolean result of the comparison for each component.

For expressions that use Boolean operators, the size and component type of each variable are promoted to be the same before the operation occurs. The promoted type determines the resolution at which the operation takes place, as well as the result type of the expression. For example an int3 + float expression would be promoted to float3 + float3 for evaluation, and its result would be of type float3.

Cast Operator

An expression preceded by a type name in parenthesis is an explicit type cast. A type cast converts the original expression to the data type of the cast. In general, the simple data types can be cast to the more complex data types (with a promotion cast), but only some complex data types can be cast into simple data types (with a demotion cast).

Only right hand side type casting is legal. For example, expressions such as (int)myFloat = myInt; are illegal. Use myFloat = (float)myInt; instead.

The compiler also performs implicit type cast. For example, the following two expressions are equivalent:

Comma Operator

The comma operator (,) separates one or more expressions that are to be evaluated in order. The value of the last expression in the sequence is used as the value of the sequence.

Here is one case worth calling attention to. If the constructor type is accidentally left off the right side of the equals sign, the right side now contains four expressions, separated by three commas.

The comma operator evaluates an expression from left to right. This reduces the right hand side to:

HLSL uses scalar promotion in this case, so the result is as if this were written as follows:

In this instance, leaving off the float4 type from the right side is probably a mistake that the compiler is unable to detect because this is a valid statement.

A4 9200ddr B2 Zh

Comparison Operators

The comparison operators are: <, >, , !=, <=, >=.

Compare values that are greater than (or less than) any scalar value:

Or, compare values equal to (or not equal to) any scalar value:

Or combine both and compare values that are greater than or equal to (or less than or equal to) any scalar value:

Each of these comparisons can be done with any scalar data type.

To use comparison operators with vector and matrix types, use the all or any intrinsic function.

This operation fails because the if statement requires a single bool but receives a bool4:

These operations succeed:

Prefix or Postfix Operators

The prefix and postfix operators are: ++, --. Prefix operators change the contents of the variable before the expression is evaluated. Postfix operators change the contents of the variable after the expression is evaluated.

A4 9200ddr B2 Zh

In this case, a loop uses the contents of i to keep track of the loop count.

Because the postfix increment operator (++) is used, arrayOfFloats[i] is multiplied by 2 before i is incremented. This could be slightly rearranged to use the prefix increment operator. This one is harder to read, although both examples are equivalent.

Because the prefix operator (++) is used, arrayOfFloats[i+1 - 1] is multiplied by 2 after i is incremented.

The prefix decrement and postfix decrement operator (--) are applied in the same sequence as the increment operator. The difference is that decrement subtracts 1 instead of adding 1.

A4 9200ddr B2 Zhao

A4 9200ddr b2 zhu

Structure Operator

The structure member selection operator (.) is a period. Given this structure:

A4 9200ddr b2 zhou

It can be read like this:

Each member can be read or written with the structure operator:

Unary Operators

The unary operators are: !, -, +

Unary operators operate on a single operand.

Operator Precedence

When an expression contains more than one operator, operator precedence determines the order of evaluation. Operator precedence for HLSL follows the same precedence as C.

Remarks

Curly braces ({,}) start and end a statement block. When a statement block uses a single statement, the curly braces are optional.

Related topics

一覽
周邊
A3A4A5
B4
互換
A44A

A4a4可以係:

  • 164嘅十六進制寫法
  • A4紙:ISO-216紙嘥士標準一種。
  • 殘疾人體育賽事醫學分級入面講嘅「單髀低位截肢」。
  • Audi A4:Audi汽車嘅其一品種
字數搞清楚
先字後數先數後字
A0A1A2A3A4A5A6A7A8A90A1A2A3A4A5A6A7A8A9A
B0B1B2B3B4B5B6B7B8B90B1B2B3B4B5B6B7B8B9B
C0C1C2C3C4C5C6C7C8C90C1C2C3C4C5C6C7C8C9C
D0D1D2D3D4D5D6D7D8D90D1D2D3D4D5D6D7D8D9D
E0E1E2E3E4E5E6E7E8E90E1E2E3E4E5E6E7E8E9E
F0F1F2F3F4F5F6F7F8F90F1F2F3F4F5F6F7F8F9F
G0G1G2G3G4G5G6G7G8G90G1G2G3G4G5G6G7G8G9G
H0H1H2H3H4H5H6H7H8H90H1H2H3H4H5H6H7H8H9H
I0I1I2I3I4I5I6I7I8I90I1I2I3I4I5I6I7I8I9I
J0J1J2J3J4J5J6J7J8J90J1J2J3J4J5J6J7J8J9J
K0K1K2K3K4K5K6K7K8K90K1K2K3K4K5K6K7K8K9K
L0L1L2L3L4L5L6L7L8L90L1L2L3L4L5L6L7L8L9L
M0M1M2M3M4M5M6M7M8M90M1M2M3M4M5M6M7M8M9M
N0N1N2N3N4N5N6N7N8N90N1N2N3N4N5N6N7N8N9N
O0O1O2O3O4O5O6O7O8O90O1O2O3O4O5O6O7O8O9O
P0P1P2P3P4P5P6P7P8P90P1P2P3P4P5P6P7P8P9P
Q0Q1Q2Q3Q4Q5Q6Q7Q8Q90Q1Q2Q3Q4Q5Q6Q7Q8Q9Q
R0R1R2R3R4R5R6R7R8R90R1R2R3R4R5R6R7R8R9R
S0S1S2S3S4S5S6S7S8S90S1S2S3S4S5S6S7S8S9S
T0T1T2T3T4T5T6T7T8T90T1T2T3T4T5T6T7T8T9T
U0U1U2U3U4U5U6U7U8U90U1U2U3U4U5U6U7U8U9U
V0V1V2V3V4V5V6V7V8V90V1V2V3V4V5V6V7V8V9V
W0W1W2W3W4W5W6W7W8W90W1W2W3W4W5W6W7W8W9W
X0X1X2X3X4X5X6X7X8X90X1X2X3X4X5X6X7X8X9X
Y0Y1Y2Y3Y4Y5Y6Y7Y8Y90Y1Y2Y3Y4Y5Y6Y7Y8Y9Y
Z0Z1Z2Z3Z4Z5Z6Z7Z8Z90Z1Z2Z3Z4Z5Z6Z7Z8Z9Z
由「https://zh-yue.wikipedia.org/w/index.php?title=A4&oldid=1102521」收