# CompareFunction

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

*** ** * ** ***


```
class CompareFunction
```

<br />

*** ** * ** ***

Defines the comparison function used for depth and stencil tests.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/CompareFunction#Always() = 8` The comparison always passes. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/CompareFunction#Equal() = 3` The comparison passes if the new value is equal to the existing value. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/CompareFunction#Greater() = 5` The comparison passes if the new value is greater than the existing value. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/CompareFunction#GreaterEqual() = 7` The comparison passes if the new value is greater than or equal to the existing value. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/CompareFunction#Less() = 2` The comparison passes if the new value is less than the existing value. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/CompareFunction#LessEqual() = 4` The comparison passes if the new value is less than or equal to the existing value. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/CompareFunction#Never() = 1` The comparison never passes. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/CompareFunction#NotEqual() = 6` The comparison passes if the new value is not equal to the existing value. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/CompareFunction#Undefined() = 0` Indicates that no compare function is specified. |

| ### Public companion functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/CompareFunction#toString(kotlin.Int)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |

## Constants

### Always

```
const val Always = 8: Int
```

The comparison always passes.

### Equal

```
const val Equal = 3: Int
```

The comparison passes if the new value is equal to the existing value.

### Greater

```
const val Greater = 5: Int
```

The comparison passes if the new value is greater than the existing value.

### GreaterEqual

```
const val GreaterEqual = 7: Int
```

The comparison passes if the new value is greater than or equal to the existing value.

### Less

```
const val Less = 2: Int
```

The comparison passes if the new value is less than the existing value.

### LessEqual

```
const val LessEqual = 4: Int
```

The comparison passes if the new value is less than or equal to the existing value.

### Never

```
const val Never = 1: Int
```

The comparison never passes.

### NotEqual

```
const val NotEqual = 6: Int
```

The comparison passes if the new value is not equal to the existing value.

### Undefined

```
const val Undefined = 0: Int
```

Indicates that no compare function is specified.

## Public companion functions

### toString

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

```
fun toString(value: Int): String
```