gradientcube(float3 dPdx, float3 dPdy)
The following member functions can be used to sample from a cube array depth texture.
T sample(sampler s, float3 coord, uint array) const
T sample(sampler s, float3 coord,
uint array, lod_options options) const
lod_options
must be one of the following types:
bias
,
level
or
gradientcube
.
The following member functions can be used to sample from a cube depth texture and compare
a single component against the specified comparison value
T sample_compare(sampler s, float3 coord, uint array, float compare_value)
const
T sample_compare(sampler s, float3 coord, uint array, float compare_value,
lod_options options) const
lod_options
must be one of the following types:
bias
,
level
or
gradientcube
.
T
must be a
float
type.
The following member functions can be used to perform sampler-less reads from a cube depth
texture array:
T read(uint2 coord,
uint face, uint array, uint lod = 0) const
T read(ushort2 coord,
ushort face,
ushort array, ushort lod = 0) const
The following member functions can be used to do a gather of four samples that would be used
for bilinear interpolation when sampling a cube depth texture.
T
v
gather(sampler s, float3 coord, uint array) const
The following member functions can be used do a gather of four samples that would be used
for bilinear interpolation when sampling a cube texture and comparing these samples with a
specified comparison value.
T
v
gather_compare(sampler s, float3 coord, uint array, float compare_value)
const
T
must be a
float
type.
The following cube depth texture query member functions are provided.
uint get_width(uint lod = 0) const
uint get_height(uint lod = 0) const
uint get_array_size() const
uint get_num_mip_levels() const
2017-9-12 | Copyright © 2017 Apple Inc. All Rights Reserved.
Page
of
132
174
5.10.13
2D Multisampled Depth Texture
The following member functions can be used to perform sampler-less reads from a 2D
multisampled depth texture:
T read(uint2 coord, uint sample) const
T read(ushort2 coord, ushort sample) const
The following 2D multisampled depth texture query member functions are provided.
uint get_width() const
uint get_height() const
uint get_num_samples() const
5.10.14
Texture Fence Functions
The following member function is supported by texture types that can be declared with the
access::read_write
attribute:
void fence()
The texture
fence
function ensures that writes to the texture by a thread become visible to
subsequent reads from that texture by the same thread (i.e. the thread performing the write).
The following example show how the texture
fence
function can be used to make sure that
writes to a texture by a thread are visible to later reads to the same location by the same thread.
kernel void
my_kernel(texture2d
texA,
…,
ushort2 gid [[thread_position_in_grid]])
{
float4 clr = …;
texA.write(gid, clr);
…
// fence to ensure that writes by thread become
// visible to later reads by thread
texA.fence();
clr_new = texA.read(gid);
…
2017-9-12 | Copyright © 2017 Apple Inc. All Rights Reserved.
Page
of
133
174