Sampler#

oneAPI Level Zero Specification - Version 1.18.31

Sampler Functions#

zeSamplerCreate#

Added in version 1.0

ZE_APIEXPORT ze_result_t ZE_APICALL zeSamplerCreate(ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_sampler_desc_t *desc, ze_sampler_handle_t *phSampler)#

Creates sampler on the context.

  • The application must only use the sampler for the device, or its sub-devices, which was provided during creation.

  • The application may call this function from simultaneous threads.

  • The implementation of this function must be thread-safe.

Parameters:
  • hContext – [in] handle of the context object

  • hDevice – [in] handle of the device

  • desc – [in] pointer to sampler descriptor

  • phSampler – [out] handle of the sampler

Returns:

zeSamplerDestroy#

Added in version 1.0

ZE_APIEXPORT ze_result_t ZE_APICALL zeSamplerDestroy(ze_sampler_handle_t hSampler)#

Destroys sampler object.

  • The application must ensure the device is not currently referencing the sampler before it is deleted.

  • The implementation of this function may immediately free all Host and Device allocations associated with this sampler.

  • The application must not call this function from simultaneous threads with the same sampler handle.

  • The implementation of this function must be thread-safe.

Parameters:

hSampler – [in][release] handle of the sampler

Returns:

Sampler Enums#

ze_sampler_address_mode_t#

Added in version 1.0

enum ze_sampler_address_mode_t#

Sampler addressing modes.

Values:

enumerator ZE_SAMPLER_ADDRESS_MODE_NONE#

No coordinate modifications for out-of-bounds image access.

enumerator ZE_SAMPLER_ADDRESS_MODE_REPEAT#

Out-of-bounds coordinates are wrapped back around.

enumerator ZE_SAMPLER_ADDRESS_MODE_CLAMP#

Out-of-bounds coordinates are clamped to edge.

enumerator ZE_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER#

Out-of-bounds coordinates are clamped to border color which is (0.0f, 0.0f, 0.0f, 0.0f) if image format swizzle contains alpha, otherwise (0.0f, 0.0f, 0.0f, 1.0f).

enumerator ZE_SAMPLER_ADDRESS_MODE_MIRROR#

Out-of-bounds coordinates are mirrored starting from edge.

enumerator ZE_SAMPLER_ADDRESS_MODE_FORCE_UINT32#

Value marking end of ZE_SAMPLER_ADDRESS_MODE_* ENUMs.

ze_sampler_filter_mode_t#

Added in version 1.0

enum ze_sampler_filter_mode_t#

Sampler filtering modes.

Values:

enumerator ZE_SAMPLER_FILTER_MODE_NEAREST#

No coordinate modifications for out of bounds image access.

enumerator ZE_SAMPLER_FILTER_MODE_LINEAR#

Out-of-bounds coordinates are wrapped back around.

enumerator ZE_SAMPLER_FILTER_MODE_FORCE_UINT32#

Value marking end of ZE_SAMPLER_FILTER_MODE_* ENUMs.

Sampler Structures#

ze_sampler_desc_t#

Added in version 1.0

struct ze_sampler_desc_t#

Sampler descriptor.

Public Members

ze_structure_type_t stype#

[in] type of this structure

const void *pNext#

[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).

ze_sampler_address_mode_t addressMode#

[in] Sampler addressing mode to determine how out-of-bounds coordinates are handled.

ze_sampler_filter_mode_t filterMode#

[in] Sampler filter mode to determine how samples are filtered.

ze_bool_t isNormalized#

[in] Are coordinates normalized [0, 1] or not.