_Texture<T, Shape, isArray, isMS, sampleCount, access, isShadow, isCombined, format>.Sample
Description
Samples the texture at the given location.
Signature
/// Requires Capability Set 1: T _Texture<T, Shape, isArray, isMS, sampleCount, access, isShadow, isCombined, format>.Sample( vector<float, isArray+Shape.dimensions> location) where Shape : __ITextureShape where access == 0 where isCombined == 1; /// Requires Capability Set 2: T _Texture<T, Shape, isArray, isMS, sampleCount, access, isShadow, isCombined, format>.Sample( vector<float, isArray+Shape.dimensions> location, vector<int, Shape.planeDimensions> offset) where Shape : __ITextureShape where access == 0 where isCombined == 1; /// Requires Capability Set 3: T _Texture<T, Shape, isArray, isMS, sampleCount, access, isShadow, isCombined, format>.Sample( vector<float, isArray+Shape.dimensions> location, vector<int, Shape.planeDimensions> offset, float clamp) where Shape : __ITextureShape where access == 0 where isCombined == 1; T _Texture<T, Shape, isArray, isMS, sampleCount, access, isShadow, isCombined, format>.Sample( vector<float, isArray+Shape.dimensions> location, vector<int, Shape.planeDimensions> offset, float clamp, out uint status) where Shape : __ITextureShape where access == 0 where isCombined == 1; /// Requires Capability Set 1: T _Texture<T, Shape, isArray, isMS, sampleCount, access, isShadow, isCombined, format>.Sample( SamplerState s, vector<float, isArray+Shape.dimensions> location) where Shape : __ITextureShape where access == 0 where isCombined == 0; /// Requires Capability Set 2: T _Texture<T, Shape, isArray, isMS, sampleCount, access, isShadow, isCombined, format>.Sample( SamplerState s, vector<float, isArray+Shape.dimensions> location, vector<int, Shape.planeDimensions> offset) where Shape : __ITextureShape where access == 0 where isCombined == 0; /// Requires Capability Set 4: T _Texture<T, Shape, isArray, isMS, sampleCount, access, isShadow, isCombined, format>.Sample( SamplerState s, vector<float, isArray+Shape.dimensions> location, vector<int, Shape.planeDimensions> offset, float clamp) where Shape : __ITextureShape where access == 0 where isCombined == 0; T _Texture<T, Shape, isArray, isMS, sampleCount, access, isShadow, isCombined, format>.Sample( SamplerState s, vector<float, isArray+Shape.dimensions> location, vector<int, Shape.planeDimensions> offset, float clamp, out uint status) where Shape : __ITextureShape where access == 0 where isCombined == 0;
Parameters
location : vector<float, isArray + Shape.dimensions>
The location to sample the texture at.
offset : vector<int, Shape.planeDimensions>
Texel offset to apply.
clamp : float
The max level of detail to use.
status : uint
[out] The result status of the operation. This parameter is currently only used when targeting HLSL. For other targets, the result status is always 0.
s : SamplerState
The SamplerState to use for the sampling operation. This parameter is omitted when this is a combined texture sampler type (isCombined==0).
Return value
The sampled texture value.
Remarks
The Sample function is defined for all read-only texture types, including Texture1D, Texture2D, Texture3D, TextureCube, Texture1DArray, Texture2DArray and TextureCubeArray.
The function is not available for read-write texture types.
For HLSL/D3D targets, the texture element type must be a scalar or vector of float or half types.
Availability and Requirements
Capability Set 1
Defined for the following targets:
hlsl
Available in all stages.
glsl
Available in all stages.
cpp
Available in all stages.
cuda
Available in all stages.
metal
Available in all stages.
wgsl
Available in all stages.
spirv
Available in all stages.
Capability Set 2
Defined for the following targets:
hlsl
Available in all stages.
glsl
Available in all stages.
cpp
Available in all stages.
metal
Available in all stages.
wgsl
Available in all stages.
spirv
Available in all stages.
Capability Set 3
Defined for the following targets:
hlsl
Available in all stages.
glsl
Available in all stages.
cpp
Available in all stages.
metal
Available in all stages.
spirv
Available in all stages.
Requires capability: spvSparseResidency
.
Capability Set 4
Defined for the following targets:
hlsl
Available in all stages.
glsl
Available in all stages.
cpp
Available in all stages.
metal
Available in all stages.
spirv
Available in all stages.
See Also
SampleBias, SampleLevel, SampleGrad, SampleCmp, SampleCmpLevelZero.