GpuTexture¶
Import: import system.gpu;
This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation. Shader-only declarations can be used only inside shader entry points and helpers reached from them; using them elsewhere is a compile error.
GpuTexture¶
An image in GPU memory that shaders sample and render passes draw into. Create one with GpuDevice.texture. A window frame's GpuFrame.target is also a texture. Inside shaders, sample, sample_level, sample_compare, load and size read it.
width¶
Width in texels.
height¶
Height in texels.
format¶
How each texel is stored.
write¶
Replaces the texels of mip level mip with data, tightly packed rows from top to bottom in the texture's format.
read¶
Downloads mip level mip as tightly packed rows from top to bottom. It waits for submitted GPU work that writes the texture.
destroy¶
Releases the GPU memory once submitted work that uses it has finished. Window frame targets belong to their surface and are not released.
sample¶
Samples the texture at uv, where (0, 0) is the top-left corner and (1, 1) the bottom-right, filtered by sampler. The mip level follows the on-screen size, which only fragment shaders know.
sample_level¶
Samples the texture at uv from mip level level; fractional levels blend two levels when the sampler filters mipmaps linearly.
sample_compare¶
Compares reference with the depth texture at uv using the comparison sampler's GpuCompare, and returns the filtered fraction of texels that passed. Used for shadow maps.
load¶
Reads the texel at integer coordinate of mip level level, without filtering.
size¶
The size in texels of mip level level.