Skip to main content
Go to Latest
function createTextureWithData
import { createTextureWithData } from "https://deno.land/std@0.223.0/webgpu/texture_with_data.ts";

Create a GPUTexture with data.

Examples

Example 1

import { createTextureWithData } from "https://deno.land/std@0.223.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