createTexture

fun GpuDevice.createTexture(width: Int, height: Int, format: TextureFormat = TextureFormat.RGBA8, usage: TextureUsage = TextureUsage.SAMPLED): GpuTexture(source)

Creates a 2D texture of width by height texels in format for usage.

Throws

if a dimension is not positive.

if the texture cannot be created.


Creates an RGBA8 texture of the size of image for sampling and uploads its pixels.

The upload is submitted on its own command buffer before this function returns, so the texture can be drawn with right away. Later changes to image do not reach the texture.

Throws

if the texture or its staging memory cannot be created, or the upload cannot be submitted.