1 |
- {"ast":null,"code":"import { WebGPUTextureHelper } from \"./webgpuTextureHelper.js\";\n/** @internal */\nexport class WebGPURenderItemViewport {\n constructor(x, y, w, h) {\n this.x = Math.floor(x);\n this.y = Math.floor(y);\n this.w = Math.floor(w);\n this.h = Math.floor(h);\n }\n run(renderPass) {\n renderPass.setViewport(this.x, this.y, this.w, this.h, 0, 1);\n }\n clone() {\n return new WebGPURenderItemViewport(this.x, this.y, this.w, this.h);\n }\n}\n/** @internal */\nexport class WebGPURenderItemScissor {\n constructor(x, y, w, h) {\n this.x = x;\n this.y = y;\n this.w = w;\n this.h = h;\n }\n run(renderPass) {\n renderPass.setScissorRect(this.x, this.y, this.w, this.h);\n }\n clone() {\n return new WebGPURenderItemScissor(this.x, this.y, this.w, this.h);\n }\n}\n/** @internal */\nexport class WebGPURenderItemStencilRef {\n constructor(ref) {\n this.ref = ref;\n }\n run(renderPass) {\n renderPass.setStencilReference(this.ref);\n }\n clone() {\n return new WebGPURenderItemStencilRef(this.ref);\n }\n}\n/** @internal */\nexport class WebGPURenderItemBlendColor {\n constructor(color) {\n this.color = color;\n }\n run(renderPass) {\n renderPass.setBlendConstant(this.color);\n }\n clone() {\n return new WebGPURenderItemBlendColor(this.color);\n }\n}\n/** @internal */\nexport class WebGPURenderItemBeginOcclusionQuery {\n constructor(query) {\n this.query = query;\n }\n run(renderPass) {\n renderPass.beginOcclusionQuery(this.query);\n }\n clone() {\n return new WebGPURenderItemBeginOcclusionQuery(this.query);\n }\n}\n/** @internal */\nexport class WebGPURenderItemEndOcclusionQuery {\n constructor() {}\n run(renderPass) {\n renderPass.endOcclusionQuery();\n }\n clone() {\n return new WebGPURenderItemEndOcclusionQuery();\n }\n}\nclass WebGPURenderItemBundles {\n constructor() {\n this.bundles = [];\n }\n run(renderPass) {\n renderPass.executeBundles(this.bundles);\n }\n clone() {\n const cloned = new WebGPURenderItemBundles();\n cloned.bundles = this.bundles;\n return cloned;\n }\n}\n/** @internal */\nexport class WebGPUBundleList {\n constructor(device) {\n this.numDrawCalls = 0;\n this._device = device;\n this._list = new Array(10);\n this._listLength = 0;\n }\n addBundle(bundle) {\n if (!this._currentItemIsBundle) {\n const item = new WebGPURenderItemBundles();\n this._list[this._listLength++] = item;\n this._currentBundleList = item.bundles;\n this._currentItemIsBundle = true;\n }\n if (bundle) {\n this._currentBundleList.push(bundle);\n }\n }\n _finishBundle() {\n if (this._currentItemIsBundle && this._bundleEncoder) {\n this._currentBundleList.push(this._bundleEncoder.finish());\n this._bundleEncoder = undefined;\n this._currentItemIsBundle = false;\n }\n }\n addItem(item) {\n this._finishBundle();\n this._list[this._listLength++] = item;\n this._currentItemIsBundle = false;\n }\n getBundleEncoder(colorFormats, depthStencilFormat, sampleCount) {\n if (!this._currentItemIsBundle) {\n this.addBundle();\n this._bundleEncoder = this._device.createRenderBundleEncoder({\n colorFormats,\n depthStencilFormat,\n sampleCount: WebGPUTextureHelper.GetSample(sampleCount)\n });\n }\n return this._bundleEncoder;\n }\n close() {\n this._finishBundle();\n }\n run(renderPass) {\n this.close();\n for (let i = 0; i < this._listLength; ++i) {\n this._list[i].run(renderPass);\n }\n }\n reset() {\n this._listLength = 0;\n this._currentItemIsBundle = false;\n this.numDrawCalls = 0;\n }\n clone() {\n this.close();\n const cloned = new WebGPUBundleList(this._device);\n cloned._list = new Array(this._listLength);\n cloned._listLength = this._listLength;\n cloned.numDrawCalls = this.numDrawCalls;\n for (let i = 0; i < this._listLength; ++i) {\n cloned._list[i] = this._list[i].clone();\n }\n return cloned;\n }\n}","map":{"version":3,"names":["WebGPUTextureHelper","WebGPURenderItemViewport","constructor","x","y","w","h","Math","floor","run","renderPass","setViewport","clone","WebGPURenderItemScissor","setScissorRect","WebGPURenderItemStencilRef","ref","setStencilReference","WebGPURenderItemBlendColor","color","setBlendConstant","WebGPURenderItemBeginOcclusionQuery","query","beginOcclusionQuery","WebGPURenderItemEndOcclusionQuery","endOcclusionQuery","WebGPURenderItemBundles","bundles","executeBundles","cloned","WebGPUBundleList","device","numDrawCalls","_device","_list","Array","_listLength","addBundle","bundle","_currentItemIsBundle","item","_currentBundleList","push","_finishBundle","_bundleEncoder","finish","undefined","addItem","getBundleEncoder","colorFormats","depthStencilFormat","sampleCount","createRenderBundleEncoder","GetSample","close","i","reset"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Engines/WebGPU/webgpuBundleList.js"],"sourcesContent":["import { WebGPUTextureHelper } from \"./webgpuTextureHelper.js\";\n/** @internal */\nexport class WebGPURenderItemViewport {\n constructor(x, y, w, h) {\n this.x = Math.floor(x);\n this.y = Math.floor(y);\n this.w = Math.floor(w);\n this.h = Math.floor(h);\n }\n run(renderPass) {\n renderPass.setViewport(this.x, this.y, this.w, this.h, 0, 1);\n }\n clone() {\n return new WebGPURenderItemViewport(this.x, this.y, this.w, this.h);\n }\n}\n/** @internal */\nexport class WebGPURenderItemScissor {\n constructor(x, y, w, h) {\n this.x = x;\n this.y = y;\n this.w = w;\n this.h = h;\n }\n run(renderPass) {\n renderPass.setScissorRect(this.x, this.y, this.w, this.h);\n }\n clone() {\n return new WebGPURenderItemScissor(this.x, this.y, this.w, this.h);\n }\n}\n/** @internal */\nexport class WebGPURenderItemStencilRef {\n constructor(ref) {\n this.ref = ref;\n }\n run(renderPass) {\n renderPass.setStencilReference(this.ref);\n }\n clone() {\n return new WebGPURenderItemStencilRef(this.ref);\n }\n}\n/** @internal */\nexport class WebGPURenderItemBlendColor {\n constructor(color) {\n this.color = color;\n }\n run(renderPass) {\n renderPass.setBlendConstant(this.color);\n }\n clone() {\n return new WebGPURenderItemBlendColor(this.color);\n }\n}\n/** @internal */\nexport class WebGPURenderItemBeginOcclusionQuery {\n constructor(query) {\n this.query = query;\n }\n run(renderPass) {\n renderPass.beginOcclusionQuery(this.query);\n }\n clone() {\n return new WebGPURenderItemBeginOcclusionQuery(this.query);\n }\n}\n/** @internal */\nexport class WebGPURenderItemEndOcclusionQuery {\n constructor() { }\n run(renderPass) {\n renderPass.endOcclusionQuery();\n }\n clone() {\n return new WebGPURenderItemEndOcclusionQuery();\n }\n}\nclass WebGPURenderItemBundles {\n constructor() {\n this.bundles = [];\n }\n run(renderPass) {\n renderPass.executeBundles(this.bundles);\n }\n clone() {\n const cloned = new WebGPURenderItemBundles();\n cloned.bundles = this.bundles;\n return cloned;\n }\n}\n/** @internal */\nexport class WebGPUBundleList {\n constructor(device) {\n this.numDrawCalls = 0;\n this._device = device;\n this._list = new Array(10);\n this._listLength = 0;\n }\n addBundle(bundle) {\n if (!this._currentItemIsBundle) {\n const item = new WebGPURenderItemBundles();\n this._list[this._listLength++] = item;\n this._currentBundleList = item.bundles;\n this._currentItemIsBundle = true;\n }\n if (bundle) {\n this._currentBundleList.push(bundle);\n }\n }\n _finishBundle() {\n if (this._currentItemIsBundle && this._bundleEncoder) {\n this._currentBundleList.push(this._bundleEncoder.finish());\n this._bundleEncoder = undefined;\n this._currentItemIsBundle = false;\n }\n }\n addItem(item) {\n this._finishBundle();\n this._list[this._listLength++] = item;\n this._currentItemIsBundle = false;\n }\n getBundleEncoder(colorFormats, depthStencilFormat, sampleCount) {\n if (!this._currentItemIsBundle) {\n this.addBundle();\n this._bundleEncoder = this._device.createRenderBundleEncoder({\n colorFormats,\n depthStencilFormat,\n sampleCount: WebGPUTextureHelper.GetSample(sampleCount),\n });\n }\n return this._bundleEncoder;\n }\n close() {\n this._finishBundle();\n }\n run(renderPass) {\n this.close();\n for (let i = 0; i < this._listLength; ++i) {\n this._list[i].run(renderPass);\n }\n }\n reset() {\n this._listLength = 0;\n this._currentItemIsBundle = false;\n this.numDrawCalls = 0;\n }\n clone() {\n this.close();\n const cloned = new WebGPUBundleList(this._device);\n cloned._list = new Array(this._listLength);\n cloned._listLength = this._listLength;\n cloned.numDrawCalls = this.numDrawCalls;\n for (let i = 0; i < this._listLength; ++i) {\n cloned._list[i] = this._list[i].clone();\n }\n return cloned;\n }\n}\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,0BAA0B;AAC9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