D3Dcompiler Intrinsics

The following intrinsics have been added to the Xbox One D3Dcompiler. These intrinsics expand into new DXBC opcodes that only work on Xbox One.

Most of these intrinsics correspond to the instruction set by AMD, which you can find here.

ALU (Arithmetic Logic Unit)

Intrinsic Description
float __XB_Cos_F32(float a);
Raw Xbox cosine function, implemented as:
return (a >= -256.0f && a <= 256.0f) ? Cos(2.0f * Pi * a) : 0.0f;
float __XB_Cube_ID(
        float f1, 
        float f2, 
        float f3);
Performs:
if (fabs(f3) >= fabs(f1) && 
        fabs(f3) >= fabs(f2)) return f3 < 0 ? 5 : 4;
if (fabs(f2) >= fabs(f1) return f2 < 0 ? 3 : 2;
return f1 < 0 ? 1 : 0;
float __XB_Cube_MA(
        float f1, 
        float f2, 
        float f3);
Performs:
if (fabs(f3) >= fabs(f1) && fabs(f3) >= fabs(f2)) 
        return 2*f3;
if (fabs(f2) >= fabs(f1) return 2*f2;
return 2*f1;
float __XB_Cube_SC(
        float f1, 
        float f2, 
        float f3);
Performs:
if (fabs(f3) >= fabs(f1) && fabs(f3) >= fabs(f2)) 
        return f3 < 0 ? –f1 : f1;
if (fabs(f2) >= fabs(f1)) return f1;
if (f1 < 0) return f3;
return –f3;
float __XB_Cube_TC(
        float f1,
        float f2,
        float f3);
Performs:
if (fabs(f3) >= fabs(f1) && fabs(f3) >= fabs(f2)) 
        return –f2;
if (fabs(f2) >= fabs(f1)) 
        return f2 < 0 ? –f3 : f3;
return –f2;
float __XB_FMA_F32(
        in float mul1, 
        in float mul2, 
        in float add3);
Translates to v_fma_f32 instruction. Fused single-precision multiply-add. Only for double-precision parts. D.f = S0.f * S1.f + S2.f.
__XB_Log_Clamp
Base 2 logarithm, result clamped to -MAX_FLOAT.
float __XB_Max3_F32(
        in float f1,
        in float f2,
        in float f3);
int __XB_Max3_I32(
        in int i1,
        in int i2,
        in int i3);
uint __XB_Max3_U32(
        in uint u1,
        in uint u2,
        in uint u3);
Translates to v_fma_f32 instruction. Fused single-precision multiply-add. Only for double-precision parts. D.f = S0.f * S1.f + S2.f.
float __XB_Med3_F32(
        in float f1, 
        in float f2,
        in float f3);

int __XB_Med3_I32(
        in int i1,
        in int i2,
        in int i3);

uint __XB_Med3_U32(
        in uint u1, 
        in uint u2, 
        in uint u3);
Returns the median of three values.
float __XB_Min3_F32(
        in float f1, 
        in float f2,
        in float f3);

int __XB_Min3_I32(
        in int i1,
        in int i2,
        in int i3);

uint __XB_Min3_U32(
        in uint u1,
        in uint u2,
        in uint u3);
Returns the smallest of three values.
int<1> __XB_MulI24(
        in int i1, 
        in int i2);

int<1> __XB_MulI24Hi(
        in int i1, 
        in int i2);

uint<1> __XB_MulU24(
        in uint u1, 
        in uint u2);

uint<1> __XB_MulU24Hi(
        in uint u1,
        in uint u2);

int<1> __XB_MadI24(
        in int i1,
        in int i2,
        in int i3);

uint<1> __XB_MadU24(
        in uint u1,
        in uint u2,
        in uint u3);
24-bit instructions complete in a single cycle. These instructions read the lower 24 bits of their source and return a 32-bit result.
__XB_Rcp_Clamp
Reciprocal, result clamped to +/- MAX_FLOAT.
__XB_Rsq_Clamp
Reciprocal square root, result clamped to +/- MAX_FLOAT.
float __XB_Sin_F32(float a);
Raw Xbox sine function, implemented as:
return (a >= -256.0f && a <= 256.0f) ? 
        Sin(2.0f * Pi * a) : 
        0.0f;

64-bit ALU

64-bit intrinsics represent 64-bit values as uint2. Note that for signed div or mod, if the denominator is 0 then the result is 0.

uint<2> __XB_AddI64(
              in uint<2> i1,
              in uint<2> i2);

uint<2> __XB_DivI64(
              in uint<2> i1,
              in uint<2> i2);

uint<2> __XB_DivU64(
              in uint<2> u1,
              in uint<2> u2);

uint<2> __XB_DToI64(
              in double<> d);

uint<2> __XB_DToU64(
              in double<> d);

double<> __XB_I64ToD(
              in uint<2> u1);

uint<2> __XB_MaxI64(
              in uint<2> i1,
              in uint<2> i2);

uint<2> __XB_MaxU64(
              in uint<2> u1,
              in uint<2> u2);

uint<2> __XB_MinI64(
              in uint<2> i1,
              in uint<2> i2);

uint<2> __XB_MinU64(
              in uint<2> u1,
              in uint<2> u2);

uint<2> __XB_ModI64(
              in uint<2> i1,
              in uint<2> i2);

uint<2> __XB_ModU64(
              in uint<2> u1,
              in uint<2> u2);

uint<2> __XB_MulI64(
              in uint<2> i1,
              in uint<2> i2);

uint<2> __XB_MulU64(
              in uint<2> u1,
              in uint<2> u2);

uint<2> __XB_NegI64(
              in uint<2> i1);

uint<2> __XB_ShlU64(
              in uint<2> u1,
              in uint u2);

uint<2> __XB_ShrI64(
              in uint<2> i1,
              in uint u2);

uint<2> __XB_ShrU64(
              in uint<2> u1,
              in uint u2);

uint<2> __XB_SubI64(
              in uint<2> i1,
              in uint<2> i2);

double<> __XB_U64ToD(
              in uint<2> u1);

Conversion

Intrinsic Description
uint<> f32tof16nearest(
        in float_like<> x);
Converts float to uint containing f16 using round to nearest. Note that the existing Windows intrinsic f32tof16 uses round to zero.
int<> __XB_F32ToI32FLR(
        in float<> val);
Computes: dst = (int)floor(val);
int<> __XB_F32ToI32RPI(
        in float<> val);
Computes: dst = (int)floor(val + 0.5f);
float<> __XB_I4ToF32(
        in int<> x);
Computes: dst = (float)((x << 28) >> 28);

Pack/unpack

Intrinsic Description
uint<> __XB_BFI(
        in uint<> val, 
        in uint<> preserve,
        in uint<> enable);
Bitfield insert, computes: u = ((UINT)val & (UINT)preserve) | (~(UINT)val & (UINT)enable);
uint<> __XB_BFM(
        in uint<> maskwidth,
        in uint<> maskloc);
Bitfield mask, computes: u = (((1i64 << (maskwidth & 0x1f))-1) << (maskloc & 0x1f));
int  __XB_IBFE(
        in uint width, 
        in uint offset, 
        in uint val);
Where val is the value to extract from, width is the bitfield width, and offset is the bitfield offset. These intrinsics are equivalent to extracting using shift. ((val << n) >> m) is the same as xbfe(32-m, m-n, val).
uint<> __XB_PackF32ToSNORM16(
        in float<> f1, 
        in float<> f2);
Translates to v_cvt_pknorm_i16_f32 instruction.
double fClamp1 = (f1 > 1.0) ? 
        1.0 : 
        (f1 < -1.0 ? -1.0 : f1);
double fClamp2 = (f2 > 1.0) ? 
        1.0 : 
        (f2 < -1.0 ? -1.0 : f2);
double fNorm1 = (fClamp1 * (double)((1 << 15) - 1));
double fNorm2 = (fClamp2 * (double)((1 << 15) - 1));
int i1 = (short)((fNorm1 >= 0) ? 
        (fNorm1 + 0.5) : 
        (fNorm1 - 0.5));
int i2 = (short)((fNorm2 >= 0) ? 
        (fNorm2 + 0.5) : 
        (fNorm2 - 0.5));
u = ((unsigned)(i2 << 16)) 
        | (unsigned)(unsigned short)i1;
uint __XB_PackF32ToU8(
        float insertvalue,
        uint idx,
        uint uSrc);
Copies uSrc to result, then converts insertvalue to uint8 and places it in byte idx of result:
unsigned uFieldIdx = u2 & 0x3;
unsigned uFieldBitLoc = uFieldIdx * 8;
unsigned uInData = u3 & ~(0xff << uFieldBitLoc);
unsigned char u8 = (unsigned char)f1;
unsigned u8Field = ((unsigned)u8) << uFieldBitLoc;

u = u8Field | uInData;
uint<> __XB_PackF32ToUNORM16(
        in float<> f1,
        in float<> f2);
Translates to v_cvt_pknorm_u16_f32 instruction.
double fClamp1 = (f1 > 1.0) ? 
        1.0 : 
        (f1 < 0 ? 0.0 : f1);
double fClamp2 = (f2 > 1.0) ? 
        1.0 : 
        (f2 < 0 ? 0.0 : f2);
double fNorm1 = (fClamp1 * (double)((1 << 16) - 1));
double fNorm2 = (fClamp2 * (double)((1 << 16) - 1));
unsigned u1 = (unsigned)(fNorm1 + 0.5);
unsigned u2 = (unsigned)(fNorm2 + 0.5);
u = ((u2 << 16)) | (unsigned short)u1;
uint<> __XB_PackI32ToI16(
        in int<> i1,
        in int<> i2);
Translates to v_cvt_pknorm_i16_i32 instruction.
u = (((unsigned)(short)i2) << 16) | 
        ((unsigned)(unsigned short)(short)i1);
uint<> __XB_PackU32ToU16(
        in uint<> u1,
        in uint<> u2);
Translates to v_cvt_pknorm_u16_u32 instruction.
u = (((unsigned)(unsigned short)u2) << 16) | 
        ((unsigned)(unsigned short)u1);
uint __XB_UBFE(
        in uint width, 
        in uint offset, 
        in uint val);
Where val is the value to extract from, width is the bitfield width, and offset is the bitfield offset. These intrinsics are equivalent to extracting using shift. ((val << n) >> m) is the same as xbfe(32-m, m-n, val).
float<> __XB_UnpackByte0(
        in uint<> x);
float<> __XB_UnpackByte1(
        in uint<> x);
float<> __XB_UnpackByte2(
        in uint<> x);
float<> __XB_UnpackByte3(
        in uint<> x);
Extracts a single byte from a uint, and converts to a float.
uint __XBOX_PackF32ToI16(
        float f1, 
        float f2)
Removed; replaced with the intrinsics listed above.
uint __XBOX_PackF32ToU16(
        float f1, 
        float f2)
Removed; replaced with the intrinsics listed above.

Scalar ALU

The following bit-count intrinsics correspond to native GPU scalar instructions. If a non-scalar value is provided to these intrinsics, the compiler will promote it to scalar using the v_readfirstlane_b32 instruction.

uint<1> __XB_S_BCNT0_U32(in uint<1> x);  // S_BCNT0_I32_B32;
uint<1> __XB_S_BCNT0_U64(in uint<2> x);  // S_BCNT0_I32_B64;
uint<1> __XB_S_BCNT1_U32(in uint<1> x);  // S_BCNT1_I32_B32;
uint<1> __XB_S_BCNT1_U64(in uint<2> x);  // S_BCNT1_I32_B64;
uint<1> __XB_S_BREV_U32(in uint<1> x);   // S_BREV_B32;
uint<1> __XB_S_BREV_U64(in uint<2> x);   // S_BREV_B64;
uint<1> __XB_S_BSET0_U32(in uint<1> x);  // S_BITSET0_B32;
uint<2> __XB_S_BSET0_U64(in uint<1> x);  // S_BITSET0_B64;
uint<1> __XB_S_BSET1_U32(in uint<1> x);  // S_BITSET1_B32;
uint<2> __XB_S_BSET1_U64(in uint<1> x);  // S_BITSET1_B64;
uint<1> __XB_S_FF0_U32(in uint<1> x);    // S_FF0_I32_B32;
uint<1> __XB_S_FF0_U64(in uint<2> x);    // S_FF0_I32_B64;
uint<1> __XB_S_FF1_U32(in uint<1> x);    // S_FF1_I32_B32;
uint<1> __XB_S_FF1_U64(in uint<2> x);    // S_FF1_I32_B64;
uint<1> __XB_S_FFO_U32(in uint<1> x);    // S_FLBIT_I32_B32;
uint<1> __XB_S_FFO_U64(in uint<2> x);    // S_FLBIT_I32_B64;
uint<1> __XB_S_FOSB_U32(in uint<1> x);   // S_FLBIT_I32;
uint<1> __XB_S_FOSB_U64(in uint<2> x);   // S_FLBIT_I32_I64;  

Typed memory access intrinsics

HLSL buffers are typically accessed via descriptors which describe the type and layout of the buffer memory to the hardware. The typed access intrinsics impose a format and layout conversion onto the memory access, bypassing the format and layout specified by the descriptor.

There are four types of buffer that support typed access: Buffer, RWBuffer, ByteAddressBuffer, and RWByteAddressBuffer. Of these four buffer types, only RWByteAddressBuffer currently supports the TypedStore intrinsics.

TypeMask

Typemask is an immediate scalar which specifies the data and numeric format to be imposed on the memory access.

The low 4 bits of scalar control data format, the next 3 bits control numeric format. The formats follow the CI GPU hardware convention.

The following define could be used to construct the type mask:

#define TYPEMASK(__NUMERIC, __DATA) (((__NUMERIC & 0x7) << 4) | (__DATA & 0xf))  
Data format coding (low 4 bits of scalar)
Code Data Format
0invalid
18
216
38,8
432
516_16
610_11_11
7invalid
810_10_10_2
92_10_10_10
108_8_8_8
1132_32
1216_16_16_16
1332_32_32
1432_32_32_32
15invalid
Numeric format coding (next 3 bits)
Code Numeric Format
0unorm
1snorm
2uscaled
3sscaled
4uint
5sint
6snorm_ogl
7float

Buffer Intrinsic

type Buffer.XB_TypedLoad(in int<1> x, in int<1> typemask);

RWBuffer Intrinsic

type RWBuffer.XB_TypedLoad(in int<1> x, in int<1> typemask);

ByteAddressBuffer Intrinsic

uint ByteAddressBuffer.XB_TypedLoad(in uint<1> byteOffset, in uint<1> typemask);

uint<2> ByteAddressBuffer.XB_TypedLoad2(in uint<1> byteOffset, in uint<1> typemask);

uint<3> ByteAddressBuffer.XB_TypedLoad3(in uint<1> byteOffset, in uint<1> typemask);

uint<4> ByteAddressBuffer.XB_TypedLoad4(in uint<1> byteOffset, in uint<1> typemask);

RWByteAddressBuffer Intrinsic

uint RWByteAddressBuffer.XB_TypedLoad(
        in uint<1> byteOffset,
        in uint<1> typemask);

uint<2> RWByteAddressBuffer.XB_TypedLoad2(
        in uint<1> byteOffset,
        in uint<1> typemask);

uint<3> RWByteAddressBuffer.XB_TypedLoad3(
        in uint<1> byteOffset,
        in uint<1> typemask);

uint<4> RWByteAddressBuffer.XB_TypedLoad4(
        in uint<1> byteOffset,
        in uint<1> typemask);

void RWByteAddressBuffer.XB_TypedStore(
        in uint<1> byteOffset, 
        in uint<1> value,
        in uint<1> typemask);

void RWByteAddressBuffer.XB_TypedStore2(
        in uint<1> byteOffset,
        in uint<2> value,
        in uint<1> typemask);

void RWByteAddressBuffer.XB_TypedStore3(
        in uint<1> byteOffset,
        in uint<3> value,
        in uint<1> typemask);

void RWByteAddressBuffer.XB_TypedStore4(
        in uint<1> byteOffset,
        in uint<4> value,
        in uint<1> typemask);

Execution context

The following intrinsics return the thread context.

uint __XB_GetCUID();
uint __XB_GetLaneID();
uint __XB_GetSEID();
uint __XB_GetSIMDID();
uint __XB_GetWaveID();

Cross lane

A lane is said to be “active on entry” if its lane’s mask bit was enabled on entry to the shader. Sample and gradient operations can require that all lanes in an active lane’s quad are enabled, and the compiler activates these lanes when needed using the s_wqm_b32 instruction.

The compiler reserves the right to enable helper lanes and by default their values will be included by all cross lane operations. If it is desired to exclude helper lanes then the user must write code to test them away. For example, the following expression returns 1 if the current lane was active on entry.

bool fWasActiveOnEntry = __XB_V_CNDMASK_B32(__XB_GetEntryActiveMask64(), uint2(0,1));

Intrinsic Description
uint<2> __XB_Ballot64(in uint condition);
Pass boolean to ballot instruction. Output is a mask, one bit for each thread in the wave. For each thread the bit is true if the condition was true for that thread.
uint<2> __XB_GetEntryActiveMask64();
Returns the value of the EXEC execution mask upon shader entry.
uint __XB_GetEntryM0();
Returns the value of the m0 register upon shader entry. You can use this intrinsic to implement algorithms in the pixel shader that need to know which quads in a wave are loaded from unique triangles.
$type1 __XB_LaneSwizzle(
        in numeric32_only<> value,
        in uint<> offset10);
Used to quickly move register values between threads in a wave. Note that the offset10 param must be a constant literal (compile time constant). Performs:
Char * pOffset = &offset10;

if (offset[15]) {
  for (i = 0; i < 32; i+=4) {
    thread_out[i+0] = thread_in[i+pOffset[1:0] ];
    thread_out[i+1] = thread_in[i+pOffset[3:2] ];
    thread_out[i+2] = thread_in[i+pOffset[5:4] ];
    thread_out[i+3] = thread_in[i+pOffset[7:6] ];
  }
}
else {
  for (i = 0; i < 32; i++) {
    j = ((i & pOffset[4:0]) | pOffset[9:5]) ^ 
          pOffset[14:10];
    thread_out[i] = thread_in[j];
  }
}
type __XB_MakeUniform(type)

An intrinsic to promote values from being wave variant to wave invariant. This information is propagated to allow operations and expressions to be evaluated on scalar units instead of vector units. The performance of the shader compiler benefits if you mark scalar values with the __XB_MakeUniform intrinsic. Vector to scalar promotion optimization is on by default. However, if you need to disable this feature, use the fxc define /D __XBOX_DISABLE_V_TO_S.

If a fundamentally vector value is promoted to scalar, the compiler does so with the v_readfirstlane_b32 instruction which will read the value from the active lane with the lowest laneid and this may be a helper lane.

uint<1> __XB_MBCNT64(in uint<2> operandToMask);
Returns number of 1 bits in operandToMask from 0th bit to LaneID’th bit.
$type1 __XB_ReadLane(
        in any<> value,
        in int lane);
Reads a value from the given lane. Lane argument must be uniform (shared in sreg between all waves.) If lane argument is not uniform the compiler will load its value to sreg using the __XB_MakeUniform intrinsic.
uint<1> __XB_V_CNDMASK_B32(in uint<2> m, in uint<2> r);
Corresponds to CI v_cndmask_b32 instruction. Returns a vector uint:
((__XB_ShrU64(m, __XB_GetLaneId())) & 1) ? r.y : r.x
$type1 __XB_WriteLane(
        in numeric32_only value, 
        in int lane,
        in $type1 val);
Assigns a new value to vgpr if current_lane == lane: new_value and lane must be in sgpr (wave invariant); if they are not then values will be moved to sgpr using readfirstlane. Performs:
dst = (current_lane == lane) ? new_value : old_value;

Wave intrinsics

These wave intrinsics perform operations on the input value from all live threads in a wave.

These intrinsics will include helper lanes in their operations. If it is desired to exclude helper lanes then they should be manually excluded by ensuring they are in the “active on entry” mask.

Intrinsic Description
float<> __XB_WaveAdd_F32(in float<> x);
Return sum of x for all active lanes.
uint<> __XB_WaveAND(in uint<> x);
Bitwise AND value of x for all active lanes.
float<> __XB_WaveMax_F32(in float<> x);
Return float max x for all active lanes.
int<> __XB_WaveMax_I32(in int<> x);
Return int max for all active lanes.
uint<> __XB_WaveMax_U32(in uint<> x);
Return unsigned max for all active lanes.
float<> __XB_WaveMin_F32(in float<> x);
Return float min x for all active lanes.
int<> __XB_WaveMin_I32(in int<> x);
Return int min for all active lanes.
uint<> __XB_WaveMin_U32(in uint<> x);
Return unsigned min for all active lanes.
uint<> __XB_WaveOR(in uint<> x);
Bitwise OR value of x for all active lanes.

Intrinsics for manual interpolation

The following shader function can be used to retrieve the three raw color interpolands for a triangle, and there are six intrinsic functions that can be used to retrieve the different kinds of barycentric coordinates for the current pixel. This enables a shader to operate on custom packed interpolants, which can be used to save space in the parameter buffer.

Shader Function Description
interptype __XB_GetRawInterpoland(
        in numeric value, 
        in uint channel)
Returns the raw value of a corner of the triangle. 0, 1 or 2 are the names of the three corners (the channel parameter). This call also instructs the driver to set the interpolant fetch into "passthrough" mode, so that the raw value will reach the shader. Normally the hardware substitutes channel1-channel0 for channel1, and channel2-channel0 for channel2 to simplify the math needed in the shader. This behavior is not compatible with normal interpolant access. There is currently no warning in d3dcompiler when an interpolant is used both ways.

The following intrinsics get the barymetric coordinates of the current pixel being processed by the pixel shader, in a call such as:

barycentric.xy = __XB_GetBarycentricCoords_Linear_Center();  

Intrinsic Description
float2 __XB_GetBarycentricCoords_Linear_Center()
Linear interpolation of coordinates between inputs, the default.
float2 __XB_GetBarycentricCoords_Linear_Centroid()
Linear interpolation of coordinates with the centroid modifier applied, which may improve anti-aliasing.
float2 __XB_GetBarycentricCoords_Linear_Sample()
Linear interpolation of pixel coordinates, but at the sample location rather than at the pixel center.
float2 __XB_GetBarycentricCoords_Noperspective_Center()
Perspective-correction is not applied.
float2 __XB_GetBarycentricCoords_Noperspective_Centroid()
The centroid modifier is applied to non-perspective positioning.
float2 __XB_GetBarycentricCoords_Noperspective_Sample()
The sample modifier is applied to non-perspective positioning.

When shading a triangle, for example, the color of any individual pixel depends on the colors specified for the three points of the triangle. Depending on the location of the pixel the color will be a blend of the three specified colors. In the usual implementation of DirectX, the interpolation to come up with the pixel color is done in hardware, and the developer does not have access to the raw values. In the Xbox One GPU process however, the interpolation is computed by the pixel shader, and the raw values are available in the pixel shader for the developer to use if required. The intrinsics listed above provide access to the raw values so a developer could write their own computation.

There are two kinds of raw value used for interpolation:

  1. The barycentric coordinate, locating the position in the triangle.
  2. The raw interpolants (the colors specified for the tips of the triangle).

For more information, refer to Interpolation Modifiers.

The following shader code shows an example of unpacking a packed interpolant using the intrinsics:

float4 Interpolate( float4 A, float4 B, float4 C, float3 barycentric )
{
   return A * barycentric.z + B * barycentric.x + C * barycentric.y;
}

struct Interpolants_Packed
{
   float4 position     : SV_POSITION0;
   float color_packed  : COLOR0;
};

float ByteToFloat( uint a )
{
   return a / 255.f;
}

float4 UnpackColor( uint packed )
{
   return float4( ByteToFloat( ( packed >>  0 ) & 0xff ),
                  ByteToFloat( ( packed >>  8 ) & 0xff ), 
                  ByteToFloat( ( packed >> 16 ) & 0xff ),
                  ByteToFloat( ( packed >> 24 ) & 0xff ) );
}

Pixel PSPackedInterpolants( Interpolants_Packed In )
{
   float3 barycentric;
   barycentric.xy = __XB_GetBarycentricCoords_Linear_Center();
   barycentric.z = 1 - barycentric.x - barycentric.y;

   uint rawA = asuint( __XB_GetRawInterpoland( In.color_packed, 0 ) );
   uint rawB = asuint( __XB_GetRawInterpoland( In.color_packed, 1 ) );
   uint rawC = asuint( __XB_GetRawInterpoland( In.color_packed, 2 ) );
   float4 decompressedA = UnpackColor( rawA );
   float4 decompressedB = UnpackColor( rawB );
   float4 decompressedC = UnpackColor( rawC );

   Pixel Out;
   Out.color = Interpolate( decompressedA, decompressedB, decompressedC, barycentric );

   return Out;
}  

GDS/GWS intrinsics

Intrinsic Description
uint __XB_GdsOrderedCount(
        in uint vsrc0, 
        in uint flags);
Implements the ds_ordered_count instruction in the shader to support Ordered Append. See the example in SetupOrderedAppendCounterX.
uint __XB_GDS_Read_U32(
        in uint addr);
Returns the value at the specified address in the Global Data Share (GDS).
void __XB_GDS_Write_U32(
        in uint addr,
        in uint value);
Writes the specified value to the specified address in the Global Data Share (GDS).

The following intrinsics all map to CI GDS instructions:

uint      __XB_GDS_Add_Rtn_U32 (in uint addr, in uint value);
void      __XB_GDS_Add_U32 (in uint addr, in uint value);
uint      __XB_GDS_And_Rtn_U32 (in uint addr, in uint value);
void      __XB_GDS_And_U32 (in uint addr, in uint value);
void      __XB_GDS_Cmpst_U32 (in uint addr, in uint cmpValue, in uint storeValue);
uint      __XB_GDS_Dec_Rtn_U32 (in uint addr, in uint value);
void      __XB_GDS_Dec_U32 (in uint addr, in uint value);
uint      __XB_GDS_Inc_Rtn_U32 (in uint addr, in uint value);
void      __XB_GDS_Inc_U32 (in uint addr, in uint value);
void      __XB_GDS_Max_I32 (in uint addr, in uint value);
uint      __XB_GDS_Max_Rtn_I32 (in uint addr, in uint value);
uint      __XB_GDS_Max_Rtn_U32 (in uint addr, in uint value);
void      __XB_GDS_Max_U32 (in uint addr, in uint value);
void      __XB_GDS_Min_I32 (in uint addr, in uint value);
uint      __XB_GDS_Min_Rtn_I32 (in uint addr, in uint value);
uint      __XB_GDS_Min_Rtn_U32 (in uint addr, in uint value);
void      __XB_GDS_Min_U32 (in uint addr, in uint value);
uint      __XB_GDS_Mskor_Rtn_U32 (in uint addr, in uint mask, in uint orValue);
void      __XB_GDS_Mskor_U32 (in uint addr, in uint mask, in uint orValue);
uint      __XB_GDS_Or_Rtn_U32 (in uint addr, in uint value);
void      __XB_GDS_Or_U32 (in uint addr, in uint value);
uint      __XB_GDS_Rsub_Rtn_U32 (in uint addr, in uint value);
void      __XB_GDS_Rsub_U32 (in uint addr, in uint value);
uint      __XB_GDS_Sub_Rtn_U32 (in uint addr, in uint value);
void      __XB_GDS_Sub_U32 (in uint addr, in uint value);
uint      __XB_GDS_Wrxchg_Rtn_U32 (in uint addr, in uint value);
uint      __XB_GDS_Xor_Rtn_U32 (in uint addr, in uint value);
void      __XB_GDS_Xor_U32 (in uint addr, in uint value);

The following intrinsics map to CI Gws instructions:

uint     __XB_GwsBarrier(in uint vsrc0, in uint offset0);
uint     __XB_GwsInit(in uint vsrc0, in uint offset0);
uint     __XB_GwsSemaBr(in uint vsrc0, in uint offset0);
uint     __XB_GwsSemaP(in uint offset0);
uint     __XB_GwsSemaReleaseAll(in uint offset0);
uint     __XB_GwsSemaV(in uint offset0);

Special

uint __XB_GetShaderUserData(in uint N)
Gets the value of the shader user data register N. This intrinsic is used in combination with the ID3D11DeviceContextX::**SetShaderUserData() family of APIs or the multidraw Draw ID functionality enabled with D3D11X_MULTI_DRAW_FLAG. The register N must be in the range 0-15. The hardware only supports up to 16 shader user data inputs. Of the 16 available inputs, the first two (0 and 1) are used by the Xbox Shader ABI (Application Binary Interface) for Hull, Domain, Geometry, Pixel, and Compute shader stages and the first four (0, 1, 2, and 3) are used by the Vertex Shader stage. For most usage scenarios, you will want to pick registers which do not conflict with those already in use by the Xbox Shader ABI. Registers 4-15 are a safe choice. Refer to:
uint<2> __XB_MemTime()
This intrinsic is intended as a means for shader to obtain random values. It uses the shader cycle counter for this purpose. It is not meaningful to use this value to profile or measure a shader’s execution time; instead PIX is recommended for profiling.
uint __XB_S_SLEEP(in uint period);
CI s_sleep instruction.

Alphabetical list of intrinsics

See also

Shaders and the FXC Shader Compiler

D3DCOMPILE Constants

GPU and Shader Acronyms