deno.com

class GPUAdapter

Represents a physical GPU device that can be used to create a logical GPU device.

Examples #

#
// Request an adapter with specific power preference
const adapter = await navigator.gpu.requestAdapter({
  powerPreference: "high-performance"
});

if (!adapter) {
  console.error("WebGPU not supported or no appropriate adapter found");
  Deno.exit(1);
}

// Check adapter capabilities
if (adapter.features.has("shader-f16")) {
  console.log("Adapter supports 16-bit shader operations");
}

console.log(`Maximum buffer size: ${adapter.limits.maxBufferSize} bytes`);

// Get adapter info (vendor, device, etc.)
console.log(`GPU Vendor: ${adapter.info.vendor}`);
console.log(`GPU Device: ${adapter.info.device}`);

// Request a logical device with specific features and limits
const device = await adapter.requestDevice({
  requiredFeatures: ["shader-f16"],
  requiredLimits: {
    maxStorageBufferBindingSize: 128 * 1024 * 1024, // 128MB
  }
});

Properties #

Methods #