STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Functions
Concurrency::direct3d Namespace Reference

Classes

struct  adopt_d3d_access_lock_t
 Tag type to indicate the D3D access lock should be adopted rather than acquired. More...
 
class  scoped_d3d_access_lock
 RAII wrapper for a D3D access lock on an accelerator_view. More...
 

Functions

template<typename _Value_type , int _Rank>
array< _Value_type, _Rank > make_array (const Concurrency::extent< _Rank > &_Extent, const Concurrency::accelerator_view &_Av, _In_ IUnknown *_D3D_buffer) __CPU_ONLY
 Create an array from a D3D buffer interface pointer. More...
 
template<typename _Value_type , int _Rank>
_Ret_ IUnknown * get_buffer (const array< _Value_type, _Rank > &_Array) __CPU_ONLY
 Get the D3D buffer interface underlying an array. More...
 
int abs (int _X) __GPU_ONLY
 Returns the absolute value of the argument More...
 
float clamp (float _X, float _Min, float _Max) __GPU_ONLY
 Clamps _X to the specified _Min and _Max range More...
 
int clamp (int _X, int _Min, int _Max) __GPU_ONLY
 Clamps _X to the specified _Min and _Max range More...
 
unsigned int countbits (unsigned int _X) __GPU_ONLY
 Counts the number of set bits in _X More...
 
int firstbithigh (int _X) __GPU_ONLY
 Gets the location of the first set bit in _X, starting from the highest order bit and working downward More...
 
int firstbitlow (int _X) __GPU_ONLY
 Gets the location of the first set bit in _X, starting from the lowest order bit and working upward More...
 
int imax (int _X, int _Y) __GPU_ONLY
 Determine the maximum numeric value of the arguments More...
 
int imin (int _X, int _Y) __GPU_ONLY
 Determine the minimum numeric value of the arguments More...
 
unsigned int umax (unsigned int _X, unsigned int _Y) __GPU_ONLY
 Determine the maximum numeric value of the arguments More...
 
unsigned int umin (unsigned int _X, unsigned int _Y) __GPU_ONLY
 Determine the minimum numeric value of the arguments More...
 
float mad (float _X, float _Y, float _Z) __GPU_ONLY
 Performs an arithmetic multiply/add operation on three arguments: _X * _Y + _Z More...
 
double mad (double _X, double _Y, double _Z) __GPU_ONLY
 Performs an arithmetic multiply/add operation on three arguments: _X * _Y + _Z More...
 
int mad (int _X, int _Y, int _Z) __GPU_ONLY
 Performs an arithmetic multiply/add operation on three arguments: _X * _Y + _Z More...
 
unsigned int mad (unsigned int _X, unsigned int _Y, unsigned int _Z) __GPU_ONLY
 Performs an arithmetic multiply/add operation on three arguments: _X * _Y + _Z More...
 
float noise (float _X) __GPU_ONLY
 Generates a random value using the Perlin noise algorithm More...
 
float radians (float _X) __GPU_ONLY
 Converts _X from degrees to radians More...
 
float rcp (float _X) __GPU_ONLY
 Calculates a fast, approximate reciprocal of the argument More...
 
unsigned int reversebits (unsigned int _X) __GPU_ONLY
 Reverses the order of the bits in _X More...
 
float saturate (float _X) __GPU_ONLY
 Clamps _X within the range of 0 to 1 More...
 
int sign (int _X) __GPU_ONLY
 Returns the sign of the argument More...
 
float smoothstep (float _Min, float _Max, float _X) __GPU_ONLY
 Returns a smooth Hermite interpolation between 0 and 1, if _X is in the range [_Min, _Max]. More...
 
float step (float _Y, float _X) __GPU_ONLY
 Compares two values, returning 0 or 1 based on which value is greater More...
 
_AMPIMP _Ret_ IUnknown *__cdecl get_device (const accelerator_view &_Av)
 Get the D3D device interface underlying a accelerator_view. More...
 
_AMPIMP accelerator_view __cdecl create_accelerator_view (_In_ IUnknown *_D3D_device, queuing_mode _Qmode=queuing_mode_automatic)
 Create a accelerator_view from a D3D device interface pointer. More...
 
_AMPIMP accelerator_view __cdecl create_accelerator_view (accelerator &_Accelerator, bool _Disable_timeout, queuing_mode _Qmode=queuing_mode_automatic)
 Create and return a new accelerator view on the specified accelerator. More...
 
_AMPIMP bool __cdecl is_timeout_disabled (const accelerator_view &_Accelerator_view)
 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. More...
 
_AMPIMP void __cdecl d3d_access_lock (accelerator_view &_Av)
 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. More...
 
_AMPIMP bool __cdecl d3d_access_try_lock (accelerator_view &_Av)
 Attempt to acquire the D3D access lock on an accelerator_view without blocking. More...
 
_AMPIMP void __cdecl d3d_access_unlock (accelerator_view &_Av)
 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. More...
 

Function Documentation

int Concurrency::direct3d::abs ( int  _X)
inline

Returns the absolute value of the argument

Parameters
_XInteger value
Returns
Returns the absolute value of the argument
7190 {
7191  return __dp_d3d_absi(_X);
7192 }
int __dp_d3d_absi(int) __GPU_ONLY
float Concurrency::direct3d::clamp ( float  _X,
float  _Min,
float  _Max 
)
inline

Clamps _X to the specified _Min and _Max range

Parameters
_XFloating-point value
_MinFloating-point value
_MaxFloating-point value
Returns
Returns the clamped value of _X
7210 {
7211  return __dp_d3d_clampf(_X, _Min, _Max);
7212 }
float __dp_d3d_clampf(float, float, float) __GPU_ONLY
int Concurrency::direct3d::clamp ( int  _X,
int  _Min,
int  _Max 
)
inline

Clamps _X to the specified _Min and _Max range

Parameters
_XInteger value
_MinInteger value
_MaxInteger value
Returns
Returns the clamped value of _X
7230 {
7231  return __dp_d3d_clampi(_X, _Min, _Max);
7232 }
int __dp_d3d_clampi(int, int, int) __GPU_ONLY
unsigned int Concurrency::direct3d::countbits ( unsigned int  _X)
inline

Counts the number of set bits in _X

Parameters
_XUnsigned integer value
Returns
Returns the number of set bits in _X
7244 {
7245  return __dp_d3d_countbitsu(_X);
7246 }
unsigned int __dp_d3d_countbitsu(unsigned int) __GPU_ONLY
_AMPIMP accelerator_view __cdecl Concurrency::direct3d::create_accelerator_view ( _In_ IUnknown *  _D3D_device,
queuing_mode  _Qmode = queuing_mode_automatic 
)

Create a accelerator_view from a D3D device interface pointer.

Parameters
_D3D_deviceThe D3D device interface pointer to create the accelerator_view from.
_QmodeThe queuing_mode to be used for the newly created accelerator_view. This parameter has a default value of queuing_mode_automatic.
Returns
The accelerator_view created from the passed D3D device interface.
_AMPIMP accelerator_view __cdecl Concurrency::direct3d::create_accelerator_view ( accelerator &  _Accelerator,
bool  _Disable_timeout,
queuing_mode  _Qmode = queuing_mode_automatic 
)

Create and return a new accelerator view on the specified accelerator.

Parameters
_AcceleratorThe accelerator on which the new accelerator_view is to be created.
_Disable_timeoutA boolean parameter that specifies whether timeout should be disabled for the newly created accelerator_view. This corresponds to the D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT flag for Direct3D device creation and is used to indicate if the operating system should allow workloads that take more than 2 seconds to execute, without resetting the device per the Windows timeout detection and recovery mechanism. Use of this flag is recommended if you need to perform time consuming tasks on the accelerator_view.
_QmodeThe queuing_mode to be used for the newly created accelerator_view. This parameter has a default value of queuing_mode_automatic.
Returns
The newly created accelerator_view.
_AMPIMP void __cdecl Concurrency::direct3d::d3d_access_lock ( accelerator_view &  _Av)

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.

Parameters
_AvThe accelerator_view to lock.
_AMPIMP bool __cdecl Concurrency::direct3d::d3d_access_try_lock ( accelerator_view &  _Av)

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

Parameters
_AvThe accelerator_view to lock.
Returns
true if the lock was acquired, or false if it is currently held by another thread.
_AMPIMP void __cdecl Concurrency::direct3d::d3d_access_unlock ( accelerator_view &  _Av)

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.

Parameters
_AvThe accelerator_view for which the lock is to be released.
int Concurrency::direct3d::firstbithigh ( int  _X)
inline

Gets the location of the first set bit in _X, starting from the highest order bit and working downward

Parameters
_XInteger value
Returns
Returns The location of the first set bit
7258 {
7259  return __dp_d3d_firstbithighi(_X);
7260 }
int __dp_d3d_firstbithighi(int) __GPU_ONLY
int Concurrency::direct3d::firstbitlow ( int  _X)
inline

Gets the location of the first set bit in _X, starting from the lowest order bit and working upward

Parameters
_XInteger value
Returns
Returns The location of the first set bit
7272 {
7273  return __dp_d3d_firstbitlowi(_X);
7274 }
int __dp_d3d_firstbitlowi(int) __GPU_ONLY
template<typename _Value_type , int _Rank>
_Ret_ IUnknown* Concurrency::direct3d::get_buffer ( const array< _Value_type, _Rank > &  _Array)

Get the D3D buffer interface underlying an array.

Parameters
_RankThe rank of the array to get underlying D3D buffer of.
_Value_typeThe type of the elements in the array to get underlying D3D buffer of.
_ArrayA array on a D3D accelerator_view for which the underlying D3D buffer interface is returned.
Returns
The IUnknown interface pointer corresponding to the D3D buffer underlying the array.
6463  {
6464  _Buffer_ptr _PBuf;
6465  _Get_access_async(_Array, _Read_write_access, _PBuf)._Get();
6466  return details::_D3D_interop::_Get_D3D_buffer(_PBuf);
6467  }
details::_Reference_counted_obj_ptr< details::_Buffer > _Buffer_ptr
Definition: amprt.h:302
_Event _Get_access_async(const _View_key _Key, accelerator_view _Av, _Access_mode _Mode, _Buffer_ptr &_Buf_ptr)
Definition: amprt.h:3457
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
Definition: amprt.h:88
_AMPIMP _Ret_ IUnknown* __cdecl Concurrency::direct3d::get_device ( const accelerator_view &  _Av)

Get the D3D device interface underlying a accelerator_view.

Parameters
_AvThe D3D accelerator_view for which the underlying D3D device interface is returned.
Returns
The IUnknown interface pointer of the D3D device underlying the accelerator_view.
int Concurrency::direct3d::imax ( int  _X,
int  _Y 
)
inline

Determine the maximum numeric value of the arguments

Parameters
_XInteger value
_YInteger value
Returns
Return the maximum numeric value of the arguments
7289 {
7290  return __dp_d3d_maxi(_X, _Y);
7291 }
int __dp_d3d_maxi(int, int) __GPU_ONLY
_In_ double _Y
Definition: math.h:999
int Concurrency::direct3d::imin ( int  _X,
int  _Y 
)
inline

Determine the minimum numeric value of the arguments

Parameters
_XInteger value
_YInteger value
Returns
Return the minimum numeric value of the arguments
7306 {
7307  return __dp_d3d_mini(_X, _Y);
7308 }
int __dp_d3d_mini(int, int) __GPU_ONLY
_In_ double _Y
Definition: math.h:999
_AMPIMP bool __cdecl Concurrency::direct3d::is_timeout_disabled ( const accelerator_view &  _Accelerator_view)

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.

Parameters
_Accelerator_viewThe accelerator_view for which the timeout disabled setting is to be queried.
Returns
A boolean flag indicating if timeout is disabled for the specified accelerator_view.
float Concurrency::direct3d::mad ( float  _X,
float  _Y,
float  _Z 
)
inline

Performs an arithmetic multiply/add operation on three arguments: _X * _Y + _Z

Parameters
_XFloating-point value
_YFloating-point value
_ZFloating-point value
Returns
Returns _X * _Y + _Z
7360 {
7361  return __dp_d3d_madf(_X, _Y, _Z);
7362 }
float __dp_d3d_madf(float, float, float) __GPU_ONLY
_In_ double _Y
Definition: math.h:999
double Concurrency::direct3d::mad ( double  _X,
double  _Y,
double  _Z 
)
inline

Performs an arithmetic multiply/add operation on three arguments: _X * _Y + _Z

Parameters
_XFloating-point value
_YFloating-point value
_ZFloating-point value
Returns
Returns _X * _Y + _Z
7380 {
7381  return __dp_d3d_madd(_X, _Y, _Z);
7382 }
double __dp_d3d_madd(double, double, double) __GPU_ONLY
_In_ double _Y
Definition: math.h:999
int Concurrency::direct3d::mad ( int  _X,
int  _Y,
int  _Z 
)
inline

Performs an arithmetic multiply/add operation on three arguments: _X * _Y + _Z

Parameters
_XInteger value
_YInteger value
_ZInteger value
Returns
Returns _X * _Y + _Z
7400 {
7401  return __dp_d3d_madi(_X, _Y, _Z);
7402 }
_In_ double _Y
Definition: math.h:999
int __dp_d3d_madi(int, int, int) __GPU_ONLY
unsigned int Concurrency::direct3d::mad ( unsigned int  _X,
unsigned int  _Y,
unsigned int  _Z 
)
inline

Performs an arithmetic multiply/add operation on three arguments: _X * _Y + _Z

Parameters
_XUnsigned integer value
_YUnsigned integer value
_ZUnsigned integer value
Returns
Returns _X * _Y + _Z
7420 {
7421  return __dp_d3d_madu(_X, _Y, _Z);
7422 }
unsigned int __dp_d3d_madu(unsigned int, unsigned int, unsigned int) __GPU_ONLY
_In_ double _Y
Definition: math.h:999
template<typename _Value_type , int _Rank>
array< _Value_type, _Rank > Concurrency::direct3d::make_array ( const Concurrency::extent< _Rank > &  _Extent,
const Concurrency::accelerator_view _Av,
_In_ IUnknown *  _D3D_buffer 
)

Create an array from a D3D buffer interface pointer.

Parameters
_RankThe rank of the array to be created from the D3D buffer.
_Value_typeThe type of the elements of the array to be created from the D3D buffer.
_ExtentAn extent that describes the shape of the array aggregate.
_AvA D3D accelerator_view on which the array is to be created.
_D3D_bufferIUnknown interface pointer of the D3D buffer to create the array from.
Returns
A array created using the provided D3D buffer.
6491  {
6492  details::_Is_valid_extent(_Extent);
6493 
6494  if (_D3D_buffer == NULL)
6495  {
6496  throw runtime_exception("NULL D3D buffer pointer.", E_INVALIDARG);
6497  }
6498 
6500  {
6501  throw runtime_exception("Cannot create D3D buffer on a non-D3D accelerator_view.", E_INVALIDARG);
6502  }
6503 
6504  _Ubiquitous_buffer_ptr _PBuf = _Ubiquitous_buffer::_Create_ubiquitous_buffer(_Buffer::_Create_buffer(_D3D_buffer, _Av, _Extent.size(), sizeof(_Value_type)));
6505  return array<_Value_type, _Rank>(_Extent, _Buffer_descriptor(_PBuf->_Get_master_buffer()->_Get_host_ptr(), _PBuf, _Is_array_mode, _Read_write_access));
6506  }
Definition: array:19
static void _Is_valid_extent(const _T< _Rank > &_Tuple) __CPU_ONLY
Definition: xxamp.h:1203
unsigned int size() const __GPU
Returns the total linear size of this extent (in units of elements).
Definition: amp.h:521
#define NULL
Definition: crtdbg.h:30
_AMPIMP bool __cdecl _Is_D3D_accelerator_view(const accelerator_view &_Av)
Definition: amprt.h:87
details::_Reference_counted_obj_ptr< details::_Ubiquitous_buffer > _Ubiquitous_buffer_ptr
Definition: amprt.h:305
struct Concurrency::details::_Buffer_descriptor _Buffer_descriptor
Definition: amprt.h:88
float Concurrency::direct3d::noise ( float  _X)
inline

Generates a random value using the Perlin noise algorithm

Parameters
_XFloating-point value from which to generate Perlin noise
Returns
Returns The Perlin noise value within a range between -1 and 1
7434 {
7435  return __dp_d3d_noisef(_X);
7436 }
float __dp_d3d_noisef(float) __GPU_ONLY
float Concurrency::direct3d::radians ( float  _X)
inline

Converts _X from degrees to radians

Parameters
_XFloating-point value
Returns
Returns _X converted from degrees to radians
7448 {
7449  return __dp_d3d_radiansf(_X);
7450 }
float __dp_d3d_radiansf(float) __GPU_ONLY
float Concurrency::direct3d::rcp ( float  _X)
inline

Calculates a fast, approximate reciprocal of the argument

Parameters
_XFloating-point value
Returns
Returns a fast, approximate reciprocal of the argument
7462 {
7463  return __dp_d3d_rcpf(_X);
7464 }
float __dp_d3d_rcpf(float) __GPU_ONLY
unsigned int Concurrency::direct3d::reversebits ( unsigned int  _X)
inline

Reverses the order of the bits in _X

Parameters
_XUnsigned integer value
Returns
Returns the value with the bit order reversed in _X
7476 {
7477  return __dp_d3d_reversebitsu(_X);
7478 }
unsigned int __dp_d3d_reversebitsu(unsigned int) __GPU_ONLY
float Concurrency::direct3d::saturate ( float  _X)
inline

Clamps _X within the range of 0 to 1

Parameters
_XFloating-point value
Returns
Returns _X clamped within the range of 0 to 1
7490 {
7491  return __dp_d3d_saturatef(_X);
7492 }
float __dp_d3d_saturatef(float) __GPU_ONLY
int Concurrency::direct3d::sign ( int  _X)
inline

Returns the sign of the argument

Parameters
_XInteger value
Returns
Returns the sign of the argument
7504 {
7505  return __dp_d3d_signi(_X);
7506 }
int __dp_d3d_signi(int) __GPU_ONLY
float Concurrency::direct3d::smoothstep ( float  _Min,
float  _Max,
float  _X 
)
inline

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

Parameters
_XFloating-point value
_MinFloating-point value
_MaxFloating-point value
Returns
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]
7524 {
7525  return __dp_d3d_smoothstepf(_Min, _Max, _X);
7526 }
float __dp_d3d_smoothstepf(float, float, float) __GPU_ONLY
float Concurrency::direct3d::step ( float  _Y,
float  _X 
)
inline

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

Parameters
_YFloating-point value
_XFloating-point value
Returns
Returns 1 if the _X is greater than or equal to _Y; otherwise, 0
7541 {
7542  return __dp_d3d_stepf(_Y, _X);
7543 }
_In_ double _Y
Definition: math.h:999
float __dp_d3d_stepf(float, float) __GPU_ONLY
unsigned int Concurrency::direct3d::umax ( unsigned int  _X,
unsigned int  _Y 
)
inline

Determine the maximum numeric value of the arguments

Parameters
_XInteger value
_YInteger value
Returns
Return the maximum numeric value of the arguments
7323 {
7324  return __dp_d3d_maxu(_X, _Y);
7325 }
unsigned int __dp_d3d_maxu(unsigned int, unsigned int) __GPU_ONLY
_In_ double _Y
Definition: math.h:999
unsigned int Concurrency::direct3d::umin ( unsigned int  _X,
unsigned int  _Y 
)
inline

Determine the minimum numeric value of the arguments

Parameters
_XInteger value
_YInteger value
Returns
Return the minimum numeric value of the arguments
7340 {
7341  return __dp_d3d_minu(_X, _Y);
7342 }
_In_ double _Y
Definition: math.h:999
unsigned int __dp_d3d_minu(unsigned int, unsigned int) __GPU_ONLY