MCPcopy Create free account
hub / github.com/denoland/std / createCapture

Function createCapture

webgpu/create_capture.ts:74–96  ·  view source on GitHub ↗
(
  device: GPUDevice,
  width: number,
  height: number,
)

Source from the content-addressed store, hash-verified

72 */
73// deno-lint-ignore deno-style-guide/exported-function-args-maximum
74export function createCapture(
75 device: GPUDevice,
76 width: number,
77 height: number,
78): CreateCapture {
79 const { padded } = getRowPadding(width);
80 const outputBuffer = device.createBuffer({
81 label: "Capture",
82 size: padded * height,
83 usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST,
84 });
85 const texture = device.createTexture({
86 label: "Capture",
87 size: {
88 width,
89 height,
90 },
91 format: "rgba8unorm-srgb",
92 usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC,
93 });
94
95 return { texture, outputBuffer };
96}

Callers 1

Calls 1

getRowPaddingFunction · 0.90

Tested by

no test coverage detected