@agpu/bindings 0.2.9 → 0.2.11

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.
Files changed (52) hide show
  1. package/dist/classes/main/adapter.d.ts +1 -0
  2. package/dist/classes/main/adapter.js +1 -1
  3. package/dist/classes/main/context.d.ts +1 -0
  4. package/dist/classes/main/context.js +1 -1
  5. package/dist/classes/main/device.d.ts +1 -0
  6. package/dist/classes/main/device.js +1 -1
  7. package/dist/classes/main/webgpucontrols.d.ts +1 -0
  8. package/dist/classes/main/webgpucontrols.js +1 -1
  9. package/dist/classes/sub/data/bindGroup.d.ts +50 -0
  10. package/dist/classes/sub/data/bindGroup.js +1 -0
  11. package/dist/classes/sub/data/bindGroupLayout.d.ts +17 -0
  12. package/dist/classes/sub/data/bindGroupLayout.js +1 -0
  13. package/dist/classes/sub/data/buffers/bufferUsageOptions.d.ts +66 -0
  14. package/dist/classes/sub/data/buffers/bufferUsageOptions.js +1 -0
  15. package/dist/classes/sub/data/buffers.d.ts +181 -0
  16. package/dist/classes/sub/data/buffers.js +1 -0
  17. package/dist/classes/sub/data/commandbuffer.d.ts +12 -0
  18. package/dist/classes/sub/data/commandbuffer.js +1 -0
  19. package/dist/classes/sub/data/shaderModule.d.ts +63 -0
  20. package/dist/classes/sub/data/shaderModule.js +1 -0
  21. package/dist/classes/sub/data/texture/textureUsageOptions.d.ts +43 -0
  22. package/dist/classes/sub/data/texture/textureUsageOptions.js +1 -0
  23. package/dist/classes/sub/data/texture/textureView.d.ts +13 -0
  24. package/dist/classes/sub/data/texture/textureView.js +1 -0
  25. package/dist/classes/sub/data/texture.d.ts +158 -0
  26. package/dist/classes/sub/data/texture.js +1 -0
  27. package/dist/classes/sub/pipeline/commandEncoder/computepass.d.ts +1 -0
  28. package/dist/classes/sub/pipeline/commandEncoder/computepass.js +1 -1
  29. package/dist/classes/sub/pipeline/commandEncoder/renderEncoderBase.d.ts +1 -0
  30. package/dist/classes/sub/pipeline/commandEncoder/renderEncoderBase.js +1 -1
  31. package/dist/classes/sub/pipeline/commandEncoder/renderPass/indirectBuffer.d.ts +1 -0
  32. package/dist/classes/sub/pipeline/commandEncoder/renderPass/indirectBuffer.js +1 -1
  33. package/dist/classes/sub/pipeline/commandEncoder/renderPass.d.ts +1 -0
  34. package/dist/classes/sub/pipeline/commandEncoder/renderPass.js +1 -1
  35. package/dist/classes/sub/pipeline/commandEncoder.d.ts +1 -0
  36. package/dist/classes/sub/pipeline/commandEncoder.js +1 -1
  37. package/dist/classes/sub/pipeline/computePipeline.d.ts +1 -0
  38. package/dist/classes/sub/pipeline/computePipeline.js +1 -1
  39. package/dist/classes/sub/pipeline/pipelineLayout.d.ts +1 -0
  40. package/dist/classes/sub/pipeline/pipelineLayout.js +1 -1
  41. package/dist/classes/sub/pipeline/querySet.d.ts +1 -0
  42. package/dist/classes/sub/pipeline/querySet.js +1 -1
  43. package/dist/classes/sub/pipeline/renderBundleEncoder/renderBundle.d.ts +1 -0
  44. package/dist/classes/sub/pipeline/renderBundleEncoder/renderBundle.js +1 -1
  45. package/dist/classes/sub/pipeline/renderBundleEncoder.d.ts +1 -0
  46. package/dist/classes/sub/pipeline/renderBundleEncoder.js +1 -1
  47. package/dist/classes/sub/pipeline/renderPipeline.d.ts +1 -0
  48. package/dist/classes/sub/pipeline/renderPipeline.js +1 -1
  49. package/dist/classes/sub/pipeline/sampler.d.ts +1 -0
  50. package/dist/classes/sub/pipeline/sampler.js +1 -1
  51. package/dist/index.d.ts +2 -2
  52. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  import { BRAND, RAW } from "@agpu/helpers/decorators";
2
2
  import DeviceControls from "./device";
3
+ import "@webgpu/types";
3
4
  export interface ADAPTER_CONTROLS extends BRAND<"AdapterControls">, RAW<"adapter"> {
4
5
  }
5
6
  export declare class AdapterControls {
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,t,r,i,a,s)=>{function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var u,n=i.kind,d="getter"===n?"get":"setter"===n?"set":"value",l=!t&&e?i.static?e:e.prototype:null,c=t||(l?Object.getOwnPropertyDescriptor(l,i.name):{}),f=!1,p=r.length-1;p>=0;p--){var h={};for(var v in i)h[v]="access"===v?{}:i[v];for(var v in i.access)h.access[v]=i.access[v];h.addInitializer=e=>{if(f)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,r[p])("accessor"===n?{get:c.get,set:c.set}:c[d],h);if("accessor"===n){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(u=o(m.get))&&(c.get=u),(u=o(m.set))&&(c.set=u),(u=o(m.init))&&a.unshift(u)}else(u=o(m))&&("field"===n?a.unshift(u):c[d]=u)}l&&Object.defineProperty(l,i.name,c),f=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var i=arguments.length>2,a=0;t.length>a;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.AdapterControls=void 0;const i=require("@agpu/helpers/decorators"),a=r(require("../../helpers/errors")),s=require("@agpu/helpers/decorators"),o=r(require("./device"));let u=(()=>{let r,u,n=[(0,i.brand)("AdapterControls"),(0,s.raw)("adapter")],d=[];return class{static{u=this}static{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,r={value:u},n,{kind:"class",name:u.name,metadata:i},null,d),u=r.value,i&&Object.defineProperty(u,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),t(u,d)}constructor(e){this.info={subgroup:{max:e.info.subgroupMaxSize,min:e.info.subgroupMinSize},...e.info},this.device=async t=>{if(this.#e)return this.#e;const r=t.required?.features?.filter(t=>!e.features.has(t))??[];if(r.length)throw(0,a.default)(29,`Adapter does not support required feature(s): ${r.join(", ")}.`,"Check adapter.features before requesting the device or remove unsupported required features.");return this.#e=new o.default(await e.requestDevice({requiredFeatures:t.required?.features,requiredLimits:t.required?.limits,defaultQueue:t.defaultQueue}).catch(()=>{throw(0,a.default)(30,"Failed to request a GPU device from the adapter.","Verify the required features and limits are valid for the selected adapter.")}))},this.features=e.features,this.limits=e.limits,this.adapter=e}#e;info;features;limits;adapter;device},u})();exports.AdapterControls=u,exports.default=u;
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,r,i,a,s)=>{function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var u,n=i.kind,d="getter"===n?"get":"setter"===n?"set":"value",l=!t&&e?i.static?e:e.prototype:null,c=t||(l?Object.getOwnPropertyDescriptor(l,i.name):{}),f=!1,p=r.length-1;p>=0;p--){var h={};for(var v in i)h[v]="access"===v?{}:i[v];for(var v in i.access)h.access[v]=i.access[v];h.addInitializer=e=>{if(f)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,r[p])("accessor"===n?{get:c.get,set:c.set}:c[d],h);if("accessor"===n){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(u=o(m.get))&&(c.get=u),(u=o(m.set))&&(c.set=u),(u=o(m.init))&&a.unshift(u)}else(u=o(m))&&("field"===n?a.unshift(u):c[d]=u)}l&&Object.defineProperty(l,i.name,c),f=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var i=arguments.length>2,a=0;t.length>a;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.AdapterControls=void 0;const i=require("@agpu/helpers/decorators"),a=r(require("../../helpers/errors")),s=require("@agpu/helpers/decorators"),o=r(require("./device"));require("@webgpu/types");let u=(()=>{let r,u,n=[(0,i.brand)("AdapterControls"),(0,s.raw)("adapter")],d=[];return class{static{u=this}static{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,r={value:u},n,{kind:"class",name:u.name,metadata:i},null,d),u=r.value,i&&Object.defineProperty(u,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),t(u,d)}constructor(e){this.info={subgroup:{max:e.info.subgroupMaxSize,min:e.info.subgroupMinSize},...e.info},this.device=async t=>{if(this.#e)return this.#e;const r=t.required?.features?.filter(t=>!e.features.has(t))??[];if(r.length)throw(0,a.default)(29,`Adapter does not support required feature(s): ${r.join(", ")}.`,"Check adapter.features before requesting the device or remove unsupported required features.");return this.#e=new o.default(await e.requestDevice({requiredFeatures:t.required?.features,requiredLimits:t.required?.limits,defaultQueue:t.defaultQueue}).catch(()=>{throw(0,a.default)(30,"Failed to request a GPU device from the adapter.","Verify the required features and limits are valid for the selected adapter.")}))},this.features=e.features,this.limits=e.limits,this.adapter=e}#e;info;features;limits;adapter;device},u})();exports.AdapterControls=u,exports.default=u;
@@ -1,6 +1,7 @@
1
1
  import { BRAND, RAW } from "@agpu/helpers/decorators";
2
2
  import TextureCreator from "../sub/data/texture";
3
3
  import DeviceControls from "./device";
4
+ import "@webgpu/types";
4
5
  export declare class ContextControls {
5
6
  constructor(ctx: GPUCanvasContext);
6
7
  configure(config: CANVAS_CONFIG): undefined;
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,t,r,n,o,a)=>{function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=n.kind,u="getter"===c?"get":"setter"===c?"set":"value",l=!t&&e?n.static?e:e.prototype:null,f=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d=!1,v=r.length-1;v>=0;v--){var h={};for(var g in n)h[g]="access"===g?{}:n[g];for(var g in n.access)h.access[g]=n.access[g];h.addInitializer=e=>{if(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var p=(0,r[v])("accessor"===c?{get:f.get,set:f.set}:f[u],h);if("accessor"===c){if(void 0===p)continue;if(null===p||"object"!=typeof p)throw new TypeError("Object expected");(s=i(p.get))&&(f.get=s),(s=i(p.set))&&(f.set=s),(s=i(p.init))&&o.unshift(s)}else(s=i(p))&&("field"===c?o.unshift(s):f[u]=s)}l&&Object.defineProperty(l,n.name,f),d=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var n=arguments.length>2,o=0;t.length>o;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.ContextControls=void 0;const n=require("@agpu/helpers/decorators"),o=r(require("../../helpers/errors")),a=require("@agpu/helpers/decorators"),i=r(require("../sub/data/texture")),s=r(require("./device"));let c=(()=>{let r,c,u=[(0,a.raw)("ctx"),(0,n.brand)("ContextControls")],l=[];return class{static{c=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,r={value:c},u,{kind:"class",name:c.name,metadata:n},null,l),c=r.value,n&&Object.defineProperty(c,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),t(c,l)}constructor(e){this.ctx=e,this.canvas=e.canvas}configure(e){if(!e.device)throw(0,o.default)(31,"Canvas configuration requires a DeviceControls instance.","Pass the device returned by AdapterControls.device(...).");if(!e.format)throw(0,o.default)(32,"Canvas configuration requires a GPUTextureFormat.","Use WebGPUControls.preferredCanvasFormat() or another valid GPUTextureFormat.");let t={...e,device:e.device.raw()};return this.ctx.configure(t)}unconfigure(){return this.ctx.unconfigure()}config(){const e=this.ctx.getConfiguration();return e?{...e,device:new s.default(e.device)}:null}currentTexture(e){if(!this.ctx.getConfiguration())throw(0,o.default)(33,"Canvas context is not configured.","Call ContextControls.configure(...) before requesting the current texture.");return new i.default(e.raw(),this.ctx.getCurrentTexture())}canvas;ctx},c})();exports.ContextControls=c;
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,r,n,o,i)=>{function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=n.kind,u="getter"===c?"get":"setter"===c?"set":"value",l=!t&&e?n.static?e:e.prototype:null,f=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d=!1,v=r.length-1;v>=0;v--){var h={};for(var p in n)h[p]="access"===p?{}:n[p];for(var p in n.access)h.access[p]=n.access[p];h.addInitializer=e=>{if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var g=(0,r[v])("accessor"===c?{get:f.get,set:f.set}:f[u],h);if("accessor"===c){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(s=a(g.get))&&(f.get=s),(s=a(g.set))&&(f.set=s),(s=a(g.init))&&o.unshift(s)}else(s=a(g))&&("field"===c?o.unshift(s):f[u]=s)}l&&Object.defineProperty(l,n.name,f),d=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var n=arguments.length>2,o=0;t.length>o;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.ContextControls=void 0;const n=require("@agpu/helpers/decorators"),o=r(require("../../helpers/errors")),i=require("@agpu/helpers/decorators"),a=r(require("../sub/data/texture")),s=r(require("./device"));require("@webgpu/types");let c=(()=>{let r,c,u=[(0,i.raw)("ctx"),(0,n.brand)("ContextControls")],l=[];return class{static{c=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,r={value:c},u,{kind:"class",name:c.name,metadata:n},null,l),c=r.value,n&&Object.defineProperty(c,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),t(c,l)}constructor(e){this.ctx=e,this.canvas=e.canvas}configure(e){if(!e.device)throw(0,o.default)(31,"Canvas configuration requires a DeviceControls instance.","Pass the device returned by AdapterControls.device(...).");if(!e.format)throw(0,o.default)(32,"Canvas configuration requires a GPUTextureFormat.","Use WebGPUControls.preferredCanvasFormat() or another valid GPUTextureFormat.");let t={...e,device:e.device.raw()};return this.ctx.configure(t)}unconfigure(){return this.ctx.unconfigure()}config(){const e=this.ctx.getConfiguration();return e?{...e,device:new s.default(e.device)}:null}currentTexture(e){if(!this.ctx.getConfiguration())throw(0,o.default)(33,"Canvas context is not configured.","Call ContextControls.configure(...) before requesting the current texture.");return new a.default(e.raw(),this.ctx.getCurrentTexture())}canvas;ctx},c})();exports.ContextControls=c;
@@ -12,6 +12,7 @@ import RenderBundleEncoderCreator from "../sub/pipeline/renderBundleEncoder";
12
12
  import { BRAND, RAW } from "@agpu/helpers/decorators";
13
13
  import CommandBufferCreator from "../sub/data/commandbuffer";
14
14
  import CommandEncoderCreator from "../sub/pipeline/commandEncoder";
15
+ import "@webgpu/types";
15
16
  export interface DeviceControls extends BRAND<"DeviceControls">, RAW<GPUDevice> {
16
17
  }
17
18
  /**
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,t,r,u,s,a)=>{function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var i,o=u.kind,c="getter"===o?"get":"setter"===o?"set":"value",l=!t&&e?u.static?e:e.prototype:null,d=t||(l?Object.getOwnPropertyDescriptor(l,u.name):{}),f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in u)m[h]="access"===h?{}:u[h];for(var h in u.access)m.access[h]=u.access[h];m.addInitializer=e=>{if(f)throw new TypeError("Cannot add initializers after decoration has completed");a.push(n(e||null))};var b=(0,r[p])("accessor"===o?{get:d.get,set:d.set}:d[c],m);if("accessor"===o){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(i=n(b.get))&&(d.get=i),(i=n(b.set))&&(d.set=i),(i=n(b.init))&&s.unshift(i)}else(i=n(b))&&("field"===o?s.unshift(i):d[c]=i)}l&&Object.defineProperty(l,u.name,d),f=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var u=arguments.length>2,s=0;t.length>s;s++)r=u?t[s].call(e,r):t[s].call(e);return u?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.DeviceControls=void 0;const u=r(require("../sub/data/bindGroupLayout")),s=r(require("../sub/data/buffers")),a=r(require("../sub/pipeline/pipelineLayout")),n=r(require("../sub/pipeline/renderPipeline")),i=r(require("../sub/pipeline/sampler")),o=r(require("../sub/data/shaderModule")),c=r(require("../sub/data/texture")),l=r(require("../sub/data/bindGroup")),d=r(require("../sub/pipeline/computePipeline")),f=r(require("../../helpers/errors")),p=r(require("../sub/pipeline/querySet")),m=r(require("../sub/pipeline/renderBundleEncoder")),h=require("@agpu/helpers/decorators"),b=require("@agpu/helpers/decorators"),g=r(require("../sub/pipeline/commandEncoder"));let w=(()=>{let r,w,x=[(0,h.brand)("DeviceControls"),(0,b.raw)("device")],y=[];return class{static{w=this}static{const u="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,r={value:w},x,{kind:"class",name:w.name,metadata:u},null,y),w=r.value,u&&Object.defineProperty(w,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:u}),t(w,y)}constructor(e){this.#e=e,this.device=e,this.Buffer=class extends s.default{constructor(t){super(e,t)}static async from(t){if(!(t.usage&GPUBufferUsage.MAP_READ))throw(0,f.default)(18,"Buffer is not MAP_READ compatible","Ensure GPUBufferUsage.MAP_READ was set during creation.");await t.mapAsync(GPUMapMode.READ);const r=t.getMappedRange().slice(0);return t.unmap(),new s.default(e,{value:r,usage:t.usage})}};const t=this;this.Texture=class extends c.default{constructor(t){super(e,t)}static async fromURL(r){const u=await fetch(r),s=await u.blob(),a=await createImageBitmap(s),n=new t.Texture({size:[a.width,a.height,1],format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT});return e.queue.copyExternalImageToTexture({source:a},{texture:n.raw()},[a.width,a.height]),n}static from(t){return new c.default(e,t)}static async fromBitmap(r){const u=new t.Texture({size:[r.width,r.height,1],format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT});return e.queue.copyExternalImageToTexture({source:r},{texture:u.raw()},[r.width,r.height]),u}},this.Sampler=class extends i.default{constructor(t={magFilter:"linear",minFilter:"linear"}){super(e,t)}static from(t){return new i.default(e,t)}},this.ShaderModule=class extends o.default{constructor(t,r){super(e,t,r)}static from(t){return new o.default(e,t)}},this.RenderPipeline=class extends n.default{constructor(t){super(e,t)}static from(t){return new n.default(e,t)}},this.BindGroupLayout=class extends u.default{constructor(t){super(e,t)}static from(t){return new u.default(e,t)}},this.PipelineLayout=class extends a.default{constructor(t={}){super(e,t)}static from(t){return new a.default(e,t)}},this.BindGroup=class extends l.default{constructor(t){super(e,t)}static from(t){return new l.default(e,t)}},this.ComputePipeline=class extends d.default{constructor(t){super(e,t)}static from(t){return new d.default(e,t)}},this.QuerySet=class extends p.default{constructor(t){super(e,t)}static from(t){return new p.default(e,t)}},this.RenderBundleEncoder=class extends m.default{constructor(t){super(e,e.createRenderBundleEncoder(t))}},this.CommandEncoder=class extends g.default{constructor(t){super(e,t)}static from(t){return new g.default(e,t)}}}queue={submit:e=>{if(!Array.isArray(e)||0===e.length)throw(0,f.default)(34,"queue.submit requires at least one CommandBufferCreator.","Finish a command encoder first and pass the resulting command buffer(s) to queue.submit(...).");return this.#e.queue.submit(e.map(e=>e.raw()))},on:(e,t)=>{if("submittedWorkDone"!==e)throw(0,f.default)(35,`Unsupported queue event: ${e+""}.`,"Use queue.on('submittedWorkDone', callback).");this.#e.queue.onSubmittedWorkDone().then(()=>t())}};#e;device;Buffer;Texture;Sampler;ShaderModule;BindGroupLayout;BindGroup;RenderPipeline;ComputePipeline;PipelineLayout;QuerySet;RenderBundleEncoder;CommandEncoder},w})();exports.DeviceControls=w,exports.default=w;
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,r,u,s,a)=>{function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var i,o=u.kind,c="getter"===o?"get":"setter"===o?"set":"value",l=!t&&e?u.static?e:e.prototype:null,d=t||(l?Object.getOwnPropertyDescriptor(l,u.name):{}),p=!1,f=r.length-1;f>=0;f--){var m={};for(var h in u)m[h]="access"===h?{}:u[h];for(var h in u.access)m.access[h]=u.access[h];m.addInitializer=e=>{if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(n(e||null))};var b=(0,r[f])("accessor"===o?{get:d.get,set:d.set}:d[c],m);if("accessor"===o){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(i=n(b.get))&&(d.get=i),(i=n(b.set))&&(d.set=i),(i=n(b.init))&&s.unshift(i)}else(i=n(b))&&("field"===o?s.unshift(i):d[c]=i)}l&&Object.defineProperty(l,u.name,d),p=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var u=arguments.length>2,s=0;t.length>s;s++)r=u?t[s].call(e,r):t[s].call(e);return u?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.DeviceControls=void 0;const u=r(require("../sub/data/bindGroupLayout")),s=r(require("../sub/data/buffers")),a=r(require("../sub/pipeline/pipelineLayout")),n=r(require("../sub/pipeline/renderPipeline")),i=r(require("../sub/pipeline/sampler")),o=r(require("../sub/data/shaderModule")),c=r(require("../sub/data/texture")),l=r(require("../sub/data/bindGroup")),d=r(require("../sub/pipeline/computePipeline")),p=r(require("../../helpers/errors")),f=r(require("../sub/pipeline/querySet")),m=r(require("../sub/pipeline/renderBundleEncoder")),h=require("@agpu/helpers/decorators"),b=require("@agpu/helpers/decorators"),g=r(require("../sub/pipeline/commandEncoder"));require("@webgpu/types");let w=(()=>{let r,w,x=[(0,h.brand)("DeviceControls"),(0,b.raw)("device")],y=[];return class{static{w=this}static{const u="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,r={value:w},x,{kind:"class",name:w.name,metadata:u},null,y),w=r.value,u&&Object.defineProperty(w,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:u}),t(w,y)}constructor(e){this.#e=e,this.device=e,this.Buffer=class extends s.default{constructor(t){super(e,t)}static async from(t){if(!(t.usage&GPUBufferUsage.MAP_READ))throw(0,p.default)(18,"Buffer is not MAP_READ compatible","Ensure GPUBufferUsage.MAP_READ was set during creation.");await t.mapAsync(GPUMapMode.READ);const r=t.getMappedRange().slice(0);return t.unmap(),new s.default(e,{value:r,usage:t.usage})}};const t=this;this.Texture=class extends c.default{constructor(t){super(e,t)}static async fromURL(r){const u=await fetch(r),s=await u.blob(),a=await createImageBitmap(s),n=new t.Texture({size:[a.width,a.height,1],format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT});return e.queue.copyExternalImageToTexture({source:a},{texture:n.raw()},[a.width,a.height]),n}static from(t){return new c.default(e,t)}static async fromBitmap(r){const u=new t.Texture({size:[r.width,r.height,1],format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT});return e.queue.copyExternalImageToTexture({source:r},{texture:u.raw()},[r.width,r.height]),u}},this.Sampler=class extends i.default{constructor(t={magFilter:"linear",minFilter:"linear"}){super(e,t)}static from(t){return new i.default(e,t)}},this.ShaderModule=class extends o.default{constructor(t,r){super(e,t,r)}static from(t){return new o.default(e,t)}},this.RenderPipeline=class extends n.default{constructor(t){super(e,t)}static from(t){return new n.default(e,t)}},this.BindGroupLayout=class extends u.default{constructor(t){super(e,t)}static from(t){return new u.default(e,t)}},this.PipelineLayout=class extends a.default{constructor(t={}){super(e,t)}static from(t){return new a.default(e,t)}},this.BindGroup=class extends l.default{constructor(t){super(e,t)}static from(t){return new l.default(e,t)}},this.ComputePipeline=class extends d.default{constructor(t){super(e,t)}static from(t){return new d.default(e,t)}},this.QuerySet=class extends f.default{constructor(t){super(e,t)}static from(t){return new f.default(e,t)}},this.RenderBundleEncoder=class extends m.default{constructor(t){super(e,e.createRenderBundleEncoder(t))}},this.CommandEncoder=class extends g.default{constructor(t){super(e,t)}static from(t){return new g.default(e,t)}}}queue={submit:e=>{if(!Array.isArray(e)||0===e.length)throw(0,p.default)(34,"queue.submit requires at least one CommandBufferCreator.","Finish a command encoder first and pass the resulting command buffer(s) to queue.submit(...).");return this.#e.queue.submit(e.map(e=>e.raw()))},on:(e,t)=>{if("submittedWorkDone"!==e)throw(0,p.default)(35,`Unsupported queue event: ${e+""}.`,"Use queue.on('submittedWorkDone', callback).");this.#e.queue.onSubmittedWorkDone().then(()=>t())}};#e;device;Buffer;Texture;Sampler;ShaderModule;BindGroupLayout;BindGroup;RenderPipeline;ComputePipeline;PipelineLayout;QuerySet;RenderBundleEncoder;CommandEncoder},w})();exports.DeviceControls=w,exports.default=w;
@@ -1,6 +1,7 @@
1
1
  import { BRAND } from "@agpu/helpers/decorators";
2
2
  import AdapterControls from "./adapter";
3
3
  import { ContextControls } from "./context";
4
+ import "@webgpu/types";
4
5
  interface WebGPUControls extends BRAND<"WebGPUControls"> {
5
6
  }
6
7
  declare class WebGPUControls {
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,t,r,a,n,o)=>{function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=a.kind,l="getter"===c?"get":"setter"===c?"set":"value",u=!t&&e?a.static?e:e.prototype:null,d=t||(u?Object.getOwnPropertyDescriptor(u,a.name):{}),f=!1,h=r.length-1;h>=0;h--){var p={};for(var v in a)p[v]="access"===v?{}:a[v];for(var v in a.access)p.access[v]=a.access[v];p.addInitializer=e=>{if(f)throw new TypeError("Cannot add initializers after decoration has completed");o.push(i(e||null))};var g=(0,r[h])("accessor"===c?{get:d.get,set:d.set}:d[l],p);if("accessor"===c){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(s=i(g.get))&&(d.get=s),(s=i(g.set))&&(d.set=s),(s=i(g.init))&&n.unshift(s)}else(s=i(g))&&("field"===c?n.unshift(s):d[l]=s)}u&&Object.defineProperty(u,a.name,d),f=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var a=arguments.length>2,n=0;t.length>n;n++)r=a?t[n].call(e,r):t[n].call(e);return a?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0});const a=require("@agpu/helpers/decorators"),n=r(require("../../helpers/errors")),o=r(require("./adapter")),i=require("./context");let s=(()=>{let r,s,c=[(0,a.brand)("WebGPUControls")],l=[];return class{static{s=this}static{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,r={value:s},c,{kind:"class",name:s.name,metadata:a},null,l),s=r.value,a&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),t(s,l)}constructor(e){if(!navigator.gpu)throw(0,n.default)(24,"WebGPU not supported!");if(!(e instanceof HTMLCanvasElement))throw(0,n.default)(26,"WebGPUControls requires a HTMLCanvasElement.","Pass a real <canvas> element when constructing WebGPUControls.");this.#e=navigator.gpu.getPreferredCanvasFormat(),this.cv=e}cv;#e;preferredCanvasFormat(){return this.#e}context(){let e=this.cv.getContext("webgpu");if(e)return new i.ContextControls(e);throw(0,n.default)(27,"Failed to acquire a WebGPU canvas context.","Ensure the canvas supports getContext('webgpu') and has not been initialized with a different context type.")}#t;get Adapter(){return this.#t?Promise.resolve(this.#t):navigator.gpu.requestAdapter().then(e=>{if(!e)throw(0,n.default)(25,"navigator.gpu.requestAdapter returned null");return this.#t=new o.default(e)}).catch(e=>{if(e instanceof Error&&"code"in e)throw e;throw(0,n.default)(28,"Failed to acquire a GPU adapter.","Ensure a compatible WebGPU adapter is available and the browser has permission to use it.")})}},s})();exports.default=s;
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,r,a,n,o)=>{function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=a.kind,l="getter"===c?"get":"setter"===c?"set":"value",u=!t&&e?a.static?e:e.prototype:null,d=t||(u?Object.getOwnPropertyDescriptor(u,a.name):{}),p=!1,f=r.length-1;f>=0;f--){var h={};for(var v in a)h[v]="access"===v?{}:a[v];for(var v in a.access)h.access[v]=a.access[v];h.addInitializer=e=>{if(p)throw new TypeError("Cannot add initializers after decoration has completed");o.push(i(e||null))};var g=(0,r[f])("accessor"===c?{get:d.get,set:d.set}:d[l],h);if("accessor"===c){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(s=i(g.get))&&(d.get=s),(s=i(g.set))&&(d.set=s),(s=i(g.init))&&n.unshift(s)}else(s=i(g))&&("field"===c?n.unshift(s):d[l]=s)}u&&Object.defineProperty(u,a.name,d),p=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var a=arguments.length>2,n=0;t.length>n;n++)r=a?t[n].call(e,r):t[n].call(e);return a?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0});const a=require("@agpu/helpers/decorators"),n=r(require("../../helpers/errors")),o=r(require("./adapter")),i=require("./context");require("@webgpu/types");let s=(()=>{let r,s,c=[(0,a.brand)("WebGPUControls")],l=[];return class{static{s=this}static{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,r={value:s},c,{kind:"class",name:s.name,metadata:a},null,l),s=r.value,a&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),t(s,l)}constructor(e){if(!navigator.gpu)throw(0,n.default)(24,"WebGPU not supported!");if(!(e instanceof HTMLCanvasElement))throw(0,n.default)(26,"WebGPUControls requires a HTMLCanvasElement.","Pass a real <canvas> element when constructing WebGPUControls.");this.#e=navigator.gpu.getPreferredCanvasFormat(),this.cv=e}cv;#e;preferredCanvasFormat(){return this.#e}context(){let e=this.cv.getContext("webgpu");if(e)return new i.ContextControls(e);throw(0,n.default)(27,"Failed to acquire a WebGPU canvas context.","Ensure the canvas supports getContext('webgpu') and has not been initialized with a different context type.")}#t;get Adapter(){return this.#t?Promise.resolve(this.#t):navigator.gpu.requestAdapter().then(e=>{if(!e)throw(0,n.default)(25,"navigator.gpu.requestAdapter returned null");return this.#t=new o.default(e)}).catch(e=>{if(e instanceof Error&&"code"in e)throw e;throw(0,n.default)(28,"Failed to acquire a GPU adapter.","Ensure a compatible WebGPU adapter is available and the browser has permission to use it.")})}},s})();exports.default=s;
@@ -0,0 +1,50 @@
1
+ import DC_MEMBER from "../../../helpers/types/DCMember";
2
+ import { BRAND, LABEL, RAW } from "@agpu/helpers/decorators";
3
+ import BindGroupLayoutCreator from "./bindGroupLayout";
4
+ import BufferCreator from "./buffers";
5
+ import SamplerCreator from "../pipeline/sampler";
6
+ import TextureCreator from "./texture";
7
+ import "@webgpu/types";
8
+ export interface BindGroupCreator extends RAW<GPUBindGroup>, BRAND<"BindGroupCreator">, LABEL {
9
+ }
10
+ /**
11
+ * Wrapper around {@link GPUBindGroup}.
12
+ */
13
+ export declare class BindGroupCreator {
14
+ #private;
15
+ readonly bindGroup: GPUBindGroup;
16
+ constructor(device: GPUDevice, options: BIND_GROUP_OPTIONS | GPUBindGroup);
17
+ /**
18
+ * Returns the layout wrapper used to create this bind group
19
+ */
20
+ layout(): BindGroupLayoutCreator | {
21
+ "__#private@#device"?: GPUDevice;
22
+ "__#private@#descriptor"?: GPUBindGroupLayoutDescriptor;
23
+ readonly bindGroupLayout: GPUBindGroupLayout;
24
+ clone(): BindGroupLayoutCreator;
25
+ raw(): GPUBindGroupLayout;
26
+ readonly __brand: "BindGroupLayoutCreator";
27
+ [Symbol.hasInstance](instance: any): boolean;
28
+ label(): string;
29
+ label<T extends string>(val: T): T;
30
+ };
31
+ /**
32
+ * Recreates the bind group from its original layout and entries when available.
33
+ */
34
+ clone(): BindGroupCreator;
35
+ }
36
+ export default BindGroupCreator;
37
+ /**
38
+ * Options used to create a bind group wrapper.
39
+ */
40
+ export interface BIND_GROUP_OPTIONS extends GPUObjectDescriptorBase {
41
+ /**The layout of the bind group.*/
42
+ layout: BindGroupLayoutCreator | DC_MEMBER<"BindGroupLayout">;
43
+ /**entries in the bind group. */
44
+ entries: {
45
+ /**The @binding(n) of the entry.*/
46
+ binding: number;
47
+ /**The resource.*/
48
+ resource: TextureCreator | DC_MEMBER<"Texture"> | BufferCreator | DC_MEMBER<"Buffer"> | SamplerCreator | DC_MEMBER<"Sampler">;
49
+ }[];
50
+ }
@@ -0,0 +1 @@
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,r,i,o,n)=>{function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=i.kind,u="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,p=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),d=!1,b=r.length-1;b>=0;b--){var h={};for(var f in i)h[f]="access"===f?{}:i[f];for(var f in i.access)h.access[f]=i.access[f];h.addInitializer=e=>{if(d)throw new TypeError("Cannot add initializers after decoration has completed");n.push(a(e||null))};var y=(0,r[b])("accessor"===l?{get:p.get,set:p.set}:p[u],h);if("accessor"===l){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=a(y.get))&&(p.get=s),(s=a(y.set))&&(p.set=s),(s=a(y.init))&&o.unshift(s)}else(s=a(y))&&("field"===l?o.unshift(s):p[u]=s)}c&&Object.defineProperty(c,i.name,p),d=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var i=arguments.length>2,o=0;t.length>o;o++)r=i?t[o].call(e,r):t[o].call(e);return i?r:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BindGroupCreator=void 0;const r=require("@agpu/helpers/decorators"),i=require("@agpu/helpers/decorators"),o=require("@agpu/helpers/decorators");require("@webgpu/types");let n=(()=>{let n,a,s=[(0,r.brand)("BindGroupCreator"),(0,o.raw)("bindGroup"),(0,i.labeling)({get:e=>e.bindGroup.label,set:(e,t)=>e.bindGroup.label=t})],l=[];var u=class{static{a=this}static{const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,n={value:a},s,{kind:"class",name:a.name,metadata:r},null,l),u=a=n.value,r&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),t(a,l)}#e;#t;#r;bindGroup;constructor(e,t){this.#r=t.layout,t.layout?(this.#e=e,this.#t={...t,entries:t.entries.map(e=>({...e}))},this.bindGroup=e.createBindGroup(this.#i(t))):this.bindGroup=t}#i(e){return{layout:e.layout.raw(),entries:e.entries.map(e=>({binding:e.binding,resource:e.resource.raw()})),label:e.label}}layout(){return this.#r}clone(){if(!this.#e||!this.#t)throw new TypeError("Cannot clone a BindGroupCreator created from a raw GPUBindGroup.");return new u(this.#e,{...this.#t,label:this.bindGroup.label||this.#t.label,entries:this.#t.entries.map(e=>({...e}))})}};return u=a})();exports.BindGroupCreator=n,exports.default=n;
@@ -0,0 +1,17 @@
1
+ import { BRAND, LABEL, RAW } from "@agpu/helpers/decorators";
2
+ import "@webgpu/types";
3
+ export interface BindGroupLayoutCreator extends RAW<GPUBindGroupLayout>, BRAND<"BindGroupLayoutCreator">, LABEL {
4
+ }
5
+ /**
6
+ * Wrapper around {@link GPUBindGroupLayout}.
7
+ */
8
+ export declare class BindGroupLayoutCreator {
9
+ #private;
10
+ readonly bindGroupLayout: GPUBindGroupLayout;
11
+ constructor(device: GPUDevice, bgldOrBgl: GPUBindGroupLayoutDescriptor | GPUBindGroupLayout);
12
+ /**
13
+ * Recreates the bind group layout from its original descriptor when available.
14
+ */
15
+ clone(): BindGroupLayoutCreator;
16
+ }
17
+ export default BindGroupLayoutCreator;
@@ -0,0 +1 @@
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,r,o,i,a)=>{function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,u=o.kind,c="getter"===u?"get":"setter"===u?"set":"value",l=!t&&e?o.static?e:e.prototype:null,d=t||(l?Object.getOwnPropertyDescriptor(l,o.name):{}),p=!1,y=r.length-1;y>=0;y--){var f={};for(var h in o)f[h]="access"===h?{}:o[h];for(var h in o.access)f.access[h]=o.access[h];f.addInitializer=e=>{if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(n(e||null))};var b=(0,r[y])("accessor"===u?{get:d.get,set:d.set}:d[c],f);if("accessor"===u){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(s=n(b.get))&&(d.get=s),(s=n(b.set))&&(d.set=s),(s=n(b.init))&&i.unshift(s)}else(s=n(b))&&("field"===u?i.unshift(s):d[c]=s)}l&&Object.defineProperty(l,o.name,d),p=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var o=arguments.length>2,i=0;t.length>i;i++)r=o?t[i].call(e,r):t[i].call(e);return o?r:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BindGroupLayoutCreator=void 0;const r=require("@agpu/helpers/decorators"),o=require("@agpu/helpers/decorators"),i=require("@agpu/helpers/decorators");require("@webgpu/types");let a=(()=>{let a,n,s=[(0,r.brand)("BindGroupLayoutCreator"),(0,i.raw)("bindGroupLayoutDescriptor"),(0,o.labeling)({get:e=>e.bindGroupLayout.label,set:(e,t)=>e.bindGroupLayout.label=t})],u=[];var c=class{static{n=this}static{const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,a={value:n},s,{kind:"class",name:n.name,metadata:r},null,u),c=n=a.value,r&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),t(n,u)}#e;#t;bindGroupLayout;constructor(e,t){t instanceof GPUBindGroupLayout?this.bindGroupLayout=t:(this.#e=e,this.#t={...t,entries:Array.from(t.entries,e=>({...e}))},this.bindGroupLayout=e.createBindGroupLayout(t))}clone(){if(!this.#e||!this.#t)throw new TypeError("Cannot clone a BindGroupLayoutCreator created from a raw GPUBindGroupLayout.");return new c(this.#e,{...this.#t,entries:Array.from(this.#t.entries,e=>({...e})),label:this.bindGroupLayout.label||this.#t.label})}};return c=n})();exports.BindGroupLayoutCreator=a,exports.default=a;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Fine-grained copy flags for buffer usage construction.
3
+ */
4
+ export interface BUFFER_COPY_OPTIONS {
5
+ /**Whether the buffer can be read while being copied. */
6
+ read?: boolean;
7
+ /**Whether the buffer can be written to while being copied */
8
+ write?: boolean;
9
+ }
10
+ import "@webgpu/types";
11
+ export interface BUFFER_BINDING_OPTIONS {
12
+ /**Whether the buffer can be bound as a vertex buffer */
13
+ vertex?: boolean;
14
+ /**Whether the buffer can be bound as a index buffer */
15
+ index?: boolean;
16
+ /**Whether the buffer can be bound as a uniform buffer */
17
+ uniform?: boolean;
18
+ /**Whether the buffer can be bound as a storage buffer */
19
+ storage?: boolean;
20
+ /**Whether the buffer can be bound as a indirect buffer */
21
+ indirect?: boolean;
22
+ }
23
+ /**
24
+ * CPU mapping flags for buffer usage construction.
25
+ */
26
+ export interface BUFFER_MAP_OPTIONS {
27
+ /**Whether the buffer can be read while mapping */
28
+ read?: boolean;
29
+ /**Whether the buffer can be written to while mapping */
30
+ write?: boolean;
31
+ }
32
+ export interface BUFFER_USAGE_OPTIONS {
33
+ /**
34
+ * Copy operations
35
+ * - `true`: Enable both texture and buffer copy (COPY_SRC | COPY_DST)
36
+ * - `false`: Disable copy operations
37
+ * - `object`: Specify which copy types to enable
38
+ */
39
+ copy?: BUFFER_COPY_OPTIONS | boolean;
40
+ /**
41
+ * Buffer binding types
42
+ * Specify how this buffer will be bound to shaders
43
+ */
44
+ buffer?: BUFFER_BINDING_OPTIONS;
45
+ /**
46
+ * Map operations (CPU access)
47
+ * - `true`: Enable read and write mapping
48
+ * - `false`: Disable mapping
49
+ * - `object`: Specify read/write separately
50
+ */
51
+ map?: BUFFER_MAP_OPTIONS | boolean;
52
+ /**
53
+ * Can be used as a query result destination
54
+ */
55
+ queryable?: boolean;
56
+ }
57
+ export default BUFFER_USAGE_OPTIONS;
58
+ /**
59
+ * Converts a structured buffer usage object into native `GPUBufferUsage` bits.
60
+ */
61
+ export declare function getBufferUsage(options?: BUFFER_USAGE_OPTIONS): number;
62
+ /**
63
+ * Expands native `GPUBufferUsage` bits into the structured options shape used
64
+ * by this package.
65
+ */
66
+ export declare function getOptionsFromUsage(usage: number): BUFFER_USAGE_OPTIONS;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getBufferUsage=(e={})=>{let f=0,r=e.copy;r&&("boolean"==typeof r?(f|=GPUBufferUsage.COPY_DST,f|=GPUBufferUsage.COPY_SRC):(r.read&&(f|=GPUBufferUsage.COPY_SRC),r.write&&(f|=GPUBufferUsage.COPY_DST)));let U=e.buffer;U&&(U.index&&(f|=GPUBufferUsage.INDEX),U.indirect&&(f|=GPUBufferUsage.INDIRECT),U.storage&&(f|=GPUBufferUsage.STORAGE),U.uniform&&(f|=GPUBufferUsage.UNIFORM),U.vertex&&(f|=GPUBufferUsage.VERTEX));let a=e.map;return a&&("boolean"==typeof a?(f|=GPUBufferUsage.MAP_READ,f|=GPUBufferUsage.MAP_WRITE):(a.read&&(f|=GPUBufferUsage.MAP_READ),a.write&&(f|=GPUBufferUsage.MAP_WRITE))),e.queryable&&(f|=GPUBufferUsage.QUERY_RESOLVE),f},exports.getOptionsFromUsage=e=>{const f={},r=!!(e&GPUBufferUsage.COPY_SRC),U=!!(e&GPUBufferUsage.COPY_DST);r&&U?f.copy=!0:(r||U)&&(f.copy={read:r,write:U});const a={};e&GPUBufferUsage.INDEX&&(a.index=!0),e&GPUBufferUsage.INDIRECT&&(a.indirect=!0),e&GPUBufferUsage.STORAGE&&(a.storage=!0),e&GPUBufferUsage.UNIFORM&&(a.uniform=!0),e&GPUBufferUsage.VERTEX&&(a.vertex=!0),Object.keys(a).length>0&&(f.buffer=a);const s=!!(e&GPUBufferUsage.MAP_READ),u=!!(e&GPUBufferUsage.MAP_WRITE);return s&&u?f.map=!0:(s||u)&&(f.map={read:s,write:u}),e&GPUBufferUsage.QUERY_RESOLVE&&(f.queryable=!0),f},require("@webgpu/types");
@@ -0,0 +1,181 @@
1
+ import UNSURE from "@agpu/helpers/unsure";
2
+ import BUFFER_USAGE_OPTIONS from "./buffers/bufferUsageOptions";
3
+ import "@webgpu/types";
4
+ /**
5
+ * Construction options for {@link BufferCreator}.
6
+ */
7
+ export interface BUFFER_CONSTRUCTION_OPTIONS extends GPUObjectDescriptorBase {
8
+ /**
9
+ * The initial value of the Buffer
10
+ *
11
+ * Using this requires usage.copy.write to be true
12
+ *
13
+ * If this is passed but copy.write is false or undefined, the constructor throws a error.
14
+ * @example
15
+ *
16
+ * // Float 32 array
17
+ * Float32Array
18
+ *
19
+ * // Float 16 Array
20
+ * Float16Array
21
+ *
22
+ * // 64 bit unsigned integer array
23
+ * BigUint64Array
24
+ */
25
+ value?: GPUAllowSharedBufferSource;
26
+ /**
27
+ * The GPUBufferUsage of the Buffer.
28
+ *
29
+ * @example
30
+ * BufferUsage.VERTEX | BufferUsage.COPY_DST
31
+ */
32
+ usage?: BUFFER_USAGE_OPTIONS | number;
33
+ }
34
+ export declare const bufferDestroyedError: import("@agpu/helpers/errors").AndromedaError;
35
+ export declare const cannotBeRead: import("@agpu/helpers/errors").AndromedaError;
36
+ export declare const initCannotRead: import("@agpu/helpers/errors").AndromedaError;
37
+ export declare const initCouldNotAssignValue: import("@agpu/helpers/errors").AndromedaError;
38
+ export declare const couldNotAssignValue: import("@agpu/helpers/errors").AndromedaError;
39
+ export declare const cannotBeWrittenTo: import("@agpu/helpers/errors").AndromedaError;
40
+ export declare const otherCannotBeWrittenTo: import("@agpu/helpers/errors").AndromedaError;
41
+ export declare const otherTextureCannotBeWrittenTo: import("@agpu/helpers/errors").AndromedaError;
42
+ export declare const invalidBufferSize: import("@agpu/helpers/errors").AndromedaError;
43
+ export declare const invalidBufferCopySize: import("@agpu/helpers/errors").AndromedaError;
44
+ /**
45
+ * Minimal texture surface accepted by {@link BufferCreator.copyToTexture}.
46
+ */
47
+ export interface TEXTURE_COPY_DESTINATION {
48
+ raw(): GPUTexture;
49
+ can: {
50
+ copy: {
51
+ write: boolean;
52
+ };
53
+ };
54
+ }
55
+ export interface BUFFER_TO_TEXTURE_OPTIONS {
56
+ offset?: number;
57
+ bytesPerRow?: number;
58
+ rowsPerImage?: number;
59
+ origin?: GPUOrigin3D;
60
+ mipLevel?: number;
61
+ aspect?: GPUTextureAspect;
62
+ size?: GPUExtent3D;
63
+ }
64
+ /**
65
+ * Wrapper around {@link GPUBuffer} with cached CPU-side state and convenience
66
+ * copy helpers.
67
+ */
68
+ export declare class BufferCreator {
69
+ #private;
70
+ constructor(device: GPUDevice, options?: BUFFER_CONSTRUCTION_OPTIONS);
71
+ /**
72
+ * Returns the raw GPUBuffer of the Buffer.
73
+ *
74
+ * Changing this may cause issues
75
+ */
76
+ raw(): GPUBuffer;
77
+ /**
78
+ * Creates a new buffer wrapper with duplicated CPU-side contents and usage.
79
+ */
80
+ clone(): BufferCreator;
81
+ /**
82
+ * Getter / Setter for destroying the buffer
83
+ *
84
+ * ● If no value is passed, it returns if the buffer is destroyed
85
+ *
86
+ * ● If the buffer is destroyed and destroy parameter is true, then it returns true
87
+ *
88
+ * ● If the buffer is not destroyed but destroy parameter is true, then it returns true and destroys the buffer
89
+ *
90
+ * ● If the buffer is not destroyed and destroy parameter is false, then it returns false
91
+ *
92
+ * ● If the buffer is destroyed and destroy parameter is true, then it recreates the buffer and returns true
93
+ */
94
+ destroy(): boolean;
95
+ destroy<T extends boolean>(destroy: T): T;
96
+ /**
97
+ * Getter/Setter for Value.
98
+ *
99
+ * ● Marks the buffer as "**dirty**" if changed.
100
+ *
101
+ * ● If no value is passed, the function returns a promise that resolves to the current value of the buffer.
102
+ *
103
+ * ● If a value is passed, the function returns the same value passed.
104
+ *
105
+ * ● Throws AGPU_1 if the buffer was destroyed
106
+ */
107
+ value(): UNSURE<GPUAllowSharedBufferSource>;
108
+ value<T extends GPUAllowSharedBufferSource>(val: T): T;
109
+ /**
110
+ * Getter/Setter for label.
111
+ *
112
+ * ● If no value is passed, the function returns the current label of the buffer.
113
+ *
114
+ * ● If a value is passed, the function returns the same label passed.
115
+ *
116
+ * ● Throws AGPU_1 if the buffer was destroyed
117
+ */
118
+ label(): string;
119
+ label<T extends string>(label: T): T;
120
+ /**
121
+ * Synchronizes local state with GPU hardware.
122
+ *
123
+ * ● Only runs if #dirty is true. That means if any changes were made.
124
+ *
125
+ * ● Throws AGPU_1 if the buffer was destroyed
126
+ */
127
+ sync(): void;
128
+ /**
129
+ * Reads the buffer.
130
+ *
131
+ * #### Different from .value(newValue). How?
132
+ * This is different from .value as it reads the value from the GPU instead of relying on what's stored in this class
133
+ *
134
+ * ● This does not update the stored value though! You will have to manually change that.
135
+ */
136
+ read(): Promise<ArrayBuffer>;
137
+ /**
138
+ * Returns a capability summary inferred from the current buffer usage flags.
139
+ */
140
+ get can(): {
141
+ copy: {
142
+ read: boolean;
143
+ write: boolean;
144
+ };
145
+ map: {
146
+ read: boolean;
147
+ write: boolean;
148
+ };
149
+ beBoundAs: {
150
+ index: boolean;
151
+ vertex: boolean;
152
+ uniform: boolean;
153
+ storage: boolean;
154
+ indirect: boolean;
155
+ };
156
+ query: boolean;
157
+ };
158
+ /**
159
+ * Copies this buffer's data to another BufferCreator or GPUBuffer.
160
+ */
161
+ copyToBuffer(destination: BufferCreator | GPUBuffer, size?: number): void;
162
+ copyToTexture(destination: TEXTURE_COPY_DESTINATION | GPUTexture, options?: BUFFER_TO_TEXTURE_OPTIONS): void;
163
+ /**
164
+ * Resolves a QuerySet into this buffer.
165
+ * Requires the buffer to have the 'queryResolve' usage flag.
166
+ */
167
+ query(querySet: GPUQuerySet, firstQuery?: number, queryCount?: number, destinationOffset?: number): void;
168
+ [Symbol.hasInstance](instance: BufferCreator): instance is BufferCreator;
169
+ readonly __brand = "BufferCreator";
170
+ }
171
+ export declare namespace BufferCreator {
172
+ namespace bufferUsage {
173
+ /**
174
+ * Shape returned by `bufferUsage()` in getter mode.
175
+ */
176
+ interface RETURNS extends BUFFER_USAGE_OPTIONS {
177
+ number: number;
178
+ }
179
+ }
180
+ }
181
+ export default BufferCreator;
@@ -0,0 +1 @@
1
+ "use strict";function e(e,r,t,i){if(0>=r.byteLength)throw exports.invalidBufferSize;let s={size:r.byteLength,usage:t,label:i};return i&&(s.label=i),e.createBuffer(s)}function r(e){return"function"==typeof e.raw}function t(e){if(e instanceof ArrayBuffer)return e.slice(0);if(ArrayBuffer.isView(e)){const r=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),t=e.constructor;return e instanceof DataView?new DataView(r):new t(r,0,e.byteLength/(t.BYTES_PER_ELEMENT??1))}return e.slice(0)}var i=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.BufferCreator=exports.invalidBufferCopySize=exports.invalidBufferSize=exports.otherTextureCannotBeWrittenTo=exports.otherCannotBeWrittenTo=exports.cannotBeWrittenTo=exports.couldNotAssignValue=exports.initCouldNotAssignValue=exports.initCannotRead=exports.cannotBeRead=exports.bufferDestroyedError=void 0;const s=i(require("../../../helpers/defaults")),o=i(require("../../../helpers/errors")),u=require("./buffers/bufferUsageOptions"),f=require("./texture/textureUsageOptions"),n=require("./buffers/bufferUsageOptions"),a=i(require("../../../helpers/align"));require("@webgpu/types"),exports.bufferDestroyedError=(0,o.default)(1,"The buffer is already destroyed!"),exports.cannotBeRead=(0,o.default)(3,"Buffer cannot be read"),exports.initCannotRead=(0,o.default)(4,"Buffer could not be initialized since the given buffer cannot be read"),exports.initCouldNotAssignValue=(0,o.default)(5,"Buffer could not be initialized since the flag 'usage.copy.write' is false or undefined"),exports.couldNotAssignValue=(0,o.default)(6,"Buffer.value didnt work as the flag 'usage.copy.write' is set to false."),exports.cannotBeWrittenTo=(0,o.default)(7,"Buffer could not be copied because the flag 'usage.copy.write' is disabled in it"),exports.otherCannotBeWrittenTo=(0,o.default)(8,"Buffer could not be copied since the other buffer doesnt allow so."),exports.otherTextureCannotBeWrittenTo=(0,o.default)(10,"Buffer could not be copied since the other texture doesnt allow writing to it"),exports.invalidBufferSize=(0,o.default)(36,"Buffer size must be greater than zero.","Provide a non-empty typed array or other GPUAllowSharedBufferSource when creating the buffer."),exports.invalidBufferCopySize=(0,o.default)(37,"Buffer copy size must be greater than zero and fit in both source and destination buffers.","Pass a positive copy size that does not exceed either buffer's size.");const d={r8unorm:1,r8snorm:1,r8uint:1,r8sint:1,r16uint:2,r16sint:2,r16float:2,rg8unorm:2,rgba8unorm:4,"rgba8unorm-srgb":4,bgra8unorm:4,rg16float:4,r32float:4,rgba16float:8,rg32float:8,rgba32float:16};class h{#e;#r;#t;#i=!1;#s=!1;constructor(r,t){if(t?.value&&!(t?.usage).copy)throw exports.initCouldNotAssignValue;if(this.#r=r,this.#t=t?.value??new Float32Array(16),this.#e=e(r,this.#t,"object"==typeof t?.usage?(0,n.getBufferUsage)(t?.usage):"number"==typeof t?.usage?t?.usage:s.default.bufferUsage,t?.label),this.#r.queue.writeBuffer(this.#e,0,this.#t),!this.#o())throw(0,o.default)(18,"Buffer flag validation error")}#o(){const e=this.can,r=this.#t,t=r.byteLength;if(e.beBoundAs.index&&!(r instanceof Uint32Array||r instanceof Uint16Array))return!1;if(e.beBoundAs.indirect&&!(r instanceof Uint32Array))return!1;if(e.beBoundAs.vertex&&t%4!=0)return!1;if(e.beBoundAs.uniform){if(t%16!=0)return!1;if(t>65536)return!1}return!e.beBoundAs.storage||t%4==0}raw(){return this.#e}clone(){if(this.#s)throw exports.bufferDestroyedError;return new h(this.#r,{value:t(this.#t),usage:this.#e.usage,label:this.#e.label})}[Symbol("Symbol.disposable")](){this.destroy(!0)}destroy(r){return void 0===r?this.#s:!(!this.#s||!r)||(!this.#s&&r?(this.#s=!0,this.#e.destroy(),!0):!(!this.#s&&!r)&&(this.#s&&!r?(this.#e=e(this.#r,this.#t,this.#e.usage,this.#e.label),this.#r.queue.writeBuffer(this.#e,0,this.#t),this.#s=!1,!1):this.#s))}value(e){if(this.#s)throw exports.bufferDestroyedError;return void 0===e?this.#t:(e!==this.#t&&(this.#t=e,this.#i=!0),e)}label(e){if(this.#s)throw exports.bufferDestroyedError;return void 0===e?this.#e.label??this.#e.label:(e!==this.#e.label&&(this.#e.label=e),e)}sync(){if(this.#s)throw exports.bufferDestroyedError;if(!this.#i)return;const r=this.#e.size;if(this.#t.byteLength>r&&(this.#e.destroy(),this.#e=e(this.#r,this.#t,this.#e.usage,this.#e.label)),!this.can.copy.write)throw exports.couldNotAssignValue;this.#r.queue.writeBuffer(this.#e,0,this.#t),this.#i=!1}async read(){if(!this.can.map.read)throw exports.cannotBeRead;const e=this.#r.createBuffer({size:this.#e.size,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),r=this.#r.createCommandEncoder();r.copyBufferToBuffer(this.#e,0,e,0,this.#e.size),this.#r.queue.submit([r.finish()]),await e.mapAsync(GPUMapMode.READ);const t=e.getMappedRange().slice();return e.unmap(),e.destroy(),t}get can(){const e=this.#e.usage;return{copy:{read:!!(e&GPUBufferUsage.COPY_SRC),write:!!(e&GPUBufferUsage.COPY_DST)},map:{read:!!(e&GPUBufferUsage.MAP_READ),write:!!(e&GPUBufferUsage.MAP_WRITE)},beBoundAs:{index:!!(e&GPUBufferUsage.INDEX),vertex:!!(e&GPUBufferUsage.VERTEX),uniform:!!(e&GPUBufferUsage.UNIFORM),storage:!!(e&GPUBufferUsage.STORAGE),indirect:!!(e&GPUBufferUsage.INDIRECT)},query:!!(e&GPUBufferUsage.QUERY_RESOLVE)}}copyToBuffer(e,r){if(!this.can.copy.read)throw exports.cannotBeRead;if(e instanceof h){if(!e.can.copy.write)throw exports.otherCannotBeWrittenTo}else{const r=(0,u.getOptionsFromUsage)(e.usage);if(!r.copy?.write)throw exports.otherCannotBeWrittenTo}const t=e instanceof h?e.raw():e,i=r??this.#e.size;if(0>=i||i>this.#e.size||i>t.size)throw exports.invalidBufferCopySize;const s=this.#r.createCommandEncoder();s.copyBufferToBuffer(this.#e,0,t,0,i),this.#r.queue.submit([s.finish()])}copyToTexture(e,t={}){if(!this.can.copy.read)throw exports.cannotBeRead;if(r(e)){if(!e.can.copy.write)throw exports.otherTextureCannotBeWrittenTo}else{const r=(0,f.getOptionsFromTextureUsage)(e.usage);if(!1===r.copy||!0!==r.copy&&!r.copy?.write)throw exports.otherTextureCannotBeWrittenTo}const i=r(e)?e.raw():e,s=t.size?(e=>{if("number"==typeof e)return{width:e,height:1,depthOrArrayLayers:1};if(Symbol.iterator in Object(e)){const r=Array.from(e);return{width:r[0]??1,height:r[1]??1,depthOrArrayLayers:r[2]??1}}return{width:e.width,height:e.height??1,depthOrArrayLayers:e.depthOrArrayLayers??1}})(t.size):{width:i.width,height:i.height,depthOrArrayLayers:i.depthOrArrayLayers},o=t.bytesPerRow??(0,a.default)(s.width*(d[i.format]??4),256),u=t.rowsPerImage??s.height,n=this.#r.createCommandEncoder();n.copyBufferToTexture({buffer:this.#e,offset:t.offset,bytesPerRow:o,rowsPerImage:u},{texture:i,origin:t.origin,mipLevel:t.mipLevel,aspect:t.aspect},s),this.#r.queue.submit([n.finish()])}query(e,r=0,t=1,i=0){if(!this.can.query)throw(0,o.default)(9,"The given buffer does not support GPUBufferUsage.QUERY_RESOLVE");const s=this.#r.createCommandEncoder();s.resolveQuerySet(e,r,t,this.#e,i),this.#r.queue.submit([s.finish()])}[Symbol.hasInstance](e){return"BufferCreator"===this.__brand}__brand="BufferCreator"}exports.BufferCreator=h,exports.default=h;
@@ -0,0 +1,12 @@
1
+ import { BRAND, LABEL, RAW } from "@agpu/helpers/decorators";
2
+ import "@webgpu/types";
3
+ export interface CommandBufferCreator extends BRAND<"CommandBufferCreator">, LABEL, RAW<GPUCommandBuffer> {
4
+ }
5
+ /**
6
+ * Wrapper around {@link GPUCommandBuffer}.
7
+ */
8
+ export declare class CommandBufferCreator {
9
+ readonly commandBuffer: GPUCommandBuffer;
10
+ constructor(cmdbuf: GPUCommandBuffer);
11
+ }
12
+ export default CommandBufferCreator;
@@ -0,0 +1 @@
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,r,a,o,n)=>{function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var i,c=a.kind,l="getter"===c?"get":"setter"===c?"set":"value",u=!t&&e?a.static?e:e.prototype:null,f=t||(u?Object.getOwnPropertyDescriptor(u,a.name):{}),d=!1,p=r.length-1;p>=0;p--){var m={};for(var h in a)m[h]="access"===h?{}:a[h];for(var h in a.access)m.access[h]=a.access[h];m.addInitializer=e=>{if(d)throw new TypeError("Cannot add initializers after decoration has completed");n.push(s(e||null))};var b=(0,r[p])("accessor"===c?{get:f.get,set:f.set}:f[l],m);if("accessor"===c){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(i=s(b.get))&&(f.get=i),(i=s(b.set))&&(f.set=i),(i=s(b.init))&&o.unshift(i)}else(i=s(b))&&("field"===c?o.unshift(i):f[l]=i)}u&&Object.defineProperty(u,a.name,f),d=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var a=arguments.length>2,o=0;t.length>o;o++)r=a?t[o].call(e,r):t[o].call(e);return a?r:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommandBufferCreator=void 0;const r=require("@agpu/helpers/decorators"),a=require("@agpu/helpers/decorators"),o=require("@agpu/helpers/decorators");require("@webgpu/types");let n=(()=>{let n,s,i=[(0,r.brand)("CommandBufferCreator"),(0,a.labeling)({get:e=>e.commandBuffer.label,set:(e,t)=>e.commandBuffer.label=t}),(0,o.raw)("commandBuffer")],c=[];return class{static{s=this}static{const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,n={value:s},i,{kind:"class",name:s.name,metadata:r},null,c),s=n.value,r&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),t(s,c)}commandBuffer;constructor(e){this.commandBuffer=e}},s})();exports.CommandBufferCreator=n,exports.default=n;
@@ -0,0 +1,63 @@
1
+ import { BRAND, LABEL, RAW } from "@agpu/helpers/decorators";
2
+ import UNSURE from "@agpu/helpers/unsure";
3
+ import "@webgpu/types";
4
+ /**
5
+ * Options used when creating a shader module from WGSL source.
6
+ */
7
+ export interface SHADER_MODULE_OPTIONS extends GPUObjectDescriptorBase {
8
+ /**Hints for the compiler.*/
9
+ hints?: Iterable<GPUShaderModuleCompilationHint>;
10
+ /**The entry point of the shader module.*/
11
+ entryPoint?: string;
12
+ constants?: Record<string, number>;
13
+ }
14
+ /**
15
+ * Wrapper around {@link GPUShaderModule}.
16
+ */
17
+ export interface ShaderModuleCreator extends RAW<GPUShaderModule>, BRAND<"ShaderModuleCreator">, LABEL {
18
+ }
19
+ export declare class ShaderModuleCreator {
20
+ #private;
21
+ readonly module: GPUShaderModule;
22
+ constructor(device: GPUDevice, codeOrModule: string | GPUShaderModule, options?: SHADER_MODULE_OPTIONS);
23
+ /**
24
+ * Recreates the shader module from its original WGSL source when available.
25
+ */
26
+ clone(): ShaderModuleCreator;
27
+ /**
28
+ * Returns the cached entry point configured on this wrapper, if any.
29
+ *
30
+ * This will be undefined if either:
31
+ *
32
+ * - It was not provided in the options
33
+ *
34
+ * - A GPUShaderModule was passed instead of a options object.
35
+ */
36
+ entryPoint(): UNSURE<string>;
37
+ /**
38
+ * Returns the cached shader constants configured on this wrapper, if any.
39
+ * This will be undefined if either:
40
+ *
41
+ * - It was not provided in the options
42
+ *
43
+ * - A GPUShaderModule was passed instead of a options object.
44
+ */
45
+ constants(): UNSURE<Record<string, number>>;
46
+ /**
47
+ * Returns the raw code of the shader module.
48
+ *
49
+ * This will be undefined if a GPUShaderModule was passed instead of a options object.
50
+ */
51
+ code(): string | undefined;
52
+ /**
53
+ * Requests compilation info for the shader module.
54
+ */
55
+ compilationInfo(): Promise<GPUCompilationInfo>;
56
+ /**
57
+ * Returns what bindGroups are used in the source code of the shader
58
+ *
59
+ * Always Set<undefined> if a GPUShaderModule was passed instead of a options object.
60
+ */
61
+ bindGroups(): Set<number>;
62
+ }
63
+ export default ShaderModuleCreator;
@@ -0,0 +1 @@
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,i,r,o,s)=>{function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,c=r.kind,l="getter"===c?"get":"setter"===c?"set":"value",h=!t&&e?r.static?e:e.prototype:null,d=t||(h?Object.getOwnPropertyDescriptor(h,r.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var b in r)f[b]="access"===b?{}:r[b];for(var b in r.access)f.access[b]=r.access[b];f.addInitializer=e=>{if(u)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var y=(0,i[p])("accessor"===c?{get:d.get,set:d.set}:d[l],f);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(a=n(y.get))&&(d.get=a),(a=n(y.set))&&(d.set=a),(a=n(y.init))&&o.unshift(a)}else(a=n(y))&&("field"===c?o.unshift(a):d[l]=a)}h&&Object.defineProperty(h,r.name,d),u=!0}),t=this&&this.__runInitializers||function(e,t,i){for(var r=arguments.length>2,o=0;t.length>o;o++)i=r?t[o].call(e,i):t[o].call(e);return r?i:void 0},i=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShaderModuleCreator=void 0;const r=require("@agpu/helpers/decorators"),o=require("@agpu/helpers/decorators"),s=require("@agpu/helpers/decorators"),n=i(require("../../../helpers/shaderRegex"));require("@webgpu/types");let a=(()=>{let i,a,c=[(0,r.brand)("ShaderModuleCreator"),(0,s.raw)("module"),(0,o.labeling)({get:e=>e.module.label,set:(e,t)=>e.module.label=t})],l=[];var h=class{static{a=this}static{const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,i={value:a},c,{kind:"class",name:a.name,metadata:r},null,l),h=a=i.value,r&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),t(a,l)}#e;#t;#i;#r;#o;#s;module;constructor(e,t,i){if("string"==typeof t){this.#e=e,this.#t=t,this.#i=i?.entryPoint,this.#r=i?.constants,this.#o=i?.label??"",this.#s=i?.hints;let r={code:t,label:i?.label??""};i?.hints&&(r.compilationHints=i.hints),this.module=e.createShaderModule(r)}else this.module=t,this.#t=void 0,this.#i=void 0,this.#r=void 0}clone(){if(!this.#e||"string"!=typeof this.#t)throw new TypeError("Cannot clone a ShaderModuleCreator created from a raw GPUShaderModule.");return new h(this.#e,this.#t,{label:this.module.label||this.#o,hints:this.#s,entryPoint:this.#i,constants:this.#r?{...this.#r}:void 0})}entryPoint(){return this.#i}constants(){return this.#r}code(){return this.#t}async compilationInfo(){return this.#n?this.#n:this.#n=await this.module.getCompilationInfo()}#n;bindGroups(){return this.#a?this.#a:this.#a=(0,n.default)(this.#t??"")}#a};return h=a})();exports.ShaderModuleCreator=a,exports.default=a;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Structured texture usage flags used by this package.
3
+ */
4
+ interface TEXTURE_COPY_OPTIONS {
5
+ /**Whether the texture can be read while copying. */
6
+ read?: boolean;
7
+ /**Whether the texture can be read while writing. */
8
+ write?: boolean;
9
+ }
10
+ import "@webgpu/types";
11
+ interface TEXTURE_BINDING_OPTIONS {
12
+ /**Whether the texture can be bound as a storage texture */
13
+ storage?: boolean;
14
+ texture?: boolean;
15
+ }
16
+ /**
17
+ * Structured texture usage flags used by this package.
18
+ */
19
+ interface TEXTURE_USAGE_OPTIONS {
20
+ /**
21
+ * Copy operations
22
+ * - `true`: Enable both texture and buffer copy (COPY_SRC | COPY_DST)
23
+ * - `false`: Disable copy operations
24
+ * - `object`: Specify which copy types to enable
25
+ *
26
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/usage Read about GPUTextureUsage-s here}
27
+ */
28
+ copy?: TEXTURE_COPY_OPTIONS | boolean;
29
+ /**
30
+ * The texture can be used as a color or depth/stencil attachment in a render pass, for example as the view property of the descriptor object in a beginRenderPass() call.
31
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/usage Read about GPUTextureUsage-s here}
32
+ */
33
+ renderAttachment?: boolean;
34
+ /**
35
+ * Texture binding types
36
+ * Specify how this texture will be bound to shaders
37
+ */
38
+ binding?: TEXTURE_BINDING_OPTIONS;
39
+ transientAttachment?: boolean;
40
+ }
41
+ export default TEXTURE_USAGE_OPTIONS;
42
+ export declare function getOptionsFromTextureUsage(usage: number): TEXTURE_USAGE_OPTIONS;
43
+ export declare function getTextureUsage(options: TEXTURE_USAGE_OPTIONS): number;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getOptionsFromTextureUsage=e=>{const t=!!(e&GPUTextureUsage.COPY_SRC),r=!!(e&GPUTextureUsage.COPY_DST);return{copy:!(!t||!r)||{read:t,write:r},renderAttachment:!!(e&GPUTextureUsage.RENDER_ATTACHMENT),binding:{texture:!!(e&GPUTextureUsage.TEXTURE_BINDING),storage:!!(e&GPUTextureUsage.STORAGE_BINDING)},transientAttachment:!(!e||!GPUTextureUsage.TRANSIENT_ATTACHMENT)}},exports.getTextureUsage=e=>{let t=0;return!0===e.copy?t|=GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST:"object"==typeof e.copy&&(e.copy.read&&(t|=GPUTextureUsage.COPY_SRC),e.copy.write&&(t|=GPUTextureUsage.COPY_DST)),e.renderAttachment&&(t|=GPUTextureUsage.RENDER_ATTACHMENT),e.binding&&(e.binding.texture&&(t|=GPUTextureUsage.TEXTURE_BINDING),e.binding.storage&&(t|=GPUTextureUsage.STORAGE_BINDING)),e.transientAttachment&&(t|=GPUTextureUsage.TRANSIENT_ATTACHMENT),t},require("@webgpu/types");
@@ -0,0 +1,13 @@
1
+ import { BRAND, LABEL, RAW } from "@agpu/helpers/decorators";
2
+ import "@webgpu/types";
3
+ export interface TextureViewCreator extends RAW<GPUTextureView>, BRAND<"TextureViewCreator">, LABEL {
4
+ }
5
+ /**
6
+ * Thin wrapper around {@link GPUTextureView}.
7
+ */
8
+ export declare class TextureViewCreator {
9
+ /**The raw GPUTextureView of the TextureView */
10
+ readonly view: GPUTextureView;
11
+ constructor(view: GPUTextureView);
12
+ }
13
+ export default TextureViewCreator;
@@ -0,0 +1 @@
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,r,a,i,o)=>{function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var n,l=a.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?a.static?e:e.prototype:null,p=t||(u?Object.getOwnPropertyDescriptor(u,a.name):{}),d=!1,f=r.length-1;f>=0;f--){var v={};for(var h in a)v[h]="access"===h?{}:a[h];for(var h in a.access)v.access[h]=a.access[h];v.addInitializer=e=>{if(d)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(e||null))};var b=(0,r[f])("accessor"===l?{get:p.get,set:p.set}:p[c],v);if("accessor"===l){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(n=s(b.get))&&(p.get=n),(n=s(b.set))&&(p.set=n),(n=s(b.init))&&i.unshift(n)}else(n=s(b))&&("field"===l?i.unshift(n):p[c]=n)}u&&Object.defineProperty(u,a.name,p),d=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var a=arguments.length>2,i=0;t.length>i;i++)r=a?t[i].call(e,r):t[i].call(e);return a?r:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.TextureViewCreator=void 0;const r=require("@agpu/helpers/decorators"),a=require("@agpu/helpers/decorators"),i=require("@agpu/helpers/decorators");require("@webgpu/types");let o=(()=>{let o,s,n=[(0,r.brand)("TextureViewCreator"),(0,i.raw)("view"),(0,a.labeling)({get:e=>e.view.label,set:(e,t)=>e.view.label=t})],l=[];return class{static{s=this}static{const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,o={value:s},n,{kind:"class",name:s.name,metadata:r},null,l),s=o.value,r&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),t(s,l)}view;constructor(e){this.view=e}},s})();exports.TextureViewCreator=o,exports.default=o;
@@ -0,0 +1,158 @@
1
+ import DC_MEMBER from "../../../helpers/types/DCMember";
2
+ import UNSURE from "@agpu/helpers/unsure";
3
+ import BufferCreator from "./buffers";
4
+ import TEXTURE_USAGE_OPTIONS from "./texture/textureUsageOptions";
5
+ import TextureViewCreator from "./texture/textureView";
6
+ import "@webgpu/types";
7
+ /**
8
+ * Public texture construction options.
9
+ */
10
+ interface TCO_BASE {
11
+ /** Initial value for the texture creator */
12
+ value?: GPUAllowSharedBufferSource;
13
+ /**The size of the texture*/
14
+ size: GPUExtent3DStrict;
15
+ /**the miplevel count */
16
+ mipLevelCount?: number | undefined;
17
+ /**the sample count */
18
+ sampleCount?: number | undefined;
19
+ /**dimension, 1d, 2d or 3d */
20
+ dimension?: GPUTextureDimension | undefined;
21
+ /**format of the texture. */
22
+ format: GPUTextureFormat;
23
+ /**formats for the view of the texture. */
24
+ viewFormats?: Iterable<GPUTextureFormat> | undefined;
25
+ /**Texture binding view dimension*/
26
+ textureBindingViewDimension?: GPUTextureViewDimension | undefined;
27
+ }
28
+ export interface TEXTURE_CREATOR_OPTIONS extends TCO_BASE {
29
+ /**usage options for the texture */
30
+ usage?: TEXTURE_USAGE_OPTIONS | number;
31
+ }
32
+ export interface TEXTURE_TO_BUFFER_OPTIONS {
33
+ offset?: number;
34
+ bytesPerRow?: number;
35
+ rowsPerImage?: number;
36
+ origin?: GPUOrigin3D;
37
+ aspect?: GPUTextureAspect;
38
+ mipLevel?: number;
39
+ size?: GPUExtent3D;
40
+ }
41
+ export interface TEXTURE_TO_TEXTURE_OPTIONS {
42
+ sourceMipLevel?: number;
43
+ destinationMipLevel?: number;
44
+ sourceOrigin?: GPUOrigin3D;
45
+ destinationOrigin?: GPUOrigin3D;
46
+ size?: GPUExtent3D;
47
+ }
48
+ /**
49
+ * Wrapper around {@link GPUTexture} with cached usage/value helpers and
50
+ * convenience copy operations.
51
+ */
52
+ export declare class TextureCreator {
53
+ #private;
54
+ constructor(device: GPUDevice, optionsOrTexture: TEXTURE_CREATOR_OPTIONS | GPUTexture);
55
+ readonly View: {
56
+ new (): {
57
+ readonly view: GPUTextureView;
58
+ raw(): GPUTextureView;
59
+ readonly __brand: "TextureViewCreator";
60
+ [Symbol.hasInstance](instance: any): boolean;
61
+ label(): string;
62
+ label<T extends string>(val: T): T;
63
+ };
64
+ };
65
+ /**
66
+ * Getter/Setter for the texture data.
67
+ *
68
+ * ● If a value is passed, It marks the texture dirty and returns the given value again.
69
+ *
70
+ * ● If no value is passed, It returns the current texture value.
71
+ *
72
+ * ● Throws AGPU_2 if the texture was destroyed
73
+ */
74
+ value(): GPUAllowSharedBufferSource | undefined;
75
+ value<T extends GPUAllowSharedBufferSource>(data: T): T;
76
+ /**
77
+ * Returns a capability summary inferred from the current texture usage flags.
78
+ */
79
+ get can(): {
80
+ copy: {
81
+ read: boolean;
82
+ write: boolean;
83
+ };
84
+ binding: {
85
+ texture: boolean;
86
+ storage: boolean;
87
+ };
88
+ renderAttachment: boolean;
89
+ };
90
+ /**
91
+ * Sync changes made.
92
+ *
93
+ * ● Throws AGPU_2 if the texture was destroyed
94
+ */
95
+ sync(): void;
96
+ /**
97
+ * Represents the raw GPUTexture
98
+ */
99
+ raw(): GPUTexture;
100
+ /**
101
+ * Recreates this texture from its cached descriptor and optionally copies the
102
+ * cached CPU-side value if one is present.
103
+ */
104
+ clone(): TextureCreator;
105
+ /**
106
+ * Represents the raw GPUTextureView
107
+ */
108
+ view(): TextureViewCreator;
109
+ /**
110
+ * Copies this texture into a buffer destination.
111
+ */
112
+ copyToBuffer(destination: BufferCreator | DC_MEMBER<"Buffer"> | GPUBuffer, options?: TEXTURE_TO_BUFFER_OPTIONS): void;
113
+ /**
114
+ * Copies this texture into another texture destination.
115
+ */
116
+ copyToTexture(destination: TextureCreator | DC_MEMBER<"Texture"> | GPUTexture, options?: TEXTURE_TO_TEXTURE_OPTIONS): void;
117
+ /**
118
+ * Returns the aspect ratio of the width and height of the texture
119
+ */
120
+ aspect(): number;
121
+ /**
122
+ * Resizes the given texture.
123
+ *
124
+ * ● Throws AGPU_2 if the texture was already destroyed
125
+ *
126
+ * ● Recreates texture and therefore expensive
127
+ */
128
+ resize(newWidth: number, newHeight: number, newDepthOrArrayLayers?: number): void;
129
+ /**
130
+ * Getter / Setter for destruction state.
131
+ */
132
+ destroy(): boolean;
133
+ destroy<T extends boolean>(val: T): T;
134
+ /**
135
+ * Getter/Setter for label.
136
+ *
137
+ * ● If no value is passed, the function returns the current label of the texture.
138
+ *
139
+ * ● If a value is passed, the function returns the same label passed.
140
+ *
141
+ * ● Throws AGPU_2 if the texture was destroyed
142
+ */
143
+ label(): UNSURE<string>;
144
+ label<T extends string>(label: T): T;
145
+ [Symbol.hasInstance](instance: TextureCreator): instance is TextureCreator;
146
+ readonly __brand = "TextureCreator";
147
+ }
148
+ export declare namespace TextureCreator {
149
+ namespace bufferUsage {
150
+ /**
151
+ * Shape returned by `textureUsage()` in getter mode.
152
+ */
153
+ interface RETURNS extends TEXTURE_USAGE_OPTIONS {
154
+ number?: number;
155
+ }
156
+ }
157
+ }
158
+ export default TextureCreator;
@@ -0,0 +1 @@
1
+ "use strict";function e(e,t,r){if(r)return i(r);const s=t??0;return{width:Math.max(1,e.width>>s),height:Math.max(1,e.height>>s),depthOrArrayLayers:e.depthOrArrayLayers}}function t(e){return"function"==typeof e.raw}function r(e){return"function"==typeof e.raw}function i(e){if("number"==typeof e)return{width:e,height:1,depthOrArrayLayers:1};if(Symbol.iterator in Object(e)){const t=Array.from(e);return{width:t[0]??1,height:t[1]??1,depthOrArrayLayers:t[2]??1}}return{width:e.width,height:e.height??1,depthOrArrayLayers:e.depthOrArrayLayers??1}}function s(e){if(e instanceof ArrayBuffer)return e.slice(0);if(ArrayBuffer.isView(e)){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),r=e.constructor;return e instanceof DataView?new DataView(t):new r(t,0,e.byteLength/(r.BYTES_PER_ELEMENT??1))}return e.slice(0)}var o=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.TextureCreator=void 0;const u=o(require("../../../helpers/align")),a=o(require("../../../helpers/defaults")),h=o(require("../../../helpers/errors")),n=require("./texture/textureUsageOptions"),d=o(require("./texture/textureView"));require("@webgpu/types");const c={r8unorm:1,r8snorm:1,r8uint:1,r8sint:1,r16uint:2,r16sint:2,r16float:2,rg8unorm:2,rgba8unorm:4,"rgba8unorm-srgb":4,bgra8unorm:4,rg16float:4,r32float:4,rgba16float:8,rg32float:8,rgba32float:16},f=(0,h.default)(2,"Texture already destroyed!"),l=(0,h.default)(10,"Cannot write to texture since the flag 'usage.copy.write' is false or undefined"),y=(0,h.default)(11,"Texture cannot be copied because the flag 'usage.copy.read' is false or undefined"),w=(0,h.default)(12,"Texture could not be copied since the other texture doesnt allow writing to it"),p=(0,h.default)(13,"Texture could not be copied since the other buffer doesnt allow writing to it"),x=(0,h.default)(38,"Cannot recreate a raw GPUTexture because no original descriptor was stored.","Construct the texture through TextureCreator options if you need resize/resurrection support."),g=(0,h.default)(39,"Texture size must be greater than zero in every dimension.","Pass width, height, and depthOrArrayLayers values of at least 1.");class v{#e;#t;#r;#i;#s;#o=!1;#u;constructor(e,t){if(this.#e=e,"function"!=typeof t.createView){const{value:r,usage:s,...o}=t,u="number"==typeof s?s:"object"==typeof s?(0,n.getTextureUsage)(s):a.default.textureUsage;this.#u=(0,n.getOptionsFromTextureUsage)(u);const h=i(t.size);if(0>=h.width||0>=h.height||0>=h.depthOrArrayLayers)throw g;this.#i={...t,usage:u},this.#t=e.createTexture({...o,usage:u}),this.#r=new d.default(this.#t.createView()),r&&(this.value(r),this.#s=r)}else{const e=t;this.#u=(0,n.getOptionsFromTextureUsage)(e.usage),this.#t=e,this.#r=new d.default(e.createView()),this.#i=void 0,this.#s=void 0}const r=this;this.View=class extends d.default{constructor(){super(r.#t.createView())}}}View;#a=!1;value(e){if(this.#o)throw f;if(void 0===e)return this.#s;if(!this.can.copy.write)throw l;return e!==this.#s&&(this.#s=e,this.#a=!0),e}get can(){const e=this.#u,t=e.copy,r=e.binding;return{copy:{read:!1!==t&&(!0===t||!!t?.read),write:!1!==t&&(!0===t||!!t?.write)},binding:{texture:!!r?.texture,storage:!!r?.storage},renderAttachment:!!e.renderAttachment}}#h(e){const t=this.#t.format,r=this.#t.width*(c[t]??4),i=(0,u.default)(r,256);this.#e.queue.writeTexture({texture:this.#t},e,{bytesPerRow:i,rowsPerImage:this.#t.height},{width:this.#t.width,height:this.#t.height,depthOrArrayLayers:this.#t.depthOrArrayLayers})}sync(){if(this.#o)throw f;if(this.#a){if(this.#s){if(!this.can.copy.write)throw l;this.#h(this.#s)}this.#a=!1}}raw(){return this.#t}clone(){if(this.#o)throw f;if(!this.#i)throw x;const{value:e,...t}=this.#i,r=new v(this.#e,{...t,value:this.#s?s(this.#s):void 0});return this.#t.label&&r.label(this.#t.label),r}view(){return this.#r}copyToBuffer(r,i={}){if(this.#o)throw f;if(!this.can.copy.read)throw y;if(this.#a&&this.sync(),t(r)){if(!r.can.copy.write)throw p}else if(!(r.usage&GPUBufferUsage.COPY_DST))throw p;const s=e(this.#t,i.mipLevel,i.size),o=i.bytesPerRow??(0,u.default)(s.width*(a=this.#t.format,c[a]??4),256);var a;const h=i.rowsPerImage??s.height,n=t(r)?r.raw():r,d=this.#e.createCommandEncoder();d.copyTextureToBuffer({texture:this.#t,origin:i.origin,aspect:i.aspect,mipLevel:i.mipLevel},{buffer:n,offset:i.offset,bytesPerRow:o,rowsPerImage:h},s),this.#e.queue.submit([d.finish()])}copyToTexture(t,i={}){if(this.#o)throw f;if(!this.can.copy.read)throw y;if(this.#a&&this.sync(),r(t)){if(!t.can.copy.write)throw w}else{const e=(0,n.getOptionsFromTextureUsage)(t.usage);if(!1===e.copy||!0!==e.copy&&!e.copy?.write)throw w}const s=r(t)?t.raw():t,o=e(this.#t,i.sourceMipLevel,i.size),u=this.#e.createCommandEncoder();u.copyTextureToTexture({texture:this.#t,mipLevel:i.sourceMipLevel,origin:i.sourceOrigin},{texture:s,mipLevel:i.destinationMipLevel,origin:i.destinationOrigin},o),this.#e.queue.submit([u.finish()])}aspect(){if(this.#o)throw f;return this.#t.width/this.#t.height}resize(e,t,r=this.#t.depthOrArrayLayers){if(this.#o)throw f;if(!this.#i)throw x;if(0>=e||0>=t||0>=r)throw g;e===this.#t.width&&t===this.#t.height&&r===this.#t.depthOrArrayLayers||(this.#t.destroy(),this.#t=this.#e.createTexture({...this.#i,size:[e,t,r]}),this.#r=new d.default(this.#t.createView()),this.#s&&(this.#a=!0,this.sync()))}destroy(e){if(void 0===e)return this.#o;if(!0===e&&!this.#o)return this.#t.destroy(),this.#o=!0,!0;if(!1===e&&this.#o)throw(0,h.default)(22,"You can not resurrect a texture. This feature is deprecated");return this.#o=e}label(e){if(this.#o)throw f;return void 0===e?this.#i?.label:this.#t.label=e}[Symbol.hasInstance](e){return"TextureCreator"===e.__brand}__brand="TextureCreator"}exports.TextureCreator=v,exports.default=v;
@@ -5,6 +5,7 @@ import BindGroupCreator from "../../data/bindGroup";
5
5
  import BufferCreator from "../../data/buffers";
6
6
  import ComputePipelineCreator from "../computePipeline";
7
7
  import QuerySetCreator from "../querySet";
8
+ import "@webgpu/types";
8
9
  import IndirectBufferCreator, { INDIRECT_BUFFER_OPTIONS } from "./renderPass/indirectBuffer";
9
10
  export interface ComputePassCreator extends RAW<GPUComputePassEncoder>, BRAND<"ComputePassCreator">, LABEL {
10
11
  }
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,t,s,r,i,a)=>{function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,u=r.kind,p="getter"===u?"get":"setter"===u?"set":"value",c=!t&&e?r.static?e:e.prototype:null,l=t||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),d=!1,f=s.length-1;f>=0;f--){var h={};for(var b in r)h[b]="access"===b?{}:r[b];for(var b in r.access)h.access[b]=r.access[b];h.addInitializer=e=>{if(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(n(e||null))};var m=(0,s[f])("accessor"===u?{get:l.get,set:l.set}:l[p],h);if("accessor"===u){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(l.get=o),(o=n(m.set))&&(l.set=o),(o=n(m.init))&&i.unshift(o)}else(o=n(m))&&("field"===u?i.unshift(o):l[p]=o)}c&&Object.defineProperty(c,r.name,l),d=!0}),t=this&&this.__runInitializers||function(e,t,s){for(var r=arguments.length>2,i=0;t.length>i;i++)s=r?t[i].call(e,s):t[i].call(e);return r?s:void 0},s=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.ComputePassCreator=void 0;const r=require("@agpu/helpers/decorators"),i=require("@agpu/helpers/decorators"),a=require("@agpu/helpers/decorators"),n=s(require("../../../../helpers/errors")),o=s(require("../../data/buffers")),u=s(require("./renderPass/indirectBuffer"));let p=(()=>{let s,p,c=[(0,r.brand)("ComputePassCreator"),(0,i.raw)("computepass"),(0,a.labeling)({get:e=>e.computepass.label,set:(e,t)=>e.computepass.label=t})],l=[];return class{static{p=this}static{const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,s={value:p},c,{kind:"class",name:p.name,metadata:r},null,l),p=s.value,r&&Object.defineProperty(p,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),t(p,l)}computepass;constructor(e,t,s){this.computepass=t.beginComputePass(this.#e(s));class r extends u.default{static len=1;constructor(t){super(e,t)}static async from(t){const s=t instanceof o.default?t:new o.default(e,t),r=s.can,i=await s.value();return r.beBoundAs.indirect=!0,new u.default(e,{value:i??new Uint32Array(this.len),usage:{copy:r.copy,map:r.map,buffer:r.beBoundAs,queryable:r.query}})}}const i=this.computepass;this.dispatchWorkgroup=Object.assign((e,t,s)=>{i.dispatchWorkgroups(e,t,s)},{IndirectBuffer:class extends r{static len=3},indirect:(e,t)=>{i.dispatchWorkgroupsIndirect(e.raw(),t)}}),this.debug={push:e=>{this.#t++,i.pushDebugGroup(e)},pop:()=>{if(0>=this.#t)throw(0,n.default)(17,"debug.pop used before init");i.popDebugGroup(),this.#t--},insertMarker:e=>{i.insertDebugMarker(e)}}}#t=0;#e(e){if(!e)return{};let t={label:e.label};return e.timestampRewrites&&(t.timestampRewrites={querySet:e.timestampRewrites.querySet.raw(),beginningOfPassWriteIndex:e.timestampRewrites.passWriteIndex?.beginning,endOfPassWriteIndex:e.timestampRewrites.passWriteIndex?.end}),t}bindGroup(e,t,s,r){r?this.computepass.setBindGroup(e,t.raw(),s,r.start,r.len):this.computepass.setBindGroup(e,t.raw())}#s;async pipeline(e){return void 0===e?this.#s:(this.computepass.setPipeline(await e.raw()),this.#s=e)}dispatchWorkgroup;end(){this.computepass.end()}debug},p})();exports.ComputePassCreator=p,exports.default=p;
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,s,r,i,a)=>{function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,u=r.kind,p="getter"===u?"get":"setter"===u?"set":"value",c=!t&&e?r.static?e:e.prototype:null,l=t||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),d=!1,f=s.length-1;f>=0;f--){var h={};for(var b in r)h[b]="access"===b?{}:r[b];for(var b in r.access)h.access[b]=r.access[b];h.addInitializer=e=>{if(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(n(e||null))};var m=(0,s[f])("accessor"===u?{get:l.get,set:l.set}:l[p],h);if("accessor"===u){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(l.get=o),(o=n(m.set))&&(l.set=o),(o=n(m.init))&&i.unshift(o)}else(o=n(m))&&("field"===u?i.unshift(o):l[p]=o)}c&&Object.defineProperty(c,r.name,l),d=!0}),t=this&&this.__runInitializers||function(e,t,s){for(var r=arguments.length>2,i=0;t.length>i;i++)s=r?t[i].call(e,s):t[i].call(e);return r?s:void 0},s=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.ComputePassCreator=void 0;const r=require("@agpu/helpers/decorators"),i=require("@agpu/helpers/decorators"),a=require("@agpu/helpers/decorators"),n=s(require("../../../../helpers/errors")),o=s(require("../../data/buffers"));require("@webgpu/types");const u=s(require("./renderPass/indirectBuffer"));let p=(()=>{let s,p,c=[(0,r.brand)("ComputePassCreator"),(0,i.raw)("computepass"),(0,a.labeling)({get:e=>e.computepass.label,set:(e,t)=>e.computepass.label=t})],l=[];return class{static{p=this}static{const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,s={value:p},c,{kind:"class",name:p.name,metadata:r},null,l),p=s.value,r&&Object.defineProperty(p,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),t(p,l)}computepass;constructor(e,t,s){this.computepass=t.beginComputePass(this.#e(s));class r extends u.default{static len=1;constructor(t){super(e,t)}static async from(t){const s=t instanceof o.default?t:new o.default(e,t),r=s.can,i=await s.value();return r.beBoundAs.indirect=!0,new u.default(e,{value:i??new Uint32Array(this.len),usage:{copy:r.copy,map:r.map,buffer:r.beBoundAs,queryable:r.query}})}}const i=this.computepass;this.dispatchWorkgroup=Object.assign((e,t,s)=>{i.dispatchWorkgroups(e,t,s)},{IndirectBuffer:class extends r{static len=3},indirect:(e,t)=>{i.dispatchWorkgroupsIndirect(e.raw(),t)}}),this.debug={push:e=>{this.#t++,i.pushDebugGroup(e)},pop:()=>{if(0>=this.#t)throw(0,n.default)(17,"debug.pop used before init");i.popDebugGroup(),this.#t--},insertMarker:e=>{i.insertDebugMarker(e)}}}#t=0;#e(e){if(!e)return{};let t={label:e.label};return e.timestampRewrites&&(t.timestampRewrites={querySet:e.timestampRewrites.querySet.raw(),beginningOfPassWriteIndex:e.timestampRewrites.passWriteIndex?.beginning,endOfPassWriteIndex:e.timestampRewrites.passWriteIndex?.end}),t}bindGroup(e,t,s,r){r?this.computepass.setBindGroup(e,t.raw(),s,r.start,r.len):this.computepass.setBindGroup(e,t.raw())}#s;async pipeline(e){return void 0===e?this.#s:(this.computepass.setPipeline(await e.raw()),this.#s=e)}dispatchWorkgroup;end(){this.computepass.end()}debug},p})();exports.ComputePassCreator=p,exports.default=p;
@@ -4,6 +4,7 @@ import BindGroupCreator from "../../data/bindGroup";
4
4
  import BufferCreator from "../../data/buffers";
5
5
  import IndirectBufferCreator, { INDIRECT_BUFFER_OPTIONS } from "./renderPass/indirectBuffer";
6
6
  import RenderPipelineCreator from "../renderPipeline";
7
+ import "@webgpu/types";
7
8
  export interface INDIRECT_BUFFER_CONSTRUCTOR {
8
9
  new (options: INDIRECT_BUFFER_OPTIONS): IndirectBufferCreator;
9
10
  readonly len: number;
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,t,r,n,i,s)=>{function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,d=n.kind,u="getter"===d?"get":"setter"===d?"set":"value",c=!t&&e?n.static?e:e.prototype:null,l=t||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),f=!1,p=r.length-1;p>=0;p--){var h={};for(var b in n)h[b]="access"===b?{}:n[b];for(var b in n.access)h.access[b]=n.access[b];h.addInitializer=e=>{if(f)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var w=(0,r[p])("accessor"===d?{get:l.get,set:l.set}:l[u],h);if("accessor"===d){if(void 0===w)continue;if(null===w||"object"!=typeof w)throw new TypeError("Object expected");(o=a(w.get))&&(l.get=o),(o=a(w.set))&&(l.set=o),(o=a(w.init))&&i.unshift(o)}else(o=a(w))&&("field"===d?i.unshift(o):l[u]=o)}c&&Object.defineProperty(c,n.name,l),f=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var n=arguments.length>2,i=0;t.length>i;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0});const n=r(require("../../../../helpers/errors")),i=require("@agpu/helpers/decorators"),s=require("@agpu/helpers/decorators"),a=r(require("../../data/buffers")),o=r(require("./renderPass/indirectBuffer"));let d=(()=>{let r,d,u=[(0,s.raw)("encoder"),(0,i.labeling)({get:e=>e.encoder.label,set:(e,t)=>e.encoder.label=t})],c=[];return class{static{d=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,r={value:d},u,{kind:"class",name:d.name,metadata:n},null,c),d=r.value,n&&Object.defineProperty(d,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),t(d,c)}encoder;draw;buffer;debug;#e=0;#t;constructor(e,t){this.encoder=t;class r extends o.default{static len=1;constructor(t){super(e,t)}static async from(t){const r=t instanceof a.default?t:new a.default(e,t),n=r.can,i=await r.value();return n.beBoundAs.indirect=!0,new o.default(e,{value:i??new Uint32Array(this.len),usage:{copy:n.copy,map:n.map,buffer:n.beBoundAs,queryable:n.query}})}}const i=this.encoder.draw.bind(this.encoder);this.draw=Object.assign(i,{indexed:this.encoder.drawIndexed.bind(this.encoder),indexedIndirect:(e,t=0)=>{this.encoder.drawIndexedIndirect(e.raw(),t)},indirect:(e,t=0)=>{this.encoder.drawIndirect(e.raw(),t)},IndirectBuffer:class extends r{static len=4},IndexedIndirectBuffer:class extends r{static len=5}}),this.buffer={index:e=>{if(!e.can.beBoundAs.index)throw(0,n.default)(22,"A buffer that does not support the GPUBufferUsage.INDEX flag was passed into buffer.index.");this.encoder.setIndexBuffer(e.raw(),e.value()instanceof Uint32Array?"uint32":"uint16")},vertex:(e,t)=>{if(!t.can.beBoundAs.vertex)throw(0,n.default)(22,"A buffer that does not support the GPUBufferUsage.VERTEX flag was passed into buffer.vertex.");this.encoder.setVertexBuffer(e,t.raw())}},this.debug={push:e=>{this.#e++,this.encoder.pushDebugGroup(e)},pop:()=>{if(0>=this.#e)throw(0,n.default)(17,"debug.pop used before init");this.encoder.popDebugGroup(),this.#e--},insertMarker:e=>{this.encoder.insertDebugMarker(e)}}}bindGroup(e,t,r,n){n?this.encoder.setBindGroup(e,t.raw(),r,n.start,n.len):this.encoder.setBindGroup(e,t.raw())}async pipeline(e){return void 0===e?this.#t:(this.encoder.setPipeline(await e.raw()),this.#t=e)}},d})();exports.default=d;
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,r,n,i,s)=>{function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,d=n.kind,u="getter"===d?"get":"setter"===d?"set":"value",c=!t&&e?n.static?e:e.prototype:null,l=t||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),f=!1,p=r.length-1;p>=0;p--){var h={};for(var b in n)h[b]="access"===b?{}:n[b];for(var b in n.access)h.access[b]=n.access[b];h.addInitializer=e=>{if(f)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var w=(0,r[p])("accessor"===d?{get:l.get,set:l.set}:l[u],h);if("accessor"===d){if(void 0===w)continue;if(null===w||"object"!=typeof w)throw new TypeError("Object expected");(o=a(w.get))&&(l.get=o),(o=a(w.set))&&(l.set=o),(o=a(w.init))&&i.unshift(o)}else(o=a(w))&&("field"===d?i.unshift(o):l[u]=o)}c&&Object.defineProperty(c,n.name,l),f=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var n=arguments.length>2,i=0;t.length>i;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0});const n=r(require("../../../../helpers/errors")),i=require("@agpu/helpers/decorators"),s=require("@agpu/helpers/decorators"),a=r(require("../../data/buffers")),o=r(require("./renderPass/indirectBuffer"));require("@webgpu/types");let d=(()=>{let r,d,u=[(0,s.raw)("encoder"),(0,i.labeling)({get:e=>e.encoder.label,set:(e,t)=>e.encoder.label=t})],c=[];return class{static{d=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,r={value:d},u,{kind:"class",name:d.name,metadata:n},null,c),d=r.value,n&&Object.defineProperty(d,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),t(d,c)}encoder;draw;buffer;debug;#e=0;#t;constructor(e,t){this.encoder=t;class r extends o.default{static len=1;constructor(t){super(e,t)}static async from(t){const r=t instanceof a.default?t:new a.default(e,t),n=r.can,i=await r.value();return n.beBoundAs.indirect=!0,new o.default(e,{value:i??new Uint32Array(this.len),usage:{copy:n.copy,map:n.map,buffer:n.beBoundAs,queryable:n.query}})}}const i=this.encoder.draw.bind(this.encoder);this.draw=Object.assign(i,{indexed:this.encoder.drawIndexed.bind(this.encoder),indexedIndirect:(e,t=0)=>{this.encoder.drawIndexedIndirect(e.raw(),t)},indirect:(e,t=0)=>{this.encoder.drawIndirect(e.raw(),t)},IndirectBuffer:class extends r{static len=4},IndexedIndirectBuffer:class extends r{static len=5}}),this.buffer={index:e=>{if(!e.can.beBoundAs.index)throw(0,n.default)(22,"A buffer that does not support the GPUBufferUsage.INDEX flag was passed into buffer.index.");this.encoder.setIndexBuffer(e.raw(),e.value()instanceof Uint32Array?"uint32":"uint16")},vertex:(e,t)=>{if(!t.can.beBoundAs.vertex)throw(0,n.default)(22,"A buffer that does not support the GPUBufferUsage.VERTEX flag was passed into buffer.vertex.");this.encoder.setVertexBuffer(e,t.raw())}},this.debug={push:e=>{this.#e++,this.encoder.pushDebugGroup(e)},pop:()=>{if(0>=this.#e)throw(0,n.default)(17,"debug.pop used before init");this.encoder.popDebugGroup(),this.#e--},insertMarker:e=>{this.encoder.insertDebugMarker(e)}}}bindGroup(e,t,r,n){n?this.encoder.setBindGroup(e,t.raw(),r,n.start,n.len):this.encoder.setBindGroup(e,t.raw())}async pipeline(e){return void 0===e?this.#t:(this.encoder.setPipeline(await e.raw()),this.#t=e)}},d})();exports.default=d;
@@ -1,5 +1,6 @@
1
1
  import BufferCreator, { BUFFER_CONSTRUCTION_OPTIONS } from "../../../data/buffers";
2
2
  import BUFFER_USAGE_OPTIONS, { BUFFER_BINDING_OPTIONS } from "../../../data/buffers/bufferUsageOptions";
3
+ import "@webgpu/types";
3
4
  /**
4
5
  * Buffer wrapper specialized for indirect draw and dispatch argument payloads.
5
6
  */
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0});const s=e(require("../../../data/buffers")),t=require("../../../data/buffers/bufferUsageOptions");exports.default=class extends s.default{constructor(e,s){"number"==typeof s.usage&&(s.usage=(0,t.getOptionsFromUsage)(s.usage)),s.usage?.buffer&&(s.usage.buffer.indirect=!0),super(e,s)}};
1
+ "use strict";var e=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0});const s=e(require("../../../data/buffers")),t=require("../../../data/buffers/bufferUsageOptions");require("@webgpu/types"),exports.default=class extends s.default{constructor(e,s){"number"==typeof s.usage&&(s.usage=(0,t.getOptionsFromUsage)(s.usage)),s.usage?.buffer&&(s.usage.buffer.indirect=!0),super(e,s)}};
@@ -5,6 +5,7 @@ import TextureCreator from "../../data/texture";
5
5
  import TextureViewCreator from "../../data/texture/textureView";
6
6
  import RenderEncoderBase, { RENDER_ENCODER_BIND_GROUP_DYNAMIC_OFFSET_DATA } from "./renderEncoderBase";
7
7
  import RenderBundleCreator from "../renderBundleEncoder/renderBundle";
8
+ import "@webgpu/types";
8
9
  /**
9
10
  * Wrapper around {@link GPURenderPassEncoder} with cached state helpers and a
10
11
  * higher-level API consistent with the rest of the bindings package.
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,t,r,o,s,i)=>{function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,a=o.kind,d="getter"===a?"get":"setter"===a?"set":"value",l=!t&&e?o.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,o.name):{}),p=!1,h=r.length-1;h>=0;h--){var v={};for(var y in o)v[y]="access"===y?{}:o[y];for(var y in o.access)v.access[y]=o.access[y];v.addInitializer=e=>{if(p)throw new TypeError("Cannot add initializers after decoration has completed");i.push(n(e||null))};var m=(0,r[h])("accessor"===a?{get:u.get,set:u.set}:u[d],v);if("accessor"===a){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(c=n(m.get))&&(u.get=c),(c=n(m.set))&&(u.set=c),(c=n(m.init))&&s.unshift(c)}else(c=n(m))&&("field"===a?s.unshift(c):u[d]=c)}l&&Object.defineProperty(l,o.name,u),p=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var o=arguments.length>2,s=0;t.length>s;s++)r=o?t[s].call(e,r):t[s].call(e);return o?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderPassCreator=void 0;const o=r(require("../../../../helpers/errors")),s=r(require("./renderEncoderBase")),i=require("@agpu/helpers/decorators");let n=(()=>{let r,n,c=[(0,i.brand)("RenderPassCreator")],a=[],d=s.default;var l=class extends d{static{n=this}static{const o="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;e(null,r={value:n},c,{kind:"class",name:n.name,metadata:o},null,a),l=n=r.value,o&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),t(n,a)}#e;#t;#r=[0,0,0,0];#o=[0,0,void 0,void 0];#s=[0,0,void 0,void 0,0,1];OcclusionQuery;constructor(e,t,r){super(e,t.beginRenderPass(l.buildDescriptor(r)));const s=this;this.OcclusionQuery=class{#i=!1;constructor(e){if(!r.occlusionQuerySet)throw(0,o.default)(14,"Occlusion Query Set Not Provided!");void 0!==s.#e&&(s.encoder.endOcclusionQuery(),s.#t?.()),s.#e=e,s.encoder.beginOcclusionQuery(e),s.#t=()=>{this.#i=!0,this.end()}}end(){this.#i||(this.#i=!0,s.#e=void 0,s.encoder.endOcclusionQuery())}}}static buildDescriptor(e){const t={colorAttachments:[],label:e.label};if(e.attachment?.color&&(t.colorAttachments=e.attachment.color.map(e=>({view:e.texture.view.raw(),resolveTarget:e.texture.resolve?.raw(),depthSlice:e.depthSlice,loadOp:e.operations.load,storeOp:e.operations.store,clearValue:e.color??{r:0,g:0,b:0,a:1}}))),e.attachment?.depthStencil){const r=e.attachment.depthStencil,o={view:r.view.raw(),depthClearValue:r.depth.clear??1,depthLoadOp:r.depth.operations?.load??"clear",depthStoreOp:r.depth.operations?.store??"store",depthReadOnly:r.depth.readonly??!1};(void 0!==r.stencil?.clear||void 0!==r.stencil?.readonly||void 0!==r.stencil?.operations?.load||void 0!==r.stencil?.operations?.store)&&(o.stencilClearValue=r.stencil.clear??0,o.stencilLoadOp=r.stencil.operations?.load??"clear",o.stencilStoreOp=r.stencil.operations?.store??"store",o.stencilReadOnly=r.stencil.readonly??!1),t.depthStencilAttachment=o}return e.occlusionQuerySet&&(t.occlusionQuerySet=e.occlusionQuerySet.raw()),e.timestampRewrites&&(t.timestampWrites={querySet:e.timestampRewrites.querySet.raw(),beginningOfPassWriteIndex:e.timestampRewrites.passWriteIndex.beginning,endOfPassWriteIndex:e.timestampRewrites.passWriteIndex.end}),e.maxDrawCount&&(t.maxDrawCount=e.maxDrawCount),t}end(){this.encoder.end()}blendConstant(e){return void 0===e?this.#r:(this.encoder.setBlendConstant(e),this.#r=e)}scissorRect(e,t,r,s){if(void 0===e)return this.#o;if(void 0===t||void 0===r||void 0===s)throw(0,o.default)(20,"scissorRect requires (x, y, width, height) to set.");this.encoder.setScissorRect(e,t,r,s);const i=[e,t,r,s];return this.#o=i,i}viewport(e,t,r,s,i,n){if(void 0===e)return this.#s;if(void 0===t||void 0===r||void 0===s||void 0===i||void 0===n)throw(0,o.default)(21,"viewport requires 6 arguments (x, y, width, height, minDepth, maxDepth) to set.");this.encoder.setViewport(e,t,r,s,i,n);const c=[e,t,r,s,i,n];return this.#s=c,c}executeBundles(e){return this.encoder.executeBundles(e.map(e=>e.raw()))}};return l=n})();exports.RenderPassCreator=n,exports.default=n;
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,r,o,s,i)=>{function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,a=o.kind,d="getter"===a?"get":"setter"===a?"set":"value",l=!t&&e?o.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,o.name):{}),p=!1,h=r.length-1;h>=0;h--){var v={};for(var y in o)v[y]="access"===y?{}:o[y];for(var y in o.access)v.access[y]=o.access[y];v.addInitializer=e=>{if(p)throw new TypeError("Cannot add initializers after decoration has completed");i.push(n(e||null))};var m=(0,r[h])("accessor"===a?{get:u.get,set:u.set}:u[d],v);if("accessor"===a){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(c=n(m.get))&&(u.get=c),(c=n(m.set))&&(u.set=c),(c=n(m.init))&&s.unshift(c)}else(c=n(m))&&("field"===a?s.unshift(c):u[d]=c)}l&&Object.defineProperty(l,o.name,u),p=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var o=arguments.length>2,s=0;t.length>s;s++)r=o?t[s].call(e,r):t[s].call(e);return o?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderPassCreator=void 0;const o=r(require("../../../../helpers/errors")),s=r(require("./renderEncoderBase")),i=require("@agpu/helpers/decorators");require("@webgpu/types");let n=(()=>{let r,n,c=[(0,i.brand)("RenderPassCreator")],a=[],d=s.default;var l=class extends d{static{n=this}static{const o="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;e(null,r={value:n},c,{kind:"class",name:n.name,metadata:o},null,a),l=n=r.value,o&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),t(n,a)}#e;#t;#r=[0,0,0,0];#o=[0,0,void 0,void 0];#s=[0,0,void 0,void 0,0,1];OcclusionQuery;constructor(e,t,r){super(e,t.beginRenderPass(l.buildDescriptor(r)));const s=this;this.OcclusionQuery=class{#i=!1;constructor(e){if(!r.occlusionQuerySet)throw(0,o.default)(14,"Occlusion Query Set Not Provided!");void 0!==s.#e&&(s.encoder.endOcclusionQuery(),s.#t?.()),s.#e=e,s.encoder.beginOcclusionQuery(e),s.#t=()=>{this.#i=!0,this.end()}}end(){this.#i||(this.#i=!0,s.#e=void 0,s.encoder.endOcclusionQuery())}}}static buildDescriptor(e){const t={colorAttachments:[],label:e.label};if(e.attachment?.color&&(t.colorAttachments=e.attachment.color.map(e=>({view:e.texture.view.raw(),resolveTarget:e.texture.resolve?.raw(),depthSlice:e.depthSlice,loadOp:e.operations.load,storeOp:e.operations.store,clearValue:e.color??{r:0,g:0,b:0,a:1}}))),e.attachment?.depthStencil){const r=e.attachment.depthStencil,o={view:r.view.raw(),depthClearValue:r.depth.clear??1,depthLoadOp:r.depth.operations?.load??"clear",depthStoreOp:r.depth.operations?.store??"store",depthReadOnly:r.depth.readonly??!1};(void 0!==r.stencil?.clear||void 0!==r.stencil?.readonly||void 0!==r.stencil?.operations?.load||void 0!==r.stencil?.operations?.store)&&(o.stencilClearValue=r.stencil.clear??0,o.stencilLoadOp=r.stencil.operations?.load??"clear",o.stencilStoreOp=r.stencil.operations?.store??"store",o.stencilReadOnly=r.stencil.readonly??!1),t.depthStencilAttachment=o}return e.occlusionQuerySet&&(t.occlusionQuerySet=e.occlusionQuerySet.raw()),e.timestampRewrites&&(t.timestampWrites={querySet:e.timestampRewrites.querySet.raw(),beginningOfPassWriteIndex:e.timestampRewrites.passWriteIndex.beginning,endOfPassWriteIndex:e.timestampRewrites.passWriteIndex.end}),e.maxDrawCount&&(t.maxDrawCount=e.maxDrawCount),t}end(){this.encoder.end()}blendConstant(e){return void 0===e?this.#r:(this.encoder.setBlendConstant(e),this.#r=e)}scissorRect(e,t,r,s){if(void 0===e)return this.#o;if(void 0===t||void 0===r||void 0===s)throw(0,o.default)(20,"scissorRect requires (x, y, width, height) to set.");this.encoder.setScissorRect(e,t,r,s);const i=[e,t,r,s];return this.#o=i,i}viewport(e,t,r,s,i,n){if(void 0===e)return this.#s;if(void 0===t||void 0===r||void 0===s||void 0===i||void 0===n)throw(0,o.default)(21,"viewport requires 6 arguments (x, y, width, height, minDepth, maxDepth) to set.");this.encoder.setViewport(e,t,r,s,i,n);const c=[e,t,r,s,i,n];return this.#s=c,c}executeBundles(e){return this.encoder.executeBundles(e.map(e=>e.raw()))}};return l=n})();exports.RenderPassCreator=n,exports.default=n;
@@ -3,6 +3,7 @@ import { BRAND, LABEL } from "@agpu/helpers/decorators";
3
3
  import UNSURE from "@agpu/helpers/unsure";
4
4
  import BufferCreator from "../data/buffers";
5
5
  import CommandBufferCreator from "../data/commandbuffer";
6
+ import "@webgpu/types";
6
7
  import ComputePassCreator, { COMPUTE_PASS_OPTIONS } from "./commandEncoder/computepass";
7
8
  import RenderPassCreator from "./commandEncoder/renderPass";
8
9
  import TextureCreator from "../data/texture";
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,r,t,o,s,i)=>{function c(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,n=o.kind,u="getter"===n?"get":"setter"===n?"set":"value",d=!r&&e?o.static?e:e.prototype:null,l=r||(d?Object.getOwnPropertyDescriptor(d,o.name):{}),f=!1,p=t.length-1;p>=0;p--){var m={};for(var h in o)m[h]="access"===h?{}:o[h];for(var h in o.access)m.access[h]=o.access[h];m.addInitializer=e=>{if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(c(e||null))};var b=(0,t[p])("accessor"===n?{get:l.get,set:l.set}:l[u],m);if("accessor"===n){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(a=c(b.get))&&(l.get=a),(a=c(b.set))&&(l.set=a),(a=c(b.init))&&s.unshift(a)}else(a=c(b))&&("field"===n?s.unshift(a):l[u]=a)}d&&Object.defineProperty(d,o.name,l),f=!0}),r=this&&this.__runInitializers||function(e,r,t){for(var o=arguments.length>2,s=0;r.length>s;s++)t=o?r[s].call(e,t):r[s].call(e);return o?t:void 0},t=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommandEncoderCreator=void 0;const o=t(require("../../../helpers/errors")),s=require("@agpu/helpers/decorators"),i=require("@agpu/helpers/decorators"),c=t(require("../data/commandbuffer")),a=t(require("./commandEncoder/computepass")),n=t(require("./commandEncoder/renderPass"));let u=(()=>{let t,u,d=[(0,s.brand)("CommandEncoderCreator"),(0,i.labeling)({get:e=>e.cmdencoder.label,set:(e,r)=>e.cmdencoder.label=r})],l=[];return class{static{u=this}static{const o="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,t={value:u},d,{kind:"class",name:u.name,metadata:o},null,l),u=t.value,o&&Object.defineProperty(u,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),r(u,l)}cmdencoder;RenderPass;ComputePass;debug;copy;#e=0;constructor(e,r){this.cmdencoder=r instanceof GPUCommandEncoder?r:e.createCommandEncoder({label:r}),this.cmdencoder=this.cmdencoder;const t=this;this.RenderPass=class extends n.default{constructor(r){super(e,t.cmdencoder,r)}static buildDescriptor(e){return n.default.buildDescriptor(e)}},this.ComputePass=class extends a.default{constructor(r){super(e,t.cmdencoder,r)}},this.debug={push:e=>{this.#e++,this.cmdencoder.pushDebugGroup(e)},pop:()=>{if(0>=this.#e)throw(0,o.default)(17,"debug.pop used before init");this.cmdencoder.popDebugGroup(),this.#e--},insertMarker:e=>{this.cmdencoder.insertDebugMarker(e)}},this.copy={textureToTexture:(e,r,t)=>this.cmdencoder.copyTextureToTexture({texture:e.texture.raw(),mipLevel:e.mipLevel,aspect:e.aspect,origin:e.origin},{texture:r.texture.raw(),mipLevel:r.mipLevel,aspect:r.aspect,origin:r.origin},t),textureToBuffer:(e,r,t)=>this.cmdencoder.copyTextureToBuffer({texture:e.texture.raw(),mipLevel:e.mipLevel,aspect:e.aspect,origin:e.origin},{buffer:r.buffer.raw(),bytesPerRow:r.bytesPerRow,offset:r.offset,rowsPerImage:r.rowsPerImage},t),bufferToTexture:(e,r,t)=>this.cmdencoder.copyBufferToTexture({buffer:e.buffer.raw(),bytesPerRow:e.bytesPerRow,offset:e.offset,rowsPerImage:e.rowsPerImage},{texture:r.texture.raw(),mipLevel:r.mipLevel,aspect:r.aspect,origin:r.origin},t),bufferToBuffer:(e,r,t)=>this.cmdencoder.copyBufferToBuffer(e.raw(),r.raw(),t)}}finish(e){return new c.default(this.cmdencoder.finish(e))}},u})();exports.CommandEncoderCreator=u,exports.default=u;
1
+ "use strict";var e=this&&this.__esDecorate||((e,r,t,o,s,i)=>{function c(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,n=o.kind,u="getter"===n?"get":"setter"===n?"set":"value",d=!r&&e?o.static?e:e.prototype:null,l=r||(d?Object.getOwnPropertyDescriptor(d,o.name):{}),p=!1,f=t.length-1;f>=0;f--){var m={};for(var h in o)m[h]="access"===h?{}:o[h];for(var h in o.access)m.access[h]=o.access[h];m.addInitializer=e=>{if(p)throw new TypeError("Cannot add initializers after decoration has completed");i.push(c(e||null))};var b=(0,t[f])("accessor"===n?{get:l.get,set:l.set}:l[u],m);if("accessor"===n){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(a=c(b.get))&&(l.get=a),(a=c(b.set))&&(l.set=a),(a=c(b.init))&&s.unshift(a)}else(a=c(b))&&("field"===n?s.unshift(a):l[u]=a)}d&&Object.defineProperty(d,o.name,l),p=!0}),r=this&&this.__runInitializers||function(e,r,t){for(var o=arguments.length>2,s=0;r.length>s;s++)t=o?r[s].call(e,t):r[s].call(e);return o?t:void 0},t=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommandEncoderCreator=void 0;const o=t(require("../../../helpers/errors")),s=require("@agpu/helpers/decorators"),i=require("@agpu/helpers/decorators"),c=t(require("../data/commandbuffer"));require("@webgpu/types");const a=t(require("./commandEncoder/computepass")),n=t(require("./commandEncoder/renderPass"));let u=(()=>{let t,u,d=[(0,s.brand)("CommandEncoderCreator"),(0,i.labeling)({get:e=>e.cmdencoder.label,set:(e,r)=>e.cmdencoder.label=r})],l=[];return class{static{u=this}static{const o="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,t={value:u},d,{kind:"class",name:u.name,metadata:o},null,l),u=t.value,o&&Object.defineProperty(u,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),r(u,l)}cmdencoder;RenderPass;ComputePass;debug;copy;#e=0;constructor(e,r){this.cmdencoder=r instanceof GPUCommandEncoder?r:e.createCommandEncoder({label:r}),this.cmdencoder=this.cmdencoder;const t=this;this.RenderPass=class extends n.default{constructor(r){super(e,t.cmdencoder,r)}static buildDescriptor(e){return n.default.buildDescriptor(e)}},this.ComputePass=class extends a.default{constructor(r){super(e,t.cmdencoder,r)}},this.debug={push:e=>{this.#e++,this.cmdencoder.pushDebugGroup(e)},pop:()=>{if(0>=this.#e)throw(0,o.default)(17,"debug.pop used before init");this.cmdencoder.popDebugGroup(),this.#e--},insertMarker:e=>{this.cmdencoder.insertDebugMarker(e)}},this.copy={textureToTexture:(e,r,t)=>this.cmdencoder.copyTextureToTexture({texture:e.texture.raw(),mipLevel:e.mipLevel,aspect:e.aspect,origin:e.origin},{texture:r.texture.raw(),mipLevel:r.mipLevel,aspect:r.aspect,origin:r.origin},t),textureToBuffer:(e,r,t)=>this.cmdencoder.copyTextureToBuffer({texture:e.texture.raw(),mipLevel:e.mipLevel,aspect:e.aspect,origin:e.origin},{buffer:r.buffer.raw(),bytesPerRow:r.bytesPerRow,offset:r.offset,rowsPerImage:r.rowsPerImage},t),bufferToTexture:(e,r,t)=>this.cmdencoder.copyBufferToTexture({buffer:e.buffer.raw(),bytesPerRow:e.bytesPerRow,offset:e.offset,rowsPerImage:e.rowsPerImage},{texture:r.texture.raw(),mipLevel:r.mipLevel,aspect:r.aspect,origin:r.origin},t),bufferToBuffer:(e,r,t)=>this.cmdencoder.copyBufferToBuffer(e.raw(),r.raw(),t)}}finish(e){return new c.default(this.cmdencoder.finish(e))}},u})();exports.CommandEncoderCreator=u,exports.default=u;
@@ -2,6 +2,7 @@ import { BRAND, RAW } from "@agpu/helpers/decorators";
2
2
  import DC_MEMBER from "../../../helpers/types/DCMember";
3
3
  import PipelineLayoutCreator from "./pipelineLayout";
4
4
  import ShaderModuleCreator from "../data/shaderModule";
5
+ import "@webgpu/types";
5
6
  export interface ComputePipelineCreator extends RAW<Promise<GPUComputePipeline>>, BRAND<"ComputePipelineCreator"> {
6
7
  label(): Promise<string>;
7
8
  label<T extends string>(label: T): Promise<T>;
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,t,i,r,o,n)=>{function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",p=!t&&e?r.static?e:e.prototype:null,u=t||(p?Object.getOwnPropertyDescriptor(p,r.name):{}),d=!1,h=i.length-1;h>=0;h--){var m={};for(var f in r)m[f]="access"===f?{}:r[f];for(var f in r.access)m.access[f]=r.access[f];m.addInitializer=e=>{if(d)throw new TypeError("Cannot add initializers after decoration has completed");n.push(a(e||null))};var y=(0,i[h])("accessor"===l?{get:u.get,set:u.set}:u[c],m);if("accessor"===l){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=a(y.get))&&(u.get=s),(s=a(y.set))&&(u.set=s),(s=a(y.init))&&o.unshift(s)}else(s=a(y))&&("field"===l?o.unshift(s):u[c]=s)}p&&Object.defineProperty(p,r.name,u),d=!0}),t=this&&this.__runInitializers||function(e,t,i){for(var r=arguments.length>2,o=0;t.length>o;o++)i=r?t[o].call(e,i):t[o].call(e);return r?i:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ComputePipelineCreator=void 0;const i=require("@agpu/helpers/decorators"),r=require("@agpu/helpers/decorators"),o=require("@agpu/helpers/decorators");let n=(()=>{let n,a,s=[(0,i.brand)("ComputePipelineCreator"),(0,o.raw)("computePipeline"),(0,r.labeling)({get:async e=>(await e.computePipeline).label,set:async(e,t)=>(await e.computePipeline).label=t})],l=[];var c=class{static{a=this}static{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,n={value:a},s,{kind:"class",name:a.name,metadata:i},null,l),c=a=n.value,i&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),t(a,l)}#e;#t;#i=[];#r=!1;computePipeline;constructor(e,t){const i=t;i.module&&(this.#e=e,this.#t={...i}),this.computePipeline=i.module?i.async?e.createComputePipelineAsync(this.#o(i)).then(e=>(this.#i.forEach(e=>e(!0)),this.#r=!0,e)):new Promise(()=>(this.#i.forEach(e=>e(!0)),this.#r=!0,e.createComputePipeline(this.#o(i)))):new Promise(()=>(this.#i.forEach(e=>e(!0)),this.#r=!0,t))}#o(e){return{layout:e.layout.raw(),compute:{module:e.module.raw(),constants:e.module.constants(),entryPoint:e.module.entryPoint()},label:e.label}}init(){return this.#r?new Promise(()=>!0):new Promise(e=>{this.#i.push(t=>{e(t)})})}clone(){if(!this.#e||!this.#t)throw new TypeError("Cannot clone a ComputePipelineCreator created from a raw GPUComputePipeline.");return new c(this.#e,{...this.#t})}};return c=a})();exports.ComputePipelineCreator=n,exports.default=n;
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,i,r,o,n)=>{function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",p=!t&&e?r.static?e:e.prototype:null,u=t||(p?Object.getOwnPropertyDescriptor(p,r.name):{}),d=!1,h=i.length-1;h>=0;h--){var m={};for(var f in r)m[f]="access"===f?{}:r[f];for(var f in r.access)m.access[f]=r.access[f];m.addInitializer=e=>{if(d)throw new TypeError("Cannot add initializers after decoration has completed");n.push(a(e||null))};var y=(0,i[h])("accessor"===l?{get:u.get,set:u.set}:u[c],m);if("accessor"===l){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=a(y.get))&&(u.get=s),(s=a(y.set))&&(u.set=s),(s=a(y.init))&&o.unshift(s)}else(s=a(y))&&("field"===l?o.unshift(s):u[c]=s)}p&&Object.defineProperty(p,r.name,u),d=!0}),t=this&&this.__runInitializers||function(e,t,i){for(var r=arguments.length>2,o=0;t.length>o;o++)i=r?t[o].call(e,i):t[o].call(e);return r?i:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ComputePipelineCreator=void 0;const i=require("@agpu/helpers/decorators"),r=require("@agpu/helpers/decorators"),o=require("@agpu/helpers/decorators");require("@webgpu/types");let n=(()=>{let n,a,s=[(0,i.brand)("ComputePipelineCreator"),(0,o.raw)("computePipeline"),(0,r.labeling)({get:async e=>(await e.computePipeline).label,set:async(e,t)=>(await e.computePipeline).label=t})],l=[];var c=class{static{a=this}static{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,n={value:a},s,{kind:"class",name:a.name,metadata:i},null,l),c=a=n.value,i&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),t(a,l)}#e;#t;#i=[];#r=!1;computePipeline;constructor(e,t){const i=t;i.module&&(this.#e=e,this.#t={...i}),this.computePipeline=i.module?i.async?e.createComputePipelineAsync(this.#o(i)).then(e=>(this.#i.forEach(e=>e(!0)),this.#r=!0,e)):new Promise(()=>(this.#i.forEach(e=>e(!0)),this.#r=!0,e.createComputePipeline(this.#o(i)))):new Promise(()=>(this.#i.forEach(e=>e(!0)),this.#r=!0,t))}#o(e){return{layout:e.layout.raw(),compute:{module:e.module.raw(),constants:e.module.constants(),entryPoint:e.module.entryPoint()},label:e.label}}init(){return this.#r?new Promise(()=>!0):new Promise(e=>{this.#i.push(t=>{e(t)})})}clone(){if(!this.#e||!this.#t)throw new TypeError("Cannot clone a ComputePipelineCreator created from a raw GPUComputePipeline.");return new c(this.#e,{...this.#t})}};return c=a})();exports.ComputePipelineCreator=n,exports.default=n;
@@ -1,6 +1,7 @@
1
1
  import DeviceControls from "../../main/device";
2
2
  import { BRAND, LABEL, RAW } from "@agpu/helpers/decorators";
3
3
  import BindGroupLayoutCreator from "../data/bindGroupLayout";
4
+ import "@webgpu/types";
4
5
  export interface PipelineLayoutCreator extends RAW<GPUPipelineLayout>, BRAND<"PipelineLayoutCreator">, LABEL {
5
6
  }
6
7
  /**
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,t,i,o,r,a)=>{function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=o.kind,p="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?o.static?e:e.prototype:null,c=t||(u?Object.getOwnPropertyDescriptor(u,o.name):{}),d=!1,y=i.length-1;y>=0;y--){var h={};for(var b in o)h[b]="access"===b?{}:o[b];for(var b in o.access)h.access[b]=o.access[b];h.addInitializer=e=>{if(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(n(e||null))};var f=(0,i[y])("accessor"===l?{get:c.get,set:c.set}:c[p],h);if("accessor"===l){if(void 0===f)continue;if(null===f||"object"!=typeof f)throw new TypeError("Object expected");(s=n(f.get))&&(c.get=s),(s=n(f.set))&&(c.set=s),(s=n(f.init))&&r.unshift(s)}else(s=n(f))&&("field"===l?r.unshift(s):c[p]=s)}u&&Object.defineProperty(u,o.name,c),d=!0}),t=this&&this.__runInitializers||function(e,t,i){for(var o=arguments.length>2,r=0;t.length>r;r++)i=o?t[r].call(e,i):t[r].call(e);return o?i:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PipelineLayoutCreator=void 0;const i=require("@agpu/helpers/decorators"),o=require("@agpu/helpers/decorators"),r=require("@agpu/helpers/decorators");let a=(()=>{let a,n,s=[(0,i.brand)("PipelineLayoutCreator"),(0,r.raw)("pipelineLayout"),(0,o.labeling)({get:e=>e.pipelineLayout.label,set:(e,t)=>e.pipelineLayout.label=t})],l=[];var p=class{static{n=this}static{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,a={value:n},s,{kind:"class",name:n.name,metadata:i},null,l),p=n=a.value,i&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),t(n,l)}#e;#t;pipelineLayout;constructor(e,t){t instanceof GPUPipelineLayout?this.#i=t:(this.#e=e,this.#t={...t,bindGroupLayouts:t.bindGroupLayouts?[...t.bindGroupLayouts]:void 0},this.#i=e.createPipelineLayout(this.#o(t))),this.pipelineLayout=this.#i}#i;#o(e){return{label:e.label,bindGroupLayouts:e.bindGroupLayouts?.map(e=>e.raw())??[]}}clone(){if(!this.#e||!this.#t)throw new TypeError("Cannot clone a PipelineLayoutCreator created from a raw GPUPipelineLayout.");return new p(this.#e,{...this.#t,label:this.pipelineLayout.label||this.#t.label,bindGroupLayouts:this.#t.bindGroupLayouts?[...this.#t.bindGroupLayouts]:void 0})}};return p=n})();exports.PipelineLayoutCreator=a,exports.default=a;
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,i,o,r,a)=>{function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=o.kind,p="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?o.static?e:e.prototype:null,c=t||(u?Object.getOwnPropertyDescriptor(u,o.name):{}),d=!1,y=i.length-1;y>=0;y--){var h={};for(var b in o)h[b]="access"===b?{}:o[b];for(var b in o.access)h.access[b]=o.access[b];h.addInitializer=e=>{if(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(n(e||null))};var f=(0,i[y])("accessor"===l?{get:c.get,set:c.set}:c[p],h);if("accessor"===l){if(void 0===f)continue;if(null===f||"object"!=typeof f)throw new TypeError("Object expected");(s=n(f.get))&&(c.get=s),(s=n(f.set))&&(c.set=s),(s=n(f.init))&&r.unshift(s)}else(s=n(f))&&("field"===l?r.unshift(s):c[p]=s)}u&&Object.defineProperty(u,o.name,c),d=!0}),t=this&&this.__runInitializers||function(e,t,i){for(var o=arguments.length>2,r=0;t.length>r;r++)i=o?t[r].call(e,i):t[r].call(e);return o?i:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PipelineLayoutCreator=void 0;const i=require("@agpu/helpers/decorators"),o=require("@agpu/helpers/decorators"),r=require("@agpu/helpers/decorators");require("@webgpu/types");let a=(()=>{let a,n,s=[(0,i.brand)("PipelineLayoutCreator"),(0,r.raw)("pipelineLayout"),(0,o.labeling)({get:e=>e.pipelineLayout.label,set:(e,t)=>e.pipelineLayout.label=t})],l=[];var p=class{static{n=this}static{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,a={value:n},s,{kind:"class",name:n.name,metadata:i},null,l),p=n=a.value,i&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),t(n,l)}#e;#t;pipelineLayout;constructor(e,t){t instanceof GPUPipelineLayout?this.#i=t:(this.#e=e,this.#t={...t,bindGroupLayouts:t.bindGroupLayouts?[...t.bindGroupLayouts]:void 0},this.#i=e.createPipelineLayout(this.#o(t))),this.pipelineLayout=this.#i}#i;#o(e){return{label:e.label,bindGroupLayouts:e.bindGroupLayouts?.map(e=>e.raw())??[]}}clone(){if(!this.#e||!this.#t)throw new TypeError("Cannot clone a PipelineLayoutCreator created from a raw GPUPipelineLayout.");return new p(this.#e,{...this.#t,label:this.pipelineLayout.label||this.#t.label,bindGroupLayouts:this.#t.bindGroupLayouts?[...this.#t.bindGroupLayouts]:void 0})}};return p=n})();exports.PipelineLayoutCreator=a,exports.default=a;
@@ -1,4 +1,5 @@
1
1
  import { BRAND, RAW } from "@agpu/helpers/decorators";
2
+ import "@webgpu/types";
2
3
  export interface QuerySetCreator extends RAW<GPUQuerySet>, BRAND<"QuerySetCreator"> {
3
4
  label(): string;
4
5
  label<T extends string>(label: T): T;
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,t,r,s,i,o)=>{function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var n,u=s.kind,l="getter"===u?"get":"setter"===u?"set":"value",d=!t&&e?s.static?e:e.prototype:null,c=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),y=!1,h=r.length-1;h>=0;h--){var f={};for(var p in s)f[p]="access"===p?{}:s[p];for(var p in s.access)f.access[p]=s.access[p];f.addInitializer=e=>{if(y)throw new TypeError("Cannot add initializers after decoration has completed");o.push(a(e||null))};var b=(0,r[h])("accessor"===u?{get:c.get,set:c.set}:c[l],f);if("accessor"===u){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(n=a(b.get))&&(c.get=n),(n=a(b.set))&&(c.set=n),(n=a(b.init))&&i.unshift(n)}else(n=a(b))&&("field"===u?i.unshift(n):c[l]=n)}d&&Object.defineProperty(d,s.name,c),y=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var s=arguments.length>2,i=0;t.length>i;i++)r=s?t[i].call(e,r):t[i].call(e);return s?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.QuerySetCreator=void 0;const s=require("@agpu/helpers/decorators"),i=require("@agpu/helpers/decorators"),o=require("@agpu/helpers/decorators"),a=r(require("../../../helpers/errors"));let n=(()=>{let r,n,u=[(0,s.brand)("QuerySetCreator"),(0,o.raw)("querySet"),(0,i.labeling)({get:e=>e.querySet.label,set:(e,t)=>e.querySet.label=t})],l=[];var d=class{static{n=this}static{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,r={value:n},u,{kind:"class",name:n.name,metadata:s},null,l),d=n=r.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),t(n,l)}#e;#t=!1;querySet;queryDescriptor;constructor(e,t){this.#e=e,t instanceof GPUQuerySet?(this.querySet=t,this.queryDescriptor={type:t.type,count:t.count,label:t.label}):(this.queryDescriptor=t,this.querySet=e.createQuerySet(t))}clone(){if(this.#t)throw(0,a.default)(52,"Cannot clone a destroyed QuerySet.","Clone the query set before destroying it.");return new d(this.#e,{...this.queryDescriptor})}destroy(e){if(void 0===e)return this.#t;if(this.#t&&e)return!0;if(!this.#t&&e)return this.#t=!0,this.querySet.destroy(),!0;if(!this.#t&&!e)return!1;if(this.#t&&!e)throw(0,a.default)(51,"Resurrecting a query set is not allowed. This feature is deprecated");return this.#t}[Symbol("Symbol.dispose")](){this.destroy(!0)}};return d=n})();exports.QuerySetCreator=n,exports.default=n;
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,r,s,i,o)=>{function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var n,u=s.kind,l="getter"===u?"get":"setter"===u?"set":"value",d=!t&&e?s.static?e:e.prototype:null,c=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),y=!1,h=r.length-1;h>=0;h--){var p={};for(var f in s)p[f]="access"===f?{}:s[f];for(var f in s.access)p.access[f]=s.access[f];p.addInitializer=e=>{if(y)throw new TypeError("Cannot add initializers after decoration has completed");o.push(a(e||null))};var b=(0,r[h])("accessor"===u?{get:c.get,set:c.set}:c[l],p);if("accessor"===u){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(n=a(b.get))&&(c.get=n),(n=a(b.set))&&(c.set=n),(n=a(b.init))&&i.unshift(n)}else(n=a(b))&&("field"===u?i.unshift(n):c[l]=n)}d&&Object.defineProperty(d,s.name,c),y=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var s=arguments.length>2,i=0;t.length>i;i++)r=s?t[i].call(e,r):t[i].call(e);return s?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.QuerySetCreator=void 0;const s=require("@agpu/helpers/decorators"),i=require("@agpu/helpers/decorators"),o=require("@agpu/helpers/decorators"),a=r(require("../../../helpers/errors"));require("@webgpu/types");let n=(()=>{let r,n,u=[(0,s.brand)("QuerySetCreator"),(0,o.raw)("querySet"),(0,i.labeling)({get:e=>e.querySet.label,set:(e,t)=>e.querySet.label=t})],l=[];var d=class{static{n=this}static{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,r={value:n},u,{kind:"class",name:n.name,metadata:s},null,l),d=n=r.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),t(n,l)}#e;#t=!1;querySet;queryDescriptor;constructor(e,t){this.#e=e,t instanceof GPUQuerySet?(this.querySet=t,this.queryDescriptor={type:t.type,count:t.count,label:t.label}):(this.queryDescriptor=t,this.querySet=e.createQuerySet(t))}clone(){if(this.#t)throw(0,a.default)(52,"Cannot clone a destroyed QuerySet.","Clone the query set before destroying it.");return new d(this.#e,{...this.queryDescriptor})}destroy(e){if(void 0===e)return this.#t;if(this.#t&&e)return!0;if(!this.#t&&e)return this.#t=!0,this.querySet.destroy(),!0;if(!this.#t&&!e)return!1;if(this.#t&&!e)throw(0,a.default)(51,"Resurrecting a query set is not allowed. This feature is deprecated");return this.#t}[Symbol("Symbol.dispose")](){this.destroy(!0)}};return d=n})();exports.QuerySetCreator=n,exports.default=n;
@@ -1,4 +1,5 @@
1
1
  import { BRAND, LABEL, RAW } from "@agpu/helpers/decorators";
2
+ import "@webgpu/types";
2
3
  export interface RenderBundleCreator extends RAW<GPURenderBundle>, BRAND<"RenderBundleCreator">, LABEL {
3
4
  }
4
5
  /**
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,t,r,n,a,o)=>{function l(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,i=n.kind,c="getter"===i?"get":"setter"===i?"set":"value",d=!t&&e?n.static?e:e.prototype:null,u=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),p=!1,f=r.length-1;f>=0;f--){var h={};for(var b in n)h[b]="access"===b?{}:n[b];for(var b in n.access)h.access[b]=n.access[b];h.addInitializer=e=>{if(p)throw new TypeError("Cannot add initializers after decoration has completed");o.push(l(e||null))};var v=(0,r[f])("accessor"===i?{get:u.get,set:u.set}:u[c],h);if("accessor"===i){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(s=l(v.get))&&(u.get=s),(s=l(v.set))&&(u.set=s),(s=l(v.init))&&a.unshift(s)}else(s=l(v))&&("field"===i?a.unshift(s):u[c]=s)}d&&Object.defineProperty(d,n.name,u),p=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var n=arguments.length>2,a=0;t.length>a;a++)r=n?t[a].call(e,r):t[a].call(e);return n?r:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderBundleCreator=void 0;const r=require("@agpu/helpers/decorators"),n=require("@agpu/helpers/decorators"),a=require("@agpu/helpers/decorators");let o=(()=>{let o,l,s=[(0,r.brand)("RenderBundleCreator"),(0,a.raw)("renderBundle"),(0,n.labeling)({get:e=>e.renderBundle.label,set:(e,t)=>e.renderBundle.label=t})],i=[];return class{static{l=this}static{const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,o={value:l},s,{kind:"class",name:l.name,metadata:r},null,i),l=o.value,r&&Object.defineProperty(l,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),t(l,i)}renderBundle;constructor(e){this.renderBundle=e}},l})();exports.RenderBundleCreator=o,exports.default=o;
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,r,n,a,o)=>{function l(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,i=n.kind,c="getter"===i?"get":"setter"===i?"set":"value",u=!t&&e?n.static?e:e.prototype:null,d=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),p=!1,f=r.length-1;f>=0;f--){var h={};for(var b in n)h[b]="access"===b?{}:n[b];for(var b in n.access)h.access[b]=n.access[b];h.addInitializer=e=>{if(p)throw new TypeError("Cannot add initializers after decoration has completed");o.push(l(e||null))};var g=(0,r[f])("accessor"===i?{get:d.get,set:d.set}:d[c],h);if("accessor"===i){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(s=l(g.get))&&(d.get=s),(s=l(g.set))&&(d.set=s),(s=l(g.init))&&a.unshift(s)}else(s=l(g))&&("field"===i?a.unshift(s):d[c]=s)}u&&Object.defineProperty(u,n.name,d),p=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var n=arguments.length>2,a=0;t.length>a;a++)r=n?t[a].call(e,r):t[a].call(e);return n?r:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderBundleCreator=void 0;const r=require("@agpu/helpers/decorators"),n=require("@agpu/helpers/decorators"),a=require("@agpu/helpers/decorators");require("@webgpu/types");let o=(()=>{let o,l,s=[(0,r.brand)("RenderBundleCreator"),(0,a.raw)("renderBundle"),(0,n.labeling)({get:e=>e.renderBundle.label,set:(e,t)=>e.renderBundle.label=t})],i=[];return class{static{l=this}static{const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,o={value:l},s,{kind:"class",name:l.name,metadata:r},null,i),l=o.value,r&&Object.defineProperty(l,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),t(l,i)}renderBundle;constructor(e){this.renderBundle=e}},l})();exports.RenderBundleCreator=o,exports.default=o;
@@ -1,5 +1,6 @@
1
1
  import { BRAND, LABEL, RAW } from "@agpu/helpers/decorators";
2
2
  import RenderEncoderBase from "./commandEncoder/renderEncoderBase";
3
+ import "@webgpu/types";
3
4
  export interface RenderBundleEncoderCreator extends RAW<GPURenderBundleEncoder>, BRAND<"RenderBundleEncoderCreator">, LABEL {
4
5
  }
5
6
  /**
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,t,r,n,a,o)=>{function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,u=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),f=!1,p=r.length-1;p>=0;p--){var h={};for(var b in n)h[b]="access"===b?{}:n[b];for(var b in n.access)h.access[b]=n.access[b];h.addInitializer=e=>{if(f)throw new TypeError("Cannot add initializers after decoration has completed");o.push(i(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[c],h);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(s=i(m.get))&&(u.get=s),(s=i(m.set))&&(u.set=s),(s=i(m.init))&&a.unshift(s)}else(s=i(m))&&("field"===l?a.unshift(s):u[c]=s)}d&&Object.defineProperty(d,n.name,u),f=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var n=arguments.length>2,a=0;t.length>a;a++)r=n?t[a].call(e,r):t[a].call(e);return n?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderBundleEncoderCreator=void 0;const n=require("@agpu/helpers/decorators"),a=r(require("./commandEncoder/renderEncoderBase")),o=r(require("./renderBundleEncoder/renderBundle"));let i=(()=>{let r,i,s=[(0,n.brand)("RenderBundleEncoderCreator")],l=[],c=a.default;return class extends c{static{i=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;e(null,r={value:i},s,{kind:"class",name:i.name,metadata:n},null,l),i=r.value,n&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),t(i,l)}constructor(e,t){super(e,t)}finish({label:e}={}){new o.default(this.encoder.finish({label:e}))}},i})();exports.RenderBundleEncoderCreator=i,exports.default=i;
1
+ "use strict";var e=this&&this.__esDecorate||((e,t,r,n,a,o)=>{function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,u=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),f=!1,p=r.length-1;p>=0;p--){var h={};for(var b in n)h[b]="access"===b?{}:n[b];for(var b in n.access)h.access[b]=n.access[b];h.addInitializer=e=>{if(f)throw new TypeError("Cannot add initializers after decoration has completed");o.push(i(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[c],h);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(s=i(m.get))&&(u.get=s),(s=i(m.set))&&(u.set=s),(s=i(m.init))&&a.unshift(s)}else(s=i(m))&&("field"===l?a.unshift(s):u[c]=s)}d&&Object.defineProperty(d,n.name,u),f=!0}),t=this&&this.__runInitializers||function(e,t,r){for(var n=arguments.length>2,a=0;t.length>a;a++)r=n?t[a].call(e,r):t[a].call(e);return n?r:void 0},r=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderBundleEncoderCreator=void 0;const n=require("@agpu/helpers/decorators"),a=r(require("./commandEncoder/renderEncoderBase")),o=r(require("./renderBundleEncoder/renderBundle"));require("@webgpu/types");let i=(()=>{let r,i,s=[(0,n.brand)("RenderBundleEncoderCreator")],l=[],c=a.default;return class extends c{static{i=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;e(null,r={value:i},s,{kind:"class",name:i.name,metadata:n},null,l),i=r.value,n&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),t(i,l)}constructor(e,t){super(e,t)}finish({label:e}={}){new o.default(this.encoder.finish({label:e}))}},i})();exports.RenderBundleEncoderCreator=i,exports.default=i;
@@ -4,6 +4,7 @@ import DeviceControls from "../../main/device";
4
4
  import BindGroupLayoutCreator from "../data/bindGroupLayout";
5
5
  import ShaderModuleCreator from "../data/shaderModule";
6
6
  import PipelineLayoutCreator from "./pipelineLayout";
7
+ import "@webgpu/types";
7
8
  export interface RenderPipelineCreator extends RAW<Promise<GPURenderPipeline>>, BRAND<"RenderPipelineCreator"> {
8
9
  label(): Promise<UNSURE<string>>;
9
10
  label<T extends string>(label: T): Promise<T>;
@@ -1 +1 @@
1
- "use strict";function e(e){return{...e,vertex:{...e.vertex,buffers:e.vertex.buffers?Array.from(e.vertex.buffers):void 0},primitive:e.primitive?{...e.primitive}:void 0,depthStencil:t(e.depthStencil),multisample:e.multisample?{...e.multisample}:void 0,fragment:e.fragment?{...e.fragment,targets:Array.from(e.fragment.targets)}:void 0}}function t(e){if(e)return{...e,depth:e.depth?{...e.depth}:void 0,stencil:e.stencil?{front:e.stencil.front?{...e.stencil.front}:void 0,back:e.stencil.back?{...e.stencil.back}:void 0,mask:e.stencil.mask?{...e.stencil.mask}:void 0}:void 0,depthBias:e.depthBias?{...e.depthBias}:void 0}}var i=this&&this.__esDecorate||((e,t,i,r,a,n)=>{function l(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,o=r.kind,p="getter"===o?"get":"setter"===o?"set":"value",d=!t&&e?r.static?e:e.prototype:null,c=t||(d?Object.getOwnPropertyDescriptor(d,r.name):{}),u=!1,h=i.length-1;h>=0;h--){var f={};for(var m in r)f[m]="access"===m?{}:r[m];for(var m in r.access)f.access[m]=r.access[m];f.addInitializer=e=>{if(u)throw new TypeError("Cannot add initializers after decoration has completed");n.push(l(e||null))};var v=(0,i[h])("accessor"===o?{get:c.get,set:c.set}:c[p],f);if("accessor"===o){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(s=l(v.get))&&(c.get=s),(s=l(v.set))&&(c.set=s),(s=l(v.init))&&a.unshift(s)}else(s=l(v))&&("field"===o?a.unshift(s):c[p]=s)}d&&Object.defineProperty(d,r.name,c),u=!0}),r=this&&this.__runInitializers||function(e,t,i){for(var r=arguments.length>2,a=0;t.length>a;a++)i=r?t[a].call(e,i):t[a].call(e);return r?i:void 0},a=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderPipelineCreator=void 0;const n=require("@agpu/helpers/decorators"),l=a(require("../../../helpers/errors")),s=require("@agpu/helpers/decorators"),o=require("@agpu/helpers/decorators"),p=a(require("../data/bindGroupLayout")),d={topology:"triangle-list",frontFace:"ccw",cullMode:"back"},c={format:"depth24plus",depth:{write:!0,compare:"less"}},u={count:4,alphaToCoverageEnabled:!1};let h=(()=>{let t,a,h=[(0,n.brand)("RenderPipelineCreator"),(0,o.raw)("pipeline"),(0,s.labeling)({get:async e=>(await e.pipeline).label,set:async(e,t)=>(await e.pipeline).label=t})],f=[];var m=class{static{a=this}static{const e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;i(null,t={value:a},h,{kind:"class",name:a.name,metadata:e},null,f),m=a=t.value,e&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e}),r(a,f)}#e;#t;#i={};#r=[];#a=!1;#n=!1;pipeline;constructor(t,i){let r={multisample:u,depthStencil:c,primitive:d};i instanceof GPURenderPipeline?(this.#a=!0,this.pipeline=Promise.resolve(i)):i?.async?(this.#e=t,this.#t=e(i),this.pipeline=t.createRenderPipelineAsync(this.#l({...r,...i})).then(e=>(this.#a=!0,this.#n=!1,this.#s(!0),e)).catch(e=>{throw this.#a=!1,this.#n=!0,this.#s(!1),e})):(this.#e=t,this.#t=e(i),this.#a=!0,this.#n=!1,this.pipeline=Promise.resolve(t.createRenderPipeline(this.#l({...r,...i})))),this.bindGroupLayout=async function(e){return this.#i[e]?this.#i[e]:this.#i[e]=new p.default(t,(await this.pipeline).getBindGroupLayout(e))}}#s(e){this.#r.splice(0).forEach(t=>t(e))}#o(e){let t=e.vertex.module,i={module:t.raw()},r=t.entryPoint();r&&(i.entryPoint=r);let a=t.constants();a&&(i.constants=a);let n=e.vertex.buffers;return n&&(i.buffers=n),i}#p(e){let t=e.fragment.module,i={module:t.raw(),targets:e.fragment.targets},r=t.entryPoint();r&&(i.entryPoint=r);let a=t.constants();return a&&(i.constants=a),i}#d(e){return e?{format:e.format,depthWriteEnabled:e.depth?.write,depthCompare:e.depth?.compare,stencilBack:e.stencil?.back,stencilFront:e.stencil?.front,stencilReadMask:e.stencil?.mask?.read,stencilWriteMask:e.stencil?.mask?.write,depthBias:e.depthBias?.value,depthBiasClamp:e.depthBias?.clamp,depthBiasSlopeScale:e.depthBias?.slopeScale}:{format:"depth24plus"}}#l(e){if(!e?.vertex?.module)throw(0,l.default)(40,"RenderPipeline requires a vertex shader module.","Pass vertex.module when constructing RenderPipelineCreator.");if(!e?.layout)throw(0,l.default)(41,"RenderPipeline requires a pipeline layout or auto layout mode.","Pass a PipelineLayout wrapper or a valid GPUAutoLayoutMode.");let t={layout:e.layout.raw()??e?.layout,vertex:this.#o(e.vertex)};return e.fragment?.module&&(t.fragment=this.#p(e.fragment)),e.depthStencil&&(t.depthStencil=this.#d(e?.depthStencil)),e.multisample&&(t.multisample=e.multisample),e.primitive&&(t.primitive=e.primitive),e.label&&(t.label=e.label),t}init(){return this.#a?Promise.resolve(!0):this.#n?Promise.reject((0,l.default)(42,"RenderPipeline initialization failed.","Inspect the pipeline descriptor, shader entry points, and GPU validation messages for the original failure.")):new Promise((e,t)=>{this.#r.push(i=>{i?e(i):t(i)})})}bindGroupLayout;clone(){if(!this.#e||!this.#t)throw new TypeError("Cannot clone a RenderPipelineCreator created from a raw GPURenderPipeline.");return new m(this.#e,e(this.#t))}};return m=a})();exports.RenderPipelineCreator=h,exports.default=h;
1
+ "use strict";function e(e){return{...e,vertex:{...e.vertex,buffers:e.vertex.buffers?Array.from(e.vertex.buffers):void 0},primitive:e.primitive?{...e.primitive}:void 0,depthStencil:t(e.depthStencil),multisample:e.multisample?{...e.multisample}:void 0,fragment:e.fragment?{...e.fragment,targets:Array.from(e.fragment.targets)}:void 0}}function t(e){if(e)return{...e,depth:e.depth?{...e.depth}:void 0,stencil:e.stencil?{front:e.stencil.front?{...e.stencil.front}:void 0,back:e.stencil.back?{...e.stencil.back}:void 0,mask:e.stencil.mask?{...e.stencil.mask}:void 0}:void 0,depthBias:e.depthBias?{...e.depthBias}:void 0}}var i=this&&this.__esDecorate||((e,t,i,r,a,n)=>{function l(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,o=r.kind,p="getter"===o?"get":"setter"===o?"set":"value",d=!t&&e?r.static?e:e.prototype:null,c=t||(d?Object.getOwnPropertyDescriptor(d,r.name):{}),u=!1,h=i.length-1;h>=0;h--){var f={};for(var m in r)f[m]="access"===m?{}:r[m];for(var m in r.access)f.access[m]=r.access[m];f.addInitializer=e=>{if(u)throw new TypeError("Cannot add initializers after decoration has completed");n.push(l(e||null))};var v=(0,i[h])("accessor"===o?{get:c.get,set:c.set}:c[p],f);if("accessor"===o){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(s=l(v.get))&&(c.get=s),(s=l(v.set))&&(c.set=s),(s=l(v.init))&&a.unshift(s)}else(s=l(v))&&("field"===o?a.unshift(s):c[p]=s)}d&&Object.defineProperty(d,r.name,c),u=!0}),r=this&&this.__runInitializers||function(e,t,i){for(var r=arguments.length>2,a=0;t.length>a;a++)i=r?t[a].call(e,i):t[a].call(e);return r?i:void 0},a=this&&this.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderPipelineCreator=void 0;const n=require("@agpu/helpers/decorators"),l=a(require("../../../helpers/errors")),s=require("@agpu/helpers/decorators"),o=require("@agpu/helpers/decorators"),p=a(require("../data/bindGroupLayout"));require("@webgpu/types");const d={topology:"triangle-list",frontFace:"ccw",cullMode:"back"},c={format:"depth24plus",depth:{write:!0,compare:"less"}},u={count:4,alphaToCoverageEnabled:!1};let h=(()=>{let t,a,h=[(0,n.brand)("RenderPipelineCreator"),(0,o.raw)("pipeline"),(0,s.labeling)({get:async e=>(await e.pipeline).label,set:async(e,t)=>(await e.pipeline).label=t})],f=[];var m=class{static{a=this}static{const e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;i(null,t={value:a},h,{kind:"class",name:a.name,metadata:e},null,f),m=a=t.value,e&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e}),r(a,f)}#e;#t;#i={};#r=[];#a=!1;#n=!1;pipeline;constructor(t,i){let r={multisample:u,depthStencil:c,primitive:d};i instanceof GPURenderPipeline?(this.#a=!0,this.pipeline=Promise.resolve(i)):i?.async?(this.#e=t,this.#t=e(i),this.pipeline=t.createRenderPipelineAsync(this.#l({...r,...i})).then(e=>(this.#a=!0,this.#n=!1,this.#s(!0),e)).catch(e=>{throw this.#a=!1,this.#n=!0,this.#s(!1),e})):(this.#e=t,this.#t=e(i),this.#a=!0,this.#n=!1,this.pipeline=Promise.resolve(t.createRenderPipeline(this.#l({...r,...i})))),this.bindGroupLayout=async function(e){return this.#i[e]?this.#i[e]:this.#i[e]=new p.default(t,(await this.pipeline).getBindGroupLayout(e))}}#s(e){this.#r.splice(0).forEach(t=>t(e))}#o(e){let t=e.vertex.module,i={module:t.raw()},r=t.entryPoint();r&&(i.entryPoint=r);let a=t.constants();a&&(i.constants=a);let n=e.vertex.buffers;return n&&(i.buffers=n),i}#p(e){let t=e.fragment.module,i={module:t.raw(),targets:e.fragment.targets},r=t.entryPoint();r&&(i.entryPoint=r);let a=t.constants();return a&&(i.constants=a),i}#d(e){return e?{format:e.format,depthWriteEnabled:e.depth?.write,depthCompare:e.depth?.compare,stencilBack:e.stencil?.back,stencilFront:e.stencil?.front,stencilReadMask:e.stencil?.mask?.read,stencilWriteMask:e.stencil?.mask?.write,depthBias:e.depthBias?.value,depthBiasClamp:e.depthBias?.clamp,depthBiasSlopeScale:e.depthBias?.slopeScale}:{format:"depth24plus"}}#l(e){if(!e?.vertex?.module)throw(0,l.default)(40,"RenderPipeline requires a vertex shader module.","Pass vertex.module when constructing RenderPipelineCreator.");if(!e?.layout)throw(0,l.default)(41,"RenderPipeline requires a pipeline layout or auto layout mode.","Pass a PipelineLayout wrapper or a valid GPUAutoLayoutMode.");let t={layout:e.layout.raw()??e?.layout,vertex:this.#o(e.vertex)};return e.fragment?.module&&(t.fragment=this.#p(e.fragment)),e.depthStencil&&(t.depthStencil=this.#d(e?.depthStencil)),e.multisample&&(t.multisample=e.multisample),e.primitive&&(t.primitive=e.primitive),e.label&&(t.label=e.label),t}init(){return this.#a?Promise.resolve(!0):this.#n?Promise.reject((0,l.default)(42,"RenderPipeline initialization failed.","Inspect the pipeline descriptor, shader entry points, and GPU validation messages for the original failure.")):new Promise((e,t)=>{this.#r.push(i=>{i?e(i):t(i)})})}bindGroupLayout;clone(){if(!this.#e||!this.#t)throw new TypeError("Cannot clone a RenderPipelineCreator created from a raw GPURenderPipeline.");return new m(this.#e,e(this.#t))}};return m=a})();exports.RenderPipelineCreator=h,exports.default=h;
@@ -1,4 +1,5 @@
1
1
  import { BRAND, LABEL, RAW } from "@agpu/helpers/decorators";
2
+ import "@webgpu/types";
2
3
  export interface SamplerCreator extends RAW<GPUSampler>, BRAND<"SamplerCreator">, LABEL {
3
4
  }
4
5
  /**
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__esDecorate||((e,r,t,a,s,l)=>{function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,n=a.kind,c="getter"===n?"get":"setter"===n?"set":"value",p=!r&&e?a.static?e:e.prototype:null,d=r||(p?Object.getOwnPropertyDescriptor(p,a.name):{}),u=!1,h=t.length-1;h>=0;h--){var f={};for(var m in a)f[m]="access"===m?{}:a[m];for(var m in a.access)f.access[m]=a.access[m];f.addInitializer=e=>{if(u)throw new TypeError("Cannot add initializers after decoration has completed");l.push(i(e||null))};var b=(0,t[h])("accessor"===n?{get:d.get,set:d.set}:d[c],f);if("accessor"===n){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(o=i(b.get))&&(d.get=o),(o=i(b.set))&&(d.set=o),(o=i(b.init))&&s.unshift(o)}else(o=i(b))&&("field"===n?s.unshift(o):d[c]=o)}p&&Object.defineProperty(p,a.name,d),u=!0}),r=this&&this.__runInitializers||function(e,r,t){for(var a=arguments.length>2,s=0;r.length>s;s++)t=a?r[s].call(e,t):r[s].call(e);return a?t:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SamplerCreator=void 0;const t=require("@agpu/helpers/decorators"),a=require("@agpu/helpers/decorators"),s=require("@agpu/helpers/decorators");let l=(()=>{let l,i,o=[(0,t.brand)("SamplerCreator"),(0,s.raw)("sampler"),(0,a.labeling)({get:e=>e.sampler.label,set:(e,r)=>e.sampler.label=r})],n=[];var c=class{static{i=this}static{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,l={value:i},o,{kind:"class",name:i.name,metadata:t},null,n),c=i=l.value,t&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t}),r(i,n)}#e;#r;sampler;constructor(e,r){r instanceof GPUSampler?this.sampler=r:(this.#e=e,this.#r={...r},this.sampler=e.createSampler(r)),r?.label&&(this.sampler.label=r.label)}clone(){if(!this.#e||!this.#r)throw new TypeError("Cannot clone a SamplerCreator created from a raw GPUSampler.");return new c(this.#e,{...this.#r,label:this.sampler.label||this.#r.label})}};return c=i})();exports.SamplerCreator=l,exports.default=l;
1
+ "use strict";var e=this&&this.__esDecorate||((e,r,t,a,s,l)=>{function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,n=a.kind,c="getter"===n?"get":"setter"===n?"set":"value",p=!r&&e?a.static?e:e.prototype:null,u=r||(p?Object.getOwnPropertyDescriptor(p,a.name):{}),d=!1,h=t.length-1;h>=0;h--){var f={};for(var m in a)f[m]="access"===m?{}:a[m];for(var m in a.access)f.access[m]=a.access[m];f.addInitializer=e=>{if(d)throw new TypeError("Cannot add initializers after decoration has completed");l.push(i(e||null))};var b=(0,t[h])("accessor"===n?{get:u.get,set:u.set}:u[c],f);if("accessor"===n){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(o=i(b.get))&&(u.get=o),(o=i(b.set))&&(u.set=o),(o=i(b.init))&&s.unshift(o)}else(o=i(b))&&("field"===n?s.unshift(o):u[c]=o)}p&&Object.defineProperty(p,a.name,u),d=!0}),r=this&&this.__runInitializers||function(e,r,t){for(var a=arguments.length>2,s=0;r.length>s;s++)t=a?r[s].call(e,t):r[s].call(e);return a?t:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SamplerCreator=void 0;const t=require("@agpu/helpers/decorators"),a=require("@agpu/helpers/decorators"),s=require("@agpu/helpers/decorators");require("@webgpu/types");let l=(()=>{let l,i,o=[(0,t.brand)("SamplerCreator"),(0,s.raw)("sampler"),(0,a.labeling)({get:e=>e.sampler.label,set:(e,r)=>e.sampler.label=r})],n=[];var c=class{static{i=this}static{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e(null,l={value:i},o,{kind:"class",name:i.name,metadata:t},null,n),c=i=l.value,t&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t}),r(i,n)}#e;#r;sampler;constructor(e,r){r instanceof GPUSampler?this.sampler=r:(this.#e=e,this.#r={...r},this.sampler=e.createSampler(r)),r?.label&&(this.sampler.label=r.label)}clone(){if(!this.#e||!this.#r)throw new TypeError("Cannot clone a SamplerCreator created from a raw GPUSampler.");return new c(this.#e,{...this.#r,label:this.sampler.label||this.#r.label})}};return c=i})();exports.SamplerCreator=l,exports.default=l;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * **@andromeda-gpu/bindings**
2
+ * **@agpu/bindings**
3
3
  * @packageDocumentation
4
- * The main bindings package for andromeda-3d's webgpu support
4
+ * The main bindings package for andromedagp
5
5
  */
6
6
  import BufferUsage from "./constants/bufferusage";
7
7
  import TextureUsage from "./constants/textureusage";
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "@webgpu/types": "^0.1.69"
17
17
  },
18
18
  "name": "@agpu/bindings",
19
- "version": "0.2.9",
19
+ "version": "0.2.11",
20
20
  "author": {
21
21
  "name": "Kryft Studios",
22
22
  "email": "AfriaStudios@outlook.in",