GPUTexture


class GPUTexture : AutoCloseable


A GPU texture object for image data storage.

Summary

Public functions

open external Unit
external GPUTextureView

Creates a view of the texture, specifying its usage and subresource range.

external Unit

Immediately destroys the texture resource.

open operator Boolean
equals(other: Any?)
external Int

Gets the depth or number of array layers of the texture at mip level 0.

external Int

Gets the dimension of the texture (1D, 2D, or 3D).

external Int

Gets the texture format.

external Int

Gets the height of the texture at mip level 0.

external Int

Gets the number of mipmap levels in the texture.

external Int

Gets the number of samples per texel (for multisampled textures).

external Int

Gets the usage flags the texture was created with.

external Int

Gets the width of the texture at mip level 0.

open Int
external Unit

Sets a debug label for the texture.

Extension functions

suspend Bitmap

Public functions

close

Added in 1.0.0-alpha01
open external fun close(): Unit

createView

Added in 1.0.0-alpha01
@FastNative
external fun createView(descriptor: TextureViewDescriptor? = null): GPUTextureView

Creates a view of the texture, specifying its usage and subresource range.

Parameters
descriptor: TextureViewDescriptor? = null

A descriptor specifying creation options for the texture view.

Returns
GPUTextureView

The newly created texture view.

destroy

Added in 1.0.0-alpha01
@FastNative
external fun destroy(): Unit

Immediately destroys the texture resource.

equals

open operator fun equals(other: Any?): Boolean

getDepthOrArrayLayers

Added in 1.0.0-alpha01
@FastNative
external fun getDepthOrArrayLayers(): Int

Gets the depth or number of array layers of the texture at mip level 0.

Returns
Int

The depth or array layer count.

getDimension

Added in 1.0.0-alpha01
@FastNative
external fun getDimension(): Int

Gets the dimension of the texture (1D, 2D, or 3D).

Returns
Int

The texture dimension.

getFormat

Added in 1.0.0-alpha01
@FastNative
external fun getFormat(): Int

Gets the texture format.

Returns
Int

The texture format.

getHeight

Added in 1.0.0-alpha01
@FastNative
external fun getHeight(): Int

Gets the height of the texture at mip level 0.

Returns
Int

The height in texels.

getMipLevelCount

Added in 1.0.0-alpha01
@FastNative
external fun getMipLevelCount(): Int

Gets the number of mipmap levels in the texture.

Returns
Int

The number of mip levels.

getSampleCount

Added in 1.0.0-alpha01
@FastNative
external fun getSampleCount(): Int

Gets the number of samples per texel (for multisampled textures).

Returns
Int

The sample count.

getUsage

Added in 1.0.0-alpha01
@FastNative
external fun getUsage(): Int

Gets the usage flags the texture was created with.

Returns
Int

The texture's usage flags.

getWidth

Added in 1.0.0-alpha01
@FastNative
external fun getWidth(): Int

Gets the width of the texture at mip level 0.

Returns
Int

The width in texels.

hashCode

open fun hashCode(): Int

setLabel

Added in 1.0.0-alpha01
@FastNative
external fun setLabel(label: String): Unit

Sets a debug label for the texture.

Parameters
label: String

The label to assign to the texture.

Public properties

depthOrArrayLayers

Added in 1.0.0-alpha01
val depthOrArrayLayersInt

dimension

Added in 1.0.0-alpha01
val dimensionInt

format

Added in 1.0.0-alpha01
val formatInt

handle

Added in 1.0.0-alpha01
val handleLong

height

Added in 1.0.0-alpha01
val heightInt

mipLevelCount

Added in 1.0.0-alpha01
val mipLevelCountInt

sampleCount

Added in 1.0.0-alpha01
val sampleCountInt

usage

Added in 1.0.0-alpha01
val usageInt

width

Added in 1.0.0-alpha01
val widthInt

Extension functions

createBitmap

suspend fun GPUTexture.createBitmap(device: GPUDevice): Bitmap