Concurrency::direct3d namespace functions (AMP)

Visual Studio 2015
 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

abs Functionclamp Functioncountbits Function
d3d_access_lock Functiond3d_access_try_lock Functiond3d_access_unlock Function
firstbithigh Functionfirstbitlow Functionget_buffer Function
imax Functionimin Functionis_timeout_disabled Function
mad Functionmake_array Functionnoise Function
radians Functionrcp Functionreversebits Function
saturate Functionsign Functionsmoothstep Function
step Functionumax Functionumin Function

Returns the absolute value of the argument

inline int abs(int _X) restrict(amp);

Parameters

_X
Integer value

Return Value

Returns the absolute value of the argument.

Computes the value of the first specified argument clamped to a range defined by the second and third specified arguments.

inline float clamp(
    float _X,  
    float _Min,  
    float _Max) restrict(amp);

 
inline int clamp(
    int _X,  
    int _Min,  
    int _Max) restrict(amp);

Parameters

_X
The value to be clamped

_Min
The lower bound of the clamping range.

_Max
The upper bound of the clamping range.

Return Value

The clamped value of _X.

Counts the number of set bits in _X

inline unsigned int countbits(unsigned int _X) restrict(amp);

Parameters

_X
Unsigned integer value

Return Value

Returns the number of set bits in _X

Acquire a lock on an accelerator_view for the purpose of safely performing D3D operations on resources shared with the accelerator_view. The accelerator_view and all C++ AMP resources associated with this accelerator_view internally take this lock when performing operations and will block while another thread holds the D3D access lock. This lock is non-recursive: It is undefined behavior to call this function from a thread that already holds the lock. It is undefined behavior to perform operations on the accelerator_view or any data container associated with the accelerator_view from the thread that holds the D3D access lock. See also scoped_d3d_access_lock, a RAII-style class for a scope-based D3D access lock.

void __cdecl d3d_access_lock(accelerator_view& _Av);

Parameters

_Av
The accelerator_view to lock.

Attempt to acquire the D3D access lock on an accelerator_view without blocking.

bool __cdecl d3d_access_try_lock(accelerator_view& _Av);

Parameters

_Av
The accelerator_view to lock.

Return Value

true if the lock was acquired, or false if it is currently held by another thread.

Release the D3D access lock on the given accelerator_view. If the calling thread does not hold the lock on the accelerator_view the results are undefined.

void __cdecl d3d_access_unlock(accelerator_view& _Av);

Parameters

_Av
The accelerator_view for which the lock is to be released.

Gets the location of the first set bit in _X, beginning with the highest-order bit and moving towards the lowest-order bit.

inline int firstbithigh(int _X) restrict(amp);

Parameters

_X
Integer value

Return Value

The location of the first set bit

Gets the location of the first set bit in _X, beginning with the lowest-order bit and working toward the highest-order bit.

inline int firstbitlow(int _X) restrict(amp);

Parameters

_X
Integer value

Return Value

Returns The location of the first set bit

Get the Direct3D buffer interface underlying the specified array.

template<
    typename value_type,  
    int _Rank  
>  
IUnknown *get_buffer(
    const array<value_type, _Rank>& _Array)  ;  

Parameters

value_type
The type of elements in the array.

_Rank
The rank of the array.

_Array
An array on a Direct3D accelerator_view for which the underlying Direct3D buffer interface is returned.

Return Value

The IUnknown interface pointer corresponding to the Direct3D buffer underlying the array.

Determine the maximum numeric value of the arguments

inline int imax(
    int _X,  
    int _Y) restrict(amp);

Parameters

_X
Integer value

_Y
Integer value

Return Value

Return the maximum numeric value of the arguments

Determine the minimum numeric value of the arguments

inline int imin(
    int _X,  
    int _Y) restrict(amp);

Parameters

_X
Integer value

_Y
Integer value

Return Value

Return the minimum numeric value of the arguments

Returns a boolean flag indicating if timeout is disabled for the specified accelerator_view. This corresponds to the D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT flag for Direct3D device creation.

bool __cdecl is_timeout_disabled(const accelerator_view& _Accelerator_view);

Parameters

_Accelerator_view
The accelerator_view for which the timeout disabled setting is to be queried.

Return Value

A boolean flag indicating if timeout is disabled for the specified accelerator_view.

Computes the product of the first and second specified argument, then adds the third specified argument.

inline float mad(
    float _X,  
    float _Y,  
    float _Z) restrict(amp);

 
inline double mad(
    double _X,  
    double _Y,  
    double _Z) restrict(amp);

 
inline int mad(
    int _X,  
    int _Y,  
    int _Z) restrict(amp);

 
inline unsigned int mad(
    unsigned int _X,  
    unsigned int _Y,  
    unsigned int _Z) restrict(amp);

Parameters

_X
The first specified argument.

_Y
The second specified argument.

_Z
The third specified argument.

Return Value

The result of _X * _Y + _Z.

Create an array from a Direct3D buffer interface pointer.

template<
    typename value_type,  
    int _Rank  
>  
array<value_type, _Rank> make_array(
    const extent<_Rank>& _Extent,  
    const Concurrency::accelerator_view& _Rv,  
    IUnknown* _D3D_buffer)  ;  

Parameters

value_type
The element type of the array to be created.

_Rank
The rank of the array to be created.

_Extent
An extent that describes the shape of the array aggregate.

_Rv
A D3D accelerator view on which the array is to be created.

_D3D_buffer
IUnknown interface pointer of the D3D buffer to create the array from.

Return Value

An array created using the provided Direct3D buffer.

Generates a random value using the Perlin noise algorithm

inline float noise(float _X) restrict(amp);

Parameters

_X
Floating-point value from which to generate Perlin noise

Return Value

Returns The Perlin noise value within a range between -1 and 1

Converts _X from degrees to radians

inline float radians(float _X) restrict(amp);

Parameters

_X
Floating-point value

Return Value

Returns _X converted from degrees to radians

Computes the reciprocal of the specified argument by using a fast approximation.

inline float rcp(float _X) restrict(amp);

 
inline double rcp(double _X) restrict(amp);

Parameters

_X
The value for which to compute the reciprocal.

Return Value

The reciprocal of the specified argument.

Reverses the order of the bits in _X

inline unsigned int reversebits(unsigned int _X) restrict(amp);

Parameters

_X
Unsigned integer value

Return Value

Returns the value with the bit order reversed in _X

Clamps _X within the range of 0 to 1

inline float saturate(float _X) restrict(amp);

Parameters

_X
Floating-point value

Return Value

Returns _X clamped within the range of 0 to 1

Determines the sign of the specified argument.

inline int sign(int _X) restrict(amp);

Parameters

_X
Integer value

Return Value

The sign of the argument.

Returns a smooth Hermite interpolation between 0 and 1, if _X is in the range [_Min, _Max].

inline float smoothstep(
    float _Min,  
    float _Max,  
    float _X) restrict(amp);

Parameters

_Min
Floating-point value

_Max
Floating-point value

_X
Floating-point value

Return Value

Returns 0 if _X is less than _Min; 1 if _X is greater than _Max; otherwise, a value between 0 and 1 if _X is in the range [_Min, _Max]

Compares two values, returning 0 or 1 based on which value is greater

inline float step(
    float _Y,  
    float _X) restrict(amp);

Parameters

_Y
Floating-point value

_X
Floating-point value

Return Value

Returns 1 if the _X is greater than or equal to _Y; otherwise, 0

Determine the maximum numeric value of the arguments

inline unsigned int umax(
    unsigned int _X,  
    unsigned int _Y) restrict(amp);

Parameters

_X
Integer value

_Y
Integer value

Return Value

Return the maximum numeric value of the arguments

Determine the minimum numeric value of the arguments

inline unsigned int umin(
    unsigned int _X,  
    unsigned int _Y) restrict(amp);

Parameters

_X
Integer value

_Y
Integer value

Return Value

Return the minimum numeric value of the arguments

Concurrency::direct3d Namespace

Show: