# 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)

*** ** * ** ***


```
public final class GPUSurface implements AutoCloseable
```

<br />

*** ** * ** ***

An object representing a platform-specific surface for rendering.

## Summary

| ### Public methods |
|---|---|
| `external void` | `https://developer.android.com/reference/androidx/webgpu/GPUSurface#close()()` Decrements the reference count of the object and frees resources when the count reaches zero. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPUSurface#configure(androidx.webgpu.GPUSurfaceConfiguration)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUSurfaceConfiguration config)` Configures the surface for rendering. |
| `boolean` | `https://developer.android.com/reference/androidx/webgpu/GPUSurface#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final external @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUSurfaceCapabilities` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPUSurface#getCapabilities(androidx.webgpu.GPUAdapter)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUAdapter adapter)` Retrieves the capabilities of the surface for a given adapter. |
| `final external @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUSurfaceTexture` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPUSurface#getCurrentTexture()()` Gets the texture for the current frame to be rendered to. |
| `final long` | `https://developer.android.com/reference/androidx/webgpu/GPUSurface#getHandle()()` |
| `int` | `https://developer.android.com/reference/androidx/webgpu/GPUSurface#hashCode()()` |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPUSurface#present()()` Presents the current texture to the user. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPUSurface#setLabel(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html label)` Sets a human-readable label for debugging. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPUSurface#unconfigure()()` Removes the configuration for the surface. |

## Public methods

### close

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

```
public external void close()
```

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
public final external void configure(@NonNull GPUSurfaceConfiguration config)
```

Configures the surface for rendering.

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

### equals

```
public boolean equals(Object other)
```

### getCapabilities

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

```
@FastNative
public final external @NonNull GPUSurfaceCapabilities getCapabilities(@NonNull GPUAdapter adapter)
```

Retrieves the capabilities of the surface for a given adapter.

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

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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
public final external @NonNull GPUSurfaceTexture getCurrentTexture()
```

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

### getHandle

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

```
public final long getHandle()
```

### hashCode

```
public int hashCode()
```

### present

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

```
@FastNative
public final external void present()
```

Presents the current texture to the user.

| Returns |
|---|---|
| `void` | 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
public final external void setLabel(@NonNull String label)
```

Sets a human-readable label for debugging.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html label` | The label string. |

### unconfigure

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

```
@FastNative
public final external void unconfigure()
```

Removes the configuration for the surface.