wgsl-test 0.2.13 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { A as runCompute, C as testWesl, D as testFragment, E as expectFragmentImage, F as compileShader, I as createProjectResolver, L as resolveShaderContext, M as lemurImagePath, N as lemurTexture, O as testFragmentImage, P as pngToTexture, S as runWesl, T as testVirtualLib, _ as getGPU, a as createUniformsVirtualLib, b as isDeno, c as gradientTexture, d as renderUniformBuffer, f as simpleRender, g as destroySharedDevice, h as withErrorScopes, i as createSampler, j as testCompute, k as findTestFunctions, l as noiseTexture, m as updateRenderUniforms, n as checkerboardTexture, o as edgePatternTexture, p as solidTexture, r as colorBarsTexture, s as fullscreenTriangleVertex, t as DeviceCache, u as radialGradientTexture, v as getGPUAdapter, w as testResultSize, x as expectWesl, y as getGPUDevice } from "./src-CHGb74p8.js";
1
+ import { A as runCompute, C as testWesl, D as testFragment, E as expectFragmentImage, F as compileShader, I as createProjectResolver, L as resolveShaderContext, M as lemurImagePath, N as lemurTexture, O as testFragmentImage, P as pngToTexture, S as runWesl, T as testVirtualLib, _ as getGPU, a as createUniformsVirtualLib, b as isDeno, c as gradientTexture, d as renderUniformBuffer, f as simpleRender, g as destroySharedDevice, h as withErrorScopes, i as createSampler, j as testCompute, k as findTestFunctions, l as noiseTexture, m as updateRenderUniforms, n as checkerboardTexture, o as edgePatternTexture, p as solidTexture, r as colorBarsTexture, s as fullscreenTriangleVertex, t as DeviceCache, u as radialGradientTexture, v as getGPUAdapter, w as testResultSize, x as expectWesl, y as getGPUDevice } from "./src-DpEjP4cy.js";
2
2
 
3
3
  export { DeviceCache, checkerboardTexture, colorBarsTexture, compileShader, createProjectResolver, createSampler, createUniformsVirtualLib, destroySharedDevice, edgePatternTexture, expectFragmentImage, expectWesl, findTestFunctions, fullscreenTriangleVertex, getGPU, getGPUAdapter, getGPUDevice, gradientTexture, isDeno, lemurImagePath, lemurTexture, noiseTexture, pngToTexture, radialGradientTexture, renderUniformBuffer, resolveShaderContext, runCompute, runWesl, simpleRender, solidTexture, testCompute, testFragment, testFragmentImage, testResultSize, testVirtualLib, testWesl, updateRenderUniforms, withErrorScopes };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node --experimental-strip-types
2
- import { S as runWesl, g as destroySharedDevice, y as getGPUDevice } from "./src-CHGb74p8.js";
2
+ import { S as runWesl, g as destroySharedDevice, y as getGPUDevice } from "./src-DpEjP4cy.js";
3
3
 
4
4
  //#region src/runTestCli.ts
5
5
  const params = JSON.parse(process.argv[2]);
@@ -17,7 +17,7 @@ import { builtinModules } from "node:module";
17
17
  import v8 from "node:v8";
18
18
  import { format, inspect } from "node:util";
19
19
  import { PNG } from "pngjs";
20
- import { componentByteSize, elementStride, numComponents, texelLoadType } from "thimbleberry";
20
+ import { componentByteSize, copyBuffer, elementStride, numComponents, texelLoadType } from "thimbleberry";
21
21
  import weslBundle from "../lib/weslBundle.js";
22
22
 
23
23
  //#region rolldown:runtime
@@ -11489,32 +11489,15 @@ async function runCompute(params) {
11489
11489
  });
11490
11490
  }
11491
11491
  function createStorageBuffer(device, targetSize) {
11492
- return device.createBuffer({
11492
+ const buffer = device.createBuffer({
11493
11493
  label: "storage",
11494
11494
  size: targetSize,
11495
- usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC
11495
+ usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC,
11496
+ mappedAtCreation: true
11496
11497
  });
11497
- }
11498
- /** Copy GPU buffer to CPU using mapAsync (avoids mappedAtCreation which isn't supported everywhere). */
11499
- async function copyBuffer(device, src, format$1) {
11500
- const size = src.size;
11501
- const staging = device.createBuffer({
11502
- label: "staging",
11503
- size,
11504
- usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST
11505
- });
11506
- const commands = device.createCommandEncoder();
11507
- commands.copyBufferToBuffer(src, 0, staging, 0, size);
11508
- device.queue.submit([commands.finish()]);
11509
- await staging.mapAsync(GPUMapMode.READ);
11510
- const result = bufferToArray(staging.getMappedRange(), format$1);
11511
- staging.unmap();
11512
- staging.destroy();
11513
- return result;
11514
- }
11515
- function bufferToArray(buffer, format$1) {
11516
- const TypedArray = format$1.startsWith("f") ? Float32Array : Uint32Array;
11517
- return Array.from(new TypedArray(buffer));
11498
+ new Float32Array(buffer.getMappedRange()).fill(-999);
11499
+ buffer.unmap();
11500
+ return buffer;
11518
11501
  }
11519
11502
 
11520
11503
  //#endregion
@@ -11819,4 +11802,4 @@ function destroySharedDevice() {
11819
11802
 
11820
11803
  //#endregion
11821
11804
  export { runCompute as A, testWesl as C, testFragment as D, expectFragmentImage as E, compileShader as F, createProjectResolver as I, resolveShaderContext as L, lemurImagePath as M, lemurTexture as N, testFragmentImage as O, pngToTexture as P, runWesl as S, testVirtualLib as T, getGPU as _, createUniformsVirtualLib as a, isDeno as b, gradientTexture as c, renderUniformBuffer as d, simpleRender as f, destroySharedDevice as g, withErrorScopes$1 as h, createSampler as i, testCompute as j, findTestFunctions as k, noiseTexture as l, updateRenderUniforms as m, checkerboardTexture as n, edgePatternTexture as o, solidTexture as p, colorBarsTexture as r, fullscreenTriangleVertex as s, DeviceCache$1 as t, radialGradientTexture as u, getGPUAdapter as v, testResultSize as w, expectWesl as x, getGPUDevice as y };
11822
- //# sourceMappingURL=src-CHGb74p8.js.map
11805
+ //# sourceMappingURL=src-DpEjP4cy.js.map