# CanvasBufferedRenderer.RenderResult

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

*** ** * ** ***


```
class CanvasBufferedRenderer.RenderResult
```

<br />

*** ** * ** ***

Class that contains data regarding the result of the render request. Consumers are to wait on the provided `https://developer.android.com/reference/kotlin/androidx/hardware/SyncFenceCompat` if it is non null before consuming the `https://developer.android.com/reference/android/hardware/HardwareBuffer.html` provided to as well as verify that the status returned by `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#status()` returns `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#SUCCESS()`.

For example:

```kotlin
fun handleRenderResult(result: RenderResult) {
    // block on the fence if it is non-null
    result.fence?.let { fence ->
        fence.awaitForever()
        fence.close()
    }
    // consume contents of RenderResult.hardwareBuffer
}
```

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#ERROR_UNKNOWN() = 1` Render request failed with an unknown error |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#SUCCESS() = 0` Render request was completed successfully |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#RenderResult(android.hardware.HardwareBuffer,androidx.hardware.SyncFenceCompat,kotlin.Int)(buffer: https://developer.android.com/reference/android/hardware/HardwareBuffer.html, mFence: https://developer.android.com/reference/kotlin/androidx/hardware/SyncFenceCompat?, mStatus: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/hardware/SyncFenceCompat?` | `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#fence()` Optional fence that should be waited upon before consuming `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#hardwareBuffer()`. |
| `https://developer.android.com/reference/android/hardware/HardwareBuffer.html` | `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#hardwareBuffer()` `https://developer.android.com/reference/android/hardware/HardwareBuffer.html` that contains the result of the render request. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#status()` Status code for the `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult` either `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#SUCCESS()` if rendering completed or `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#ERROR_UNKNOWN()` if the rendering could not be completed. |

## Constants

### ERROR_UNKNOWN

```
const val ERROR_UNKNOWN = 1: Int
```

Render request failed with an unknown error

### SUCCESS

```
const val SUCCESS = 0: Int
```

Render request was completed successfully

## Public constructors

### RenderResult

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

```
RenderResult(buffer: HardwareBuffer, mFence: SyncFenceCompat?, mStatus: Int)
```

## Public properties

### fence

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

```
val fence: SyncFenceCompat?
```

Optional fence that should be waited upon before consuming `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#hardwareBuffer()`. On Android U and above, requests to render will return sooner and include this fence as a way to signal that the result of the render request is reflected in the contents of the buffer. This is done to reduce latency and provide opportunities for other systems to block on the fence on the behalf of the application. For example, `https://developer.android.com/reference/kotlin/androidx/graphics/surface/SurfaceControlCompat.Transaction#setBuffer(androidx.graphics.surface.SurfaceControlCompat,android.hardware.HardwareBuffer,androidx.hardware.SyncFenceCompat,kotlin.Function1)` can be invoked with `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#hardwareBuffer()` and `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#fence()` respectively without the application having to explicitly block on this fence. For older Android versions, the rendering pipeline will automatically block on this fence and this value will return null.

### hardwareBuffer

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

```
val hardwareBuffer: HardwareBuffer
```

`https://developer.android.com/reference/android/hardware/HardwareBuffer.html` that contains the result of the render request. Consumers should be sure to block on the `https://developer.android.com/reference/kotlin/androidx/hardware/SyncFenceCompat` instance provided in `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#fence()` if it is non-null before consuming the contents of this buffer. If `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#fence()` returns null then this `https://developer.android.com/reference/android/hardware/HardwareBuffer.html` can be consumed immediately.

### status

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

```
val status: Int
```

Status code for the `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult` either `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#SUCCESS()` if rendering completed or `https://developer.android.com/reference/kotlin/androidx/graphics/CanvasBufferedRenderer.RenderResult#ERROR_UNKNOWN()` if the rendering could not be completed.