Name
ps_4_0 - Translation profile to DirectX 10's High Level Shader Language for pixel shaders.
Synopsis
ps_4_0Description
This Direct3D profile translates Cg into DirectX 10's High Level Shader Language (HLSL10) for pixel shaders.
The compiler output for this profile conforms to the textual high-level language defined by DirectX 10's High Level Shading Language.
The limitations of the ps_4_0 profile depend on what HLSL10 profile to which the translated HLSL code is compiled.
3D Api Dependencies
Requires Direct3D 10 support.
http://msdn.microsoft.com/en-us/library/bb509657.aspxProfile Options
-po pad16 This will add padding variables to the cbuffer declarations to match the 16 byte padding the GP4 OpenGL profiles use. This makes sure each variable in the cbuffer uses an entire float4 constant instead of the tight packing HLSL10 normally uses.
Data Types
In general, the Cg data types translate to the HLSL10 data types with the same name.
- half
- NVIDIA GPUs may use half-precision floating-point when the Partial Precision instruction modifier is specified. Half-precision floating-point is encoded with a sign bit, 10 mantissa bits, and 5 exponent bits (biased by 16), sometimes called s10e5.
- float
- The float data type corresponds to a floating-point representation with at least 24 bits.
- NVIDIA GPUs supporting ps_4_0 use standard IEEE 754 single-precision floating-point encoding with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called s10e5.
- Older ATI GPUs use 24-bit floating-point.
- fixed
- The fixed data type is treated like half.
Semantics
Input Semantics
The varying input semantics in the ps_4_0 profile correspond to the respectively named varying output semantics of the vs_4_0 profile.
Binding Semantics Name Corresponding Data COLOR Input primary color COLOR0 COL COL0 COLOR1 Input secondary color COL1 TEX0 Input texture coordinate sets 0 TEXCOORD0 TEX# translates to TEXCOORD# TEX1 Input texture coordinate sets 1 TEXCOORD1 TEX# translates to TEXCOORD# TEX2 Input texture coordinate sets 2 TEXCOORD2 TEX# translates to TEXCOORD# TEX3 Input texture coordinate sets 3 TEXCOORD3 TEX# translates to TEXCOORD# TEX4 Input texture coordinate sets 4 TEXCOORD4 TEX# translates to TEXCOORD# TEX5 Input texture coordinate sets 5 TEXCOORD5 TEX# translates to TEXCOORD# TEX6 Input texture coordinate sets 6 TEXCOORD6 TEX# translates to TEXCOORD# TEX7 Input texture coordinate sets 7 TEXCOORD7 TEX# translates to TEXCOORD# FOGP Input fog color (XYZ) and factor (W) FOGUniform Input Semantics
Sixteen texture units are supported:
Binding Semantic Name Corresponding Data TEXUNIT0 Texture unit 0 TEXUNIT1 Texture unit 1 ... TEXUNIT15 Texture unit 15Output Semantics
COLOR Output color (float4) COLOR0 COL0 COL DEPTH Output depth (float) DEPRStandard Library Issues
This profile is limited to standard library support available in HLSL10. In general, the Cg and HLSL10 standard libraries are very similar.
See Also