Exploring the AndroidX WebGPU API in Kotlin
shubham0204.github.io·2h·
Discuss: Hacker News
🗺️Region Inference
Preview
Report Post

Setup

Add the latest package of the androidx.webgpu release to the app module’s build.gradle.kts:

dependencies {
implementation("androidx.webgpu:webgpu:1.0.0-alpha01")
}

Check the project: https://github.com/shubham0204/Experiments/tree/main/androidx-webgpu-api-demo

Get GPU Device Info

To start exploring the WebGPU API, we write a method that retrieves the details of the underlying GPU device that is visible to the API:

import androidx.webgpu.helper.createWebGpu

class WebGPUComputeShader {

private val webGpu = runBlocking { createWebGpu() }

fun getGPUDeviceInfo(): AdapterInfo = runBlocking {
val ada...

Similar Posts

Loading similar posts...