Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function createTextureWithData
import { createTextureWithData } from "https://deno.land/std@0.221.0/webgpu/mod.ts";

Create a GPUTexture with data.

Examples

Example 1

import { createTextureWithData } from "https://deno.land/std@0.221.0/webgpu/texture_with_data.ts";

const adapter = await navigator.gpu.requestAdapter();
const device = await adapter?.requestDevice()!;

createTextureWithData(device, {
  format: "bgra8unorm-srgb",
  size: {
    width: 3,
    height: 2,
  },
  usage: GPUTextureUsage.COPY_SRC,
}, new Uint8Array([1, 1, 1, 1, 1, 1, 1]));

Parameters

device: GPUDevice
data: Uint8Array