# GPUSurface

Artifact: [androidx.webgpu:webgpu](https://developer.android.com/jetpack/androidx/releases/webgpu) [View Source](https://cs.android.com/search?q=file:androidx/webgpu/GPUSurface.kt+class:androidx.webgpu.GPUSurface) Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

*** ** * ** ***


```
class GPUSurface : AutoCloseable
```

<br />

*** ** * ** ***

An object representing a platform-specific surface for rendering.

## Summary

| ### Public functions |
|---|---|
| `open external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurface#close()()` Decrements the reference count of the object and frees resources when the count reaches zero. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurface#configure(androidx.webgpu.GPUSurfaceConfiguration)(config: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurfaceConfiguration)` Configures the surface for rendering. |
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurface#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `external https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurfaceCapabilities` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurface#getCapabilities(androidx.webgpu.GPUAdapter)(adapter: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUAdapter)` Retrieves the capabilities of the surface for a given adapter. |
| `external https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurfaceTexture` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurface#getCurrentTexture()()` Gets the texture for the current frame to be rendered to. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurface#hashCode()()` |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurface#present()()` Presents the current texture to the user. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurface#setLabel(kotlin.String)(label: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Sets a human-readable label for debugging. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurface#unconfigure()()` Removes the configuration for the surface. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurface#handle()` |

## Public functions

### close

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
open external fun close(): Unit
```

Decrements the reference count of the object and frees resources when the count reaches zero.

This is the standard way to manage object lifetimes and should be used in `use` blocks. After calling this, the object is no longer usable.

### configure

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun configure(config: GPUSurfaceConfiguration): Unit
```

Configures the surface for rendering.

| Parameters |
|---|---|
| `config: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurfaceConfiguration` | The new configuration for the surface. |

### equals

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

### getCapabilities

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun getCapabilities(adapter: GPUAdapter): GPUSurfaceCapabilities
```

Retrieves the capabilities of the surface for a given adapter.

| Parameters |
|---|---|
| `adapter: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUAdapter` | The adapter to query capabilities for. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webgpu/GPUSurfaceCapabilities` | The status of the operation. |

### getCurrentTexture

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun getCurrentTexture(): GPUSurfaceTexture
```

Gets the texture for the current frame to be rendered to.

### hashCode

```
open fun hashCode(): Int
```

### present

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun present(): Unit
```

Presents the current texture to the user.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The status of the operation. |

### setLabel

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun setLabel(label: String): Unit
```

Sets a human-readable label for debugging.

| Parameters |
|---|---|
| `label: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The label string. |

### unconfigure

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun unconfigure(): Unit
```

Removes the configuration for the surface.

## Public properties

### handle

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
val handle: Long
```